diff -Naur flickrfs-1.2.9.orig/flickrapi.py flickrfs-1.2.9/flickrapi.py --- flickrfs-1.2.9.orig/flickrapi.py 2006-05-26 02:57:08.000000000 +0200 +++ flickrfs-1.2.9/flickrapi.py 2006-07-26 09:16:23.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!python # # Flickr API implementation # diff -Naur flickrfs-1.2.9.orig/flickrfs.conf flickrfs-1.2.9/flickrfs.conf --- flickrfs-1.2.9.orig/flickrfs.conf 1970-01-01 01:00:00.000000000 +0100 +++ flickrfs-1.2.9/flickrfs.conf 2006-07-26 09:53:46.000000000 +0200 @@ -0,0 +1,24 @@ +[USER] + +# for out-of-band auth inside a web browser +browserName : /usr/bin/firefox + +# Specify the default file upload size (e.g. 640x512) +image.size: + +# Synchronization intervals +sets.sync.int:300 +stream.sync.int:300 + +#------------------------------------------------------------------- + +# 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 flickrfs-1.2.9.orig/flickrfs.py flickrfs-1.2.9/flickrfs.py --- flickrfs-1.2.9.orig/flickrfs.py 2006-05-28 09:07:25.000000000 +0200 +++ flickrfs-1.2.9/flickrfs.py 2006-07-26 09:59:38.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!python #=============================================================================== # flickrfs - Virtual Filesystem for Flickr # Copyright (c) 2005 Manish Rai Jain @@ -18,7 +18,14 @@ from errno import * from stat import * from traceback import format_exc + +import fuse +# Necessary for new python api to fuse +# --G.Wrobel +fuse.compat_0_1 = True + from fuse import Fuse + from flickrapi import FlickrAPI import random import commands @@ -26,10 +33,6 @@ #Some global definitions and functions DEFAULTBLOCKSIZE = 4*1024 #4KB -# flickr auth information -flickrAPIKey = "f8aa9917a9ae5e44a87cae657924f42d" # API key -flickrSecret = "3fbf7144be7eca28" # shared "secret" -browserName = "/usr/bin/firefox" # for out-of-band auth inside a web browser #Set up the .flickfs directory. homedir = os.getenv('HOME') @@ -41,6 +44,24 @@ for a in glob(os.path.join(flickrfsHome, '.*')): os.remove(os.path.join(flickrfsHome, a)) +def read_config(config_file = '/etc/flickrfs/flickrfs.conf'): + + defaults = { + 'flickrAPIKey' : "f8aa9917a9ae5e44a87cae657924f42d", # API key + 'flickrSecret' : "3fbf7144be7eca28", # shared "secret" + 'image.size' : "", # upload image size + 'sets.sync.int' : "600", # + 'stream.sync.int' : "600", # + 'browserName' : "/usr/bin/firefox",} # for out-of-band auth inside a web browser + + config = ConfigParser.ConfigParser(defaults) + config.add_section('configuration') + + if os.access(config_file, os.R_OK): + config.read(config_file) + + return config + # Set up logging log = logging.getLogger('flickrfs') loghdlr = logging.handlers.RotatingFileHandler(os.path.join(flickrfsHome,'log'), "a", 5242880, 3) @@ -49,28 +70,6 @@ log.addHandler(loghdlr) log.setLevel(logging.DEBUG) -cp = ConfigParser.ConfigParser() -cp.read(flickrfsHome + '/config.txt') -iSizestr = "" -sets_sync_int = 600.0 -stream_sync_int = 600.0 -try: - iSizestr = cp.get('configuration', 'image.size') -except: - print 'No default size of image found. Will upload original size of images.' -try: - sets_sync_int = float(cp.get('configuration', 'sets.sync.int')) -except: - pass -try: - stream_sync_int = float(cp.get('configuration', 'stream.sync.int')) -except: - pass -try: - browserName = cp.get('configuration', 'browser') -except: - pass - #Utility functions. def _log_exception_wrapper(func, *args, **kw): """Call 'func' with args and kws and log any exception it throws. @@ -1214,6 +1213,26 @@ if __name__ == '__main__': + + config = read_config() + flickrAPIKey = config.get('configuration', 'flickrAPIKey') + flickrSecret = config.get('configuration', 'flickrSecret') + browserName = config.get('configuration', 'browserName') + + try: + iSizestr = cp.get('configuration', 'image.size') + except: + print 'No default size of image found. Will upload original size of images.' + iSizestr = "" + try: + sets_sync_int = float(cp.get('configuration', 'sets.sync.int')) + except: + sets_sync_int = 600.0 + try: + stream_sync_int = float(cp.get('configuration', 'stream.sync.int')) + except: + stream_sync_int = 600.0 + try: server = Flickrfs() server.multithreaded = 1; diff -Naur flickrfs-1.2.9.orig/setup.py flickrfs-1.2.9/setup.py --- flickrfs-1.2.9.orig/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ flickrfs-1.2.9/setup.py 2006-07-26 09:16:23.000000000 +0200 @@ -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.1.9', + description = 'A virtual filesystem that provides easy access to flickr', + author = 'Manish Rai Jain', + author_email = 'manishrjain@gmail.com', + url = 'http://manishrjain.googlepages.com/flickrfs', + py_modules = ['flickrapi'], + scripts = ['flickrfs'], + data_files = [('/etc/flickrfs', ['flickrfs.conf'])], + license = 'GPL', + )