diff -Naur --exclude='*.pyc' flickrapi.py.ORIG flickrapi.py --- flickrapi.py.ORIG 2007-06-17 23:37:13.000000000 +0900 +++ flickrapi.py 2007-06-17 23:37:40.000000000 +0900 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!python # # Flickr API implementation # diff -Naur --exclude='*.pyc' flickrfs-1.3.9/flickrfs.conf flickrfs-1.3.9-mod/flickrfs.conf --- flickrfs.conf 1970-01-01 01:00:00.000000000 +0100 +++ flickrfs-1.3.9-mod/flickrfs.conf 2005-11-14 21:03:03.000000000 +0100 @@ -0,0 +1,18 @@ +[USER] + +# for out-of-band auth inside a web browser +browserName : /usr/bin/firefox + + +#------------------------------------------------------------------- + +# It is not necessary to change these. They just identifies this as +# this application as flickrfs so that flickr.com can track the +# usage by different api's + +# API key +flickrAPIKey : f8aa9917a9ae5e44a87cae657924f42d + +# shared "secret" +flickrSecret : 3fbf7144be7eca28 + diff -Naur --exclude='*.pyc' flickrfs.py.ORIG flickrfs.py --- flickrfs.py.ORIG 2007-06-17 23:38:08.000000000 +0900 +++ flickrfs.py 2007-06-17 23:50:35.000000000 +0900 @@ -1,3 +1,4 @@ +#!python #=============================================================================== # flickrfs - Virtual Filesystem for Flickr # Copyright (c) 2005,2006 Manish Rai Jain @@ -23,7 +24,7 @@ import threading import random, commands from urllib2 import URLError -from transactions import TransFlickr +from transactions import TransFlickr, read_config import inodes #Some global definitions and functions @@ -1075,6 +1076,12 @@ if __name__ == '__main__': + + config = read_config() + flickrAPIKey = config.get('USER', 'flickrAPIKey') + flickrSecret = config.get('USER', 'flickrSecret') + browserName = config.get('USER', 'browserName') + try: server = Flickrfs() server.multithreaded = 1; diff -Naur --exclude='*.pyc' transactions.py.ORIG transactions.py --- transactions.py.ORIG 2007-06-24 12:03:35.946226309 +0900 +++ transactions.py 2007-06-24 12:22:09.546226308 +0900 @@ -22,9 +22,22 @@ import os import time -# flickr auth information -flickrAPIKey = "f8aa9917a9ae5e44a87cae657924f42d" # API key -flickrSecret = "3fbf7144be7eca28" # shared "secret" +# Import ConfigParser +from ConfigParser import ConfigParser + +def read_config(config_file = '/etc/flickrfs/flickrfs.conf'): + defaults = { + 'flickrAPIKey' : "f8aa9917a9ae5e44a87cae657924f42d", # API key + 'flickrSecret' : "3fbf7144be7eca28", # shared "secret" + 'browserName' : "/usr/bin/firefox",} # for out-of-band auth inside a web browser + + config = ConfigParser(defaults) + config.add_section('USER') + + if os.access(config_file, os.R_OK): + config.read(config_file) + + return config # Utility functions def kwdict(**kw): return kw @@ -38,7 +51,13 @@ def __init__(self, logg, browserName): global log log = logg - self.fapi = FlickrAPI(flickrAPIKey, flickrSecret) + + config = read_config() + self.flickrAPIKey = config.get('USER', 'flickrAPIKey') + self.flickrSecret = config.get('USER', 'flickrSecret') + self.browserName = config.get('USER', 'browserName') + + self.fapi = FlickrAPI(self.flickrAPIKey, self.flickrSecret) self.user_id = "" # proceed with auth # TODO use auth.checkToken function if available, @@ -302,7 +321,7 @@ return (bw['max'], bw['used']) def getUserId(self): - rsp = self.fapi.auth_checkToken(api_key=flickrAPIKey, + rsp = self.fapi.auth_checkToken(api_key=self.flickrAPIKey, auth_token=self.authtoken) if not rsp: log.error("Unable to get userid:" + rsp.errormsg) diff -Naur --exclude='*.pyc' flickrfs-1.3.9/setup.py flickrfs-1.3.9-mod/setup.py --- setup.py 1970-01-01 01:00:00.000000000 +0100 +++ flickrfs-1.3.9-mod/setup.py 2005-11-14 20:23:31.000000000 +0100 @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import sys + +from distutils.core import setup + +# this affects the names of all the directories we do stuff with +sys.path.insert(0, './') + +setup(name = 'flickrfs', + version = '1.3.9', + description = 'A virtual filesystem that provides easy access to flickr', + author = 'Manish Rai Jain', + author_email = 'manishrjain@gmail.com', + url = 'http://flickrfs.sourceforge.net/', + scripts = ['flickrfs'], + py_modules = ['flickrapi', 'inodes', 'transactions'], + data_files = [('/etc/flickrfs', ['flickrfs.conf'])], + license = 'GPL', + )