On 4/23/07, Juha Pahkala <[EMAIL PROTECTED]> wrote:
mike lewis wrote:
> On 4/12/07, Juha Pahkala <[EMAIL PROTECTED]> wrote:
>
>> I was excited to see your patch on the devel list today, but it awfully
>> much resembles something  more for CD burning than VDR, might be the
>> wrong patch....  :)
>>
>>
> Doh!   Sorry.  I'll have a look over the weekend..
>
> M
A friendly reminder... i'm (and probably others as well) still
interested in the patch if you find it....

Here tis, in all it's glory..

local_conf excerpt:
---
#plugin.activate('vdr_interface')
plugin.activate('vdrtv', level=5)
VDR_VIEWER_PLUGIN = 'xine'
VDR_XINE_FIFO_PATH = 'vdr:/tmp/vdr-xine/stream#demux:mpeg_pes'
---

Note, vdr_interface no longer required..  this new version works on
vdr-xine only when installed to allow xine to issue commands to vdr.
Can't what compile option that is though... vdr_interface is the
reason why the other versions of the plugin no longer work..

Let me know how it goes...  I'm happy to help you get it running.
Sorry for taking so long.  Been studying.

Mike

tia, juhis


-------------------------------------------------------------------------
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-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

#if 0 /*
# -----------------------------------------------------------------------
# vdrtv.py - A VDR (DVB) plugin for freevo
# -----------------------------------------------------------------------
# Se README for documentation
# -----------------------------------------------------------------------
# Revision history
# see the file HISTORY
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2003 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ----------------------------------------------------------------------- */
#endif

#python modules
import re

#freevo modules
import config, menu, rc, plugin, util
from item import Item
import childapp
import pygame.locals as key
from event import *

#vdrpy modules
#from vdr.svdrp import SVDRP
import time

VDR_EVENTS = {
    'PLAY'      : PLAY,
    'PAUSE'     : PAUSE,
    'STOP'      : STOP,
    'EXIT'      : Event('EXIT'),
    'UP'        : Event('UP'),
    'DOWN'      : Event('DOWN'),
    'LEFT'      : Event('LEFT'),
    'RIGHT'     : Event('RIGHT'),
    '0'         : INPUT_0,
    '1'         : INPUT_1,
    '2'         : INPUT_2,
    '3'         : INPUT_3,
    '4'         : INPUT_4,
    '5'         : INPUT_5,
    '6'         : INPUT_6,
    '7'         : INPUT_7,
    '8'         : INPUT_8,
    '9'         : INPUT_9,
    'RED'       : Event('RED'),
    'GREEN'     : Event('GREEN'),
    'YELLOW'    : Event('YELLOW'),
    'BLUE'      : Event('BLUE'),
    'POWER'     : Event('POWER'),
    'MENU'      : MENU,
#    'BACK'      : Event('BACK'),
    #michaell
    'ENTER'     : Event('BACK'),
    'SELECT'    : Event('SELECT'),
    'VOL+'      : Event('VOL+'),
    'VOL-'      : Event('VOL-'),
    'MUTE'      : Event('MUTE'),
    'CH+'       : Event('CH+'),
    'CH-'       : Event('CH-'),
    'FFWD'      : Event('FFWD'),
    'REW'       : Event('REW'),
    'REC'       : Event('REC'),
    'ASPECT'    : Event('ASPECT'),
    'ZOOM'      : Event('ZOOMIN'),
    'DVHS'      : Event('ZOOMOUT'),
    'RECORDINGS' : Event('RECORDINGS'),
    'CHANNELS'  : Event('CHANNELS'),
    'AUDIO'     : Event('LANG'),
    'SCHEDULE'  : Event('GUIDE'),
    'TIMERS'    : Event('TIMERS'),
    'SETUP'     : Event('SETUP'),
    'COMMANDS'  : Event('EJECT'),
    }

