Permalink
Browse files

import of PLi enigma2 plugins (sorry, no history)

  • Loading branch information...
0 parents commit 9707b545971c742a1dd9d429ad00dc45c1537180 @pieterg pieterg committed Sep 23, 2009
Showing with 4,833 additions and 0 deletions.
  1. 0 AUTHORS
  2. 0 ChangeLog
  3. +339 −0 LICENSE
  4. +3 −0 Makefile.am
  5. 0 NEWS
  6. +3 −0 PLi/AntiLogo/Makefile.am
  7. 0 PLi/AntiLogo/__init__.py
  8. +291 −0 PLi/AntiLogo/plugin.py
  9. +8 −0 PLi/Bitrate/Makefile.am
  10. 0 PLi/Bitrate/__init__.py
  11. +88 −0 PLi/Bitrate/bitrate.py
  12. +3 −0 PLi/Bitrate/bitratetool/Makefile.am
  13. +234 −0 PLi/Bitrate/bitratetool/bitrate.cpp
  14. +79 −0 PLi/Bitrate/plugin.py
  15. +6 −0 PLi/LipSync/Makefile.am
  16. 0 PLi/LipSync/__init__.py
  17. +103 −0 PLi/LipSync/plugin.py
  18. +1 −0 PLi/Makefile.am
  19. +6 −0 PLi/MountManager/Makefile.am
  20. +341 −0 PLi/MountManager/MountManager.py
  21. +1 −0 PLi/MountManager/__init__.py
  22. +13 −0 PLi/MountManager/plugin.py
  23. +6 −0 PLi/NFSServer/Makefile.am
  24. 0 PLi/NFSServer/__init__.py
  25. +75 −0 PLi/NFSServer/plugin.py
  26. +5 −0 PLi/NewsReader/Makefile.am
  27. 0 PLi/NewsReader/__init__.py
  28. +612 −0 PLi/NewsReader/plugin.py
  29. +7 −0 PLi/PPanel/Makefile.am
  30. 0 PLi/PPanel/__init__.py
  31. +8 −0 PLi/PPanel/plugin.py
  32. +502 −0 PLi/PPanel/ppanel.py
  33. +21 −0 PLi/PPanel/url.py
  34. +6 −0 PLi/RemoteControlChannel/Makefile.am
  35. 0 PLi/RemoteControlChannel/__init__.py
  36. +73 −0 PLi/RemoteControlChannel/plugin.py
  37. +6 −0 PLi/ScreenPosition/Makefile.am
  38. 0 PLi/ScreenPosition/__init__.py
  39. +152 −0 PLi/ScreenPosition/plugin.py
  40. +7 −0 PLi/SnmpAgent/Makefile.am
  41. 0 PLi/SnmpAgent/__init__.py
  42. +74 −0 PLi/SnmpAgent/bitrate.py
  43. +49 −0 PLi/SnmpAgent/emm.py
  44. +612 −0 PLi/SnmpAgent/plugin.py
  45. +8 −0 PLi/SoftcamSetup/Makefile.am
  46. 0 PLi/SoftcamSetup/__init__.py
  47. +164 −0 PLi/SoftcamSetup/plimgr.py
  48. +13 −0 PLi/SoftcamSetup/plugin.py
  49. +197 −0 PLi/SoftcamSetup/softcamsetup.py
  50. +6 −0 PLi/StreamInterface/Makefile.am
  51. 0 PLi/StreamInterface/__init__.py
  52. +85 −0 PLi/StreamInterface/plugin.py
  53. +6 −0 PLi/UShare/Makefile.am
  54. 0 PLi/UShare/__init__.py
  55. +107 −0 PLi/UShare/plugin.py
  56. 0 README
  57. +486 −0 acinclude.m4
  58. +27 −0 configure.ac
