Author: dmeyer Date: Sat Feb 25 19:07:04 2006 New Revision: 7939 Added: trunk/dbox/ trunk/dbox/setup.py trunk/dbox/src/ trunk/dbox/src/ui/ trunk/dbox/src/ui/lcd.py
Log: first draft of dbox plugins Added: trunk/dbox/setup.py ============================================================================== --- (empty file) +++ trunk/dbox/setup.py Sat Feb 25 19:07:04 2006 @@ -0,0 +1,58 @@ +# -*- coding: iso-8859-1 -*- +# ----------------------------------------------------------------------------- +# setup.py - setup script for dbox plugins +# ----------------------------------------------------------------------------- +# $Id$ +# +# ----------------------------------------------------------------------------- +# Freevo - A Home Theater PC framework +# Copyright (C) 2002-2006 Krister Lagerstrom, Dirk Meyer, et al. +# +# First Edition: Dirk Meyer <[EMAIL PROTECTED]> +# Maintainer: Dirk Meyer <[EMAIL PROTECTED]> +# +# Please see the file doc/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 +# +# ----------------------------------------------------------------------------- + +import os +from distutils.core import setup +from distutils.command.build_py import build_py as _build_py + +class build_py(_build_py): + def check_package (self, package, package_dir): + # The function is identical to the original one except + # it does not complain about missing __init__.py files. + # And it does no special checkings ;) + init_py = os.path.join(package_dir, "__init__.py") + if os.path.isfile(init_py): + return init_py + return None + + +# now start the python magic +setup (name = 'freevo-dbox', + version = '0.1', + description = 'Freevo DBox Plugins', + author = 'Dirk Meyer', + author_email = '[EMAIL PROTECTED]', + url = 'http://www.freevo.org', + package_dir = { 'freevo.ui.plugins': 'src/ui'}, + packages = [ 'freevo.ui.plugins' ], + license = 'GPL', + cmdclass = { 'build_py': build_py } + ) Added: trunk/dbox/src/ui/lcd.py ============================================================================== --- (empty file) +++ trunk/dbox/src/ui/lcd.py Sat Feb 25 19:07:04 2006 @@ -0,0 +1,81 @@ +import urllib +import time + +# kaa imports +from kaa.notifier import EventHandler, Timer +import kaa +import kaa.notifier + +# freevo imports +from event import * +from menu import MediaItem +import plugin + +class PluginInterface(plugin.Plugin): + def __init__(self): + plugin.Plugin.__init__(self) + self.dbox = 'dbox' + self._send(lock=1) + self.info = None + self.item = None + EventHandler(self.eventhandler).register() + Timer(self.status).start(0.1) + kaa.notifier.signals['shutdown'].connect(self.shutdown) + + def update(self): + pass + + + def status(self): + if self.item: + name = self.item.name + info1 = info2 = '' + if hasattr(self.item, 'tv_show_name'): + name = self.item.tv_show_name + info1 = self.item.tv_show_ep + if self.item['artist']: + info1 = self.item['artist'] + if self.item['album']: + info2 = self.item['album'] + pos = int(0.71 * min(100, self.item['elapsed:percent'])) + 2 + else: + name = 'Freevo Menu' + info1 = info2 = '' + pos = 2 + + t = time.strftime('%H:%M', time.localtime()) + + if (name, info1, info2, pos, t) == self.info: + return + self.update(name, info1, info2, pos, t) + + + @kaa.notifier.execute_in_thread('dbox') + def update(self, name, info1, info2, pos, t): + self.info = name, info1, info2, pos, t + self._send(clear=1, rect='0,50,75,60,1,0', font=1, size=13, + text=name, xpos=1, ypos=12) + if info1: + self._send(text=info1, xpos=1, ypos=25, size=11, font=0) + if info2: + self._send(text=info2, xpos=1, ypos=35, size=11, font=0) + + self._send(rect='2,52,%s,58,1,1' % pos, text=t, font=1, size=14, + xpos=80, ypos=62, update=1) + + + def eventhandler(self, event): + if event == PLAY_START and event.arg and isinstance(event.arg, MediaItem): + self.item = event.arg + if event == PLAY_END: + self.item = None + return True + + + def _send(self, **data): + params = urllib.urlencode(data) + urllib.urlopen('http://%s/control/lcd?%s' % (self.dbox, params)).close() + + + def shutdown(self): + self._send(lock=0) ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Freevo-cvslog mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog
