Author: tack
Date: Thu Aug 23 18:08:30 2007
New Revision: 2785

Log:
Drop defunct zap2it labs service for upcoming Schedules Direct
service.


Added:
   trunk/epg/src/sources/config_schedulesdirect.cxml
      - copied, changed from r2782, /trunk/epg/src/sources/config_zap2it.cxml
   trunk/epg/src/sources/schedulesdirect.py
      - copied, changed from r2782, /trunk/epg/src/sources/zap2it.py
Removed:
   trunk/epg/src/sources/config_zap2it.cxml
   trunk/epg/src/sources/zap2it.py
Modified:
   trunk/epg/src/config.cxml
   trunk/epg/src/server.py

Modified: trunk/epg/src/config.cxml
==============================================================================
--- trunk/epg/src/config.cxml   (original)
+++ trunk/epg/src/config.cxml   Thu Aug 23 18:08:30 2007
@@ -11,7 +11,7 @@
             Comma separated list of EPG data sources to use.  If you specify a
             source here, you will need to configure it below.
             
-            Valid sources are: xmltv, zap2it, or epgdata.
+            Valid sources are: xmltv, schedulesdirect, or epgdata.
         </desc>
     </var>
 

Modified: trunk/epg/src/server.py
==============================================================================
--- trunk/epg/src/server.py     (original)
+++ trunk/epg/src/server.py     Thu Aug 23 18:08:30 2007
@@ -289,7 +289,7 @@
                 if t not in c2["tuner_id"]:
                     if t in self._tuner_ids:
                         log.warning('not adding tuner_id %s for channel %s - 
'+\
-                            'it is claimed by another channel', t, name)
+                            'it is claimed by another channel (%s)', t, name, 
self._tuner_ids[t])
                     else:
                         # only add this id if it's not already there and not
                         # claimed by another channel

Copied: trunk/epg/src/sources/config_schedulesdirect.cxml (from r2782, 
/trunk/epg/src/sources/config_zap2it.cxml)
==============================================================================
--- /trunk/epg/src/sources/config_zap2it.cxml   (original)
+++ trunk/epg/src/sources/config_schedulesdirect.cxml   Thu Aug 23 18:08:30 2007
@@ -1,12 +1,22 @@
 <?xml version="1.0"?>
 <config>
     <desc lang="en">
-        Zap2it Settings.
+        Schedules Direct Settings.
 
-        Zap2it provides EPG data for North American television providers.  A
-        Zap2it Labs subscription is needed, which can be obtained at no cost at
-        http://labs.zap2it.com.
+        Schedules Direct provides EPG data for North American television
+        providers.  A paid Schedules Direct subscription is needed, which can 
be obtained
+        at reasonable cost at https://www.schedulesdirect.org/
+
+        (Note: Schedules Direct is currently in beta and may not be accepting
+        new accounts at this time.)
     </desc>
     <var name="username" type="str" />
     <var name="password" type="str" />
+    <var name="url" type="str" 
+         
default="http://webservices.schedulesdirect.tmsdatadirect.com/schedulesdirect/tvlistings/xtvdService";>
+         <desc lang="en">
+            URL for the Schedules Direct SOAP service.  The default setting is
+            almost certainly correct.
+         </desc>
+    </var>
 </config>

Copied: trunk/epg/src/sources/schedulesdirect.py (from r2782, 
/trunk/epg/src/sources/zap2it.py)
==============================================================================
--- /trunk/epg/src/sources/zap2it.py    (original)
+++ trunk/epg/src/sources/schedulesdirect.py    Thu Aug 23 18:08:30 2007
@@ -1,13 +1,13 @@
 # -*- coding: iso-8859-1 -*-
 # -----------------------------------------------------------------------------
-# source_zap2it.py - Zap2It source for the epg
+# source_schedulesdirect.py - Schedules Direct source for the epg
 # -----------------------------------------------------------------------------
 # $Id$
 # -----------------------------------------------------------------------------
 # kaa.epg - EPG Database
 # Copyright (C) 2004-2007 Jason Tackaberry, Dirk Meyer, Rob Shortt
 #
-# First Edition: Jason Tackaberry <[EMAIL PROTECTED]>
+# Maintainer: Jason Tackaberry <[EMAIL PROTECTED]>
 #
 # Please see the file AUTHORS for a complete list of authors.
 #
@@ -36,20 +36,17 @@
 import calendar
 import logging
 import xml.sax
+import urlparse
 
 # kaa imports
 import kaa
 import kaa.notifier
 from kaa.strutils import str_to_unicode
-from config_zap2it import config
+from config_schedulesdirect import config
 
 # get logging object
 log = logging.getLogger('epg')
 
-# FIXME: should be configurable.
-ZAP2IT_HOST = "datadirect.webservices.zap2it.com:80"
-ZAP2IT_URI = "/tvlistings/xtvdService"
-
 def H(m):
     return md5.md5(m).hexdigest()
 
@@ -100,6 +97,9 @@
 
 def request(username, passwd, host, uri, start, stop, auth = None):
     t0 = time.time()
+    if ':' not in host:
+        # Append default port of 80
+        host = host + ':80'
     conn = httplib.HTTPConnection(host)
     start_str = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(start))
     stop_str = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(stop))
@@ -116,14 +116,14 @@
     if auth:
         headers["Authorization"] = auth
     else:
-        log.info('Connecting to zap2it server')
+        log.info('Connecting to schedulesdirect server')
 
     conn.request("POST", uri, None, headers)
     conn.send(soap_request)
     response = conn.getresponse()
     if response.status == 401 and auth:
         # Failed authentication.
-        log.error('zap2it authentication failed; bad username or password?')
+        log.error('schedulesdirect authentication failed; bad username or 
password?')
         return
 
     if not auth and response.getheader("www-authenticate"):
@@ -135,7 +135,7 @@
 
     t0 = time.time()
     # FIXME: check response header to see if data is compressed.
-    fname = '/tmp/zap2it.xml.gz'
+    fname = '/tmp/schedulesdirect.xml.gz'
     dfile = open(fname, 'w+')
     # Read data in 50KB chunks.
     while True:
@@ -315,7 +315,8 @@
         # If stop isn't specified, use config default.
         stop = start + (24 * 60 * 60 * epg_config.days)
 
-    filename = request(str(config.username), str(config.password), 
ZAP2IT_HOST, ZAP2IT_URI, start, stop)
+    urlparts = urlparse.urlparse(config.url)
+    filename = request(str(config.username), str(config.password), 
urlparts[1], urlparts[2], start, stop)
     if not filename:
         return
 
@@ -325,5 +326,5 @@
     parser.parse(GzipFile(filename))
     os.unlink(filename)
     epg.add_program_wait()
-    log.info('zap2it XML parsing took %.03f seconds' % (time.time() - t0))
+    log.info('schedulesdirect XML parsing took %.03f seconds' % (time.time() - 
t0))
     return True

-------------------------------------------------------------------------
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

Reply via email to