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
# -*- 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()

skin_object.register('karaoke', ('screen', 'title', 'scrollabletext', 'plugin'))

#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 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)
	menuw.osd.clearscreen(osd.COL_BLACK)
	menuw.osd.restartdisplay()



-------------------------------------------------------------------------
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

Reply via email to