Author: duncan
Date: Tue Oct 23 00:43:12 2007
New Revision: 10032

Log:
Tidied up/corrected docstrings


Modified:
   branches/rel-1/freevo/src/audio/plugins/album_tree.py
   branches/rel-1/freevo/src/helpers/recordserver.py
   branches/rel-1/freevo/src/plugins/buttonbar.py
   branches/rel-1/freevo/src/tv/plugins/vbi2srt_record.py
   branches/rel-1/freevo/src/util/feedparser.py

Modified: branches/rel-1/freevo/src/audio/plugins/album_tree.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/album_tree.py       (original)
+++ branches/rel-1/freevo/src/audio/plugins/album_tree.py       Tue Oct 23 
00:43:12 2007
@@ -49,25 +49,25 @@
     Inspired by foobar2000 albumlist (NOT playlist tree)
     (http://www.hydrogenaudio.org/forums/index.php?showforum=28)
     This is a tree/not a playlist generator.
-    generates ugly sql(only as ugly as the spec),but sqlite is fast enough.
+    generates ugly sql(only as ugly as the spec), but sqlite is fast enough.
     operates directly on a sqlite cursor.
     see http://www.sqlite.org/lang_expr.html for "scripting" functions
     """
-    def __init__(self,name='unnamed',cursor=None,spec=None,alt_grouping=None):
+    def __init__(self, name='unnamed', cursor=None, spec=None, 
alt_grouping=None):
         self.spec = spec
         self.name = name
         self.alt_grouping = alt_grouping
         self.cursor = cursor
 
-    def get_query(self,data):
+    def get_query(self, data):
         """
         builds query
         """
 
         where = []
-        for i,item in enumerate(self.spec):
+        for i, item in enumerate(self.spec):
             if i < len(data):
-                where.append('%s="%s"' % (item,data[i]))
+                where.append('%s="%s"' % (item, data[i]))
             else:
                 break
         if where:
@@ -80,21 +80,21 @@
         if self.alt_grouping and self.alt_grouping[i]:
             grouping = self.alt_grouping[i]
 
-        #last level in tree-->,no-count ; use path,filename + order by instead 
of group by
+        #last level in tree-->, no-count ; use path, filename + order by 
instead of group by
         if len(self.spec) -1 == len(data):
-            query = 'select %s,path,filename from music'% (self.spec[i],)
+            query = 'select %s, path, filename from music'% (self.spec[i], )
             query += wheresql
             query += ' order by ' + grouping
         #normal/not last level in tree
         else:
-            query = 'select %s,count() from music'% (self.spec[i],)
+            query = 'select %s, count() from music'% (self.spec[i], )
             query += wheresql
-            query += ' group by %s order by %s'  % (grouping,grouping)
+            query += ' group by %s order by %s'  % (grouping, grouping)
 
 
         return query
 
-    def execute(self,data):
+    def execute(self, data):
         self.cursor.execute(self.get_query(data))
         return list(self.cursor)
         #should return an iterator/generator instead of a list?
@@ -105,7 +105,7 @@
     Plugin to browse songs in a tree-like way.
 
     Requires:
-    * pysqlite.
+        * pysqlite.
 
     === Pre Installation ===
 
@@ -115,12 +115,12 @@
     you can skip the rest of the pre-install if those plugins
     are already succesfully installed.
 
-    * install pysqlite,sqlite
-    * edit your local_config.py : Configure AUDIO_ITEMS
-    ('''AudioConfig''' ,don't leave it at the default!)
-    * run freevo cache
-    * wait.....
-    * The meta database should be available now.
+        * install pysqlite, sqlite
+        * edit your local_config.py
+          Configure AUDIO_ITEMS ('''AudioConfig''', don't leave it at the 
default!)
+        * run freevo cache
+        * wait.....
+        * The meta database should be available now.
 
     === Configuration ===
 
@@ -130,41 +130,41 @@
     | AUDIO_ALBUM_TREE_SPEC = []
     |
     | #You could add all trees below:, but probably you only want 1 or 2 of 
them:
-    | AUDIO_ALBUM_TREE_SPEC.append({'name':'Artist/Album/Track'
-    |   ,'spec':["artist","album","track||'-'||title"]
-    |   ,'alt_grouping':[None,None,'track']
+    | AUDIO_ALBUM_TREE_SPEC.append({'name':'Artist/Album/Track',
+    |   'spec':["artist", "album", "track||'-'||title"],
+    |   'alt_grouping':[None, None, 'track']
     | })
     |
     | #A case sensitive tree like above...
     | #Is easy to convert to a convert to a case insensitive tree like below:
-    | AUDIO_ALBUM_TREE_SPEC.append({'name':'nocase:artist/album/Track'
-    |   ,'spec':["lower(artist)","lower(album)","track||'-'||title"]
-    |   ,'alt_grouping':[None,None,'track']
+    | AUDIO_ALBUM_TREE_SPEC.append({'name':'nocase:artist/album/Track',
+    |   'spec':["lower(artist)", "lower(album)", "track||'-'||title"],
+    |   'alt_grouping':[None, None, 'track']
     | })
     |
     | #my favorite layout:
-    | AUDIO_ALBUM_TREE_SPEC.append({'name':'(A-Z)/Artist/Album-Year/Track'
-    |   ,'spec':["upper(substr(artist,0,1))"
-    |   ,"artist","album||'-'||year"
-    |   ,"track||'-'||title"]
-    |   ,'alt_grouping':[None,None,'year||album','track']
+    | AUDIO_ALBUM_TREE_SPEC.append({'name':'(A-Z)/Artist/Album-Year/Track',
+    |   'spec':["upper(substr(artist, 0, 1))",
+    |   "artist", "album||'-'||year",
+    |   "track||'-'||title"],
+    |   'alt_grouping':[None, None, 'year||album', 'track']
     | })
     |
     | #you can comment out a tree definition like this:
-    | #AUDIO_ALBUM_TREE_SPEC.append({'name':'Artist-Album/Track'
-    | #  ,'spec':["artist||'-'||album","track||'-'||title"]
-    | #  ,'alt_grouping':[None,'track']
+    | #AUDIO_ALBUM_TREE_SPEC.append({'name':'Artist-Album/Track',
+    | #  'spec':["artist||'-'||album", "track||'-'||title"],
+    | #  'alt_grouping':[None, 'track']
     | #})
     |
     | #More Examples:
-    | AUDIO_ALBUM_TREE_SPEC.append({'name':'Year/Artist-Album/Track'
-    |   ,'spec':["year","artist||'-'||album","track||'-'||title"]
-    |   ,'alt_grouping':[None,None,None,'track']
+    | AUDIO_ALBUM_TREE_SPEC.append({'name':'Year/Artist-Album/Track',
+    |   'spec':["year", "artist||'-'||album", "track||'-'||title"],
+    |   'alt_grouping':[None, None, None, 'track']
     | })
     |
-    | AUDIO_ALBUM_TREE_SPEC.append({'name':'Dirtitle/Artist/Album/Track'
-    |   ,'spec':["dirtitle","artist","album","track||'-'||title"]
-    |   ,'alt_grouping':[None,None,None,'track']
+    | AUDIO_ALBUM_TREE_SPEC.append({'name':'Dirtitle/Artist/Album/Track',
+    |   'spec':["dirtitle", "artist", "album", "track||'-'||title"],
+    |   'alt_grouping':[None, None, None, 'track']
     | })
 
     === Post Installation ===
@@ -179,9 +179,9 @@
     def __init__(self):
         plugin.MainMenuPlugin.__init__(self)
         #config.EVENTS['audio']['DISPLAY'] = Event(FUNCTION_CALL, 
arg=self.detach)
-        self.show_item = menu.MenuItem(_('Album 
Tree'),action=self.onchoose_main)
+        self.show_item = menu.MenuItem(_('Album Tree'), 
action=self.onchoose_main)
         self.show_item.type = 'audio'
-        plugin.register(self,'audio.album_tree')
+        plugin.register(self, 'audio.album_tree')
 
         if (not config.__dict__.has_key('AUDIO_ALBUM_TREE_SPEC') ) or  (not 
config.AUDIO_ALBUM_TREE_SPEC):
             print '*ALBUM_TREE:"config.AUDIO_ALBUM_TREE_SPEC" is 
empty:DEMO-MODE:USING PREDEFINED TREES'
@@ -196,14 +196,14 @@
         _debug_('shutdown', 2)
         db.close()
 
-    def load_spec(self,spec_list):
+    def load_spec(self, spec_list):
         """
         load definitions from config
         """
         curs = db.cursor
         self.album_tree_list = []
         for specdef in spec_list:
-            tree = treeSpec(specdef['name'],curs,specdef['spec'])
+            tree = treeSpec(specdef['name'], curs, specdef['spec'])
             if specdef.has_key('alt_grouping'):
                 tree.alt_grouping = specdef['alt_grouping']
             self.album_tree_list.append(tree)
@@ -214,41 +214,29 @@
         """
         curs = db.cursor
         self.album_tree_list = [
-        treeSpec('Artist/Album/Track',curs
-                ,["artist","album","track||'-'||title"],[None,None,'track'])
-
-        ,treeSpec('(A-Z)/Artist/Year-Album/Track',curs
-        ,["upper(substr(artist,0,1))",
-        "artist","album||'-'||year"
-        ,"track||'-'||title"],[None,None,'year||album','track'])
-
-
-        ,treeSpec('Artist-Album/Track',curs
-                ,["artist||'-'||album","track||'-'||title"],[None,'track'])
-
-        ,treeSpec('a-z/artist/title-album-track',curs
-                ,["lower(substr(artist,0,1))"
-                ,"lower(artist)","title||'-'||album||'-'||track"])
-
-        ,treeSpec('Year/Artist-Album/Track',curs,
-                ["year","artist||'-'||album","track||'-'||title"]
-                ,[None,None,None,'track'])
+        treeSpec('Artist/Album/Track', curs, ["artist", "album", 
"track||'-'||title"], [None, None, 'track']),
+        treeSpec('(A-Z)/Artist/Year-Album/Track', curs,
+            ["upper(substr(artist, 0, 1))", "artist", "album||'-'||year", 
"track||'-'||title"],
+            [None, None, 'year||album', 'track']),
+        treeSpec('Artist-Album/Track', curs, ["artist||'-'||album", 
"track||'-'||title"], [None, 'track']),
+        treeSpec('a-z/artist/title-album-track', curs,
+            ["lower(substr(artist, 0, 1))", "lower(artist)", 
"title||'-'||album||'-'||track"]),
+        treeSpec('Year/Artist-Album/Track', curs,
+            ["year", "artist||'-'||album", "track||'-'||title"], [None, None, 
None, 'track']), 
         #demo:
-        ,treeSpec('Dirtitle/Artist/Album/Track',curs
-            ,["dirtitle","artist","album","track||'-'||title"]
-            ,[None,None,None,'track'])
-
+        treeSpec('Dirtitle/Artist/Album/Track', curs,
+            ["dirtitle", "artist", "album", "track||'-'||title"], [None, None, 
None, 'track'])
         ]
 
         #treespec below:
-        #INSANE,but this is what i like about foobar2000.
+        #INSANE, but this is what i like about foobar2000.
         #NOT YET POSSIBLE, "album_artist" tag is not in sql database.
         #Surprisingly:sqlite can handle it pretty fast.
-        #treeSpec('a-z/album_artist/album/track-(artist)-title',curs
-        #        ,["lower(substr(ifnull(album_artist,artist),0,1))",
-        #           "ifnull(album_artist,artist)"
-        #           
,"album","track||'-'||nullif(artist,ifnull(album_artist,artist))||'-'||title"]
-        #           ,[None,None,None,None,'track'])
+        #treeSpec('a-z/album_artist/album/track-(artist)-title', curs,
+        #   ["lower(substr(ifnull(album_artist, artist), 0, 1))",
+        #       "ifnull(album_artist, artist)", "album",
+        #       "track||'-'||nullif(artist, ifnull(album_artist, 
artist))||'-'||title"],
+        #   [None, None, None, None, 'track'])
 
 
     def items(self, parent):
