Author: duncan
Date: Thu Oct 18 09:40:45 2007
New Revision: 9998
Log:
Clean up of plug-in messages
Clean up of some code
Modified:
branches/rel-1/freevo/local_conf.py.example
branches/rel-1/freevo/src/audio/plugins/lastfm.py
branches/rel-1/freevo/src/helpers/makelinuxevent.py
branches/rel-1/freevo/src/helpers/plugins.py
branches/rel-1/freevo/src/plugins/icecast.py
branches/rel-1/freevo/src/plugins/rom_drives.py
branches/rel-1/freevo/src/plugins/weatherdata.py (props changed)
branches/rel-1/freevo/src/tv/epg_xmltv.py
branches/rel-1/freevo/src/www/__init__.py
Modified: branches/rel-1/freevo/local_conf.py.example
==============================================================================
--- branches/rel-1/freevo/local_conf.py.example (original)
+++ branches/rel-1/freevo/local_conf.py.example Thu Oct 18 09:40:45 2007
@@ -62,7 +62,7 @@
# START_FULLSCREEN_X = 0 # Start in fullscreen mode if using x11
or xv.
-# CONFIRM_SHUTDOWN = 1 # ask before shutdown
+# SHUTDOWN_CONFIRM = 1 # ask before shutdown
#
# Physical ROM drives, multiple ones can be specified
@@ -111,7 +111,7 @@
# -- autoshutdown menu item configuration --
-# CONFIRM_SHUTDOWN
+# SHUTDOWN_CONFIRM
# Set to True to popup dialog boxes for confirmation.
# this applies to menu items only.
#AUTOSHUTDOWN_CONFIRM = True
@@ -1121,7 +1121,7 @@
#plugin.activate('tv.ivtv_xine_tv')
# Note: TV_IVTV_OPTIONS must be configured properly
-# Note: FREQUENCY_TABLE must be configured properly
+# Note: TV_FREQUENCY_TABLE must be configured properly
# Note: XINE_COMMAND must be configured properly
# Note: XINE_ARGS_DEF must be configured properly
@@ -1366,7 +1366,7 @@
# }
#
-# FREQUENCY_TABLE - This is only used when Freevo changes the channel natively.
+# TV_FREQUENCY_TABLE - This is only used when Freevo changes the channel
natively.
# This is only the case if you are using V4L2 and any of the following plugins:
# timeshift, ivtv_record, ivtv_basic_tv.
# For the standard frequancy tables see src/tv/freq.py. To add your own just
@@ -1376,7 +1376,7 @@
# frequency table and you can also have entries here that are not present in
# there.
-# FREQUENCY_TABLE = {
+# TV_FREQUENCY_TABLE = {
# 'tuner_id' : 55250,
# }
Modified: branches/rel-1/freevo/src/audio/plugins/lastfm.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/lastfm.py (original)
+++ branches/rel-1/freevo/src/audio/plugins/lastfm.py Thu Oct 18 09:40:45 2007
@@ -28,20 +28,20 @@
To activate this plugin, put the following in your local_conf.py:
- plugin.activate('audio.lastfm')
- LASTFM_USER = '<last fm user name>'
- LASTFM_PASS = '<last fm password>'
- LASTFM_SESSION = ' '
-
- LASTFM_LOCATIONS = [
- ('Last Fm - Neighbours','lastfm://user/<lastfm user
name>/neighbours'),
- ('Last FM - Jazz', 'lastfm://globaltags/jazz'),
- ('Last FM - Rock', 'lastfm://globaltags/rock'),
- ('Last FM - Oldies', 'lastfm://globaltags/oldies'),
- ('Las FM - Pop', 'lastfm://globaltags/pop'),
- ('Las FM - Norah Jones', 'lastfm://artist/norah jones')
- ]
- ------------------------------------------------------------------------
+ | plugin.activate('audio.lastfm')
+ | LASTFM_USER = '<last fm user name>'
+ | LASTFM_PASS = '<last fm password>'
+ | LASTFM_SESSION = ' '
+ |
+ | LASTFM_LOCATIONS = [
+ | ('Last Fm - Neighbours','lastfm://user/<lastfm user
name>/neighbours'),
+ | ('Last FM - Jazz', 'lastfm://globaltags/jazz'),
+ | ('Last FM - Rock', 'lastfm://globaltags/rock'),
+ | ('Last FM - Oldies', 'lastfm://globaltags/oldies'),
+ | ('Las FM - Pop', 'lastfm://globaltags/pop'),
+ | ('Las FM - Norah Jones', 'lastfm://artist/norah jones')
+ | ]
+
RIGHT - skip song
1 - send to last.fm LOVE song
9 - send to last.fm BAN song
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 Thu Oct 18 09:40:45 2007
@@ -98,7 +98,6 @@
_ids = ids
_buses = buses
-import cPickle, pickle
def save_event(fout):
#fout = open('ev.dat', 'wb')
Modified: branches/rel-1/freevo/src/helpers/plugins.py
==============================================================================
--- branches/rel-1/freevo/src/helpers/plugins.py (original)
+++ branches/rel-1/freevo/src/helpers/plugins.py Thu Oct 18 09:40:45 2007
@@ -158,6 +158,12 @@
print 'The plugin is not activated in the current setting'
def iscode(line):
+ """
+ Find code lines in the docstring
+ When the line starts with a '|' then is has been marked as a code line
+ @note this does not work too well in all cases
+ """
+ return line.strip().startswith('|')
return (len(line) > 2 and line[:2].upper() == line[:2] and \
line.find('=') > 0) or \
(line and line[0] in ('#', ' ', '[', '(')) or
(line.find('plugin.') == 0)
@@ -245,7 +251,7 @@
return '.'.join(words)
-def wiki_info(name, file, type, status, desc, config, mode):
+def wiki_info(name, file, type, status, desc, config, mode, names=[]):
"""
Wiki formatter, formats a single entry for a wiki page
"""
@@ -255,6 +261,7 @@
ret += "== %s ==\n" % (wiki_word(name, mode))
ret += "----\n"
ret += "'''File: %s'''\n" % (file)
+ ret += "\n"
if not desc:
ret += "The plugin has no description. You can help by " + \
"writing a small description and send it to the Freevo "\
@@ -275,8 +282,12 @@
line = desc[i]
if iscode(line):
if not code:
- #ret += "{{{\n"
- ret += "{{{#!python\n"
+ if mode == 'trac':
+ ret += "{{{\n"
+ ret += "#!python\n"
+ else:
+ ret += "{{{#!python\n"
+ line = line.lstrip(' ')[1:]
ret += line+"\n"
code = 1
@@ -292,34 +303,45 @@
elif code:
ret += "\n"
else:
- #ret += "[[BR]]\n"
ret += "\n"
if code:
ret += "}}}\n"
code = 0
- ret += "\n"
+ #ret += "\n"
- ret += "=== Configuration ===\n"
- ret += "\n"
- if mode == 'trac':
- ret += "{{{\n"
- ret += "#!rst\n"
- ret += "Config Item Value Description\n"
- ret += "============== ============
=================================\n"
- for config_item in config:
- ret += "%s %s %s\n" % config_item
- ret += "============== ============
=================================\n"
- ret += "}}}\n"
- else:
- ret += "||<20%>'''Config
Item'''||<20%>'''Value'''||<:99%>'''Description'''||\n"
- for config_item in config:
- ret += "||%s||%s||%s||\n" % config_item
- ret += "\n"
+ if config:
+ ret += "=== Configuration ===\n"
+ ret += "\n"
+ if mode == 'trac':
+ ret += "{{{\n"
+ ret += "#!rst\n"
+ ret += "Config Item Value Description\n"
+ ret += "============== ============
=================================\n"
+ for config_item in config:
+ ret += "%s %s %s\n" % config_item
+ ret += "============== ============
=================================\n"
+ ret += "}}}\n"
+ else:
+ ret += "||<20%>'''Config
Item'''||<20%>'''Value'''||<:99%>'''Description'''||\n"
+ for config_item in config:
+ ret += "||%s||%s||%s||\n" % config_item
return ret
-
+def compare_types(first, second):
+ values = {
+ 'MainMenuPlugin': 1,
+ 'Plugin': 2,
+ 'DaemonPlugin': 3,
+ 'IdleBarPlugin': 4,
+ 'ItemPlugin': 5,
+ 'MimetypePlugin': 6,
+ 'ScreenSaverPlugin': 7,
+ }
+ value_first = values.has_key(first) and values[first] or 10
+ value_second = values.has_key(second) and values[second] or 10
+ return value_first - value_second
# show a list of all plugins
if len(sys.argv)>1 and sys.argv[1] == '-l':
@@ -385,25 +407,57 @@
# show info about all plugins in wiki format
elif len(sys.argv)>1 and sys.argv[1] == '-wiki':
+ # we should be able to call this in one of several modes
+ # freevo plugins -wiki [moin|trac] [<plug-in type>*|<plug-in name>*]
mode = 'moin'
+ types = []
+ modules = []
if len(sys.argv) > 2:
mode = sys.argv[2]
- if mode not in ('moin','trac',):
- print "mode can be one of 'moin', 'trac'"
- sys.exit(2)
+ if mode in ('moin','trac',):
+ modules = sys.argv[3:]
+ else:
+ modules = sys.argv[2:]
all_plugins = parse_plugins()
+ # This is a bit horrid
if mode == 'trac':
print '[[TOC(depth=2)]]'
else:
print '[[TableOfContents(2)]]'
print
- types = []
- for p in all_plugins:
- if not p[2] in types:
- types.append(p[2])
- types.sort()
+ #print 'name=%r file=%r type=%r status=%r desc=%r config=%r' % (name,
file, type, status, desc, config)
+ list_plugins_by_type = False
+ if modules:
+ for name, file, type, status, desc, config in all_plugins:
+ if type in modules:
+ if type in types:
+ continue
+ list_plugins_by_type = True
+ types.append(type)
+ continue
+
+ if list_plugins_by_type:
+ modules = []
+ else:
+ # specified a list of modules by name
+ for name, file, type, status, desc, config in all_plugins:
+ if name in modules:
+ if type in types:
+ continue
+ types.append(type)
+ continue
+
+ else:
+ for name, file, type, status, desc, config in all_plugins:
+ if type in types:
+ continue
+ types.append(type)
+
+ if not list_plugins_by_type:
+ types.sort(compare_types)
+
for t in types:
print
print '= %ss =' % t
@@ -411,13 +465,21 @@
print ''
for name, file, type, status, desc, config in all_plugins:
if type == t:
- try:
- exec(config)
- config_list = return_config()
- except SyntaxError, e:
- config_list = [('', '', e)]
- except AttributeError, e:
- config_list = [('', '', e)]
+ if modules and name not in modules:
+ continue
+
+ if config:
+ try:
+ exec(config)
+ config_list = return_config()
+ except SyntaxError, e:
+ config_list = [('', '', e)]
+ except AttributeError, e:
+ config_list = [('', '', e)]
+ except Exception, e:
+ config_list = [('', '', e)]
+ else:
+ config_list = []
if file.startswith(os.environ['FREEVO_PYTHON']):
file = file[len(os.environ['FREEVO_PYTHON'])+1:]
Modified: branches/rel-1/freevo/src/plugins/icecast.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/icecast.py (original)
+++ branches/rel-1/freevo/src/plugins/icecast.py Thu Oct 18 09:40:45 2007
@@ -47,20 +47,20 @@
adjust paths and passwords appropriately.
To activate, put the following lines in local_conf.py:
- plugin.activate('icecast')
-
- ICECAST_WWW_PAGE = 1
- ICECAST_CMD = '/usr/local/icecast/bin/icecast'
- ICECAST_CONF_DIR = '/usr/local/icecast/conf'
- ICES_CMD = '/usr/local/icecast/bin/ices'
- ICES_OPTIONS = [ '-d', 'FreevoIcecast',
- '-g', 'Rock',
- '-m', '/freevo',
- '-n', 'Freevo_Music_Collection',
- '-P', 'hackme',
- '-s',
- '-r' ]
- ICES_DEF_LIST = '/usr/local/freevo_data/Music/ROCK/mymix.m3u'
+ | plugin.activate('icecast')
+ |
+ | ICECAST_WWW_PAGE = 1
+ | ICECAST_CMD = '/usr/local/icecast/bin/icecast'
+ | ICECAST_CONF_DIR = '/usr/local/icecast/conf'
+ | ICES_CMD = '/usr/local/icecast/bin/ices'
+ | ICES_OPTIONS = [ '-d', 'FreevoIcecast',
+ | '-g', 'Rock',
+ | '-m', '/freevo',
+ | '-n', 'Freevo_Music_Collection',
+ | '-P', 'hackme',
+ | '-s',
+ | '-r' ]
+ | ICES_DEF_LIST = '/usr/local/freevo_data/Music/ROCK/mymix.m3u'
"""
def __init__(self):
plugin.DaemonPlugin.__init__(self)
Modified: branches/rel-1/freevo/src/plugins/rom_drives.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/rom_drives.py (original)
+++ branches/rel-1/freevo/src/plugins/rom_drives.py Thu Oct 18 09:40:45 2007
@@ -325,28 +325,28 @@
if config.DEBUG:
# some code to view the capabilities
- print '%s cdc=0x%08x ' % (self.devicename, cdc)
- print cdc & CDC_CLOSE_TRAY and 'CDC_CLOSE_TRAY'
or 'not CDC_CLOSE_TRAY'
- print cdc & CDC_OPEN_TRAY and 'CDC_OPEN_TRAY'
or 'not CDC_OPEN_TRAY'
- print cdc & CDC_LOCK and 'CDC_LOCK'
or 'not CDC_LOCK'
- print cdc & CDC_SELECT_SPEED and 'CDC_SELECT_SPEED'
or 'not CDC_SELECT_SPEED'
- print cdc & CDC_SELECT_DISC and 'CDC_SELECT_DISC'
or 'not CDC_SELECT_DISC'
- print cdc & CDC_MULTI_SESSION and
'CDC_MULTI_SESSION' or 'not CDC_MULTI_SESSION'
- print cdc & CDC_MCN and 'CDC_MCN'
or 'not CDC_MCN'
- print cdc & CDC_MEDIA_CHANGED and
'CDC_MEDIA_CHANGED' or 'not CDC_MEDIA_CHANGED'
- print cdc & CDC_PLAY_AUDIO and 'CDC_PLAY_AUDIO'
or 'not CDC_PLAY_AUDIO'
- print cdc & CDC_RESET and 'CDC_RESET'
or 'not CDC_RESET'
- print cdc & CDC_DRIVE_STATUS and 'CDC_DRIVE_STATUS'
or 'not CDC_DRIVE_STATUS'
- print cdc & CDC_GENERIC_PACKET and
'CDC_GENERIC_PACKET' or 'not CDC_GENERIC_PACKET'
- print cdc & CDC_CD_R and 'CDC_CD_R'
or 'not CDC_CD_R'
- print cdc & CDC_CD_RW and 'CDC_CD_RW'
or 'not CDC_CD_RW'
- print cdc & CDC_DVD and 'CDC_DVD'
or 'not CDC_DVD'
- print cdc & CDC_DVD_R and 'CDC_DVD_R'
or 'not CDC_DVD_R'
- print cdc & CDC_DVD_RAM and 'CDC_DVD_RAM'
or 'not CDC_DVD_RAM'
- print cdc & CDC_MO_DRIVE and 'CDC_MO_DRIVE'
or 'not CDC_MO_DRIVE'
- print cdc & CDC_MRW and 'CDC_MRW'
or 'not CDC_MRW'
- print cdc & CDC_MRW_W and 'CDC_MRW_W'
or 'not CDC_MRW_W'
- print cdc & CDC_RAM and 'CDC_RAM'
or 'not CDC_RAM'
+ _debug_('%s cdc=0x%08x ' % (self.devicename, cdc))
+ _debug_(cdc & CDC_CLOSE_TRAY and 'CDC_CLOSE_TRAY'
or 'not CDC_CLOSE_TRAY')
+ _debug_(cdc & CDC_OPEN_TRAY and 'CDC_OPEN_TRAY'
or 'not CDC_OPEN_TRAY' )
+ _debug_(cdc & CDC_LOCK and 'CDC_LOCK'
or 'not CDC_LOCK')
+ _debug_(cdc & CDC_SELECT_SPEED and
'CDC_SELECT_SPEED' or 'not CDC_SELECT_SPEED')
+ _debug_(cdc & CDC_SELECT_DISC and 'CDC_SELECT_DISC'
or 'not CDC_SELECT_DISC')
+ _debug_(cdc & CDC_MULTI_SESSION and
'CDC_MULTI_SESSION' or 'not CDC_MULTI_SESSION')
+ _debug_(cdc & CDC_MCN and 'CDC_MCN'
or 'not CDC_MCN')
+ _debug_(cdc & CDC_MEDIA_CHANGED and
'CDC_MEDIA_CHANGED' or 'not CDC_MEDIA_CHANGED')
+ _debug_(cdc & CDC_PLAY_AUDIO and 'CDC_PLAY_AUDIO'
or 'not CDC_PLAY_AUDIO')
+ _debug_(cdc & CDC_RESET and 'CDC_RESET'
or 'not CDC_RESET')
+ _debug_(cdc & CDC_DRIVE_STATUS and
'CDC_DRIVE_STATUS' or 'not CDC_DRIVE_STATUS')
+ _debug_(cdc & CDC_GENERIC_PACKET and
'CDC_GENERIC_PACKET' or 'not CDC_GENERIC_PACKET')
+ _debug_(cdc & CDC_CD_R and 'CDC_CD_R'
or 'not CDC_CD_R')
+ _debug_(cdc & CDC_CD_RW and 'CDC_CD_RW'
or 'not CDC_CD_RW')
+ _debug_(cdc & CDC_DVD and 'CDC_DVD'
or 'not CDC_DVD')
+ _debug_(cdc & CDC_DVD_R and 'CDC_DVD_R'
or 'not CDC_DVD_R')
+ _debug_(cdc & CDC_DVD_RAM and 'CDC_DVD_RAM'
or 'not CDC_DVD_RAM')
+ _debug_(cdc & CDC_MO_DRIVE and 'CDC_MO_DRIVE'
or 'not CDC_MO_DRIVE')
+ _debug_(cdc & CDC_MRW and 'CDC_MRW'
or 'not CDC_MRW')
+ _debug_(cdc & CDC_MRW_W and 'CDC_MRW_W'
or 'not CDC_MRW_W')
+ _debug_(cdc & CDC_RAM and 'CDC_RAM'
or 'not CDC_RAM')
finally:
os.close(fd)
except Exception, e:
@@ -370,12 +370,12 @@
self.cds = cds
if config.DEBUG:
- print '%s cds=%s' % (self.devicename, cds)
- if cds == CDS_NO_INFO: print
'CDS_NO_INFO'
- elif cds == CDS_NO_DISC: print
'CDS_NO_DISC'
- elif cds == CDS_TRAY_OPEN: print
'CDS_TRAY_OPEN'
- elif cds == CDS_DRIVE_NOT_READY: print
'CDS_DRIVE_NOT_READY'
- elif cds == CDS_DISC_OK: print
'CDS_DISC_OK'
+ _debug_('%s cds=%s' % (self.devicename, cds))
+ if cds == CDS_NO_INFO:
_debug_('CDS_NO_INFO')
+ elif cds == CDS_NO_DISC:
_debug_('CDS_NO_DISC')
+ elif cds == CDS_TRAY_OPEN:
_debug_('CDS_TRAY_OPEN')
+ elif cds == CDS_DRIVE_NOT_READY:
_debug_('CDS_DRIVE_NOT_READY')
+ elif cds == CDS_DISC_OK:
_debug_('CDS_DISC_OK')
finally:
os.close(fd)
except Exception, e:
Modified: branches/rel-1/freevo/src/tv/epg_xmltv.py
==============================================================================
--- branches/rel-1/freevo/src/tv/epg_xmltv.py (original)
+++ branches/rel-1/freevo/src/tv/epg_xmltv.py Thu Oct 18 09:40:45 2007
@@ -39,22 +39,24 @@
import config
import util
-# Use the alternate strptime module which seems to handle time zones
-# XXX Remove when we are ready to require Python 2.3
-if float(sys.version[0:3]) < 2.3:
- import strptime
-else:
- import _strptime as strptime
+import _strptime as strptime
-# The XMLTV handler from openpvr.sourceforge.net
import tv.xmltv as xmltv
-# The EPG data types. They need to be in an external module in order for
-# pickling to work properly when run from inside this module and from the
-# tv.py module.
+# The EPG data types. They need to be in an external module in order for
pickling
+# to work properly when run from inside this module and from the tv.py module.
import tv.epg_types as epg_types
-EPG_TIME_EXC = _('Time conversion error')
+class EpgException(Exception):
+ """
+ Electronic programming guide exception class
+ """
+
+ def __init__(self, value):
+ self.value = value
+
+ def __str__(self):
+ return repr(self.value)
cached_guide = None
@@ -277,7 +279,8 @@
# Fudging end time
prog.stop = timestr2secs_utc(p['start'][0:8] + '235900' + \
p['start'][14:18])
- except EPG_TIME_EXC:
+ # Don't think that this is ever raised
+ except EpgException:
continue
# fix bad German titles to make favorites working
if prog.title.endswith('. Teil'):
Modified: branches/rel-1/freevo/src/www/__init__.py
==============================================================================
--- branches/rel-1/freevo/src/www/__init__.py (original)
+++ branches/rel-1/freevo/src/www/__init__.py Thu Oct 18 09:40:45 2007
@@ -36,6 +36,10 @@
import plugin
class PluginInterface(plugin.DaemonPlugin):
+ """
+ Starts the webserver when freevo is started
+ """
+
def __init__(self):
if config.CONF.display in ('dxr3', 'directfb', 'dfbmga'):
print 'For some strange reason, the starting of the webserver
inside'
-------------------------------------------------------------------------
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