Author: duncan
Date: Sat Feb  9 06:40:29 2008
New Revision: 10349

Log:
[ 1889376 ] Configurable timezone for XMLTV feeds
Patch from Andrew Jeffery applied


Modified:
   branches/rel-1-7/freevo/freevo_config.py
   branches/rel-1-7/freevo/local_conf.py.example
   branches/rel-1-7/freevo/src/tv/epg_xmltv.py
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/local_conf.py.example
   branches/rel-1/freevo/src/tv/epg_xmltv.py

Modified: branches/rel-1-7/freevo/freevo_config.py
==============================================================================
--- branches/rel-1-7/freevo/freevo_config.py    (original)
+++ branches/rel-1-7/freevo/freevo_config.py    Sat Feb  9 06:40:29 2008
@@ -108,7 +108,7 @@
 # of the config file doesn't match, Freevo won't start. If the minor version
 # is different, there will be only a warning
 
-LOCAL_CONF_VERSION = 5.22
+LOCAL_CONF_VERSION = 5.23
 
 # Description of changes in each new version
 FREEVO_CONF_CHANGES = [
@@ -345,6 +345,9 @@
      Added ENCODINGSERVER_SAVE_DIR for re-encoded DVDs
      Added TV_CHANNELS_COMPARE as a lambda to sort the channels
      '''),
+    (5.23,
+     ''' Added XMLTV_TIMEZONE to allow the time zone to be specified
+     '''),
 ]
 
 
@@ -1934,6 +1937,14 @@
 
 XMLTV_DAYS = 3
 
+#
+# GMT offset for XMLTV feeds that don't contain timezone information
+# An example of this is the OzTivo feed which has the timestamps
+# in the XML pre-adjusted for your timezone
+#
+XMLTV_TIMEZONE = None
+
+
 
 # ======================================================================
 # Freevo builtin WWW server settings:

Modified: branches/rel-1-7/freevo/local_conf.py.example
==============================================================================
--- branches/rel-1-7/freevo/local_conf.py.example       (original)
+++ branches/rel-1-7/freevo/local_conf.py.example       Sat Feb  9 06:40:29 2008
@@ -10,7 +10,7 @@
 # freevo_config.py. freevo_config.py, which is usually installed in
 # /usr/share/freevo, contains all the core settings.  To change the settings 
copy
 # this file to ~/.freevo/local_conf.py or /etc/freevo/local_conf.py
-# 
+#
 # It does not contain all the possible settings that you can change, see
 # freevo_config.py for all the possible settings. Also it does not contain
 # settings for the plug-ins, plug-ins contain their configuration information 
and
@@ -18,12 +18,12 @@
 # | freevo plugins -l
 # and the settings can se shown with
 # | freevo plugins -i <name of plug-in>
-# 
+#
 # E.g.: when you want a alsa as mplayer audio out, just put in local_conf.py:
 # | MPLAYER_AO_DEV = 'alsa9'
-# 
+#
 # The vertical line indicates code.
-# 
+#
 # This is no normal config file, it's Python code. Because of that, you
 # need to follow some rules to avoid crashes. The examples should explain
 # the settings, but make sure a line starting with a variable has NO SPACES OR
@@ -50,7 +50,7 @@
 #
 # -----------------------------------------------------------------------
 
-CONFIG_VERSION = 5.22
+CONFIG_VERSION = 5.23
 
 # ======================================================================
 # General freevo settings:
@@ -63,8 +63,8 @@
 # MIXER_MAJOR_CTRL   = 'VOL'           # Freevo takes control over one audio 
ctrl
                                        # 'VOL', 'PCM' 'OGAIN' etc.
 
-# MIXER_MAJOR_MUTE_CTRL = 'PCM'        # used in alsamixer.py There are 
systems where 
-                                       # volume and mute use different 
controls 
+# MIXER_MAJOR_MUTE_CTRL = 'PCM'        # used in alsamixer.py There are 
systems where
+                                       # volume and mute use different controls
 
 # MIXER_DEVICE          = '/dev/mixer' # mixer device
 # MIXER_CONTROL_ALL     = 1            # Should Freevo take complete control 
of audio
@@ -1374,7 +1374,7 @@
 # TV_VIDEO_GROUPS setting to handles multiple arbitrary groups of devices
 # for viewing or recording.  It is possible to have different Freevo
 # channels use different Video Groups.
-# 
+#
 # See the wiki for more details:
 #   http://doc.freevo.org/MultiTunerConfig
 #   http://doc.freevo.org/Analoguemulti
@@ -1543,6 +1543,14 @@
 #
 # XMLTV_DAYS = 3
 
+## ONLY ADJUST THIS IF YOUR GUIDE TIMES ARE INCORRECT ##
+#
+# GMT offset for XMLTV feeds that don't contain timezone information
+# An example of this is the OzTivo feed which has the timestamps
+# in the XML pre-adjusted for your timezone
+#
+# XMLTV_TIMEZONE='+0100'
+
 
 # ======================================================================
 # Freevo builtin commdetect server settings:

Modified: branches/rel-1-7/freevo/src/tv/epg_xmltv.py
==============================================================================
--- branches/rel-1-7/freevo/src/tv/epg_xmltv.py (original)
+++ branches/rel-1-7/freevo/src/tv/epg_xmltv.py Sat Feb  9 06:40:29 2008
@@ -313,12 +313,21 @@
     '20020702100000 CDT'
     '200209080000 +0100'
     """
-    # This is either something like 'EDT', or '+1'
-    try:
-        tval, tz = timestr.split()
-    except ValueError:
+
+    # Accounting for feeds that pre-adjust start/finish timestamps in the feed 
to the
+    # correct timezone and DO NOT provide a timestamp offset (as it would be 
zero).
+    # An example of this strange behaviour is the OzTivo feed
+
+    if config.XMLTV_TIMEZONE is not None:
         tval = timestr
-        tz   = str(-time.timezone/3600)
+        tz = config.XMLTV_TIMEZONE
+    else:
+        # This is either something like 'EDT', or '+1'
+        try:
+            tval, tz = timestr.split()
+        except ValueError:
+            tval = timestr
+            tz   = str(-time.timezone/3600)
 
     if tz == 'CET':
         tz='+1'

Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Sat Feb  9 06:40:29 2008
@@ -108,7 +108,7 @@
 # of the config file doesn't match, Freevo won't start. If the minor version
 # is different, there will be only a warning
 
-LOCAL_CONF_VERSION = 5.22
+LOCAL_CONF_VERSION = 5.23
 
 # Description of changes in each new version
 FREEVO_CONF_CHANGES = [
@@ -346,6 +346,9 @@
      Added ENCODINGSERVER_SAVE_DIR for re-encoded DVDs
      Added TV_CHANNELS_COMPARE as a lambda to sort the channels
      '''),
