Update of /cvsroot/freevo/freevo/src/helpers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2990/src/helpers

Modified Files:
        epg.py makelogos.py rssh.py tv_grab.py 
Log Message:
use kaa.epg instead of pyepg

Index: rssh.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/rssh.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rssh.py     13 Feb 2005 18:05:03 -0000      1.4
--- rssh.py     26 Jun 2005 10:52:59 -0000      1.5
***************
*** 6,10 ****
  
  import notifier
! import pyepg
  import config
  import mcomm
--- 6,10 ----
  
  import notifier
! import kaa.epg
  import config
  import mcomm
***************
*** 101,105 ****
          try:
              print 
!             result = eval('pyepg.guide' + String(input[3:]))
              print_result(result)
          except Exception, e:
--- 101,105 ----
          try:
              print 
!             result = eval('kaa.epg.guide' + String(input[3:]))
              print_result(result)
          except Exception, e:

Index: epg.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/epg.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** epg.py      22 Jan 2005 13:28:46 -0000      1.6
--- epg.py      26 Jun 2005 10:52:59 -0000      1.7
***************
*** 1,159 ****
  import getopt
  import os
  import sys
  import time
  
- import config
  import sysconfig
! import pyepg
! 
! pyepg.connect('sqlite', sysconfig.datafile('epgdb'))
! pyepg.load(config.TV_CHANNELS, config.TV_CHANNELS_EXCLUDE)
! 
! 
! # db.db.db looks a bit rediculous!
! print 'Using database: %s' % pyepg.guide.db.db.db.filename
! 
  
! def usage():
!     print '\nUsage: freevo epg [options]'
      print '\nOptions:'
!     print '  [-h|--help]                       Print help and exit.'
!     print '  [-i|--info]                       Print some information.'
!     print '  [-l|--list]                       List your channels.'
!     print '  [-f|--fill]                       Fill DB with XMLTV data.'
!     print '  [-p chan|--list-programs chan]    List programs in a given chan.'
!     print '  [-s|--search]                     Search DB for matching 
program.'
!     print '  [-t|--test]                       Developer test function.'
!     print '\nDescription:'
!     print '      This helper can be used to perform operations on the EPG'
!     print '      database.\n'
!     sys.exit(0)
  
  
  def list_channels():
!     print 'EPGDB Channels:'
!     print '---------------'
!     for c in pyepg.channels:
!         print '%s: %s' % (c.id, c.title)
! 
! 
! def list_programs(channel):
!     print 'list_programs() disabled'
!     sys.exit(0)
!     for c in pyepg.channels:
          print c
  
  
- def fill_xmltv(xmltv_file):
-     if not os.path.isfile(xmltv_file):
-         xmltv_file = config.XMLTV_FILE
- 
-     print 'FILE: "%s"' % xmltv_file
- 
-     pyepg.update('xmltv', xmltv_file)
- 
- 
- def info():
-     print 'info() disabled'
-     sys.exit(0)
-     print 'Version:'
-     print epg.execute('select * from admin')
-     print 'Channel Types:'
-     print epg.execute('select * from channel_types')
-     print 'Categories:'
-     print epg.execute('select * from categories')
-     print 'Advisories:'
-     print epg.execute('select * from advisories')
-     print 'Ratings:'
-     print epg.execute('select * from ratings')
-    
- 
- def list_tables():
-     print 'list_tables() disabled'
-     sys.exit(0)
-     rows = epg.execute('select tbl_name from sqlite_master where \
-                         type="table" order by tbl_name')
-     print 'EPGDB Tables:'
-     print '-------------'
-     for r in rows:
-         print '    %s' % r[0]
-    
- 
  def search_progs(subs):
!     print 'Results:'
!     print '--------'
!     programs = pyepg.search(subs)
      for p in programs:
!         print '%s:%d: %s - %s' % (String(p.channel.id), p.id, 
!                String(p.title), 
!                time.strftime('%b %d ' + config.TV_TIMEFORMAT, 
!                              time.localtime(p.start)))
! 
! 
! def test_func():
!     pyepg.guide.expire_programs()
!     sys.exit(0)
  
  
  def main():
!     update_chan = False
!     show_info = False
!     show_tables = False
!     show_progs = False
!     add_xmltv = False
!     xmltv_file = ''
!     search_subs = ''
!     channel = ''
! 
!     options = 'cfhilp:s:t'
!     long_options = ['update-channels', 'fill', 'help', 'info', 'list', 
!                     'list-programs', 'search', 'test']
  
      try:
          opts, args = getopt.getopt(sys.argv[1:], options, long_options)
