+# -*- coding: ISO-8859-1 -*-\r
+#===============================================================================\r
+# VLC Player Plugin by A. Lätsch 2007\r
+#\r
+# This is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License as published by the Free\r
+# Software Foundation; either version 2, or (at your option) any later\r
+# version.\r
+#===============================================================================\r
+\r
from Screens.Screen import Screen\r
from Components.config import config\r
from Components.config import getConfigListEntry\r
\r
class VLCSettings(Screen, ConfigListScreen):\r
skin = """\r
- <screen name="VLCSettings" position="80,140" size="560,320" title="VLC Settings">\r
- <widget name="config" position="10,10" size="520,240" scrollbarMode="showOnDemand" />\r
- <ePixmap name="red" position="0,270" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-red.png" transparent="1" alphatest="on" />\r
- <ePixmap name="green" position="140,270" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-green.png" transparent="1" alphatest="on" />\r
- <ePixmap name="yellow" position="280,270" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-yellow.png" transparent="1" alphatest="on" />\r
- <ePixmap name="blue" position="420,270" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-blue.png" transparent="1" alphatest="on" />\r
- <widget name="key_red" position="0,270" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
- <widget name="key_green" position="140,270" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
- <widget name="key_yellow" position="280,270" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
- <widget name="key_blue" position="420,270" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
+ <screen name="VLCSettings" position="80,140" size="560,330" title="VLC Settings">\r
+ <widget name="config" position="10,10" size="540,250" scrollbarMode="showOnDemand" />\r
+ <ePixmap name="red" position="0,280" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-red.png" transparent="1" alphatest="on" />\r
+ <ePixmap name="green" position="140,280" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-green.png" transparent="1" alphatest="on" />\r
+ <ePixmap name="yellow" position="280,280" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-yellow.png" transparent="1" alphatest="on" />\r
+ <ePixmap name="blue" position="420,280" zPosition="4" size="140,40" pixmap="Nemesis.SkinSuite.Shared/key-blue.png" transparent="1" alphatest="on" />\r
+ <widget name="key_red" position="0,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
+ <widget name="key_green" position="140,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
+ <widget name="key_yellow" position="280,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
+ <widget name="key_blue" position="420,280" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />\r
</screen>"""\r
\r
def __init__(self, session):\r
cfglist.append(getConfigListEntry(_("Scale"), config.plugins.vlcplayer.scale))\r
cfglist.append(getConfigListEntry(_("Audio Codec"), config.plugins.vlcplayer.acodec))\r
cfglist.append(getConfigListEntry(_("Audio Bitrate"), config.plugins.vlcplayer.ab))\r
+ cfglist.append(getConfigListEntry(_("Audio Samplerate"), config.plugins.vlcplayer.samplerate))\r
cfglist.append(getConfigListEntry(_("Audio Channels"), config.plugins.vlcplayer.channels))\r
ConfigListScreen.__init__(self, cfglist, session)\r
\r
+# -*- coding: ISO-8859-1 -*-\r
+#===============================================================================\r
+# VLC Player Plugin by A. L�tsch 2007\r
+#\r
+# This is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License as published by the Free\r
+# Software Foundation; either version 2, or (at your option) any later\r
+# version.\r
+#===============================================================================\r
+\r
from urllib import urlencode\r
from urllib2 import urlopen\r
from xml.dom.minidom import parse\r
from Components.config import config\r
-import socket\r
+from socket import socket as socket_socket, AF_INET as socket_AF_INET, SOCK_STREAM as socket_SOCK_STREAM\r
\r
def getText(nodelist):\r
rc = ""\r
rc = rc + node.data\r
return rc\r
\r
+def getLocalHostIP( remote = ("www.python.org", 80)):\r
+ '''Get the "public" address of the local machine, i.e.\r
+ that address which is connected to the general internet.\r
+ Code by Donn Cave, posted to comp.lang.python'''\r
+ s = socket_socket(socket_AF_INET, socket_SOCK_STREAM)\r
+ s.connect( remote )\r
+ ip, localport = s.getsockname()\r
+ s.close()\r
+ return ip\r
+\r
class VlcControlHttp:\r
- defaultStreamName = "dreambox"\r
+ defaultStreamName = None\r
\r
def __init__(self, servernum):\r
cfg = config.plugins.vlcplayer.servers[servernum]\r
self.servercfg = cfg\r
self.host = cfg.host.value + ":" + str(cfg.httpport.value)\r
self.lastError = None\r
- try:\r
- self.defaultStreamName = "dream" + socket.gethostbyname(socket.gethostname()).split('.')[3]\r
- except Exception, e:\r
- pass\r
+ if VlcControlHttp.defaultStreamName is None:\r
+ try:\r
+ ip = getLocalHostIP( (cfg.host.value, cfg.httpport.value) )\r
+ VlcControlHttp.defaultStreamName = "dream" + str(ip)\r
+ except Exception, e:\r
+ VlcControlHttp.defaultStreamName = "dreambox"\r
\r
def connect(self):\r
pass\r
+# -*- coding: ISO-8859-1 -*-\r
+#===============================================================================\r
+# VLC Player Plugin by A. L�tsch 2007\r
+#\r
+# This is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License as published by the Free\r
+# Software Foundation; either version 2, or (at your option) any later\r
+# version.\r
+#===============================================================================\r
+\r
from Components.config import config\r
+from VlcControlHttp import getLocalHostIP\r
import socket\r
\r
def vlctime2sec(t):\r
return t/1000000\r
\r
class VlcControlTelnet:\r
- defaultStreamName = "dreambox"\r
+ defaultStreamName = None\r
\r
def __init__(self, servernum):\r
cfg = config.plugins.vlcplayer.servers[servernum]\r
port = cfg.adminport.value\r
self.address = (host, int(port));\r
self.passwd = cfg.adminpwd.value\r
- try:\r
- self.defaultStreamName = "dream" + socket.gethostbyname(socket.gethostname()).split('.')[3]\r
- except Exception, e:\r
- pass\r
+ if VlcControlTelnet.defaultStreamName is None:\r
+ try:\r
+ ip = getLocalHostIP( (cfg.host.value, cfg.httpport.value) )\r
+ VlcControlTelnet.defaultStreamName = "dream" + str(ip)\r
+ except Exception, e:\r
+ VlcControlTelnet.defaultStreamName = "dreambox"\r
\r
def __connect(self):\r
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r
+# -*- coding: ISO-8859-1 -*-\r
+#===============================================================================\r
+# VLC Player Plugin by A. Lätsch 2007\r
+#\r
+# This is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License as published by the Free\r
+# Software Foundation; either version 2, or (at your option) any later\r
+# version.\r
+#===============================================================================\r
+\r
from Components.FileList import FileEntryComponent\r
from Components.FileList import FileList\r
from Components.config import config\r
from urllib import urlencode\r
from urllib import urlopen\r
-from re import compile\r
-from xml.sax import ContentHandler, parse\r
-import os.path\r
+import posixpath\r
+import re\r
+import xml.sax\r
+\r
+def normpath(path):\r
+ if path is None:\r
+ return None\r
+ path = path.replace("\\","/").replace("//", "/")\r
+ if path == "/..":\r
+ return ""\r
+ if len(path) > 0 and path[0] != '/': \r
+ path = posixpath.normpath('/'+path)[1:]\r
+ else:\r
+ path = posixpath.normpath(path)\r
+\r
+ if len(path) == 0 or path == "//":\r
+ return "/"\r
+ elif path == ".":\r
+ return None\r
+ return path\r
\r
-class vlcBrowseXmlHandler(ContentHandler):\r
+class vlcBrowseXmlHandler(xml.sax.ContentHandler):\r
\r
def __init__(self, host, regex = None):\r
self.host = host\r
def startElement(self, name, attrs):\r
if name == "element" and attrs is not None:\r
type = attrs.getValue("type")\r
- name = attrs.getValue("name").encode("latin_1", "replace")\r
- path = self.host + ":" + attrs.getValue("path").encode("latin_1")\r
+ name = attrs.getValue("name").encode("utf8")\r
+ path = "%s:%s" % (self.host, normpath(attrs.getValue("path").encode("utf8")))\r
if type == "directory":\r
self.directories.append(FileEntryComponent(name, path, True))\r
elif len(path) > 0:\r
if req is None:\r
raise IOError, "No response from server"\r
handler = vlcBrowseXmlHandler(str(servernum), regex)\r
- parse(req, handler)\r
+ xml.sax.parse(req, handler)\r
return (handler.files, handler.directories)\r
\r
def initServerlist(self):\r
self.current_directory = None\r
self.current_server = None\r
self.current_path = None\r
-\r
+ \r
def changeDir(self, directory, select = None):\r
- print "[VLC] changeDir ", directory\r
+ print "[VLC] changeDir ", directory, select\r
if directory is None:\r
self.initServerlist()\r
return\r
\r
- directory = directory.replace("\\","/")\r
- directory = os.path.normpath(directory)\r
- if directory == ".":\r
- self.initServerlist()\r
- return\r
-\r
i = directory.find(":")\r
servernum = int(directory[0:i])\r
- path = directory[i+1:]\r
- if len(path) == 0:\r
- path = "/"\r
+ path = normpath(directory[i+1:])\r
+ if path is None:\r
+ self.initServerlist()\r
+ return\r
\r
if self.matchingPattern is not None:\r
- regex = compile(self.matchingPattern)\r
+ regex = re.compile(self.matchingPattern)\r
else:\r
regex = None\r
\r
\r
if select is not None:\r
self.setSelection(select)\r
+ else:\r
+ self.moveToIndex(0)\r
\r
def setSelection(self, select):\r
i = 0\r
+# -*- coding: ISO-8859-1 -*-\r
+#===============================================================================\r
+# VLC Player Plugin by A. Lätsch 2007\r
+#\r
+# This is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License as published by the Free\r
+# Software Foundation; either version 2, or (at your option) any later\r
+# version.\r
+#===============================================================================\r
+\r
from enigma import iPlayableServicePtr\r
from time import time\r
from Screens.Screen import Screen\r
from enigma import iPlayableService\r
from enigma import eTimer\r
from Components.ActionMap import ActionMap\r
-\r
from VlcControlTelnet import VlcControlTelnet\r
from VlcControlHttp import VlcControlHttp\r
\r
self.stats = None\r
return\r
print "[VLC] refresh"\r
- self.lastrefresh = time()\r
- self.stats = self.vlccontrol.status()\r
+ try:\r
+ self.stats = self.vlccontrol.status()\r
+ self.lastrefresh = time()\r
+ except Exception, e:\r
+ print e\r
\r
def refresh(self):\r
self.__onRefresh()\r
cfg = config.plugins.vlcplayer.servers[servernum]\r
if cfg.method.value == "telnet":\r
self.vlccontrol = VlcControlTelnet(servernum)\r
+ streamName = VlcControlTelnet.defaultStreamName\r
else:\r
self.vlccontrol = VlcControlHttp(servernum)\r
+ streamName = VlcControlHttp.defaultStreamName\r
self.vlcservice.setFilename(path)\r
\r
- self.url = "http://%s:%d/%s.ts" % (cfg.host.value, cfg.httpport.value, self.vlccontrol.defaultStreamName)\r
+ self.url = "http://%s:%d/%s.ts" % (cfg.host.value, cfg.httpport.value, streamName)\r
self.filename = path\r
- self.output = "#transcode{vcodec=%s,vb=%d,width=%s,height=%s,fps=%s,scale=%s,acodec=%s,ab=%d,channels=%d}:std{access=http,mux=ts,dst=/%s.ts}" % (\r
+ self.output = "#transcode{vcodec=%s,vb=%d,width=%s,height=%s,fps=%s,scale=%s,acodec=%s,ab=%d,channels=%d,samplerate=%s}:std{access=http,mux=ts,dst=/%s.ts}" % (\r
config.plugins.vlcplayer.vcodec.value, \r
config.plugins.vlcplayer.vb.value, \r
config.plugins.vlcplayer.width.value, \r
config.plugins.vlcplayer.acodec.value, \r
config.plugins.vlcplayer.ab.value, \r
config.plugins.vlcplayer.channels.value,\r
- self.vlccontrol.defaultStreamName\r
+ config.plugins.vlcplayer.samplerate.value,\r
+ streamName\r
)\r
self.play()\r
\r
-from Components.config import config, ConfigSubsection, ConfigSelection, ConfigInteger, ConfigSubList, ConfigText\r
+import Plugins.Plugin\r
+from Components.config import config\r
+from Components.config import ConfigSubsection\r
+from Components.config import ConfigSelection\r
+from Components.config import ConfigInteger\r
+from Components.config import ConfigSubList\r
+from Components.config import ConfigSubDict\r
+from Components.config import ConfigText\r
+from Components.config import configfile\r
\r
config.plugins.vlcplayer = ConfigSubsection()\r
config.plugins.vlcplayer.vcodec = ConfigSelection({"mp1v": "MPEG1", "mp2v": "MPEG2"}, "mp2v")\r
config.plugins.vlcplayer.vb = ConfigInteger(1000, (100, 9999))\r
-config.plugins.vlcplayer.acodec = ConfigSelection({"mpga":"MP1", "mp2a": "MP2", "mp3": "MP3"}, "mp2a")\r
+config.plugins.vlcplayer.acodec = ConfigSelection({"mpga":"MP1", "mp2a": "MP2", "mp3": "MP3"}, "mpga")\r
config.plugins.vlcplayer.ab = ConfigInteger(128, (64, 320))\r
-config.plugins.vlcplayer.channels = ConfigInteger(2, (2, 9))\r
+config.plugins.vlcplayer.samplerate = ConfigSelection({"0":"as Input", "44100": "44100", "48000": "48000"}, "48000")\r
+config.plugins.vlcplayer.channels = ConfigInteger(2, (1, 9))\r
config.plugins.vlcplayer.width = ConfigSelection(["352", "704", "720"])\r
config.plugins.vlcplayer.height = ConfigSelection(["288", "576"])\r
config.plugins.vlcplayer.fps = ConfigInteger(25, (1, 99))\r
+# -*- coding: ISO-8859-1 -*-
+#===============================================================================
+# VLC Player Plugin by A. Lätsch 2007
+#
+# This 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, or (at your option) any later
+# version.
+#===============================================================================
+
from Plugins.Plugin import PluginDescriptor
from Components.ActionMap import ActionMap
from Components.Label import Label
<widget name="key_blue" position="420,355" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
</screen>"""
- defaultFilter = "(?i)\.(avi|mpeg|mpg|divx|xvid|mov|ts|vob)$"
+ defaultFilter = "(?i)\.(avi|mpeg|mpg|divx|xvid|mp4|mov|ts|vob|wmv)$"
def __init__(self, session):
self.session = session