i tried
class KaraokeBaseScreen(skin.Area):
def
__init__(self):
skin.Area.__init__(self,
'content')
print "init base
screen"
# Weather display
fonts
self.key_font = skin.get_font('medium0')
self.val_font = skin.get_font('medium1')
self.small_font = skin.get_font('small0')
self.big_font = skin.get_font('huge0')
# set the multiplier to be used in all screen
drawing
self.xmult = float(osd.width - config.OSD_OVERSCAN_LEFT -
config.OSD_OVERSCAN_RIGHT) /
800
self.ymult = float(osd.height - config.OSD_OVERSCAN_TOP -
config.OSD_OVERSCAN_BOTTOM) /
600
self.update_functions = (self.update_info, self.update_info,
self.update_info, self.update_info)
def
update_info(self):
print "update
Info"
def
update_content(self):
print "update
content"
self.parent = self.menu
self.content = self.calc_geometry(self.layout.content,
copy_object=True)
self.update_functions[self.menu.curSkin]()
def
update_content_needed(self):
"""
check if the content needs an
update
"""
return
True
skin.register ( 'karaoke', ('screen', 'subtitle', 'title', 'plugin',
KaraokeBaseScreen()) )
and i have
manager.WaitForPlayer()
pygame.time.wait(1)
skin.redraw()
black screen yet..
i haven't more ideas
2008/2/27, Duncan Webb <[EMAIL PROTECTED]>:
>
> John Molohan wrote:
> > Alberto González Rodríguez wrote:
> >> hello,
> >>
> >> i attach a karaoke plugin using pykaraoke (is in wishlist), but i
> >> have a problem, when pykaraoke finish the screen is black, and if you
> >> move on the menu if redrawing zones
> >>
> >> the best is download pykaraoke, probe the plugin and see the
> problem
> >>
> >> could help me?
> >>
> >> thanks
> >>
> >>
> >> owen / Alberto González / atic at sourceforge
> > Hi Alberto,
> >
> > Did you have any luck with this? I'm seeing a similar behaviour when
> > trying to view youtube video with the itv plugin.
>
>
>
> Missed this one :(, I think you need an update_content and or
> update_content_needed methods to tell the skin what to redraw. You may
> need to call skin.redraw too.
>
> The PluginInterface class need a config method, this does two things:
>
> First, when someone runs freevo plugins -i karaoke it tells them the
> options and what has been set.
>
> Secondly, it set the default configuration options, so you don't need
> code to check if an option exists. However, this doesn't work with all
> plug-in types.
>
> You also need to run the code through contrib/developer/reindent.py to
> correct the indentation to four spaces.
>
> HTH
>
> Duncan
>
>
> -------------------------------------------------------------------------
> 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-users mailing list
> Freevo-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freevo-users
>
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# Plugin for download and watch videos of youtube
# -----------------------------------------------------------------------
# $Id$
#
# Notes:
# You need to install:
# pykaraoke from http://www.kibosh.org/pykaraoke/
#
# To activate, put the following line in local_conf.py:
# plugin.activate('karaoke')
# KARAOKE_DIRECTORY = [
# ('Karaoke directory', '/home/karaoke/')
# ]
#
# ToDo:
#
# -----------------------------------------------------------------------
#
# 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
#
# -----------------------------------------------------------------------
#python modules
import os, time, stat, re, copy, pygame
#freevo modules
import pykar
import config, menu, rc, plugin, skin, osd, util,gui
from gui.GUIObject import *
from gui.PopupBox import PopupBox
from item import Item
from skin.widgets import ScrollableTextScreen
from directory import DirItem
from pykmanager import manager
#get the singletons so we get skin info and access the osd
skin_object = skin.get_singleton()
osd = osd.get_singleton()
#check every 30 minutes
MAX_HEADLINE_AGE = 1800
class PluginInterface(plugin.MainMenuPlugin):
"""
Play karaoke files
prerequisites are:
U(pykaraoke http://www.kibosh.org/pykaraoke/)
Activate:
| plugin.activate('karaoke')
| KARAOKE_DIRECTORY = [
| ('Karaoke directory', '/home/karaoke/'),
| ..
| ]
"""
def __init__(self):
_debug_('PluginInterface.__init__()', 2)
if not hasattr(config,"KARAOKE_DIRECTORY"):
self.reason = 'KARAOKE_DIRECTORY not defined'
return
plugin.MainMenuPlugin.__init__(self)
self.display_type = 'audio'
def config(self):
return [('KARAOKE_DIRECTORY',
('Home', config.FREEVO_CACHEDIR + '/karaoke'),
'Karaoke directory')]
def update_content(self):
""" update the contents of the skin """
_debug_('update_content()', 2)
self.parent = self.menu
self.content = self.calc_geometry(self.layout.content, copy_object=True)
self.update_functions[self.menu.skin_num]()
def items(self, parent):
return [ KaraokeMainMenuItem(parent) ]
class KaraokeMainMenuItem(Item):
"""
Main class
"""
def __init__(self, parent):
Item.__init__(self, parent, skin_type='Karaoke')
self.name = _('Karaoke')
self.display_type = 'audio'
def actions(self):
"""
return a list of actions for this item
"""
return [(self.karaoke_list, 'Karaoke songs')]
def karaoke_list(self,arg=None, menuw=None):
osd.update()
items = []
for des,directory in config.KARAOKE_DIRECTORY:
items.append(menu.MenuItem(des, self.list_directory, directory))
#d = DirItem(directory, self, des, display_type=self.display_type)
#items.append(d)
menuw.pushmenu(menu.Menu(_("Choose please"), items))
def list_directory(self,arg=None, menuw=None):
"""
return list of files
"""
osd.update()
items =[]
for f in os.listdir(arg):
name = re.search('(.*)\.(.*)$',f).group(1)
ext = re.search('(.*)\.(.*)$',f).group(2)
if ext in ["kar","mpg","cdg"]:
items.append(menu.MenuItem(name, self.play_file, (arg + f,ext)))
menuw.pushmenu(menu.Menu(_("Choose please"), items))
def errorPopup(error):
box = PopupBox(text=error)
def play_file(self, arg=None, menuw=None):
file = arg[0]
ext = arg[1]
player = pykar.midPlayer(file,self.errorPopup)
player.Play()
pygame.display.set_mode((config.CONF.width,config.CONF.height))
manager.WaitForPlayer()
pygame.time.wait(1)
skin.redraw()
class KaraokeBaseScreen(skin.Area):
def __init__(self):
skin.Area.__init__(self, 'content')
print "init base screen"
# Weather display fonts
self.key_font = skin.get_font('medium0')
self.val_font = skin.get_font('medium1')
self.small_font = skin.get_font('small0')
self.big_font = skin.get_font('huge0')
# set the multiplier to be used in all screen drawing
self.xmult = float(osd.width - config.OSD_OVERSCAN_LEFT - config.OSD_OVERSCAN_RIGHT) / 800
self.ymult = float(osd.height - config.OSD_OVERSCAN_TOP - config.OSD_OVERSCAN_BOTTOM) / 600
self.update_functions = (self.update_info, self.update_info, self.update_info, self.update_info)
def update_info(self):
print "update Info"
def update_content(self):
print "update content"
self.parent = self.menu
self.content = self.calc_geometry(self.layout.content, copy_object=True)
self.update_functions[self.menu.curSkin]()
def update_content_needed(self):
"""
check if the content needs an update
"""
return True
skin.register ( 'karaoke', ('screen', 'subtitle', 'title', 'plugin', KaraokeBaseScreen()) )
-------------------------------------------------------------------------
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-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users