Update of /cvsroot/freevo/freevo/src/tv/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19700/src/tv/plugins
Modified Files:
mplayer.py
Log Message:
fix strange indend
Index: mplayer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/plugins/mplayer.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** mplayer.py 16 Jul 2005 09:18:28 -0000 1.47
--- mplayer.py 16 Jul 2005 09:28:18 -0000 1.48
***************
*** 6,13 ****
#
# Notes:
! # Todo:
#
# -----------------------------------------------------------------------
# $Log$
# Revision 1.47 2005/07/16 09:18:28 dischi
# add modified version from Henrik aka KaarPo
--- 6,16 ----
#
# Notes:
! # Todo:
#
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.48 2005/07/16 09:28:18 dischi
+ # fix strange indend
+ #
# Revision 1.47 2005/07/16 09:18:28 dischi
# add modified version from Henrik aka KaarPo
***************
*** 73,77 ****
import time, os
! import util # Various utilities
import event as em
--- 76,80 ----
import time, os
! import util
import event as em
***************
*** 79,83 ****
import tv.ivtv as ivtv
import plugin
- import eventhandler
import notifier
--- 82,85 ----
***************
*** 92,277 ****
class PluginInterface(plugin.Plugin):
! """
Plugin to watch tv with mplayer.
"""
! def __init__(self):
! plugin.Plugin.__init__(self)
! # create the mplayer object and register it
! plugin.register(MPlayer(), plugin.TV, True)
class MPlayer(TVPlayer):
! def __init__(self):
! TVPlayer.__init__(self, 'mplayer')
!
! def rate(self, channel, device, uri):
! """
! for now, just handle ivtv
! """
! log.info('MPlayer.rate(): channel=[%s] device=[%s] uri=[%s]' %
! (channel, device, uri))
! if device.startswith('ivtv'):
! log.info('MPlayer.rate(): Returning 2: MPlayer handles this!')
! return 2
! return 0
! def tune(self, uri):
! log.info('MPlayer.play(): Tuning [%s] to chan [%s]' %
! (self.device.vdev, uri))
! import tv.v4l2
! v = tv.v4l2.Videodev(device=self.device.vdev)
! v.setchannel(uri)
! del v
! def play(self, channel, device, uri):
! log.info('MPlayer.play(): channel=[%s] device=[%s] uri=[%s]' %
! (channel, device, uri))
! self.channel = channel
! self.device = config.TV_CARDS[device]
! if not isinstance(self.device, IVTVCard):
! self.reason = 'Device %s is not of class IVTVCard' % device
! log.error('MPlayer.play(): ' + self.reason)
! return
! log.debug('MPlayer.play(): driver=[%s] vdev=[%s] chanlist=[%s]' %
! (self.device.driver, self.device.vdev, self.device.chanlist))
! self.tune(uri)
! command = 'mplayer -nolirc -slave '
! command += config.MPLAYER_ARGS_DEF + ' '
! if config.MPLAYER_ARGS.has_key('ivtv'):
! command += config.MPLAYER_ARGS['ivtv'] + ' '
! command += '-ao ' + config.MPLAYER_AO_DEV + ' '
! command += '-vo ' + config.MPLAYER_VO_DEV + \
! config.MPLAYER_VO_DEV_OPTS + ' '
! command += self.device.vdev
! log.info('mplayer.play(): Starting cmd=%s' % command)
! self.show()
! self.app = Process( command )
! return
! def stop(self, channel_change=0):
! """
! Stop mplayer
! """
! log.info('MPlayer.stop(): Stopping mplayer')
! TVPlayer.stop(self)
! if self.app:
! self.app.stop('quit\n')
! def osd_channel(self):
! # Display the channel info message
! #tuner_id, chan_name, prog_info = self.fc.getChannelInfo()
! now = time.strftime('%H:%M')
! program = self.channel[time.time()]
! #msg = '%s %s (%s): %s' % (now, chan_name, tuner_id, prog_info)
! msg = '%s [%s]: %s' % ( self.channel.title, now, program.title)
! cmd = 'osd_show_text "%s"\n' % msg
! self.app.write(cmd)
! return False # this removes the timer...
! def osd_updown(self):
! cmd = 'osd_show_text "Changing to [%s]"\n' % self.channel.title
! self.app.write(cmd)
! # wait three seconds for the tuner to tune in...
! cb = notifier.Callback( self.osd_channel )
! notifier.addTimer( 3000, cb )
! return False
! def eventhandler(self, event, menuw=None):
! """
! MPlayer event handler.
! If an event is not bound in this
! function it will be passed over to the items eventhandler.
! """
! s_event = '%s' % event
! log.debug('MPlayer.eventhandler(): Got event [%s]' % s_event)
! if event == em.STOP or event == em.PLAY_END:
! self.stop()
! eventhandler.post(em.PLAY_END)
! return True
! if event == em.TV_CHANNEL_UP:
! self.channel = kaa.epg.get_channel(self.channel, 1)
! uri = self.channel.get_uri(self.channel, self.device)
! self.tune(String(uri))
! self.osd_updown()
! return True
! if event == em.TV_CHANNEL_DOWN:
! self.channel = kaa.epg.get_channel(self.channel, -1)
! uri = self.channel.get_uri(self.channel, self.device)
! self.tune(String(uri))
! self.osd_updown()
! return True
! elif event == em.OSD_MESSAGE:
! cmd = 'osd_show_text "%s"\n' % event.arg
! self.app.write(cmd)
! return True
! # not changed by HKP yet...
! elif False and s_event.startswith('INPUT_'):
! if event == em.TV_CHANNEL_UP:
! nextchan = self.fc.getNextChannel()
! elif event == em.TV_CHANNEL_DOWN:
! nextchan = self.fc.getPrevChannel()
! else:
! chan = int( s_event[6] )
! nextchan = self.fc.getManChannel(chan)
! nextvg = self.fc.getVideoGroup(nextchan)
! if self.current_vg != nextvg:
! self.Stop(channel_change=1)
! self.Play('tv', nextchan)
! return True
! if self.mode == 'vcr':
! return True
!
! elif self.current_vg.group_type == 'dvb':
! self.Stop(channel_change=1)
! self.Play('tv', nextchan)
! return True
! elif self.current_vg.group_type == 'ivtv':
! self.fc.chanSet(nextchan)
! self.app.write('seek 999999 0\n')
! else:
! freq_khz = self.fc.chanSet(nextchan, app=self.app)
! new_freq = '%1.3f' % (freq_khz / 1000.0)
! self.app.write('tv_set_freq %s\n' % new_freq)
! self.current_vg = self.fc.getVideoGroup(self.fc.getChannel())
! # Display a channel changed message
! tuner_id, chan_name, prog_info = self.fc.getChannelInfo()
! now = time.strftime('%H:%M')
! msg = '%s %s (%s): %s' % (now, chan_name, tuner_id, prog_info)
! cmd = 'osd_show_text "%s"\n' % msg
! self.app.write(cmd)
! return True
! elif event == em.TOGGLE_OSD:
! self.osd_channel()
! return True
! log.debug('MPlayer.eventhandler(): No handler for event [%s]' %
s_event)
! return False
--- 94,279 ----
class PluginInterface(plugin.Plugin):
! """
Plugin to watch tv with mplayer.
"""
! def __init__(self):
! plugin.Plugin.__init__(self)
! # create the mplayer object and register it
! plugin.register(MPlayer(), plugin.TV, True)
class MPlayer(TVPlayer):
! def __init__(self):
! TVPlayer.__init__(self, 'mplayer')
!
! def rate(self, channel, device, uri):
! """
! for now, just handle ivtv
! """
! log.info('MPlayer.rate(): channel=[%s] device=[%s] uri=[%s]' %
! (channel, device, uri))
! if device.startswith('ivtv'):
! log.info('MPlayer.rate(): Returning 2: MPlayer handles this!')
! return 2
! return 0
! def tune(self, uri):
! log.info('MPlayer.play(): Tuning [%s] to chan [%s]' %
! (self.device.vdev, uri))
! import tv.v4l2
! v = tv.v4l2.Videodev(device=self.device.vdev)
! v.setchannel(uri)
! del v
! def play(self, channel, device, uri):
! log.info('MPlayer.play(): channel=[%s] device=[%s] uri=[%s]' %
! (channel, device, uri))
! self.channel = channel
! self.device = config.TV_CARDS[device]
! if not isinstance(self.device, IVTVCard):
! self.reason = 'Device %s is not of class IVTVCard' % device
! log.error('MPlayer.play(): ' + self.reason)
! return
! log.debug('MPlayer.play(): driver=[%s] vdev=[%s] chanlist=[%s]' %
! (self.device.driver, self.device.vdev, self.device.chanlist))
! self.tune(uri)
! command = 'mplayer -nolirc -slave '
! command += config.MPLAYER_ARGS_DEF + ' '
! if config.MPLAYER_ARGS.has_key('ivtv'):
! command += config.MPLAYER_ARGS['ivtv'] + ' '
! command += '-ao ' + config.MPLAYER_AO_DEV + ' '
! command += '-vo ' + config.MPLAYER_VO_DEV + \
! config.MPLAYER_VO_DEV_OPTS + ' '
! command += self.device.vdev
! log.info('mplayer.play(): Starting cmd=%s' % command)
! self.show()
! self.app = Process( command )
! return
! def stop(self, channel_change=0):
! """
! Stop mplayer
! """
! log.info('MPlayer.stop(): Stopping mplayer')
! TVPlayer.stop(self)
! if self.app:
! self.app.stop('quit\n')
! def osd_channel(self):
! # Display the channel info message
! #tuner_id, chan_name, prog_info = self.fc.getChannelInfo()
! now = time.strftime('%H:%M')
! program = self.channel[time.time()]
! #msg = '%s %s (%s): %s' % (now, chan_name, tuner_id, prog_info)
! msg = '%s [%s]: %s' % ( self.channel.title, now, program.title)
! cmd = 'osd_show_text "%s"\n' % msg
! self.app.write(cmd)
! return False # this removes the timer...
! def osd_updown(self):
! cmd = 'osd_show_text "Changing to [%s]"\n' % self.channel.title
! self.app.write(cmd)
! # wait three seconds for the tuner to tune in...
! cb = notifier.Callback( self.osd_channel )
! notifier.addTimer( 3000, cb )
! return False
! def eventhandler(self, event, menuw=None):
! """
! MPlayer event handler.
! If an event is not bound in this
! function it will be passed over to the items eventhandler.
! """
! s_event = '%s' % event
! log.debug('MPlayer.eventhandler(): Got event [%s]' % s_event)
! if event == em.STOP or event == em.PLAY_END:
! self.stop()
! em.PLAY_END.post()
! return True
! if event == em.TV_CHANNEL_UP:
! self.channel = kaa.epg.get_channel(self.channel, 1)
! uri = self.channel.get_uri(self.channel, self.device)
! self.tune(String(uri))
! self.osd_updown()
! return True
! if event == em.TV_CHANNEL_DOWN:
! self.channel = kaa.epg.get_channel(self.channel, -1)
! uri = self.channel.get_uri(self.channel, self.device)
! self.tune(String(uri))
! self.osd_updown()
! return True
! elif event == em.OSD_MESSAGE:
! cmd = 'osd_show_text "%s"\n' % event.arg
! self.app.write(cmd)
! return True
! # not changed by HKP yet...
! elif False and s_event.startswith('INPUT_'):
! if event == em.TV_CHANNEL_UP:
! nextchan = self.fc.getNextChannel()
! elif event == em.TV_CHANNEL_DOWN:
! nextchan = self.fc.getPrevChannel()
! else:
! chan = int( s_event[6] )
! nextchan = self.fc.getManChannel(chan)
! nextvg = self.fc.getVideoGroup(nextchan)
! if self.current_vg != nextvg:
! self.Stop(channel_change=1)
! self.Play('tv', nextchan)
! return True
! if self.mode == 'vcr':
! return True
!
! elif self.current_vg.group_type == 'dvb':
! self.Stop(channel_change=1)
! self.Play('tv', nextchan)
! return True
! elif self.current_vg.group_type == 'ivtv':
! self.fc.chanSet(nextchan)
! self.app.write('seek 999999 0\n')
! else:
! freq_khz = self.fc.chanSet(nextchan, app=self.app)
! new_freq = '%1.3f' % (freq_khz / 1000.0)
! self.app.write('tv_set_freq %s\n' % new_freq)
! self.current_vg = self.fc.getVideoGroup(self.fc.getChannel())
! # Display a channel changed message
! tuner_id, chan_name, prog_info = self.fc.getChannelInfo()
! now = time.strftime('%H:%M')
! msg = '%s %s (%s): %s' % (now, chan_name, tuner_id, prog_info)
! cmd = 'osd_show_text "%s"\n' % msg
! self.app.write(cmd)
! return True
! elif event == em.TOGGLE_OSD:
! self.osd_channel()
! return True
! log.debug('MPlayer.eventhandler(): No handler for event [%s]' %
s_event)
! return False
-------------------------------------------------------
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