+    (5.23,
+     ''' Added XMLTV_TIMEZONE to allow the time zone to be specified
+     '''),
 ]
 
 
@@ -1939,6 +1942,14 @@
 
 XMLTV_DAYS = 3
 
+#
+# GMT offset for XMLTV feeds that don't contain timezone information
+# An example of this is the OzTivo feed which has the timestamps
+# in the XML pre-adjusted for your timezone
+#
+XMLTV_TIMEZONE = None
+
+
 
 # ======================================================================
 # Freevo builtin WWW server settings:

Modified: branches/rel-1/freevo/local_conf.py.example
==============================================================================
--- branches/rel-1/freevo/local_conf.py.example (original)
+++ branches/rel-1/freevo/local_conf.py.example Sat Feb  9 06:40:29 2008
@@ -10,7 +10,7 @@
 # freevo_config.py. freevo_config.py, which is usually installed in
 # /usr/share/freevo, contains all the core settings.  To change the settings 
copy
 # this file to ~/.freevo/local_conf.py or /etc/freevo/local_conf.py
-# 
+#
 # It does not contain all the possible settings that you can change, see
 # freevo_config.py for all the possible settings. Also it does not contain
 # settings for the plug-ins, plug-ins contain their configuration information 
and
@@ -18,12 +18,12 @@
 # | freevo plugins -l
 # and the settings can se shown with
 # | freevo plugins -i <name of plug-in>