@@ -258,15 +246,14 @@
         #todo: add random 10 etc..
         return []
 
-    def onchoose_main(self,arg=None, menuw=None):
+    def onchoose_main(self, arg=None, menuw=None):
         """
         main menu
         """
         #
         items = []
         for tree in self.album_tree_list:
-            items.append(menu.MenuItem(tree.name
-                ,action=self.onchoose_node,arg=[tree,[]]) )
+            items.append(menu.MenuItem(tree.name, action=self.onchoose_node, 
arg=[tree, []]))
 
         #myobjectmenu = menu.Menu(_('Album Tree'), items, 
reload_func=menuw.back_one_menu )
         myobjectmenu = menu.Menu(_('Album Tree'), items)
@@ -274,7 +261,7 @@
         menuw.pushmenu(myobjectmenu)
         menuw.refresh()
 
-    def onchoose_node(self,arg=None, menuw=None):
+    def onchoose_node(self, arg=None, menuw=None):
         """
         browse through a tree specification
         """
@@ -285,12 +272,12 @@
         mylistofitems =  []
 
         if len(tree.spec) -1 <> len(data): #non-tracks
-            for tree_item,count in tree.execute(data):
+            for tree_item, count in tree.execute(data):
                 mylistofitems.append(
-                    menu.MenuItem("%s(%i)" % (tree_item ,count)
-                    ,action=self.onchoose_node,arg=[tree,data + [tree_item]]))
+                    menu.MenuItem("%s(%i)" % \
+                        (tree_item, count), action=self.onchoose_node, 
arg=[tree, data + [tree_item]]))
         else: #tracks