!     except getopt.GetoptError:
!         usage()
  
      for o, a in opts:
-         if o in ('-c', '--update-channels'):
-             update_chan = True
-         if o in ('-f', '--fill'):
-             add_xmltv = True
-             xmltv_file = a
          if o in ('-h', '--help'):
!             usage()
!         if o in ('-i', '--info'):
!             show_info = True
          if o in ('-l', '--list'):
!             show_tables = True
!         if o in ('-p', '--list-programs'):
!             show_progs = True
!             channel = a
          if o in ('-s', '--search'):
!             search_subs = a
!         if o in ('-t', '--test'):
!             test_func()
! 
!     if update_chan:
!         update_channels()
! 
!     elif add_xmltv:
!         fill_xmltv(xmltv_file)
! 
!     elif show_info:
!         info()
! 
!     elif show_tables:
!         list_channels()
  
!     elif show_progs:
!         list_programs(channel)
  
!     elif search_subs:
!         search_progs(search_subs)
  
!     else:
!         usage()
  
  
--- 1,82 ----
+ #!/usr/bin/python
+ 
  import getopt
  import os
  import sys
  import time
+ import logging
+ import kaa.epg
  
  import sysconfig
! import config
  
! def usage(return_value):
!     print '\nUsage: kaa-epg [config] [options]'
      print '\nOptions:'
!     print '  -h, --help              Print help and exit.'
!     print '  -l, --list              List your channels.'
!     print '  -f file, --fill=file    Fill db with xmltv from file.'
!     print '  -s prog, --search=prog  Search db for matching program.'
!     sys.exit(return_value)
  
  
  def list_channels():
!     """
!     List all channels in the database.
!     """
!     for c in kaa.epg.channels:
          print c
  
  
  def search_progs(subs):
!     """
!     Search for programs in database.
!     """
!     programs = kaa.epg.search(subs)
      for p in programs:
!         start = time.strftime('%b %d %H:%M', time.localtime(p.start))
!         stop = time.strftime('%H:%M', time.localtime(p.stop))
!         channel = p.channel.name.encode('latin-1', 'ignore')
!         title   = p.title.encode('latin-1', 'ignore')
!         if len(title) > 30:
!             title = title[:27] + '...'
!         print '%s-%s %-30s on %s (%d)' % (start, stop, title, channel, p.id)
  
  
  def main():
!     options = 'f:hls:'
!     long_options = ['fill=', 'help', 'list', 'search=']
!     action = None
!     action_args = []
  
      try:
          opts, args = getopt.getopt(sys.argv[1:], options, long_options)
!     except getopt.GetoptError, e:
!         print 'Error:', e
!         usage(1)
  
      for o, a in opts:
          if o in ('-h', '--help'):
!             usage(0)
! 
!         # options
!         if o in ('-f', '--fill'):
!             action = kaa.epg.update
!             action_args = ['xmltv', a]
          if o in ('-l', '--list'):
!             action = list_channels
!             action_args = []
          if o in ('-s', '--search'):
!             action = search_progs
!             action_args = [ a ]
  
!     if not action:
!         usage(1)
  
!     kaa.epg.connect('sqlite', sysconfig.datafile('epgdb'))
!     # TV_CHANNELS, TV_CHANNELS_EXCLUDE
!     kaa.epg.load(config.TV_CHANNELS, config.TV_CHANNELS_EXCLUDE)
  
!     action(*action_args)
  
  

Index: tv_grab.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/tv_grab.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** tv_grab.py  28 Apr 2005 01:37:00 -0000      1.22
--- tv_grab.py  26 Jun 2005 10:52:59 -0000      1.23
***************
*** 37,45 ****
  from optparse import OptionParser
  
  import config
  import sysconfig
  import mcomm
  
- import pyepg
  
  
--- 37,46 ----
  from optparse import OptionParser
  
+ import kaa.epg
+ 
  import config
  import sysconfig
  import mcomm
  
  
  
***************
*** 57,61 ****
                                               xmltvtmp,
                                               config.XMLTV_DAYS ))
- 
      if os.path.exists(xmltvtmp):
          if os.path.isfile(config.XMLTV_SORT):
--- 58,61 ----
***************
*** 73,77 ****
  
          shutil.move(xmltvtmp, config.XMLTV_FILE)
!         pyepg.update('xmltv', config.XMLTV_FILE)
  
  
--- 73,78 ----
  
          shutil.move(xmltvtmp, config.XMLTV_FILE)
! 
!     kaa.epg.update('xmltv', config.XMLTV_FILE)
  
  
***************
*** 79,84 ****
      print 'Fetching guide from VDR.'
  
