Author: tack
Date: Wed Dec  6 18:05:00 2006
New Revision: 2159

Added:
   trunk/epg/src/config.cxml
   trunk/epg/src/sources/
   trunk/epg/src/sources/__init__.py
      - copied, changed from r2153, /trunk/epg/src/source.py
   trunk/epg/src/sources/config_vdr.cxml
   trunk/epg/src/sources/config_xmltv.cxml
   trunk/epg/src/sources/config_zap2it.cxml
   trunk/epg/src/sources/vdr.py
      - copied, changed from r2153, /trunk/epg/src/source_vdr.py
   trunk/epg/src/sources/xmltv.py
      - copied, changed from r2153, /trunk/epg/src/source_xmltv.py
   trunk/epg/src/sources/zap2it.py
      - copied, changed from r2158, /trunk/epg/src/source_zap2it.py
Removed:
   trunk/epg/src/source.py
   trunk/epg/src/source_vdr.py
   trunk/epg/src/source_xmltv.py
   trunk/epg/src/source_zap2it.py
Modified:
   trunk/epg/src/__init__.py
   trunk/epg/src/server.py

Log:
Create sources directory and move sources into there; use cxml for config
definitions.


Modified: trunk/epg/src/__init__.py
==============================================================================
--- trunk/epg/src/__init__.py   (original)
+++ trunk/epg/src/__init__.py   Wed Dec  6 18:05:00 2006
@@ -37,11 +37,12 @@
 from kaa.db import QExpr
 
 # kaa.epg imports
+from config import config
 from channel import Channel
 from program import Program
 from client import Client, DISCONNECTED, CONNECTING, CONNECTED
 from server import Server
-from source import sources
+from sources import *
 
 # kaa.epg import for internal use
 from util import cmp_channel

Added: trunk/epg/src/config.cxml
==============================================================================
--- (empty file)
+++ trunk/epg/src/config.cxml   Wed Dec  6 18:05:00 2006
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<config>
+    <code>
+        from sources import *
+
+        for name, source in sources.items():
+            config.add_variable(name, source.config)
+    </code>
+</config>
+

Modified: trunk/epg/src/server.py
==============================================================================
--- trunk/epg/src/server.py     (original)
+++ trunk/epg/src/server.py     Wed Dec  6 18:05:00 2006
@@ -40,7 +40,7 @@
 from kaa.notifier import Signal
 
 # kaa.epg imports
-from source import sources
+from sources import *
 
 # get logging object
 log = logging.getLogger('epg')

Copied: trunk/epg/src/sources/__init__.py (from r2153, /trunk/epg/src/source.py)
==============================================================================
--- /trunk/epg/src/source.py    (original)
+++ trunk/epg/src/sources/__init__.py   Wed Dec  6 18:05:00 2006
@@ -30,13 +30,15 @@
 
 import os
 
+__all__ = ['sources']
+
 sources = {}
 
 for f in os.listdir(os.path.dirname(__file__)):
-    if not f.startswith('source_') or not f.endswith('.py'):
+    if f.startswith('_') or f.startswith('config_') or not f.endswith('.py'):
         continue
     try:
         exec('import %s as s' % f[:-3])
     except ImportError:
         continue
-    sources[f[7:-3]] = s
+    sources[f[:-3]] = s

Added: trunk/epg/src/sources/config_vdr.cxml
==============================================================================
--- (empty file)
+++ trunk/epg/src/sources/config_vdr.cxml       Wed Dec  6 18:05:00 2006
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<config>
+    <desc lang="en">
+        VDR settings
+
+        FIXME: more documentation here.
+    </desc>
+    <var name="activate" default="False">
+        <desc lang="en">Use VDR to populate database.</desc>
+    </var>
+    <var name="dir" default="/video">
+        <desc lang="en">VDR main directory.</desc>
+    </var>
+    <var name="channels_file" default="channels.conf">
+        <desc lang="en">VDR channels file name.</desc>
+    </var>
+    <var name="epg_file" default="epg.data">
+        <desc lang="en">VDR EPG file name.</desc>
+    </var>
+    <var name="host" default="localhost">
+        <desc lang="en">VDR SVDPR host.</desc>
+    </var>
+    <var name="port" default="2001">
+        <desc lang="en">VDR SVDPR port.</desc>
+    </var>
+    <var name="access_by" default="sid">
+        <desc lang="en">
+            Which field to access channels by: name, sid (service id), or rid 
(radio id).
+        </desc>
+        <values>
+            <value>name</value>
+            <value>rid</value>
+            <value>sid</value>
+        </values>
+    </var>
+    <var name="limit_channels" default="chan">
+        <desc lang="en">
+            Limit channels added to those found in the EPG file, the channels 
file, or 
+            both.  Values: epg, chan, both
+        </desc>
+        <values>
+            <value>epg</value>
+            <value>chan</value>
+            <value>both</value>
+        </values>
+    </var>
+</config>