class PluginInterface(plugin.MainMenuPlugin):
    """
    A plugin to run vdr in freevo
    To activate, put the following lines in local_conf.py:

    plugin.activate('vdrtv', level=5) 

    You may configure the plugin by following variables in your local_conf.py

    VDR_VIEWER_PLUGIN='tvtime'  # Wich Viewer? Use either tvtime or xine. 
    VDR_XINE_FIFO_PATH='vdr://var/vdr/xine/stream#demux:mpeg_pes'
                                # path to your vdr-xine fifo, only if different
                                # than this one
                                # support for the networked version of vdr-xine
                                # is planned for future releases
    """
    def __init__(self):
        plugin.MainMenuPlugin.__init__(self)
        # check for plugin dependencies
        #self.vdrinterface=plugin.getbyname('VDRINTERFACE');
        #if self.vdrinterface==None:
        #    raise Exception,"VDR Interface Plugin not loaded!"
        
    def items(self, parent):
        return [ VDRXineMainMenuItem(parent) ]


class FooSenderPlugin(plugin.DaemonPlugin):
    """
        Sending foo events
    """
    def __init__(self):
        DaemonPlugin.__init__(self)
        self.poll_interval  = 1000
	#self.vdrinterface=plugin.getbyname('VDRINTERFACE');

    def poll(self):
        print "trying to close svdrp"
	print dir(self.vdrinterface)