-# 
+#
 # E.g.: when you want a alsa as mplayer audio out, just put in local_conf.py:
 # | MPLAYER_AO_DEV = 'alsa9'
-# 
+#
 # The vertical line indicates code.
-# 
+#
 # This is no normal config file, it's Python code. Because of that, you
 # need to follow some rules to avoid crashes. The examples should explain
 # the settings, but make sure a line starting with a variable has NO SPACES OR
@@ -50,7 +50,7 @@
 #
 # -----------------------------------------------------------------------
 
-CONFIG_VERSION = 5.22
+CONFIG_VERSION = 5.23
 
 # ======================================================================
 # General freevo settings:
@@ -63,8 +63,8 @@
 # MIXER_MAJOR_CTRL   = 'VOL'           # Freevo takes control over one audio 
ctrl
                                        # 'VOL', 'PCM' 'OGAIN' etc.
 
-# MIXER_MAJOR_MUTE_CTRL = 'PCM'        # used in alsamixer.py There are 
systems where 
-                                       # volume and mute use different 
controls 
+# MIXER_MAJOR_MUTE_CTRL = 'PCM'        # used in alsamixer.py There are 
systems where
+                                       # volume and mute use different controls
 
 # MIXER_DEVICE          = '/dev/mixer' # mixer device
 # MIXER_CONTROL_ALL     = 1            # Should Freevo take complete control 
of audio
@@ -1376,7 +1376,7 @@
 # TV_VIDEO_GROUPS setting to handles multiple arbitrary groups of devices
 # for viewing or recording.  It is possible to have different Freevo
 # channels use different Video Groups.
-# 
+#
 # See the wiki for more details:
 #   http://doc.freevo.org/MultiTunerConfig
 #   http://doc.freevo.org/Analoguemulti
@@ -1545,6 +1545,14 @@
 #
 # XMLTV_DAYS = 3
 
+## ONLY ADJUST THIS IF YOUR GUIDE TIMES ARE INCORRECT ##
+#
+# GMT offset for XMLTV feeds that don't contain timezone information
+# An example of this is the OzTivo feed which has the timestamps
+# in the XML pre-adjusted for your timezone
+#
+# XMLTV_TIMEZONE='+0100'
+
 
 # ======================================================================
 # Freevo builtin commdetect server settings:

Modified: branches/rel-1/freevo/src/tv/epg_xmltv.py
==============================================================================
--- branches/rel-1/freevo/src/tv/epg_xmltv.py   (original)
+++ branches/rel-1/freevo/src/tv/epg_xmltv.py   Sat Feb  9 06:40:29 2008
@@ -313,12 +313,21 @@
     '20020702100000 CDT'
     '200209080000 +0100'
     """
-    # This is either something like 'EDT', or '+1'
-    try:
-        tval, tz = timestr.split()
-    except ValueError:
+
+    # Accounting for feeds that pre-adjust start/finish timestamps in the feed 
to the
+    # correct timezone and DO NOT provide a timestamp offset (as it would be 
zero).
+    # An example of this strange behaviour is the OzTivo feed
+
+    if config.XMLTV_TIMEZONE is not None:
         tval = timestr
-        tz   = str(-time.timezone/3600)
+        tz = config.XMLTV_TIMEZONE
+    else:
+        # This is either something like 'EDT', or '+1'
+        try:
+            tval, tz = timestr.split()
+        except ValueError:
+            tval = timestr
+            tz   = str(-time.timezone/3600)
 
     if tz == 'CET':
         tz='+1'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to