!     pyepg.update('vdr', config.VDR_DIR, config.VDR_CHANNELS, config.VDR_EPG,
!                  config.VDR_HOST, config.VDR_PORT, config.VDR_ACCESS_ID, 
'both')
  
  
--- 80,86 ----
      print 'Fetching guide from VDR.'
  
!     kaa.epg.update('vdr', config.VDR_DIR, config.VDR_CHANNELS, config.VDR_EPG,
!                    config.VDR_HOST, config.VDR_PORT, config.VDR_ACCESS_ID,
!                    'both')
  
  
***************
*** 87,97 ****
  
      parser.add_option('-s', '--source', dest='source', default='xmltv',
!                       help='set the source for the guide: xmltv (default), ' 
+ \
!                             'xmltv_nofetch, vdr, or none')
      parser.add_option('-q', '--query', action="store_true", dest='query', 
                        default=False,
                        help='print a list that can be used to set TV_CHANNELS')
!     parser.add_option('-e', '--query-exclude', action="store_true", 
dest='exclude',
!                       default=False,
                        help='print a list that can be used to set ' + \
                             'TV_CHANNELS_EXCLUDE')
--- 89,99 ----
  
      parser.add_option('-s', '--source', dest='source', default='xmltv',
!                       help='set the source for the guide: xmltv (default), ' 
+\
!                       'xmltv_nofetch, vdr, or none')
      parser.add_option('-q', '--query', action="store_true", dest='query', 
                        default=False,
                        help='print a list that can be used to set TV_CHANNELS')
!     parser.add_option('-e', '--query-exclude', action="store_true",
!                       dest='exclude', default=False,
                        help='print a list that can be used to set ' + \
                             'TV_CHANNELS_EXCLUDE')
***************
*** 99,111 ****
      (options, args) = parser.parse_args()
  
!     pyepg.connect('sqlite', sysconfig.datafile('epgdb'))
!     pyepg.load(config.TV_CHANNELS, config.TV_CHANNELS_EXCLUDE)
  
  
      if options.query:
!         chanlist = pyepg.guide.sql_get_channels()
  
          print
!         print 'Possible list of tv channels. If you want to change the name 
or '
          print 'acess id copy the next statement into your local_conf.py and '
          print 'edit it.'
--- 101,113 ----
      (options, args) = parser.parse_args()
  
!     kaa.epg.connect('sqlite', sysconfig.datafile('epgdb'))
!     kaa.epg.load(config.TV_CHANNELS, config.TV_CHANNELS_EXCLUDE)
  
  
      if options.query:
!         chanlist = kaa.epg.guide.sql_get_channels()
  
          print
!         print 'Possible list of tv channels. If you want to change the name 
or'
          print 'acess id copy the next statement into your local_conf.py and '
          print 'edit it.'
***************
*** 123,127 ****
  
      if options.exclude:
!         chanlist = pyepg.guide.sql_get_channels()
  
          print
--- 125,129 ----
  
      if options.exclude:
!         chanlist = kaa.epg.guide.sql_get_channels()
  
          print
***************
*** 142,146 ****
          grab_xmltv()
      elif options.source == 'xmltv_nofetch':
!         pyepg.update('xmltv', config.XMLTV_FILE)
      elif options.source == 'vdr':
          grab_vdr()
--- 144,148 ----
          grab_xmltv()
      elif options.source == 'xmltv_nofetch':
!         kaa.epg.update('xmltv', config.XMLTV_FILE)
      elif options.source == 'vdr':
          grab_vdr()

Index: makelogos.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/makelogos.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** makelogos.py        8 Nov 2004 21:28:38 -0000       1.4
--- makelogos.py        26 Jun 2005 10:52:59 -0000      1.5
***************
*** 11,16 ****
  # -----------------------------------------------------------------------
  # $Log$
  # Revision 1.4  2004/11/08 21:28:38  dischi
! # fix to use pyepg (maybe move this in pyepg?)
  #
  # Revision 1.3  2004/07/10 12:33:39  dischi
--- 11,19 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.5  2005/06/26 10:52:59  dischi
+ # use kaa.epg instead of pyepg
+ #
  # Revision 1.4  2004/11/08 21:28:38  dischi
! # fix to use kaa.epg (maybe move this in kaa.epg?)
  #
  # Revision 1.3  2004/07/10 12:33:39  dischi
***************
*** 49,53 ****
  
  import config
! from pyepg import xmltv_parser as xmltv
  
  # Check if the logos directory exists, if not, make it before
--- 52,56 ----
  
  import config
! from kaa.epg import xmltv_parser as xmltv
  
  # Check if the logos directory exists, if not, make it before



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to