Author: duncan
Date: Fri May 18 18:37:20 2007
New Revision: 9581

Modified:
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/src/event.py
   branches/rel-1/freevo/src/tv/plugins/mplayer.py

Log:
[ 1720667 ] lastchannel zapping
patch from Henne Vogelsang applied, with more general fixes


Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Fri May 18 18:37:20 2007
@@ -269,6 +269,7 @@
      Moved video.reencode to video.reencode-old and video.reencode2 to 
video.reencode
      Added MAJOR_AUDIO_CTRL_MUTE to be able to choose a differente control for 
mute in the Alsa mixer plugin
      Changed default locale from latin-1 to iso-8859-15, they are really the 
same
+     Added MPLAYER_OLDTVCHANNELCHANGE to allow the PREV_CH button to swap to 
previous channel
      ''' ),
 ]
 
@@ -1428,6 +1429,12 @@
 MPLAYER_VF_INTERLACED = 'pp=de/fd'
 MPLAYER_VF_PROGRESSIVE = 'pp=de'
 
+# This setting is for the MPlayer TV plugin. You can either use dvb_set_channel
+# for switching TV channels (set this to 0) or you can restart mplayer (set 
this
+# to 1).
+# NOTE: You need to set this to 1 to be able to use the TV_CHANNEL_LAST 
feature.
+#
+MPLAYER_OLDTVCHANNELCHANGE = False
 
 # ======================================================================
 # Xine settings:

Modified: branches/rel-1/freevo/src/event.py
==============================================================================
--- branches/rel-1/freevo/src/event.py  (original)
+++ branches/rel-1/freevo/src/event.py  Fri May 18 18:37:20 2007
@@ -323,6 +323,7 @@
     'PAUSE'     : PAUSE,
     'CH+'       : TV_CHANNEL_UP,
     'CH-'       : TV_CHANNEL_DOWN,
+    'PREV_CH'   : TV_CHANNEL_LAST,
     'LEFT'      : Event(SEEK, arg=-60),
     'RIGHT'     : Event(SEEK, arg=60),
     'REW'       : Event(SEEK, arg=-10),

Modified: branches/rel-1/freevo/src/tv/plugins/mplayer.py
==============================================================================
--- branches/rel-1/freevo/src/tv/plugins/mplayer.py     (original)
+++ branches/rel-1/freevo/src/tv/plugins/mplayer.py     Fri May 18 18:37:20 2007
@@ -232,15 +232,16 @@
 
         if os.path.exists('/tmp/freevo.wid'): os.unlink('/tmp/freevo.wid')
 
-        lastchanfile = os.path.join(config.FREEVO_CACHEDIR, 'lastchan')
-        lcfp = open(lastchanfile, "w")
-        lastchan = self.fc.getChannel()
-        lastchannum = self.fc.getChannelNum()
-        lcfp.write(str(lastchan))
-        lcfp.write('\n')
-        lcfp.write(str(lastchannum))
-        lcfp.write('\n')
-        lcfp.close()
+        if config.MPLAYER_OLDTVCHANNELCHANGE:
+            lastchanfile = os.path.join(config.FREEVO_CACHEDIR, 'lastchan')
+            lcfp = open(lastchanfile, "w")
+            lastchan = self.fc.getChannel()
+            lastchannum = self.fc.getChannelNum()
+            lcfp.write(str(lastchan))
+            lcfp.write('\n')
+            lcfp.write(str(lastchannum))
+            lcfp.write('\n')
+            lcfp.close()
 
     def eventhandler(self, event, menuw=None):
         s_event = '%s' % event
@@ -264,14 +265,21 @@
                 nextchan = self.fc.getPrevChannel()
                 nextchannum = self.fc.getPrevChannelNum()
             elif event == em.TV_CHANNEL_LAST:
-                lastchanfile = os.path.join(config.FREEVO_CACHEDIR, 'lastchan')
-                lcfp = open(lastchanfile, "r")
-                nextchan = lcfp.readline()
-                nextchan = nextchan.strip()
-                nextchannum = lcfp.readline()
-                nextchannum = nextchannum.strip()
-                nextchannum = int(nextchannum)
-                lcfp.close()
+                if config.MPLAYER_OLDTVCHANNELCHANGE:
+                    if os.path.isfile(os.path.join(config.FREEVO_CACHEDIR, 
'lastchan')):
+                        lastchanfile = os.path.join(config.FREEVO_CACHEDIR, 
'lastchan')
+                        lcfp = open(lastchanfile, "r")
+                        nextchan = lcfp.readline()
+                        nextchan = nextchan.strip()
+                        nextchannum = lcfp.readline()
+                        nextchannum = nextchannum.strip()
+                        nextchannum = int(nextchannum)
+                        lcfp.close()
+                    else:
+                        nextchan = self.fc.getChannel()
+                        nextchannum = self.fc.getChannelNum()
+                else:
+                    return TRUE
             else:
                 chan = int( s_event[6] )
                 nextchan = self.fc.getManChannel(chan)
@@ -289,11 +297,15 @@
                 return
 
             elif self.current_vg.group_type == 'dvb':
-                card = 0 # May be this should come from video groups or 
TV_CHANNELS
-                if em.TV_CHANNEL_UP:
-                    self.app.write('dvb_set_channel %s %s\n' % (nextchannum, 
card))
-                elif em.TV_CHANNEL_DOWN:
-                    self.app.write('dvb_set_channel %s %s\n' % (nextchannum, 
card))
+                if not config.MPLAYER_OLDTVCHANNELCHANGE:
+                    card = 0 # May be this should come from video groups or 
TV_CHANNELS
+                    if em.TV_CHANNEL_UP:
+                        self.app.write('dvb_set_channel %s %s\n' % 
(nextchannum, card))
+                    elif em.TV_CHANNEL_DOWN:
+                        self.app.write('dvb_set_channel %s %s\n' % 
(nextchannum, card))
+                else:
+                    self.Stop(channel_change=1)
+                    self.Play('tv', nextchan)
                 return TRUE
 
             elif self.current_vg.group_type == 'ivtv':

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to