Added: trunk/epg/src/sources/config_xmltv.cxml
==============================================================================
--- (empty file)
+++ trunk/epg/src/sources/config_xmltv.cxml     Wed Dec  6 18:05:00 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<config>
+    <desc lang="en">
+        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>
+    <var name="activate" default="False">
+        <desc lang="en">Use XMLTV service to populate database.</desc>
+    </var>
+    <var name="data_file" type="str">
+        <desc lang="en">Location of XMLTV data file.</desc>
+    </var>
+    <var name="grabber" default="xmltv">
+        <desc lang="en">
+            If you want to run an XMLTV grabber to fetch your listings set 
this to
+            the full path of your grabber program plus any additional custom
+            arguments.  If no path is specified it will use the default search 
path
+            ($PATH).
+        </desc>
+    </var>
+    <var name="days" default="7">
+        <desc lang="en">How many days of XMLTV data you want to fetch.</desc>
+    </var>
+    <var name="sort" type="str">
+        <desc lang="en">
+            Set this to the path of the tv_sort program if you want to sort 
your
+            listings.
+        </desc>
+    </var>
+</config>

Added: trunk/epg/src/sources/config_zap2it.cxml
==============================================================================
--- (empty file)
+++ trunk/epg/src/sources/config_zap2it.cxml    Wed Dec  6 18:05:00 2006
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<config>
+    <desc lang="en">
+        Zap2It settings
+
+        FIXME: more documentation here.
+    </desc>
+    <var name="activate" default="False">
+        <desc lang="en">Use Zap2It service to populate database.</desc>
+    </var>
+    <var name="username" type="str" />
+    <var name="password" type="str" />
+</config>

Copied: trunk/epg/src/sources/vdr.py (from r2153, /trunk/epg/src/source_vdr.py)
==============================================================================
--- /trunk/epg/src/source_vdr.py        (original)
+++ trunk/epg/src/sources/vdr.py        Wed Dec  6 18:05:00 2006
@@ -37,6 +37,7 @@
 from kaa import strutils
 import kaa.notifier
 from kaa.config import Var, Group
+from config_vdr import config
 
 # vdr imports
 from vdr.vdr import VDR
@@ -45,59 +46,6 @@
 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
 

Copied: trunk/epg/src/sources/xmltv.py (from r2153, 
/trunk/epg/src/source_xmltv.py)
==============================================================================
--- /trunk/epg/src/source_xmltv.py      (original)
+++ trunk/epg/src/sources/xmltv.py      Wed Dec  6 18:05:00 2006
@@ -41,52 +41,11 @@
 from kaa.config import Var, Group
 from kaa.notifier import Timer, Thread
 
+from config_xmltv import config
+
 # get logging object
 log = logging.getLogger('xmltv')
 
-# 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):
     """

Copied: trunk/epg/src/sources/zap2it.py (from r2158, 
/trunk/epg/src/source_zap2it.py)
==============================================================================
--- /trunk/epg/src/source_zap2it.py     (original)
+++ trunk/epg/src/sources/zap2it.py     Wed Dec  6 18:05:00 2006
@@ -42,7 +42,7 @@
 # kaa imports
 import kaa
 from kaa.strutils import str_to_unicode
-from kaa.config import Var, Group
+from config_zap2it import config
 
 # get logging object
 log = logging.getLogger('epg')
@@ -50,32 +50,6 @@
 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()
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to