class VDRXineMainMenuItem(Item):
    """
    This is the item for the main menu
    """
    def __init__(self, parent):
        try:
            config.XINE_COMMAND
        except:
            print String(_( 'ERROR' )) + ': ' + \
                  String(_("'XINE_COMMAND' not defined, plugin 'xine' deactivated.\n" \
                           'please check the xine section in freevo_config.py' ))
            return

        Item.__init__(self, parent, skin_type='tv')
        self.tcp= False
        self.viewer=config.VDR_VIEWER_PLUGIN
        self.app = True
        self.name = _('Watch TV (VDR)')
        self.app_mode = 'vdr'
        if not config.EVENTS.has_key('vdr'):
            config.EVENTS['vdr'] = VDR_EVENTS
            config.KEYMAP[key.K_F9]        = 'RED'
            config.KEYMAP[key.K_F10]       = 'GREEN'
            config.KEYMAP[key.K_F11]       = 'YELLOW'
            config.KEYMAP[key.K_F12]       = 'BLUE'
            config.KEYMAP[key.K_BACKSPACE] = 'BACK'
	self.vdrhasfreevoplugin = None

    def actions(self):
        """
        Start VDR plugin
        """
        items = [ ( self.start_vdr_plugin , _('Start VDR plugin' )) ]
        return items
 
    def start_vdr_plugin(self, arg=None, menuw=None):
        if plugin.getbyname('MIXER'):
            mixer=plugin.getbyname('MIXER')
            mixer.reset()

        if self.viewer=='xine':
            command = [ '--prio=%s' % config.MPLAYER_NICE ] + \
                      config.XINE_COMMAND.split(' ') + \
                      [ '--stdctl', '-V', config.XINE_VO_DEV,
                      '-A', config.XINE_AO_DEV ] + \
                      config.XINE_ARGS_DEF.split(' ')
            command.append('-D')

            if not rc.PYLIRC and '--no-lirc' in command:
                command.remove('--no-lirc')

	    if config.VDR_XINE_FIFO_PATH:
		command.append(config.VDR_XINE_FIFO_PATH)
	    else:
        	command.append('vdr://var/vdr/xine/stream#demux:mpeg_pes')
        else:
            self.tcp=1
            if self.viewer=='tvtime':
                command =  config.TVTIME_CMD + " " + config.TVTIME_ARGS
            else:
                command = self.viewer

        if self.tcp:
            self.svdrp = SVDRP(config.VDR_SVDRP_HOST,port=config.VDR_SVDRP_PORT,close_connection=config.VDR_SVDRP_ALWAYSCLOSE)
	    # let's see if the freevo plugin is loaded in freevo
	    result = self.svdrp.write_cmd('plug freevo' + '\n')
	    if result[0:3] == '214':
		self.vdrhasfreevoplugin = True
		# turn off VDR remotes
		self.svdrp.write_cmd('plug freevo rctl off' + '\n')
		print result
	    else:
		print "\n#####################################"
		print "VDR has no plugin named 'freevo' loaded"
		print "Most likely you'll experience key-hit conflicts in VDR"
		print "#####################################\n"
            # switch vdr to the last used channel
            channel=self.vdrinterface.getVar('CURRENT_TV_CHANNEL')
            if channel:
                print "switching to "+channel
                self.svdrp.chan(channel)
        if self.viewer!='xine':
            mixer.setLineinVolume(100)

	if not self.menuw:
            self.menuw = menuw

        self.menuw.hide()

        self.app = childapp.ChildApp2(command)
        rc.app(self)

        return None
	
    def hitk(self, key):
	if self.vdrhasfreevoplugin:
	    # temporarily turn on VDR remotes
	    self.svdrp.write_cmd('plug freevo rctl on' + '\n')
	self.svdrp.hitk(key)
	if self.vdrhasfreevoplugin:
	    # turn off VDR remotes
	    self.svdrp.write_cmd('plug freevo rctl off' + '\n')

    def stop(self):
        if self.app:
            if self.viewer=='xine':
                self.app.stop('quit\n')
            else:
                self.app.stop()
            rc.app(None)
        if self.tcp:
            # retrieve and store the current channel
            channel=self.svdrp.current_chan()
            self.vdrinterface.putVar('CURRENT_TV_CHANNEL',channel)
            self.vdrinterface.saveVars()
	    if self.vdrhasfreevoplugin:
		# turn on VDR remotes
		self.svdrp.write_cmd('plug freevo rctl on' + '\n')
            self.hitk('stop')
            self.svdrp.close()
            self.svdrp=0
            if plugin.getbyname('MIXER'):
                plugin.getbyname('MIXER').reset()
	self.menuw.show()

    def eventhandler(self, event, menuw=None):
        """
        eventhandler for xine control.
        """
        if not self.app:
            return False

        print "VDR_XINE: EVENT %s" % event

        if event == PLAY_START:
            print "VDR_XINE: PLAY_START"
            return True

        if event == PLAY_END:
            print "VDR_XINE: PLAY_END"
            self.stop()
            return True

        if event == VIDEO_START:
            print "VDR_XINE: VIDEO_START"
            return False

        if event == VIDEO_END:
            print "VDR_XINE: VIDEO_END"
            return False

        if event == INPUT_0:
            if self.tcp:
                self.hitk('0')
            else:
                self.app.write('number0\n')
            return True

        if event == INPUT_1:
            if self.tcp:
                self.hitk('1')
            else:
                self.app.write('number1\n')
            return True

        if event == INPUT_2:
            if self.tcp:
                self.hitk('2')
            else:
                self.app.write('number2\n')
            return True

        if event == INPUT_3:
            if self.tcp:
                self.hitk('3')
            else:
                self.app.write('number3\n')
            return True

        if event == INPUT_4:
            if self.tcp:
                self.hitk('4')
            else:
                self.app.write('number4\n')
            return True

        if event == INPUT_5:
            if self.tcp:
                self.hitk('5')
            else:
                self.app.write('number5\n')
            return True

        if event == INPUT_6:
            if self.tcp:
                self.hitk('6')
            else:
                self.app.write('number6\n')
            return True

        if event == INPUT_7:
            if self.tcp:
                self.hitk('7')
            else:
                self.app.write('number7\n')
            return True

        if event == INPUT_8:
            if self.tcp:
                self.hitk('8')
            else:
                self.app.write('number8\n')
            return True

        if event == INPUT_9:
            if self.tcp:
                self.hitk('9')
            else:
                self.app.write('number9\n')
            return True

        if event == Event('RED'):
            if self.tcp:
                self.hitk('Red')
            else:
                self.app.write('VDRButtonRed\n')
            return True

        if event == Event('GREEN'):
            if self.tcp:
                self.hitk('Green')
            else:
                self.app.write('VDRButtonGreen\n')
            return True

        if event == Event('YELLOW'):
            if self.tcp:
                self.hitk('Yellow')
            else:
                self.app.write('VDRButtonYellow\n')
            return True

        if event == Event('BLUE'):
            if self.tcp:
                self.hitk('Blue')
            else:
                self.app.write('VDRButtonBlue\n')
            return True

        if event == PLAY:
            if self.tcp:
                self.hitk('Play')
            else:
                self.app.write('VDRPlay\n')
            return True

        if event == PAUSE:
            if self.tcp:
                self.hitk('Pause')
            else:
                self.app.write('VDRPause\n')
            return True
        
	if event == Event('BACK'):
            if self.tcp:
                self.hitk('back')
            else:
		self.app.write('VDRBack\n')
            return True


        if event == STOP:
            if self.tcp:
                self.hitk('Stop')
            else:
                self.app.write('VDRStop\n')
            return True

        if event == Event('EXIT'):
            if self.tcp:
		self.hitk('Back')
                self.stop()
            else:
                self.stop()
            return True

        if event == Event('POWER'):
            if self.tcp:
                self.stop()
            return True

        if event == Event('UP'):
            if self.tcp:
                self.hitk('Up')
            else:
                self.app.write('EventUp\n')
            return True

        if event == Event('DOWN'):
            if self.tcp:
                self.hitk('Down')
            else:
                self.app.write('EventDown\n')
            return True

        if event == Event('LEFT'):
            if self.tcp:
                self.hitk('Left')
            else:
                self.app.write('EventLeft\n')
            return True

        if event == Event('RIGHT'):
            if self.tcp:
                self.hitk('Right')
            else:
                self.app.write('EventRight\n')
            return True

        if event == Event('VOL+'):
            if self.tcp:
                self.hitk('Volume+')
            else:
                self.app.write('VDRVolumePlus\n')
            return True

        if event == Event('VOL-'):
            if self.tcp:
                self.hitk('Volume-')
            else:
                self.app.write('VDRVolumeMinus\n')
            return True

        if event == Event('MUTE'):
            if self.tcp:
                self.hitk('MUTE')
            else:
                self.app.write('VDRMute\n')
            return True

        if event == Event('CH+'):
            if self.tcp:
                self.hitk('Channel+')
            else:
                self.app.write('VDRChannelPlus\n')
            return True

        if event == Event('CH-'):
            if self.tcp:
                self.hitk('Channel-')
            else:
                self.app.write('VDRChannelMinus\n')
            return True

        if event == Event('FFWD'):
            if self.tcp:
                self.hitk('FastFwd')
            else:
                self.app.write('VDRFastFwd\n')
            return True

        if event == Event('REW'):
            if self.tcp:
                self.hitk('FastRew')
            else:
                self.app.write('VDRFastRew\n')
            return True

        if event == Event('REC'):
            if self.tcp:
                self.hitk('Record')
            else:
                self.app.write('VDRRecord\n')
            return True

        if event == Event('ZOOMIN'):
            if self.tcp:
                self.app.write('z\n')
                #self.hitk('z')
            else:
                self.app.write('z\n')
            return True

        if event == Event('ZOOMOUT'):
            if self.tcp:
                self.app.write('Z\n')
                #self.hitk('Z')
            else:
                self.app.write('Z\n')
            return True

        if event == Event('ASPECT'):
            if self.tcp:
                self.app.write('ToggleAspectRatio\n')
            else:
                self.app.write('ToggleAspectRatio\n')
            return True

        if event == Event('SELECT'):
            if self.tcp:
                self.hitk('Ok')
            else:
                self.app.write('EventSelect\n')
            return True

        if event == MENU:
            if self.tcp:
                self.hitk('Menu')
            else:
                self.app.write('Menu\n')
            return True
	    
        if event == Event('RECORDINGS'):
            if self.tcp:
                self.hitk('Recordings')
            else:
                self.app.write('VDRRecordings\n')
            return True	    
	    
        if event == Event('CHANNELS'):
            if self.tcp:
                self.hitk('Channels')
            else:
                self.app.write('VDRChannels\n')
            return True	    
	    
        if event == Event('AUDIO'):
            if self.tcp:
                self.hitk('Audio')
            else:
                none # fixme
            return True	    
	    
        if event == Event('SCHEDULE'):
            if self.tcp:
                self.hitk('Schedule')
            else:
                self.app.write('VDRSchedule\n')
            return True	    

        if event == Event('TIMERS'):
            if self.tcp:
                self.hitk('Timers')
            else:
                self.app.write('VDRTimers\n')
            return True	    
	    
        if event == Event('SETUP'):
            if self.tcp:
                self.hitk('Setup')
            else:
                self.app.write('VDRSetup\n')
            return True	    	    
	    
        if event == Event('COMMANDS'):
            if self.tcp:
                self.hitk('Commands')
            else:
                self.app.write('VDRCommands\n')
            return True	    	    	    

        # nothing found?
        return False

-------------------------------------------------------------------------
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-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to