-            self.onchoose_last_node(tree,data,menuw)
+            self.onchoose_last_node(tree, data, menuw)
             return
 
         #should be impossible?
@@ -304,28 +291,24 @@
         menuw.pushmenu(myobjectmenu)
         menuw.refresh()
 
-    def onchoose_last_node(self,tree,data,menuw):
+    def onchoose_last_node(self, tree, data, menuw):
         """
         last node in tree generates a playlist.
         """
         title = '-'.join(data)
         #creating of audio items is slow.
         #need a progress-bar.
-        pl = playlist.Playlist(
-                name='-'.join(data)
-                ,playlist=[]
-                ,display_type='audiocd')
-
-        tracks = tree.execute(data)  #returns list of (desc,path,filename)
+        pl = playlist.Playlist(name='-'.join(data), playlist=[], 
display_type='audiocd')
 
+        tracks = tree.execute(data)  #returns list of (desc, path, filename)
 
         pop = ProgressBox(text=_('Generating playlist...'), full=len(tracks))
         pop.show()
         items = []
         i = 0
-        for desc,path,filename in tracks:
-            filepath = os.path.join(path,filename)
-            item = audioitem.AudioItem(filepath,parent=pl)
+        for desc, path, filename in tracks:
+            filepath = os.path.join(path, filename)
+            item = audioitem.AudioItem(filepath, parent=pl)
             item.name = desc
             item.track = i
             items.append( item)
