Update of /cvsroot/freevo/freevo/WIP/Dischi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26514
Added Files:
fbxine-vdr.patch vdr.py
Log Message:
vdr plugin
--- NEW FILE: vdr.py ---
#if 0 /*
# -----------------------------------------------------------------------
# vdr.py - a way to use vdr and Freevo
# -----------------------------------------------------------------------
# $Id: vdr.py,v 1.1 2004/06/25 11:30:39 dischi Exp $
#
# Notes:
#
# This plugin uses vdr + it's xine plugin as tv plugin. It overrides
# the complete tv part of freevo. It's more a proof of concept.
#
# You need vdr running and the vdr xine output plugin. If you use
# Freevo on the framebuffer, you also need the fbxine-vdr.patch.
#
# To install, put this file into src/tv/plugins and add the following
# two lines to your local_conf.py:
#
# plugin.remove('tv')
# plugin.activate('tv.vdr', type='main')
#
# Now the complete tv menu in Freevo is replaced by vdr.
# Here a small list why you should use this plugin and why not:
#
# + live pause
# + watching and recording at the same time for some channels
# + many plugins like teletext
#
# - the look and feel is different from Freevo
# - webserver and recordserver are useless
# - no auto thumbnail / fxd creation
#
#
# Todo:
#
#
# -----------------------------------------------------------------------
# $Log: vdr.py,v $
# Revision 1.1 2004/06/25 11:30:39 dischi
# vdr plugin
#
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 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
import copy
import os
import config # Configuration handler. reads config file.
import childapp # Handle child applications
import rc # The RemoteControl class.
from event import *
import plugin
import menu
from video.videoitem import VideoItem
VDR_EVENTS = {
'PLAY' : PLAY,
'PAUSE' : PAUSE,
'STOP' : Event('VDR_COMMAND', arg='VDRStop'),
'MENU' : MENU,
'EXIT' : STOP,
'SELECT' : MENU_SELECT,
'LEFT' : MENU_LEFT,
'RIGHT' : MENU_RIGHT,
'UP' : MENU_UP,
'DOWN' : MENU_DOWN,
'1' : Event('VDR_COMMAND', arg='VDRButtonRed'),
'2' : Event('VDR_COMMAND', arg='VDRButtonGreen'),
'3' : Event('VDR_COMMAND', arg='VDRButtonYellow'),
'4' : Event('VDR_COMMAND', arg='VDRButtonBlue'),
'DISPLAY' : VIDEO_TOGGLE_INTERLACE,
}
class PluginInterface(plugin.MainMenuPlugin):
"""
This plugin uses vdr + it's xine plugin as tv plugin. It overrides
the complete tv part of freevo. It's more a proof of concept.
You need vdr running and the vdr xine output plugin. If you use
Freevo on the framebuffer, you also need the fbxine-vdr.patch from
WIP/Dischi
"""
def __init__(self):
plugin.MainMenuPlugin.__init__(self)
self.app_mode = 'vdr'
self.command = [ '--prio=%s' % config.MPLAYER_NICE ] + \
config.XINE_COMMAND.split(' ') + \
[ '--stdctl', '-V', config.XINE_VO_DEV,
'-A', config.XINE_AO_DEV, '-D' ] + \
config.TV_VDR_XINE_ARGS_DEF.split(' ')
if not config.EVENTS.has_key('vdr'):
print 'adding vdr keymap'
config.EVENTS['vdr'] = {}
for key in VDR_EVENTS:
if not key in config.EVENTS['vdr']:
if VDR_EVENTS[key] == 'VDR_COMMAND':
print '[vdr] adding %s -> %s' % (key, VDR_EVENTS[key].arg)
else:
print '[vdr] adding %s -> %s' % (key, VDR_EVENTS[key])
config.EVENTS['vdr'][key] = VDR_EVENTS[key]
# load video dir support for vdr files
plugin.activate('tv.vdr.VDR_MIME')
def config(self):
"""
The config variables this plugin needs
"""
return [ ('TV_VDR_XINE_ARGS_DEF', '--no-lirc --post=expand',
'xine arguments for the vdr frontend'),
('TV_VDR_XINE_PIPE', '/tmp/vdr-xine/stream#demux:mpeg_pes',
'pipe for vdr <-> xine communication')]
def items(self, parent):
"""
Possible actions for this plugin
"""
return [ menu.MenuItem('', action=self.play, type='main', parent=parent,
skin_type='tv') ]
def play(self, menuw=None, arg=None):
"""
Play vdr stream with xine
"""
if plugin.getbyname('MIXER'):
plugin.getbyname('MIXER').reset()
command = copy.copy(self.command)
if not rc.PYLIRC and '--no-lirc' in command:
command.remove('--no-lirc')
command.append('vdr:' + config.TV_VDR_XINE_PIPE)
_debug_('Xine.play(): Starting cmd=%s' % command)
self.menuw = menuw
menuw.hide()
rc.app(self)
self.app = childapp.ChildApp2(command)
return None
def stop(self, channel_change=0):
"""
Stop xine
"""
if self.app:
self.app.stop('quit\n')
rc.app(None)
self.menuw.show()
if not channel_change:
pass
def eventhandler(self, event, menuw=None):
"""
Eventhandler for xine control.
"""
if event in ( PLAY_END, USER_END, STOP ):
self.stop()
rc.post_event(PLAY_END)
return True
if event == PAUSE or event == PLAY:
self.app.write('VDRPause\n')
return True
if event == MENU_LEFT:
self.app.write('EventLeft\n')
return True
if event == MENU_RIGHT:
self.app.write('EventRight\n')
return True
if event == MENU_UP:
self.app.write('EventUp\n')
return True
if event == MENU_DOWN:
self.app.write('EventDown\n')
return True
if event == MENU_SELECT:
self.app.write('EventSelect\n')
return True
if event == MENU:
self.app.write('Menu\n')
return True
if str(event).startswith('INPUT_'):
self.app.write('Number%s\n' % event.arg)
return True
if event == VIDEO_TOGGLE_INTERLACE:
self.app.write('ToggleInterleave\n')
return True
if event == 'VDR_COMMAND':
self.app.write(event.arg + '\n')
return True
# nothing found
return False
class VDR_MIME(plugin.MimetypePlugin):
"""
Plugin to handle vdr video items
"""
def __init__(self):
plugin.MimetypePlugin.__init__(self)
self.display_type = [ 'video' ]
config.VIDEO_MPLAYER_SUFFIX.append('vdr')
def get(self, parent, files):
"""
return a list of items based on the files
"""
if not files:
return []
if os.path.isfile(os.path.dirname(files[0]) + '/epg.data'):
print 'vdr basic record dir detected'
for file in copy.copy(files):
if os.path.isdir(file):
base = os.path.basename(file)
if base.startswith('@'):
# vdr timeshift dir, hide it
files.remove(file)
continue
return []
if not os.path.isfile(os.path.dirname(files[0]) + '/../epg.data'):
return []
print 'vdr show dir detected'
items = []
for file in copy.copy(files):
if file.endswith('.del'):
files.remove(file)
continue
if not file.endswith('.rec'):
continue
if not os.path.isdir(file):
continue
subfiles = os.listdir(file)
for hide in ('.', '..', 'index.vdr', 'summary.vdr', 'resume.vdr'):
if hide in subfiles:
subfiles.remove(hide)
if not subfiles:
continue
files.remove(file)
subfiles.sort(lambda l, o: cmp(l.upper(), o.upper()))
if len(subfiles) != 1:
v = VideoItem('', parent)
for s in subfiles:
v.subitems.append(VideoItem(os.path.join(file, s), v))
else:
v = VideoItem(os.path.join(file, subfiles[0]), parent)
# mmpython can't detect vdr files, force to MPEG-PES
v.info['type'] = 'MPEG-PES'
# set dir name as item name
v.name = os.path.basename(file)[:-4]
if os.path.isfile(file+'/summary.vdr'):
f = open(file+'/summary.vdr')
v.info['plot'] = f.readlines()[-1]
f.close()
items.append(v)
return items
--- NEW FILE: fbxine-vdr.patch ---
*** ../fb.orig/actions.c Thu Jun 24 16:02:45 2004
--- actions.c Thu Jun 24 16:02:01 2004
***************
*** 210,215 ****
--- 210,279 ----
{ "Loop mode toggle.",
"ToggleLoopMode", ACTID_LOOPMODE },
+ { "VDR Red button",
+ "VDRButtonRed", ACTID_EVENT_VDR_RED },
+ { "VDR Green button",
+ "VDRButtonGreen", ACTID_EVENT_VDR_GREEN },
+ { "VDR Yellow button",
+ "VDRButtonYellow", ACTID_EVENT_VDR_YELLOW },
+ { "VDR Blue button",
+ "VDRButtonBlue", ACTID_EVENT_VDR_BLUE },
+ { "VDR play",
+ "VDRPlay", ACTID_EVENT_VDR_PLAY },
+ { "VDR Pause",
+ "VDRPause", ACTID_EVENT_VDR_PAUSE },
+ { "VDR Stop",
+ "VDRStop", ACTID_EVENT_VDR_STOP },
+ { "VDR Record",
+ "VDRRecord", ACTID_EVENT_VDR_RECORD },
+ { "VDR Fast Forward",
+ "VDRFastFwd", ACTID_EVENT_VDR_FASTFWD },
+ { "VDR Fast Rewind",
+ "VDRFastRew", ACTID_EVENT_VDR_FASTREW },
+ { "VDR power",
+ "VDRPower", ACTID_EVENT_VDR_POWER },
+ { "VDR next channel",
+ "VDRChannelPlus", ACTID_EVENT_VDR_CHANNELPLUS },
+ { "VDR previous channel",
+ "VDRChannelMinus", ACTID_EVENT_VDR_CHANNELMINUS },
+ { "VDR schedule menu",
+ "VDRSchedule", ACTID_EVENT_VDR_SCHEDULE },
+ { "VDR Channel menu",
+ "VDRChannels", ACTID_EVENT_VDR_CHANNELS },
+ { "VDR Timers menu",
+ "VDRTimers", ACTID_EVENT_VDR_TIMERS },
+ { "VDR Recordings menu",
+ "VDRRecordings", ACTID_EVENT_VDR_RECORDINGS },
+ { "VDR Setup menu",
+ "VDRSetup", ACTID_EVENT_VDR_SETUP },
+ { "VDR Command menu",
+ "VDRCommands", ACTID_EVENT_VDR_COMMANDS },
+ { "VDR Command Back",
+ "VDRBack", ACTID_EVENT_VDR_BACK },
+ { "VDR User command 1",
+ "VDRUser1", ACTID_EVENT_VDR_USER1 },
+ { "VDR User command 2",
+ "VDRUser2", ACTID_EVENT_VDR_USER2 },
+ { "VDR User command 3",
+ "VDRUser3", ACTID_EVENT_VDR_USER3 },
+ { "VDR User command 4",
+ "VDRUser4", ACTID_EVENT_VDR_USER4 },
+ { "VDR User command 5",
+ "VDRUser5", ACTID_EVENT_VDR_USER5 },
+ { "VDR User command 6",
+ "VDRUser6", ACTID_EVENT_VDR_USER6 },
+ { "VDR User command 7",
+ "VDRUser7", ACTID_EVENT_VDR_USER7 },
+ { "VDR User command 8",
+ "VDRUser8", ACTID_EVENT_VDR_USER8 },
+ { "VDR User command 9",
+ "VDRUser9", ACTID_EVENT_VDR_USER9 },
+ { "VDR Volume plus",
+ "VDRVolumePlus", ACTID_EVENT_VDR_VOLPLUS },
+ { "VDR Volume minus",
+ "VDRVolumeMinus", ACTID_EVENT_VDR_VOLMINUS },
+ { "VDR Audio Mute",
+ "VDRMute", ACTID_EVENT_VDR_MUTE },
{ 0,
0, 0 }
};
*** ../fb.orig/actions.h Sun Nov 16 15:08:01 2003
--- actions.h Thu Jun 24 15:58:42 2004
***************
*** 154,161 ****
ACTID_EVENT_NUMBER_7 = XINE_EVENT_INPUT_NUMBER_7 | ACTID_IS_INPUT_EVENT,
ACTID_EVENT_NUMBER_8 = XINE_EVENT_INPUT_NUMBER_8 | ACTID_IS_INPUT_EVENT,
ACTID_EVENT_NUMBER_9 = XINE_EVENT_INPUT_NUMBER_9 | ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_NUMBER_10_ADD = XINE_EVENT_INPUT_NUMBER_10_ADD | ACTID_IS_INPUT_EVENT
! /*
* End of numeric mapping.
*/
} action_id_t;
--- 154,194 ----
ACTID_EVENT_NUMBER_7 = XINE_EVENT_INPUT_NUMBER_7 | ACTID_IS_INPUT_EVENT,
ACTID_EVENT_NUMBER_8 = XINE_EVENT_INPUT_NUMBER_8 | ACTID_IS_INPUT_EVENT,
ACTID_EVENT_NUMBER_9 = XINE_EVENT_INPUT_NUMBER_9 | ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_NUMBER_10_ADD = XINE_EVENT_INPUT_NUMBER_10_ADD | ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_RED = XINE_EVENT_VDR_RED |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_GREEN = XINE_EVENT_VDR_GREEN |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_YELLOW = XINE_EVENT_VDR_YELLOW |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_BLUE = XINE_EVENT_VDR_BLUE |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_PLAY = XINE_EVENT_VDR_PLAY |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_PAUSE = XINE_EVENT_VDR_PAUSE |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_STOP = XINE_EVENT_VDR_STOP |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_RECORD = XINE_EVENT_VDR_RECORD |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_FASTFWD = XINE_EVENT_VDR_FASTFWD |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_FASTREW = XINE_EVENT_VDR_FASTREW |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_POWER = XINE_EVENT_VDR_POWER |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_CHANNELPLUS = XINE_EVENT_VDR_CHANNELPLUS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_CHANNELMINUS = XINE_EVENT_VDR_CHANNELMINUS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_SCHEDULE = XINE_EVENT_VDR_SCHEDULE |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_CHANNELS = XINE_EVENT_VDR_CHANNELS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_TIMERS = XINE_EVENT_VDR_TIMERS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_RECORDINGS = XINE_EVENT_VDR_RECORDINGS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_SETUP = XINE_EVENT_VDR_SETUP |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_COMMANDS = XINE_EVENT_VDR_COMMANDS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_BACK = XINE_EVENT_VDR_BACK |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER1 = XINE_EVENT_VDR_USER1 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER2 = XINE_EVENT_VDR_USER2 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER3 = XINE_EVENT_VDR_USER3 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER4 = XINE_EVENT_VDR_USER4 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER5 = XINE_EVENT_VDR_USER5 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER6 = XINE_EVENT_VDR_USER6 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER7 = XINE_EVENT_VDR_USER7 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER8 = XINE_EVENT_VDR_USER8 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_USER9 = XINE_EVENT_VDR_USER9 |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_VOLPLUS = XINE_EVENT_VDR_VOLPLUS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_VOLMINUS = XINE_EVENT_VDR_VOLMINUS |
ACTID_IS_INPUT_EVENT,
! ACTID_EVENT_VDR_MUTE = XINE_EVENT_VDR_MUTE |
ACTID_IS_INPUT_EVENT
!
! /*
* End of numeric mapping.
*/
} action_id_t;
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog