Author: duncan
Date: Fri May 11 17:50:56 2007
New Revision: 9559

Modified:
   branches/rel-1/freevo/src/helpers/makelinuxevent.py
   branches/rel-1/freevo/src/helpers/recordserver.py
   branches/rel-1/freevo/src/plugins/cd_burn.py
   branches/rel-1/freevo/src/rssperiodic.py
   branches/rel-1/freevo/src/util/fileops.py

Log:
Added cPickle to be used first
Run Tools/scripts/reindent.py on modules


Modified: branches/rel-1/freevo/src/helpers/makelinuxevent.py
==============================================================================
--- branches/rel-1/freevo/src/helpers/makelinuxevent.py (original)
+++ branches/rel-1/freevo/src/helpers/makelinuxevent.py Fri May 11 17:50:56 2007
@@ -9,7 +9,7 @@
 #
 # -----------------------------------------------------------------------
 # Freevo - A Home Theater PC framework
-# Copyright (C) 2002 Krister Lagerstrom, et al. 
+# Copyright (C) 2002 Krister Lagerstrom, et al.
 # Please see the fout freevo/Docs/CREDITS for a complete list of authors.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -98,7 +98,7 @@
     _ids = ids
     _buses = buses
 
-import pickle
+import cPickle, pickle
 
 def save_event(fout):
     #fout = open('ev.dat', 'wb')
@@ -361,7 +361,7 @@
     print 'The linux/input.h will be parsed and the event data will be'
     print 'written to stdout which can be redirected to the linuxevent.py'
     print 'E.g.: freevo makelinuxevent > src/linuxevent.py'
-    print 
+    print
     print 'if <device> is given then the device information will be also'
     print 'written to stdout.'
     print 'E.g.: freevo makelinuxevent /dev/input/event0'

Modified: branches/rel-1/freevo/src/helpers/recordserver.py
==============================================================================
--- branches/rel-1/freevo/src/helpers/recordserver.py   (original)
+++ branches/rel-1/freevo/src/helpers/recordserver.py   Fri May 11 17:50:56 2007
@@ -27,7 +27,8 @@
 # -----------------------------------------------------------------------
 
 
-import sys, string, random, time, os, re, pwd, stat, threading, pickle, md5, 
datetime, copy
+import sys, string, random, time, os, re, pwd, stat, threading, md5, datetime, 
copy
+import cPickle, pickle
 import config
 from util import vfs
 
@@ -277,10 +278,13 @@
 
         cacheFile = config.FREEVO_CACHEDIR + "/previouslyRecorded.pickle"
         try:
-            self.previouslyRecordedShows = pickle.load(open(cacheFile, "r"))
-        except IOError:
-            self.previouslyRecordedShows = {}
-            pass
+            self.previouslyRecordedShows = cPickle.load(open(cacheFile, "r"))
+        except:
+            try:
+                self.previouslyRecordedShows = pickle.load(open(cacheFile, 
"r"))
+            except IOError:
+                self.previouslyRecordedShows = {}
+                pass
 
     def savePreviouslyRecordedShows(self):
         ''' Save the set of recorded shows '''
@@ -288,7 +292,10 @@
             return
 
         cacheFile=config.FREEVO_CACHEDIR+"/previouslyRecorded.pickle"
-        pickle.dump(self.previouslyRecordedShows, open(cacheFile, "w"))
+        try:
+            cPickle.dump(self.previouslyRecordedShows, open(cacheFile, "w"))
+        except:
+            pickle.dump(self.previouslyRecordedShows, open(cacheFile, "w"))
 
     def newEpisode(self, prog=None):
         ''' Return true if this is a new episode of 'prog' '''

Modified: branches/rel-1/freevo/src/plugins/cd_burn.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/cd_burn.py        (original)
+++ branches/rel-1/freevo/src/plugins/cd_burn.py        Fri May 11 17:50:56 2007
@@ -20,11 +20,11 @@
 #    - BurnCD is now a sub menu
 #    - Directory burning
 #
