Tuesday, 21 May 2013

Script for extracting all photo tagged with a certain username on Don't Stay In

Windows Instructions

  1. Download and install Python for windows (see links below)
  2. Create a directory (c:\dsi or something)
  3. Download the script or copy and paste the source from below into that folder
  4. Start the windows command line (Start --> Run --> type 'cmd' --> Press return)
  5. Change directory to where you saved the script (type 'cd c:\dsi' press return)
  6. Find the username you want to get (click on their profile page)
  7. Find the total number of PAGES of photos they have (click on "all photos of user", look for "1 of 10", you're after the big number)
  8. Run the script (type 'python getphotos.py username pagecount' press return
  9. Make tea
  10. If it doesn't work, Official Windows Support (!! 8@) is being provided by Karl (dreammaster4) so go ask him.

Python Links


Python Download
Python 2.7.5 for windows


sudo apt-get install python

Download Script


Script Source

import urllib
import re
import sys
import os

def do_page(url):
    print "getting " + url
    f = urllib.urlopen(url)
    html = f.read()
    pattern = r'http://www.dontstayin.com/.*/photo-[0-9]*'
    hits = re.findall(pattern, html)
    return hits

if __name__ == '__main__':
    hits = []
    for i in range(1, pages + 1):
        url = 'http://www.dontstayin.com/members/' + username + '/photos/photopage-%d' % i

    pattern = r'(http://pixmaster-eu.dontstayin.com/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}.jpg))'
    for hit in hits:
        pathPattern = r'http://www.dontstayin.com/(.*)/photo-[0-9]*'
        paths = re.findall(pathPattern, hit)
        path = os.path.join(username,paths[0])
        if not os.path.exists(path):
            print "making dir " + path
        print "processing photo page " + hit
        f = urllib.urlopen(hit)
        html = f.read()
        pictures = re.findall(pattern, html)
        for picture in pictures:
            print "found picture " + picture[0]
            filename = os.path.join(path,picture[1])
            urllib.urlretrieve (picture[0], filename)
            print "saved picture " + filename

Friday, 12 April 2013

Grocery Syndication

A standardized Xml format for describing supplied produce and groceries, including cost and location.
Syndicated using RSS
Collated by centralized grocery shopping web sites
Enter your shopping list, generates best price and allows you to edit manually.
Allow small producers to compete with market heavyweights Tesco, Asda, etc.
Cut out middle men and fund local produce directly without the inefficiency of driving about or remembering to visit farmers marker
Automatic increased visibility of small producers
Decentralize food production, sales and distribution.
Retire hellish supermarket eyesores.

Add standard Xml format for food recipes.
Internally measurements stored as metric, localize to US and old money via translation
Recipe sites now syndicate their recipes as well.
Grocery shopping sites now allow you to choose your shopping list via what you want to cook as well.

Filter by organic or no gm
Calculate and filter by food miles
Enforce dietary requirements

I love Xml.

Thursday, 4 April 2013

Tuesday, 22 January 2013

Chilli mix No.2

Chilli mix No.2:

2 tbsp Cumin powder
1 tbsp Corriander powder
1 tbsp Crushed dried red chilli
1 tbsp Cayenne powder
1 tbsp Onion powder
1 tbsp Smoked paprika
1 tsp Garlic salt

Makes enough for Chilli made with 1kg beef mince.
Mix together, blend with the chopped tomatoes.