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

Modified Files:
        tv_grab.py 
Removed Files:
        tv_grab_vdr.py 
Log Message:
-Merge tv_grab_vdr.py into tv_grab.py.
-Add optparse support to tv_grab.py.


Index: tv_grab.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/tv_grab.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** tv_grab.py  12 Dec 2004 15:33:37 -0000      1.16
--- tv_grab.py  12 Dec 2004 16:50:41 -0000      1.17
***************
*** 1,59 ****
- #!/usr/bin/env python
  # -*- coding: iso-8859-1 -*-
! # -----------------------------------------------------------------------
! # tv_grab.py - wrapper for xmltv
! # -----------------------------------------------------------------------
  # $Id$
  #
- # Notes:
  #
! # Todo:        
! #
! # -----------------------------------------------------------------------
! # $Log$
! # Revision 1.16  2004/12/12 15:33:37  rshortt
! # pyepg updates
! #
! # Revision 1.15  2004/12/10 19:56:22  dischi
! # changes to new pyepg
! #
! # Revision 1.14  2004/12/04 01:25:28  rshortt
! # Add --query-exclude for help generating TV_CHANNELS_EXCLUDE.  Update 
location
! # of EPGDB.
! #
! # Revision 1.13  2004/11/06 17:56:21  dischi
! # Current status of the recordserver:
! # o add/delete/modify/list recordings
! # o add/list favorites
! # o tv_grab will force an internal favorite update
! # o create recordings based on favorites
! # o basic conflict detection
! # o store everything in a fxd file
! # Recording itself (a.k.a. record/plugins) is not working yet
! #
! # Revision 1.12  2004/10/20 12:33:01  rshortt
! # Put epg loading inside xmltv results check.
! #
! # Revision 1.11  2004/10/19 19:05:23  dischi
! # add data to db even if not sorted
! #
! # Revision 1.10  2004/10/18 01:21:50  rshortt
! # Load data into new pyepg database.
! #
! # Revision 1.9  2004/08/14 01:26:02  rshortt
! # Oops, we don't need a reference to the epg.
! #
! # Revision 1.8  2004/08/14 01:18:07  rshortt
! # Make tv_grab helper work again, now with pyepg.
! #
! # Revision 1.7  2004/07/10 12:33:39  dischi
! # header cleanup
  #
! # Revision 1.6  2004/03/28 15:04:42  rshortt
! # Bugfix.
  #
- # -----------------------------------------------------------------------
- # Freevo - A Home Theater PC framework
- # Copyright (C) 2002 Krister Lagerstrom, et al. 
  # Please see the file freevo/Docs/CREDITS for a complete list of authors.
  #
--- 1,17 ----
  # -*- coding: iso-8859-1 -*-
! # 
-----------------------------------------------------------------------------
! # tv_grab.py - Freevo helper to populate the EPG with TV listings.
! # 
-----------------------------------------------------------------------------
  # $Id$
  #
  #
! # 
-----------------------------------------------------------------------------
! # Freevo - A Home Theater PC framework
! # Copyright (C) 2002-2004 Krister Lagerstrom, Dirk Meyer, et al.
  #
! # First Edition: Dirk Meyer <[EMAIL PROTECTED]>
! # Maintainer:    Dirk Meyer <[EMAIL PROTECTED]>
! #                Rob Shortt <[EMAIL PROTECTED]>
  #
  # Please see the file freevo/Docs/CREDITS for a complete list of authors.
  #
***************
*** 72,81 ****
  # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  #
! # ----------------------------------------------------------------------- */
! 
  
  import sys
  import os
  import shutil
  
  import config
--- 30,39 ----
  # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  #
! # 
-----------------------------------------------------------------------------
  
  import sys
  import os
  import shutil
+ from optparse import OptionParser
  
  import config
***************
*** 88,102 ****
  
  
! def usage():
!     print 'Downloads the listing for xmltv and cache the data'
!     print
!     print 'usage: freevo tv_grab [ --query ]'
!     print 'options:'
!     print '  --query:  print a list of all stations. The list can be used to 
set TV_CHANNELS'
!     print '  --query-exclude:  print a list of channels for use with 
TV_CHANNELS_EXCLUDE'
!     sys.exit(0)
! 
  
- def grab():
      if not config.XMLTV_GRABBER:
          print 'No program found to grab the listings. Please set 
XMLTV_GRABBER'
--- 46,51 ----
  
  
! def grab_xmltv():
  
      if not config.XMLTV_GRABBER:
          print 'No program found to grab the listings. Please set 
XMLTV_GRABBER'
***************
*** 105,109 ****
          usage()
  
!     print 'Grabbing listings.'
      xmltvtmp = '/tmp/TV.xml.tmp'
      os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, 
--- 54,58 ----
          usage()
  
!     print 'Grabbing listings using XMLTV.'
      xmltvtmp = '/tmp/TV.xml.tmp'
      os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, 
***************
*** 129,138 ****
  
  
! if __name__ == '__main__':
  
!     if len(sys.argv)>1 and sys.argv[1] == '--help':
!         usage()
!     
!     if len(sys.argv)>1 and sys.argv[1] == '--query':
          chanlist = pyepg.guide.sql_get_channels()
  
--- 78,106 ----
  
  
! def grab_vdr():
!     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)
! 
! 
! def main():
!     parser = OptionParser()
! 
!     parser.add_option('-s', '--source', dest='source', default='xmltv',
!                       help='set the source for the guide: xmltv (default) ' + 
\
!                             'or vdr')
!     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')
! 
!     (options, args) = parser.parse_args()
! 
! 
!     if options.query:
          chanlist = pyepg.guide.sql_get_channels()
  
***************
*** 144,153 ****
          print 'TV_CHANNELS = ['
          for c in chanlist[:-1]:
!             print '    ( \'%s\', \'%s\', \'%s\' ), ' % (c['id'], 
c['call_sign'], c['tuner_id'])
          print '    ( \'%s\', \'%s\', \'%s\' ) ] ' % \
!               (chanlist[-1]['id'], chanlist[-1]['call_sign'], 
chanlist[-1]['tuner_id'])
          sys.exit(0)
  
!     if len(sys.argv)>1 and sys.argv[1] == '--query-exclude':
          chanlist = pyepg.guide.sql_get_channels()
  
--- 112,125 ----
          print 'TV_CHANNELS = ['
          for c in chanlist[:-1]:
!             print '    ( \'%s\', \'%s\', \'%s\' ), ' % (c['id'], 
!                                                         c['display_name'], 
!                                                         c['access_id'])
          print '    ( \'%s\', \'%s\', \'%s\' ) ] ' % \
!               (chanlist[-1]['id'], chanlist[-1]['display_name'], 
!                chanlist[-1]['access_id'])
          sys.exit(0)
  
! 
!     if options.exclude:
          chanlist = pyepg.guide.sql_get_channels()
  
***************
*** 166,170 ****
  
  
!     grab()
  
      print 'connecting to recordserver'
--- 138,149 ----
  
  
!     if options.source == 'xmltv':
!         grab_xmltv()
!     elif options.source == 'vdr':
!         grab_vdr()
!     else:
!         print 'ERROR: source "%s" not supported.' % options.source
!         sys.exit(0)
! 
  
      print 'connecting to recordserver'
***************
*** 175,176 ****
--- 154,160 ----
      print 'update favorites'
      rs.favorite_update()
+ 
+ 
+ if __name__ == '__main__':
+     main()
+ 

--- tv_grab_vdr.py DELETED ---



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to