-# Todo:        
+# Todo:
 #
 # -----------------------------------------------------------------------
 # Freevo - A Home Theater PC framework
-# Copyright (C) 2002 Krister Lagerstrom, et al. 
+# Copyright (C) 2002 Krister Lagerstrom, et al.
 # Please see the file freevo/Docs/CREDITS for a complete list of authors.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -53,7 +53,6 @@
 import rc
 
 import os
-import pickle
 
 import string
 import menu
@@ -70,7 +69,7 @@
 import fcntl
 
 from gui.PopupBox import PopupBox
-from gui.Button import Button 
+from gui.Button import Button
 from gui.ProgressBox import ProgressBox
 from gui.ConfirmBox import ConfirmBox
 from gui.AlertBox import AlertBox
@@ -82,8 +81,8 @@
 from event import *
 
 class MyProgressBox(ProgressBox):
-    def __init__(self, text, x=None, y=None, width=0, height=0, icon=None, 
-        vertical_expansion=1, text_prop=None, full=0, parent='osd', 
+    def __init__(self, text, x=None, y=None, width=0, height=0, icon=None,
+        vertical_expansion=1, text_prop=None, full=0, parent='osd',
         handler=None,initial_progress=0):
 
         ProgressBox.__init__(self, text, x, y, width, height,
@@ -99,7 +98,7 @@
     def set_progress(self, progress):
         _debug_('set_progress(self, progress)')
         while self.progressbar.position < progress:
-           self.tick()                                                         
                                                                  
+            self.tick()
     def eventhandler(self, event):
         _debug_('eventhandler(self, event)')
         if event in (INPUT_ENTER, INPUT_EXIT):
@@ -114,7 +113,7 @@
         _debug_('__init__(self)')
         self.filename = '%s/%s-%s.log' % (config.LOGDIR, 'burn_cd-helpers', 
os.getuid())
         self.file     = file(self.filename,"a")
-        
+
     def log (self,line=None):
         _debug_('log (self,line=None)')
         self.file.write(line + "\n")
@@ -124,11 +123,11 @@
     def 
__init__(self,item,filename=None,plugin=None,menu=None,burn_mode="data_cd"):
         
_debug_('__init__(self,item,filename=None,plugin=None,menu=None,burn_mode="data_cd")')
         self.item          = item
-        self.menuw         = menu 
-        self.plugin        = plugin 
+        self.menuw         = menu
+        self.plugin        = plugin
         self.files         = []
         self.volume_name   = None
-        self.burn_mode     = burn_mode 
+        self.burn_mode     = burn_mode
 
     def menu_back (self):
         _debug_('menu_back (self)')
@@ -171,9 +170,9 @@
         """
         Checks for burnlist cleanup, mplayer availability
         """
-        if not self.check_program(program=config.MPLAYER_CMD,  
program_name="mplayer"): 
+        if not self.check_program(program=config.MPLAYER_CMD,  
program_name="mplayer"):
             return
-        
+
         if not self.clean_up_burndir():
             return
 
@@ -223,17 +222,17 @@
         if not self.check_program(program=config.CDBURN_CDRECORD_PATH, 
program_name="cdrecord"):
             _debug_("Unable to find %s" %config.CDBURN_CDRECORD_PATH)
             return
-        if not self.check_program(program=config.CDBURN_MKISOFS_PATH,  
program_name="mkisofs"): 
+        if not self.check_program(program=config.CDBURN_MKISOFS_PATH,  
program_name="mkisofs"):
             _debug_("Unable to find %s" %config.CDBURN_MKISOFS_PATH)
             return
-        
+
         if not self.clean_up_burndir():
             return
 
         #if list of files not to big just display it
         if len( self.files) <= 4:
-          ConfirmBox(text=_('Start burning %s ?' % self.files),
-                     handler=self.start_burning, default_choice=0).show()
+            ConfirmBox(text=_('Start burning %s ?' % self.files),
+                       handler=self.start_burning, default_choice=0).show()
         #else display the size of the burning
         else:
             t_sum = 0
@@ -244,7 +243,7 @@
 
             ConfirmBox(text=_('Start burning %s entries? ( %d Mb )' % 
(t_files, t_sum)),
                      handler=self.start_burning, default_choice=0).show()
-        
+
 
     def clean_up_burndir (self):
         _debug_('clean_up_burndir (self)')
@@ -369,7 +368,7 @@
         _debug_('stop(self)')
         self.stopping = True
         starttime = time.time()
-        
+
         while self.stopping and (time.time()- starttime < 15):
             _debug_('Waiting for the thread to terminate...')
             time.sleep(1)
@@ -386,7 +385,7 @@
             except OSError:
                 print 'killing process group %d FAILED' % (child.pid)
                 pass
-                    
+
             for i in range(20):
                 #_debug_('Waiting for process group %d to terminate...' % 
(child.pid))
                 try:
@@ -418,7 +417,7 @@
                     time.sleep(0.1)
 
             self.update_status(status='error', description='Aborted by user')
-   
+
     #mick, all childs are spwaned using this method
     def run_child(self,cmd=None,cwd=None,wait=0,task_weight=False):
         _debug_('run_child(self,cmd=None,cwd=None,wait=0,task_weight=False)')
@@ -444,7 +443,7 @@
 
         if wait:
             _debug_('Waiting for %s' % child_app.pid)
-        
+
             self.makeNonBlocking(child_app.fromchild.fileno())
 
             while child_app.poll() < 0:
@@ -498,7 +497,7 @@
         """
         The thread has is own status widget
         """
-        self.widget = MyProgressBox(text=_('Burning status: %s' % self.status 
), 
+        self.widget = MyProgressBox(text=_('Burning status: %s' % self.status 
),
                         handler=self.hide_status,full=100,
             initial_progress=self.progress            )
         self.widget.show()
@@ -508,14 +507,14 @@
         w = self.widget;
         self.widget = False;
         if w:
-          w.destroy 
+            w.destroy
 
     def update_progress(self,progress=0):
         _debug_('update_progress(self,progress=0)')
         self.progress=progress
         if self.widget:
-          self.widget.set_progress(progress)
-          self.widget.draw(update=True)
+            self.widget.set_progress(progress)
+            self.widget.draw(update=True)
 
     def update_status(self, status='running', description=None):
         _debug_('update_status(self, status="running", description=None)')
@@ -564,10 +563,10 @@
             """
             for a in self.token.files:
                 path = re.split("\\/", a)
-                os.symlink(a, "/tmp/burnlist/" + path[-1])   
+                os.symlink(a, "/tmp/burnlist/" + path[-1])
 
             _debug_("start burning")
-        
+
             """
             copy files into a CD
             """
@@ -591,7 +590,7 @@
             self.status = "Burning files to CD"
 
             cdrecord_cmd = '%s -eject -v -driveropts=burnfree speed=%s dev=%s 
%s' % \
-                
(config.CDBURN_CDRECORD_PATH,config.CDBURN_SPEED,config.CDBURN_DEV,image_file) 
+                
(config.CDBURN_CDRECORD_PATH,config.CDBURN_SPEED,config.CDBURN_DEV,image_file)
 
             rec_child = self.run_child(cmd=cdrecord_cmd,wait=1,task_weight=50)
 
@@ -641,7 +640,7 @@
 
                 conv_child = 
self.run_child(cmd=convert_cmd,cwd='/tmp/burnlist',wait=1,task_weight=track_percent)
                 if not conv_child:
-                   return
+                    return
 
                 if conv_child.poll() != 0:
                     self.update_status(status="error",description=_("Error : 
Could not convert %s" % os.path.basename(a)))
@@ -650,7 +649,7 @@
                 _debug_("Conversion done")
                 rename_wav = '%s.wav' % (config.os.path.basename(a))
                 os.rename('/tmp/burnlist/audiodump.wav', _('/tmp/burnlist/%s' 
% rename_wav))
-        
+
             self.update_status(status='running',description="Burning Audio to 
CD")
             audio_mode = config.CDBURN_AUDIO_DAO;
             if audio_mode == 1:
@@ -658,17 +657,17 @@
             else:
                 audio_mode = ""
             cdrec_cmd = '%s -audio -s -eject -v -driveropts=burnfree speed=%s 
dev=%s %s -pad -useinfo /tmp/burnlist/*' \
-                % 
(config.CDBURN_CDRECORD_PATH,config.CDBURN_SPEED,config.CDBURN_DEV,audio_mode) 
+                % 
(config.CDBURN_CDRECORD_PATH,config.CDBURN_SPEED,config.CDBURN_DEV,audio_mode)
             _debug_('%s' % cdrec_cmd)
 
-            rec_child = self.run_child(cmd=cdrec_cmd,wait=1) 
+            rec_child = self.run_child(cmd=cdrec_cmd,wait=1)
             if not rec_child:
                 return
 
             if rec_child.poll() != 0:
                 self.update_status(status="error",description='Could burn 
audio tracks to CD')
                 return
-        
+
         #lets wait for all childs to stop
         for child in self.childs:
             while child.poll() < 0:
@@ -680,25 +679,25 @@
         return
 
 
-class PluginInterface(plugin.ItemPlugin):        
+class PluginInterface(plugin.ItemPlugin):
     """
     Enables writing selected item to compatable device.  So far we can burn
-    files to cd, DVD (VIDEO_TS) to video dvd, and files (mp3 and Ogg) to 
+    files to cd, DVD (VIDEO_TS) to video dvd, and files (mp3 and Ogg) to
     Audio cd.
 
     Place cd_burn.py in:
     freevo/plugins/.
-    
+
     Activate in local_conf.py by:
     plugin.activate(cd_burn)
     """
-        
+
     def __init__(self):
         _debug_('__init__(self)')
         plugin.ItemPlugin.__init__(self)
         self.device = ''
         self.item   = None
-        self.thread_burn = None 
+        self.thread_burn = None
         self.dev_list = []
 
     def config(self):
@@ -733,7 +732,7 @@
             else:
                 record_dev = 'ATAPI:0,0,0'
         except Exception, e:
-            print e    
+            print e
 
         return [
             ('CDBURN_CDRECORD_PATH', '/usr/bin/cdrecord', 'Path to cdrecord'),
@@ -782,7 +781,7 @@
             return [ (self.fill_menu, _('Burn CD')) ]
         else:
             return []
-        
+
     def draw_menu(self,menuw=None,items=None):
         _debug_('draw_menu(self,menuw=None,items=None)')
         #draws the menu with the options on the screen
@@ -795,7 +794,7 @@
 
 
     def fill_menu(self,arg=None, menuw=None):
-        _debug_('fill_menu(self, arg=%r, menuw=%r)' % (arg, menuw)) 
+        _debug_('fill_menu(self, arg=%r, menuw=%r)' % (arg, menuw))
         #chooses the options available for this type of item
         to_return = []
         item = self.item
@@ -827,7 +826,7 @@
                 cur.findFileFromItem()
                 #cur.addFilesFromItem()
                 if cur.files:
-                    to_return.append( ( cur.burn, _('Copy this file to CD')) ) 
+                    to_return.append( ( cur.burn, _('Copy this file to CD')) )
 
             #any joined item except dirs
             elif not item.type == 'dir' and item.subitems:
@@ -835,7 +834,7 @@
                     cur = BurnCDItem(item=a, plugin=self,menu=menuw)
                     cur.findFileFromItem()
                     if cur.files:
-                        to_return.append( ( cur.burn, _('Copy %s to CD' % 
a.name )) ) 
+                        to_return.append( ( cur.burn, _('Copy %s to CD' % 
a.name )) )
         except:
             pass
 
@@ -885,6 +884,6 @@
             _debug_("Not possible to findFileFromItem for DVD Movie")
 
         if self.thread_burn and self.thread_burn.running == 0:
-           to_return.append( (self.thread_burn.show_status, 'Show last burn 
status/result' ));
+            to_return.append( (self.thread_burn.show_status, 'Show last burn 
status/result' ));
 
         return self.draw_menu(menuw=menuw,items=to_return)

Modified: branches/rel-1/freevo/src/rssperiodic.py
==============================================================================
--- branches/rel-1/freevo/src/rssperiodic.py    (original)
+++ branches/rel-1/freevo/src/rssperiodic.py    Fri May 11 17:50:56 2007
@@ -5,11 +5,11 @@
 # $Id$
 #
 # Notes:
-# Todo:        
+# Todo:
 #
 # -----------------------------------------------------------------------
 # Freevo - A Home Theater PC framework
-# Copyright (C) 2002 Krister Lagerstrom, et al. 
+# Copyright (C) 2002 Krister Lagerstrom, et al.
 # Please see the file freevo/Docs/CREDITS for a complete list of authors.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -28,13 +28,14 @@
 #
 # -----------------------------------------------------------------------
 
-import re,os,glob,urllib,datetime,pickle,time
+import re,os,glob,urllib,datetime,time
+import cPickle, pickle
 import config
 import rssfeed
 
 def convertDate(string):
     if not re.search("\d+\s+\S+\s+\d+",string):
-       return datetime.date.today()
+        return datetime.date.today()
     itemDateList = re.split(" ", re.search("\d+\s+\S+\s+\d+",string).group())
     day=int(itemDateList[0])
     if itemDateList[1] == "Jan":
@@ -68,37 +69,52 @@
 def checkForDup(string):
     cacheFile=config.FREEVO_CACHEDIR+"/rss.pickle"
     try:
-       downloadedUrls=pickle.load(open(cacheFile,"r"))
+        try:
+            downloadedUrls=cPickle.load(open(cacheFile,"r"))
+        except:
+            downloadedUrls=pickle.load(open(cacheFile,"r"))
     except IOError:
-       return False
+        return False
     except EOFError:
-       return False
+        return False
     foundFile=False
     for line in downloadedUrls:
         if string in line:
-           foundFile=True
+            foundFile=True
     return foundFile
 
 def addFileToCache(string):
     cacheFile=config.FREEVO_CACHEDIR+"/rss.pickle"
     downloadedUrls=[]
     try:
-       downloadedUrls = pickle.load(open(cacheFile,"r"))
+        try:
+            downloadedUrls = cPickle.load(open(cacheFile,"r"))
+        except:
+            downloadedUrls = pickle.load(open(cacheFile,"r"))
     except IOError:
-       pass
+        pass
     downloadedUrls.append(string)
-    pickle.dump(downloadedUrls, open(cacheFile,"w"))
+    try:
+        cPickle.dump(downloadedUrls, open(cacheFile,"w"))
+    except:
+        pickle.dump(downloadedUrls, open(cacheFile,"w"))
 
 def addFileToExpiration(string,goodUntil):
     ''' the new file gets added with the expiration date to the expiration 
file '''
     cacheFile=config.FREEVO_CACHEDIR+"/rss.expiration"
     downloadedFiles=[]
     try:
-       downloadedFiles = pickle.load(open(cacheFile,"r"))
+        try:
+            downloadedFiles = cPickle.load(open(cacheFile,"r"))
+        except:
+            downloadedFiles = pickle.load(open(cacheFile,"r"))
     except IOError:
-       pass
+        pass
     downloadedFiles.append(string + ";" + goodUntil.__str__())
-    pickle.dump(downloadedFiles, open(cacheFile,"w"))
+    try:
+        cPickle.dump(downloadedFiles, open(cacheFile,"w"))
+    except:
+        pickle.dump(downloadedFiles, open(cacheFile,"w"))
 
 def checkForExpiration():
     ''' checking for expired files by reading the rss.expiration file the file
@@ -106,9 +122,12 @@
     deleted at the end the file gets removed from the rss.expiration file '''
     cacheFile=config.FREEVO_CACHEDIR+"/rss.expiration"
     try:
-       downloadedFiles=pickle.load(open(cacheFile,"r"))
+        try:
+            downloadedFiles=cPickle.load(open(cacheFile,"r"))
+        except:
+            downloadedFiles=pickle.load(open(cacheFile,"r"))
     except IOError:
-       return 
+        return
     deletedItems = []
     for line in downloadedFiles:
         (filename,goodUntil)=re.split(";", line)
@@ -131,10 +150,13 @@
                 print"removing the file %s failed" % (filename)
     for line in deletedItems:
 #      try:
-       downloadedFiles.remove(line)
+        downloadedFiles.remove(line)
 #      except ValueError:
 #          _debug_("removing the line %s failed" % (line))
-    pickle.dump(downloadedFiles, open(cacheFile,"w"))
+    try:
+        cPickle.dump(downloadedFiles, open(cacheFile,"w"))
+    except:
+        pickle.dump(downloadedFiles, open(cacheFile,"w"))
 
 def createFxd(item,filename):
     if "audio" in item.type:
@@ -147,28 +169,28 @@
         ofile=ofile+"."+line
     ofile=ofile+".fxd"
     try:
-       file = open(ofile, 'w')
-       file.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
-       file.write('<freevo>\n')
-       file.write('   <movie title="%s">\n' % item.title)
-       file.write('      <video>\n')
-       file.write('         <file id="f1">%s</file>\n' % fullFilename)
-       file.write('      </video>\n')
-       file.write('      <info>\n')
-       file.write('         <plot>%s</plot>\n' % item.description)
-       file.write('      </info>\n')
-       file.write('   </movie>\n')
-       file.write('</freevo>\n')
-       file.close()
+        file = open(ofile, 'w')
+        file.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
+        file.write('<freevo>\n')
+        file.write('   <movie title="%s">\n' % item.title)
+        file.write('      <video>\n')
+        file.write('         <file id="f1">%s</file>\n' % fullFilename)
+        file.write('      </video>\n')
+        file.write('      <info>\n')
+        file.write('         <plot>%s</plot>\n' % item.description)
+        file.write('      </info>\n')
+        file.write('   </movie>\n')
+        file.write('</freevo>\n')
+        file.close()
     except IOError:
-       print "ERROR: Unable to write FXD file %s" % (ofile)
+        print "ERROR: Unable to write FXD file %s" % (ofile)
 
 def checkForUpdates():
     try:
         file = open(config.RSS_FEEDS,"r")
     except IOError:
-       print "ERROR: Could not open configuration file %s" % (config.RSS_FEEDS)
-       return
+        print "ERROR: Could not open configuration file %s" % 
(config.RSS_FEEDS)
+        return
 
     for line in file:
         if line == '\n':
@@ -211,4 +233,3 @@
                             os.popen("rm %s" % (filename))
         except IOError:
             print "ERROR: Unable to download %s. Connection may be down." % 
(url)
-

Modified: branches/rel-1/freevo/src/util/fileops.py
==============================================================================
--- branches/rel-1/freevo/src/util/fileops.py   (original)
+++ branches/rel-1/freevo/src/util/fileops.py   Fri May 11 17:50:56 2007
@@ -5,11 +5,11 @@
 # $Id$
 #
 # Notes:
-# Todo:        
+# Todo:
 #
 # -----------------------------------------------------------------------
 # Freevo - A Home Theater PC framework
-# Copyright (C) 2002 Krister Lagerstrom, et al. 
+# Copyright (C) 2002 Krister Lagerstrom, et al.
 # Please see the file freevo/Docs/CREDITS for a complete list of authors.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -35,7 +35,7 @@
 import statvfs
 import string
 import copy
-import cPickle, pickle # pickle because sometimes cPickle doesn't work
+import cPickle, pickle
 import fnmatch
 import traceback
 
@@ -52,7 +52,7 @@
 if traceback.extract_stack()[0][0].find('install.py') == -1:
     # Configuration file. Determines where to look for AVI/MP3 files, etc
     import config
-    
+
     # import stuff from util.misc
     import misc
 
@@ -93,9 +93,9 @@
     magic = m.read(2)
     m.close
     if magic == '\037\213':
-         f = gzip.open(file)
+        f = gzip.open(file)
     else:
-         f = open(file)
+        f = open(file)
     return f
 
 
@@ -121,7 +121,7 @@
     except OSError, e:
         print '\"%s\": %s' % (path, e)
     return 0
-        
+
 
 def totalspace(path):
     """
@@ -135,7 +135,7 @@
     except OSError, e:
         print '\"%s\": %s' % (path, e)
     return 0
-        
+
 
 def touch(file):
     """
@@ -214,9 +214,9 @@
         return []
 
     matches = [ fname for fname in files if match_suffix(fname, suffix_list) ]
-        
+
     matches.sort(lambda l, o: cmp(l.upper(), o.upper()))
-    
+
     return matches
 
 
@@ -258,7 +258,7 @@
     matches = misc.unique([f for f in all_files if match_suffix(f, 
suffix_list) ])
 
     matches.sort(lambda l, o: cmp(l.upper(), o.upper()))
-    
+
     return matches
 
 
@@ -278,19 +278,19 @@
 
 def recursefolders(root, recurse=0, pattern='*', return_folders=0):
     """
-    Before anyone asks why I didn't use os.path.walk; it's simple, 
+    Before anyone asks why I didn't use os.path.walk; it's simple,
     os.path.walk is difficult, clunky and doesn't work right in my
-    mind. 
-    
+    mind.
+
     Here's how you use this function:
-    
+
     songs = recursefolders('/media/Music/Guttermouth',1,'*.mp3',1):
     for song in songs:
-          print song      
-    
+          print song
+
     Should be easy to add to the mp3.py app.
     """
-    
+
     # initialize
     result = []
 
@@ -359,8 +359,8 @@
             mounted_dirs.append(dir)
     if force and not dir in mounted_dirs:
         mounted_dirs.append(dir)
-        
-    
+
+
 def umount_all():
     """
     umount all mounted directories
@@ -368,7 +368,7 @@
     global mounted_dirs
     for d in copy.copy(mounted_dirs):
         umount(d)
-        
+
 
 def is_mounted(dir):
     """
@@ -377,7 +377,7 @@
     global mounted_dirs
     return dir in mounted_dirs
 
-    
+
 def resolve_media_mountdir(*arg):
     """
     get the mount point of the media with media_id
@@ -488,7 +488,7 @@
                 f=open(filename, 'rb')
                 tags=exif.process_file(f)
                 f.close()
-                
+
                 if tags.has_key('JPEGThumbnail'):
                     image = imlib2.open_from_memory(tags['JPEGThumbnail'])
             except Exception, e:
@@ -504,7 +504,7 @@
                 if config.DEBUG:
                     print 'caching image:', e
                 return None
-        
+
     try:
         if image.width > 255 or image.height > 255:
             image.thumbnail((255,255))
@@ -527,7 +527,7 @@
     except Exception, e:
         print 'error caching image %s: %s' % (filename, e)
         return None
-        
+
 
 def cache_image(filename, thumbnail=None, use_exif=False):
     """

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to