@@ -338,9 +321,9 @@
         #note/question for core developers:
         #command below causes strange errors?
         #plugin.__plugin_type_list__ is empty??? but it's Not?
-        #pl.browse(arg=None,menuw=menuw)
-        #print 'LIST=',plugin.__plugin_type_list__['mimetype']
+        #pl.browse(arg=None, menuw=menuw)
+        #print 'LIST=', plugin.__plugin_type_list__['mimetype']
         #workaround: not all features of a real playlist :(
 
-        mymenu = menu.Menu(title, pl.playlist,item_types="audio")
+        mymenu = menu.Menu(title, pl.playlist, item_types="audio")
         menuw.pushmenu(mymenu)

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   Tue Oct 23 00:43:12 2007
@@ -1533,7 +1533,10 @@
         fxd.info['runtime'] = None
         fxd.info['recording_timestamp'] = str(rec_prog.start)
         # bad use of the movie year field :)
-        fxd.info['year'] = time.strftime(config.TV_RECORD_YEAR_FORMAT, 
time.localtime(rec_prog.start))
+        try:
+            fxd.info['year'] = time.strftime(config.TV_RECORD_YEAR_FORMAT, 
time.localtime(rec_prog.start))
+        except:
+            fxd.info['year'] = '2007'
         fxd.title = rec_prog.title
         fxd.writeFxd()
 
@@ -1556,7 +1559,7 @@
 
 
     def eventNotice(self):
-        #print 'RECORDSERVER GOT EVENT NOTICE'
+        print 'RECORDSERVER GOT EVENT NOTICE'
         # Use callLater so that handleEvents will get called the next time
         # through the main loop.
         reactor.callLater(0, self.handleEvents)

Modified: branches/rel-1/freevo/src/plugins/buttonbar.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/buttonbar.py      (original)
+++ branches/rel-1/freevo/src/plugins/buttonbar.py      Tue Oct 23 00:43:12 2007
@@ -75,13 +75,13 @@
     | plugin.activate('buttonbar')
 
     Where the actions mapped to each of the colors can be one of the following:
-    * info - Brings up a screen displaying more information than can be 
displayed
-      in the few lines available on the TV guide page.
-    * record - Same as the record button.
-    * adv:<number> - Special action to allow navigation of the TV Guide,
-      <number> can be either positive or negative and is the number of hours
-      to go forward/back.
-    * now - jumps back to the currently running program
+        * info - Brings up a screen displaying more information than can be 
displayed
+          in the few lines available on the TV guide page.
+        * record - Same as the record button.
+        * adv:<number> - Special action to allow navigation of the TV Guide,
+          <number> can be either positive or negative and is the number of 
hours
+          to go forward/back.
+        * now - jumps back to the currently running program
 
     You can also map the following actions to unused keys of your keyboard
     (For example):

Modified: branches/rel-1/freevo/src/tv/plugins/vbi2srt_record.py
==============================================================================
--- branches/rel-1/freevo/src/tv/plugins/vbi2srt_record.py      (original)
+++ branches/rel-1/freevo/src/tv/plugins/vbi2srt_record.py      Tue Oct 23 
00:43:12 2007
@@ -84,7 +84,7 @@
     | }
 
     Requirements:
-       * vbi2srt: (http://www.linuxowl.com/vbi2srt.html)
+        * vbi2srt: (http://www.linuxowl.com/vbi2srt.html)
 
     Updates available from http://www.linuxowl.com/software/.
 

Modified: branches/rel-1/freevo/src/util/feedparser.py
==============================================================================
--- branches/rel-1/freevo/src/util/feedparser.py        (original)
+++ branches/rel-1/freevo/src/util/feedparser.py        Tue Oct 23 00:43:12 2007
@@ -20,11 +20,11 @@
 Redistribution and use in source and binary forms, with or without 
modification,
 are permitted provided that the following conditions are met:
 
-* Redistributions of source code must retain the above copyright notice,
-  this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to