Author: dmeyer
Date: Thu Mar 23 19:31:04 2006
New Revision: 1320

Modified:
   trunk/epg/src/source_vdr.py
   trunk/epg/src/source_xmltv.py
   trunk/epg/src/source_zap2it.py

Log:
put the config into the source modules

Modified: trunk/epg/src/source_vdr.py
==============================================================================
--- trunk/epg/src/source_vdr.py (original)
+++ trunk/epg/src/source_vdr.py Thu Mar 23 19:31:04 2006
@@ -37,6 +37,7 @@
 # kaa imports
 from kaa import strutils
 import kaa.notifier
+from kaa.config import Var, Group
 
 # vdr imports
 from vdr.vdr import VDR
@@ -45,6 +46,59 @@
 log = logging.getLogger('epg')
 
 
+# Source configuration
+config = \
+       Group(name='vdr', desc=u'''
+       VDR settings
+       
+       Add more doc here please!
+       ''',
+             desc_type='group',
+             schema = [
+
+    Var(name='activate',
+        default=False,
+        desc=u'Use VDR to populate the database.'),
+
+    Var(name='dir',
+        default='/video',
+        desc=u'VDR main directory.'),
+
+    Var(name='channels_file',
+        default='channels.conf',
+        desc=u'VDR channels file name.'),
+    
+    Var(name='epg_file',
+        default='epg.data',
+        desc=u'VDR EPG file name.'
+       ),
+
+    Var(name='host',
+        default='localhost',
+        desc=u'VDR SVDRP host.'
+       ),
+    
+    Var(name='port',
+        default=2001,
+        desc=u'VDR SVDRP port.'
+       ),
+
+    Var(name='access_by',
+        type=('name', 'sid' 'rid'),
+        default='sid',
+        desc=u'Which field to access channels by: name, sid (service id), \n'+
+        u'or rid (radio id).'
+       ),
+
+    Var(name='limit_channels',
+        type=('epg', 'chan' 'both'),
+        default='chan',
+        desc=u'Limit channels added to those found in the EPG file, the \n'+
+        u'channels file, or both.  Values: epg, chan, both'
+       ),
+    ])
+
+
 class UpdateInfo:
     pass
 

Modified: trunk/epg/src/source_xmltv.py
==============================================================================
--- trunk/epg/src/source_xmltv.py       (original)
+++ trunk/epg/src/source_xmltv.py       Thu Mar 23 19:31:04 2006
@@ -3,8 +3,54 @@
 import kaa.notifier
 from kaa import xml
 
+from kaa.config import Var, Group
+
 log = logging.getLogger('xmltv')
 
+# Source configuration
+config = \
+       Group(name='xmltv', desc='''
+       XMLTV settings
+       
+       You can use a xmltv rabber to populate the epg database. To activate 
the xmltv
+       grabber you need to set 'activate' to True and specify a data_file 
which already
+       contains the current listing or define a grabber to fetch the listings.
+       Optionally you can define arguments for that grabber and the location 
of a
+       sort program to sort the data after the grabber has finished.
+       ''',
+             desc_type='group',
+             schema = [
+    
+    Var(name='activate',
+        default=False,
+        desc='Use XMLTV file to populate database.'
+       ),
+
+    Var(name='data_file',
+        default='',
+        desc='Location of XMLTV data file.'
+       ),
+
+    Var(name='grabber',
+        default='',
+        desc='If you want to run an XMLTV grabber to fetch your listings\n' +\
+        'set this to the full path of your grabber program plus any\n' +\
+        'additional arguments.'
+       ),
+
+    Var(name='days',
+        default=5,
+        desc='How many days of XMLTV data you want to fetch.'
+       ),
+
+    Var(name='sort',
+        default='',
+        desc='Set this to the path of the tv_sort program if you need to\n'
+        'sort your listings.'
+       ),
+    ])
+
+
 def timestr2secs_utc(timestr):
     """
     Convert a timestring to UTC (=GMT) seconds.
@@ -184,11 +230,18 @@
 
     if not info.node:
         info.epg.signals["update_progress"].emit(info.cur, info.total)
+        info.epg.signals["updated"].emit()
         return False
 
     return True
     
 
-def update(epg, xmltv_file):
-    thread = kaa.notifier.Thread(_update_parse_xml_thread, epg, xmltv_file)
+def update(epg):
+    if not config.data_file:
+        log.error('XMLTV gabber not supported yet. Please download the')
+        log.error('file manually and set xmltv.data_file')
+        epg.signals["updated"].emit()
+        return False
+    thread = kaa.notifier.Thread(_update_parse_xml_thread, epg, 
str(config.data_file))
     thread.start()
+    return True

Modified: trunk/epg/src/source_zap2it.py
==============================================================================
--- trunk/epg/src/source_zap2it.py      (original)
+++ trunk/epg/src/source_zap2it.py      Thu Mar 23 19:31:04 2006
@@ -2,11 +2,37 @@
 import md5, time, httplib, gzip, calendar
 from StringIO import StringIO
 from kaa.strutils import str_to_unicode
+from kaa.config import Var, Group
 import kaa
 
 ZAP2IT_HOST = "datadirect.webservices.zap2it.com:80"
 ZAP2IT_URI = "/tvlistings/xtvdService"
 
+# Source configuration
+config = \
+       Group(name='zap2it', desc='''
+       Zap2it settings
+       
+       Add more doc here please!
+       ''',
+             desc_type='group',
+             schema = [
+
+    Var(name='activate',
+        default=False,
+        desc='Use Zap2it service to populate database.'
+       ), 
+
+    Var(name='username',
+        default='',
+        desc='Zap2it username.'
+       ),
+
+    Var(name='password',
+        default='',
+        desc='Zap2it password.'
+       ),
+    ])
 
 def H(m):
     return md5.md5(m).hexdigest()
@@ -239,12 +265,13 @@
     if not info.node and not info.roots:
         info.epg.signals["update_progress"].emit(info.total, info.total)
         info.doc.freeDoc()
+        info.epg.signals["updated"].emit()
         return False
 
     return True
 
 
-def update(epg, username, passwd, start = None, stop = None):
+def update(epg, start = None, stop = None):
     if not start:
         # If start isn't specified, choose current time (rounded down to the 
         # nearest hour).
@@ -253,5 +280,8 @@
         # If stop isn't specified, use 24 hours after start.
         stop = start + (24 * 60 * 60)
 
-    thread = kaa.notifier.Thread(_update_parse_xml_thread, epg, username, 
passwd, start, stop)
+    thread = kaa.notifier.Thread(_update_parse_xml_thread, epg,
+                                 str(config.username), str(config.password),
+                                 start, stop)
     thread.start()
+    return True


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to