PDA

View Full Version : plugin coding help req



delboy13
12-04-14, 13:45
i've manged to get an old version of open pli working on my sunray , if i use telnet command for plugin from tmp it works no probs. but if i use plugin it will read and parse sdt but get loads of nit errors. i think it is because plugin was from AutoBouquets E2 UltraLite for which you use plugin to choose region and i just want to run script. i think it might be this part of script having problems if someone could look for me


def go(self):
self.shcom("/usr/lib/enigma2/python/Plugins/Extensions/AutoBouquets/autobouquets_c2.sh ")


def shcom(self, com):
if fileExists("/usr/bin/dvbsnoop"):
self.session.open(Console,_("autobouquets_c2.sh"), ["%s" % com])

["%s" % com]) that is my guess but i don't know nowt about coding, just started linux commands online and this is python hopefully learn it one day

here is most of script just incase


from Screens.Screen import Screen
from Screens.Console import Console
from Screens.MessageBox import MessageBox
from Components.MenuList import MenuList
from Components.ActionMap import ActionMap
from Components.Button import Button
from Tools.Directories import fileExists
from Plugins.Plugin import PluginDescriptor

class MyShCom(Screen):
skin = """
<screen position="center,center" size="365,100" title="AutoBouquets C2" >
<widget name="key_red" position="24,5" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;18" transparent="1"/>
<widget name="key_green" position="200,5" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;18" transparent="1"/>
<widget name="key_yellow" position="24,55" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;18" transparent="1"/>
<widget name="key_blue" position="200,55" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;18" transparent="1"/>
<ePixmap name="red" position="25,5" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
<ePixmap name="green" position="200,5" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
<ePixmap name="yellow" position="24,55" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
<ePixmap name="blue" position="200,55" zPosition="2" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
</screen>"""

def __init__(self, session, args = 0):
self.session = session

Screen.__init__(self, session)

self["key_red"] = Button(_("Cancel"))
self["key_green"] = Button(_("Start"))
self["key_yellow"] = Button(_("Help"))
self["key_blue"] = Button(_("About"))

self["myActionMap"] = ActionMap(["SetupActions", "ColorActions"],
{
"red": self.cancel,
"green": self.go,
"yellow": self.help,
"blue": self.about,
"cancel": self.cancel,
"ok": self.go
}, -1)

def go(self):
self.shcom("/usr/lib/enigma2/python/Plugins/Extensions/AutoBouquets/autobouquets_c2.sh ")


def shcom(self, com):
if fileExists("/usr/bin/dvbsnoop"):
self.session.open(Console,_("autobouquets_c2.sh"), ["%s" % com])
else:
self.session.open(MessageBox,"dvbsnoop not found!",MessageBox.TYPE_ERROR)
print "[AutoBouquets] dvbsnoop failed!"