No changes.
No changes.
339 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,3 @@
+AUTOMAKE_OPTIONS = gnu
+
+SUBDIRS = PLi
0 NEWS
No changes.
@@ -0,0 +1,3 @@
+installdir = /usr/lib/enigma2/python/Plugins/PLi/AntiLogo
+
+install_PYTHON = __init__.py plugin.py
No changes.
@@ -0,0 +1,291 @@
+from Screens.Screen import Screen
+from Screens.InfoBar import InfoBar
+from Screens.InputBox import InputBox
+from Screens.ChoiceBox import ChoiceBox
+from Components.ActionMap import ActionMap
+from Components.Label import Label
+from Components.MenuList import MenuList
+from Components.Input import Input
+from Plugins.Plugin import PluginDescriptor
+
+from enigma import ePoint, eSize
+
+from ConfigParser import ConfigParser, DEFAULTSECT, DuplicateSectionError
+
+class AntiLogoMain(InfoBar):
+ def __init__(self, session, args = 0, size = None, position = None):
+ config = AntiLogoConfig()
+ try:
+ preset = config.getLastPreset()
+ self.size = [preset["width"], preset["height"]]
+ self.position = [preset["x"], preset["y"]]
+ except Exception:
+ config.setPreset("standard",[100, 100],[20, 20])
+ config = AntiLogoConfig()
+ preset = config.getPreset("standard")
+
+ self.size = [preset["width"],preset["height"]]
+ self.position = [preset["x"],preset["y"]]
+ skin = "<screen position=\"%i,%i\" size=\"%i,%i\" title=\"%s\" flags=\"wfNoBorder\" >" %(preset["x"],preset["y"],preset["width"],preset["height"], "AntiLogo")
+ skin += "<widget name=\"label\" position=\"0,0\" size=\"%i,%i\" backgroundColor=\"transpBlack\" />" %(preset["width"],preset["height"])
+ skin += "</screen>"
+ self.skin = skin
+ InfoBar.__init__(self, session)
+ self.hideTimer.callback.pop()
+
+ self["label"] = Label()
+ self["actions"] = ActionMap(["MenuActions"],
+ {
+ "menu": self.openmenu,
+ }, prio=-4)
+
+ def openmenu(self):
+ self.session.open(AntiLogoMenu, callback = self.menuCallback, size = self.size, position = self.position)
+
+ def menuCallback(self, size, position):
+ if size and position:
+ self.size = size
+ self.position = position
+ self.move(self.position[0], self.position[1])
+ self.resize(self.size[0], self.size[1])
+ else:
+ self.close()
+
+ def move(self, x, y):
+ self.instance.move(ePoint(x, y))
+
+ def resize(self, w, h):
+ self.instance.resize(eSize(*(w, h)))
+ self["label"].instance.resize(eSize(*(w, h)))
+
+class AntiLogoBase(Screen):
+ def __init__(self, session, size, position):
+ preset = {}
+ preset["width"] = size[0]
+ preset["height"] = size[1]
+ preset["x"] = position[0]
+ preset["y"] = position[1]
+ self.size = [preset["width"], preset["height"]]
+ self.position = [preset["x"], preset["y"]]
+ skin = "<screen position=\"%i,%i\" size=\"%i,%i\" title=\"%s\" flags=\"wfNoBorder\" >" %(preset["x"], preset["y"],preset["width"], preset["height"], "AntiLogo")
+ skin += "<widget name=\"label\" position=\"0,0\" size=\"%i,%i\" backgroundColor=\"transpBlack\" />" %(preset["width"],preset["height"])
+ skin += "</screen>"
+ self.skin = skin
+ Screen.__init__(self, session)
+ self["label"] = Label()
+ self["actions"] = ActionMap(["WizardActions", "DirectionActions", "MenuActions"],
+ {
+ "ok": self.go,
+ "back": self.go,
+ "menu": self.go,
+ "down": self.down,
+ "up": self.up,
+ "left": self.left,
+ "right": self.right,
+ }, -1)
+
+ def move(self, x, y):
+ self.instance.move(ePoint(x, y))
+
+ def resize(self, w, h):
+ self.instance.resize(eSize(*(w, h)))
+ self["label"].instance.resize(eSize(*(w, h)))
+
+class AntiLogoMove(AntiLogoBase):
+ step = 5
+ def __init__(self, session, args = 0, size = [], position = []):
+ AntiLogoBase.__init__(self, session, size, position)
+
+ def go(self):
+ self.close(self.position)
+
+ def up(self):
+ self.position = [self.position[0],self.position[1]-self.step]
+ self.move(self.position[0],self.position[1])
+
+ def down(self):
+ self.position = [self.position[0],self.position[1]+self.step]
+ self.move(self.position[0],self.position[1])
+
+ def left(self):
+ self.position = [self.position[0]-self.step,self.position[1]]
+ self.move(self.position[0],self.position[1])
+
+ def right(self):
+ self.position = [self.position[0]+self.step,self.position[1]]
+ self.move(self.position[0],self.position[1])
+
+class AntiLogoResize(AntiLogoBase):
+ step = 5
+ def __init__(self, session, args = 0, size = [], position = []):
+ AntiLogoBase.__init__(self, session, size, position)
+
+ def go(self):
+ self.close(self.size)
+
+ def up(self):
+ self.size = [self.size[0],self.size[1]-self.step]
+ self.resize(self.size[0],self.size[1])
+
+ def down(self):
+ self.size = [self.size[0],self.size[1]+self.step]
+ self.resize(self.size[0],self.size[1])
+
+ def left(self):
+ self.size= [self.size[0]-self.step,self.size[1]]
+ self.resize(self.size[0],self.size[1])
+
+ def right(self):
+ self.size = [self.size[0]+self.step,self.size[1]]
+ self.resize(self.size[0],self.size[1])
+
+class AntiLogoMenu(Screen):
+ def __init__(self,session,callback=None,size=None,position=None,arg=0):
+ self.session = session
+ self.callBack = callback
+ self.size= size
+ self.position = position
+ ss ="<screen position=\"200,200\" size=\"300,200\" title=\"AntiLogo menu\" >"
+ ss +="<widget name=\"menu\" position=\"0,0\" size=\"300,150\" scrollbarMode=\"showOnDemand\" />"
+ ss +="</screen>"
+ self.skin = ss
+ Screen.__init__(self,session)
+ list = []
+ list.append((_("exit"), self.exit))
+ list.append((_("move"), self.move))
+ list.append((_("resize"), self.resize))
+ list.append((_("load"), self.load))
+ list.append((_("save"), self.save))
+ list.append((_("save as"), self.saveas))
+ self["menu"] = MenuList(list)
+ self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
+ {
+ "ok": self.go,
+ "back": self.close,
+ }, -1)
+
+ def exit(self):
+ self.callBack(None, None)
+ self.close()
+
+ def go(self):
+ selection = self["menu"].getCurrent()
+ selection[1]()
+
+ def load(self):
+ config = AntiLogoConfig()
+ list = []
+ for i in config.getPresets():
+ list.append((i,i))
+ self.session.openWithCallback(self.loadPreset,ChoiceBox,_("select preset to load"),list)
+
+ def loadPreset(self,value):
+ if value is not None:
+ config = AntiLogoConfig()
+ preset = config.getPreset(value[1])
+ if preset is not False:
+ self.callBack([preset["width"],preset["height"]],[preset["x"],preset["y"]])
+
+ def presetnameEntered(self,value):
+ if value is not None:
+ config = AntiLogoConfig()
+ config.setPreset(value,self.size,self.position)
+
+ def save(self):
+ config = AntiLogoConfig()
+ list = []
+ for i in config.getPresets():
+ list.append((i, i))
+ self.session.openWithCallback(self.savePreset, ChoiceBox,_("select preset to save"), list)
+
+ def saveas(self):
+ name = ""
+ if self.session.nav.getCurrentService():
+ name = self.session.nav.getCurrentService().info().getName()
+ self.session.openWithCallback(self.presetnameEntered, InputBox, title = _("please enter a name"), text=name, maxSize=False, type=Input.TEXT)
+
+ def savePreset(self, value):
+ if value is not None:
+ config = AntiLogoConfig()
+ config.setPreset(value[1], self.size, self.position)
+
+ def move(self):
+ self.session.openWithCallback(self.moveCompleted, AntiLogoMove, size = self.size, position = self.position)
+
+ def moveCompleted(self, position):
+ self.position = position
+ self.callBack(self.size, self.position)
+
+ def resize(self):
+ self.session.openWithCallback(self.resizeCompleted, AntiLogoResize, size = self.size, position = self.position)
+
+ def resizeCompleted(self, size):
+ self.size = size
+ self.callBack(self.size, self.position)
+
+class AntiLogoConfig:
+ configfile = "/etc/enigma2/AntiLogo.conf"
+
+ def __init__(self):
+ self.configparser = ConfigParser()
+ self.configparser.read(self.configfile)
+
+ def setLastPreset(self,name):
+ self.configparser.set(DEFAULTSECT, "lastpreset",name)
+ self.writeConfig()
+
+ def getLastPreset(self):
+ last = self.configparser.get(DEFAULTSECT, "lastpreset")
+ return self.getPreset(last)
+
+ def getPresets(self):
+ presets = []
+ sections = self.configparser.sections()
+ for section in sections:
+ presets.append(section)
+ return presets
+
+ def getPreset(self,name):
+ if self.configparser.has_section(name) is True:
+ print "loading preset ",name
+ l = {}
+ l["x"] = int(self.configparser.get(name, "x"))
+ l["y"] = int(self.configparser.get(name, "y"))
+ l["width"] = int(self.configparser.get(name, "width"))
+ l["height"] = int(self.configparser.get(name, "height"))
+ self.setLastPreset(name)
+ return l
+ else:
+ print "couldn't find preset", name
+ return False
+
+ def setPreset(self,name,size,position):
+ try:
+ self.configparser.add_section(name)
+ self.configparser.set(name, "x", position[0])
+ self.configparser.set(name, "y", position[1])
+ self.configparser.set(name, "width", size[0])
+ self.configparser.set(name, "height", size[1])
+ self.configparser.set(DEFAULTSECT, "lastpreset",name)
+ self.writeConfig()
+ return True
+ except DuplicateSectionError:
+ self.deletePreset(name)
+ self.setPreset(name, size, position)
+
+ def deletePreset(self,name):
+ self.configparser.remove_section(name)
+ self.writeConfig()
+
+ def writeConfig(self):
+ fp = open(self.configfile, "w")
+ self.configparser.write(fp)
+ fp.close()
+
+
+def main(session, **kwargs):
+ session.open(AntiLogoMain)
+
+def Plugins(**kwargs):
+ return [PluginDescriptor(name = "AntiLogo" ,description = _("mask irritating logos"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main),
+ PluginDescriptor(name = "AntiLogo", description = _("mask irritating logos"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main)]
@@ -0,0 +1,8 @@
+installdir = $(LIBDIR)/enigma2/python/Plugins/PLi/Bitrate
+
+install_PYTHON = \
+ __init__.py \
+ plugin.py \
+ bitrate.py
+
+SUBDIRS = bitratetool
No changes.
@@ -0,0 +1,88 @@
+from enigma import eConsoleAppContainer, iServiceInformation
+
+class Bitrate:
+ def __init__(self, session, refresh_func = None, finished_func = None):
+ self.session = session
+ self.refresh_func = refresh_func
+ self.finished_func = finished_func
+
+ self.remainingdata = ""
+ self.running = False
+ self.clearValues()
+ self.datalines = []
+ self.container = eConsoleAppContainer()
+ self.container.appClosed.append(self.appClosed)
+ self.container.dataAvail.append(self.dataAvail)
+
+ def start(self):
+ if self.running:
+ return
+ service = self.session.nav.getCurrentService()
+ if service:
+ #stream() doesn't work in HEAD enigma2, default data demux for tuner 0 seems to be 2...
+ demux = 2
+ try:
+ stream = service.stream()
+ if stream:
+ streamdata = stream.getStreamingData()
+ if streamdata and 'demux' in streamdata:
+ demux = streamdata["demux"]
+ except:
+ pass
+ info = service.info()
+ vpid = info.getInfo(iServiceInformation.sVideoPID)
+ apid = info.getInfo(iServiceInformation.sAudioPID)
+ cmd = "bitrate "
+ cmd += str(demux)
+ cmd += " "
+ cmd += str(vpid)
+ cmd += " "
+ cmd += str(apid)
+ self.running = True
+ self.container.execute(cmd)
+
+ def clearValues(self):
+ self.vmin = 0
+ self.vmax = 0
+ self.vavg = 0
+ self.vcur = 0
+ self.amin = 0
+ self.amax = 0
+ self.aavg = 0
+ self.acur = 0
+
+ def stop(self):
+ self.container.kill()
+ self.remainingdata = ""
+ self.clearValues()
+ self.running = False
+
+ def appClosed(self, retval):
+ self.remainingdata = ""
+ self.clearValues()
+ self.running = False
+ if self.finished_func:
+ self.finished_func(retval)
+
+ def dataAvail(self, str):
+ #prepend any remaining data from the previous call
+ str = self.remainingdata + str
+ #split in lines
+ newlines = str.split('\n')
+ #'str' should end with '\n', so when splitting, the last line should be empty. If this is not the case, we received an incomplete line
+ if len(newlines[-1]):
+ #remember this data for next time
+ self.remainingdata = newlines[-1]
+ newlines = newlines[0:-1]
+ else:
+ self.remainingdata = ""
+
+ for line in newlines:
+ if len(line):
+ self.datalines.append(line)
+ if len(self.datalines) >= 2:
+ self.vmin, self.vmax, self.vavg, self.vcur = self.datalines[0].split(' ')
+ self.amin, self.amax, self.aavg, self.acur = self.datalines[1].split(' ')
+ self.datalines = []
+ if self.refresh_func:
+ self.refresh_func()
Oops, something went wrong.

0 comments on commit 9707b54

Please sign in to comment.