Navigation

Recent site activity

PyPhoto

#!/usr/bin/env python

# Licensed under GPL
# By Joe Smith
# 11/27/08
# Using the PyFacebook client library http://pyfacebook.googlecode.com

import sys
from facebook import *

def wait_login():
    raw_input('Please press enter once logged in.')

def setup():
    fb = Facebook(api_key = '2fcebebee796622de315cc3017846441', secret_key = '6e06a81a9e8014d61e4971e42490a7c9')
    fb.auth.createToken()
    fb.login()          
    wait_login()              
    fb.auth.getSession()
    return fb

def need_album(fb):
    if(int(raw_input('Need to create album? 1 or 0\n'))):
        name = raw_input("Please enter the name of it: \n")
        location = raw_input("Location?\n")
        description = raw_input("Description?\n")
        fb.photos.createAlbum(name, location, description)
   
def main():

    fb = setup()
    need_album(fb)

    aid = raw_input("Alright, it's late, I'm lazy. What's the aid?\n")
# Um, aid = Album ID, btw
    print 'Alright, ready-ish to roll'

    list = open('/home/joe/list')
    counter = 0
    for line in list:
        print "Working on photo #",  counter
        line = line.rstrip("\n")
        image = '/home/joe/Pictures/2008_11_11/00'+line+'.jpg'
        fb.photos.upload(image, aid)
        counter += 1

    print 'done'

if __name__ == '__main__':
    main()

Sign in   Recent Site Activity   Terms   Report Abuse   Print page   Powered by Google Sites