def DeleteTimerConfirmed(self, timerentry, answer):
    if answer:
        ip = "%d.%d.%d.%d" % tuple(self.partnerboxentry.ip.value)
        port = self.partnerboxentry.port.value
        http = "http://%s:%d" % (ip, port)
        if int(self.partnerboxentry.enigma.value) == 0:
            sCommand = (
                http
                + "/web/timerdelete?sRef="
                + timerentry.servicereference
                + "&begin="
                + ("%s" % (timerentry.timebegin))
                + "&end="
                + ("%s" % (timerentry.timeend))
            )
        else:
            sCommand = (
                http
                + "/deleteTimerEvent?ref="
                + timerentry.servicereference
                + "&start="
                + ("%s" % (timerentry.timebegin))
                + "&type="
                + ("%s" % (timerentry.type))
                + "&force=yes"
            )
        sendPartnerBoxWebCommand(sCommand, None, 3, "root", self.partnerboxentry.password.value).addCallback(
            self.DeleteTimerCallback
        ).addErrback(DeleteTimerCallbackError)
	def menuCallback(self, choice):
		if choice is None:
			return
		try:sel = self["entrylist"].l.getCurrentSelection()[0]
		except: sel = None
		if sel is None:
			return
		password = sel.password.value
		username = "******"
		ip = "%d.%d.%d.%d" % tuple(sel.ip.value)
		port = sel.port.value
		http = "http://%s:%d" % (ip,port)
		enigma_type = int(sel.enigma.value)
		sCommand = http
		sCommand += enigma_type and "/cgi-bin/admin?command=" or "/web/powerstate?newstate="
		if choice[1] == 0:
			sCommand += enigma_type and "wakeup" or "4"
		elif choice[1] == 1:
			sCommand += enigma_type and "standby" or "5"
		elif choice[1] == 2:
			sCommand += enigma_type and "restart" or "3"
		elif choice[1] == 3:
			sCommand += enigma_type and "reboot"  or "2"
		elif choice[1] == 4:
			sCommand += enigma_type and "shutdown" or "0"
		elif choice[1] == 5:
			if enigma_type:
				return
			sCommand += "1"
		else:
			return
		from PartnerboxFunctions import sendPartnerBoxWebCommand
		sendPartnerBoxWebCommand(sCommand, None,3, username, password)
	def menuCallback(self, choice):
		if choice is None:
			return
		sel = self.getSelected()
		if sel is None:
			return
		(password, username, http, cmd, enigma_type) = self.getPars(sel)
		sCommand = cmd
		if choice[1] == 0:
			sCommand += enigma_type and "wakeup" or "4"
		elif choice[1] == 1:
			sCommand += enigma_type and "standby" or "5"
		elif choice[1] == 2:
			sCommand += enigma_type and "restart" or "3"
		elif choice[1] == 3:
			sCommand += enigma_type and "reboot"  or "2"
		elif choice[1] == 4:
			sCommand += enigma_type and "shutdown" or "0"
		elif choice[1] == 5:
			if enigma_type:
				return
			sCommand += "1"
		elif choice[1] == 6:
			self.sendWOL(sel.mac.value)
			return
		elif choice[1] == 10:
			self.setFallbackTuner(sel.name.value, ip)
			return
		elif choice[1] == 11:
			sCommand = http
			sCommand += enigma_type and "/cgi-bin/audio?mute=1" or "/web/vol?set=mute"
		else:
			return
		sendPartnerBoxWebCommand(sCommand, None,3, username, password)
	def powerStandby(self):
		sel = self.getSelected()
		if sel is None:
			return
		(password, username, http, cmd, enigma_type) = self.getPars(sel)
		sCommand = cmd
		sCommand += enigma_type and "standby" or "5"
		sendPartnerBoxWebCommand(sCommand, None, 3, username, password)
	def powerMute(self):
		sel = self.getSelected()
		if sel is None:
			return
		(password, username, http, cmd, enigma_type) = self.getPars(sel)
		sCommand = http
		sCommand += enigma_type and "/cgi-bin/audio?mute=1" or "/web/vol?set=mute"
		sendPartnerBoxWebCommand(sCommand, None, 3, username, password)
	def callbackAutoTimerOverview(self, partnerboxentry, autotimer, result):
		if result is not None:
			parameter = {'xml': autotimer.writeXmlTimer(autotimer.timers)}
			ip = "%d.%d.%d.%d" % tuple(partnerboxentry.ip.value)
			port = partnerboxentry.port.value
			username = "******"
			password = partnerboxentry.password.value
			sCommand = "http://%s:%d/autotimer/upload_xmlconfiguration" % (ip,port)
			sendPartnerBoxWebCommand(sCommand, None, 10, username, password, parameter=parameter).addCallback(self.downloadCallback).addErrback(self.downloadError)
	def partnerboxplugin(self, unUsed, parameter, partnerboxentry = None):
		if partnerboxentry is None:
			return
		ip = "%d.%d.%d.%d" % tuple(partnerboxentry.ip.value)
		port = partnerboxentry.port.value
		username = "******"
		password = partnerboxentry.password.value
		sCommand = "http://%s:%d/autotimer/add_xmltimer" % (ip,port)
		sendPartnerBoxWebCommand(sCommand, None, 10, username, password, parameter=parameter).addCallback(self.downloadCallback).addErrback(self.downloadError)
	def getPartnerboxAutoTimerList(self, unUsed1, unUsed2, partnerboxentry = None):
		if partnerboxentry is None:
			return
		ip = "%d.%d.%d.%d" % tuple(partnerboxentry.ip.value)
		port = partnerboxentry.port.value
		username = "******"
		password = partnerboxentry.password.value
		sCommand = "http://%s:%d/autotimer?webif=false" % (ip,port)
		print sCommand
		sendPartnerBoxWebCommand(sCommand, None, 10, username, password).addCallback(self.getPartnerboxAutoTimerListCallback, partnerboxentry).addErrback(self.downloadError)
def GetPartnerboxTimerlist(self):
	if self.partnerboxentry is not None:
		ip = "%d.%d.%d.%d" % tuple(self.partnerboxentry.ip.value)
		port = self.partnerboxentry.port.value
		http = "http://%s:%d" % (ip,port)
		if int(self.partnerboxentry.enigma.value) == 0:
			sCommand = http + "/web/timerlist"
		else:
			sCommand = http + "/xml/timers"
		print "[Partnerbox] %s"%sCommand
		sendPartnerBoxWebCommand(sCommand, None,3, "root", self.partnerboxentry.password.value).addCallback(self.GetPartnerboxTimerlistCallback).addErrback(GetPartnerboxTimerlistCallbackError)
 def getPartnerboxAutoTimerList(self,
                                unUsed1,
                                unUsed2,
                                partnerboxentry=None):
     if partnerboxentry is None:
         return
     ip = "%d.%d.%d.%d" % tuple(partnerboxentry.ip.value)
     port = partnerboxentry.port.value
     username = "******"
     password = partnerboxentry.password.value
     webiftype = partnerboxentry.webinterfacetype.value
     sCommand = "http://%s:%d/autotimer?webif=false" % (ip, port)
     sendPartnerBoxWebCommand(
         sCommand, 10, username, password, webiftype).addCallback(
             self.getPartnerboxAutoTimerListCallback,
             partnerboxentry).addErrback(self.downloadError)
Exemple #11
0
def addInfiniteRemoteRecording(self, session, what, partnerboxentry):
	if setPartnerboxData(self, self.session, None, partnerboxentry):
		self.sref = getServiceReference(self)
		if self.sref == "":
			self.session.open(MessageBox, _("This is not a Partnerbox channel"), MessageBox.TYPE_ERROR, timeout=5)
		else:
			begin = int(time())
			end = begin + 3600
			#todo: read insta rec dir
			name = urllib.quote(_("Instant Record"))
			dir = urllib.quote("/media/hdd/movie/")
			url = "http://%s:%d/web/timeradd?sRef=%s&begin=%d&end=%d&name=%s&dirname=%s&eit=0&description=" %(self.ip, self.port, self.sref, begin, end, name, dir)
			
			sendPartnerBoxWebCommand(url).addCallback(boundFunction(RemoteInstantRecordCallback, self)).addErrback(boundFunction(RemoteInstantRecordError, self))	
	else:
		self.session.open(MessageBox, _("Partnerbox Serverbox does not support recording"), MessageBox.TYPE_ERROR, timeout=5)	
Exemple #12
0
def GetPartnerboxTimerlist(self):
    try:
        if self.partnerboxentry is not None:
            ip = "%d.%d.%d.%d" % tuple(self.partnerboxentry.ip.value)
            port = self.partnerboxentry.port.value
            http = "http://%s:%d" % (ip, port)
            if int(self.partnerboxentry.enigma.value) == 0:
                sCommand = http + "/web/timerlist"
            else:
                sCommand = http + "/xml/timers"
            sendPartnerBoxWebCommand(
                sCommand, None, 3, "root",
                self.partnerboxentry.password.value).addCallback(
                    self.GetPartnerboxTimerlistCallback).addErrback(
                        GetPartnerboxTimerlistCallbackError)
    except:
        pass
Exemple #13
0
 def callbackAutoTimerOverview(self, partnerboxentry, autotimer, result):
     if result is not None:
         parameter = {'xml': autotimer.writeXmlTimer(autotimer.timers)}
         ip = "%d.%d.%d.%d" % tuple(partnerboxentry.ip.value)
         port = partnerboxentry.port.value
         username = "******"
         password = partnerboxentry.password.value
         sCommand = "http://%s:%d/autotimer/upload_xmlconfiguration" % (
             ip, port)
         sendPartnerBoxWebCommand(sCommand,
                                  None,
                                  10,
                                  username,
                                  password,
                                  parameter=parameter).addCallback(
                                      self.downloadCallback).addErrback(
                                          self.downloadError)
 def partnerboxplugin(self, unUsed, parameter, partnerboxentry=None):
     if partnerboxentry is None:
         return
     ip = "%d.%d.%d.%d" % tuple(partnerboxentry.ip.value)
     port = partnerboxentry.port.value
     username = "******"
     password = partnerboxentry.password.value
     webiftype = partnerboxentry.webinterfacetype.value
     sCommand = "http://%s:%d/autotimer/add_xmltimer" % (ip, port)
     sendPartnerBoxWebCommand(sCommand,
                              10,
                              username,
                              password,
                              webiftype,
                              None,
                              parameter=parameter).addCallback(
                                  self.downloadCallback).addErrback(
                                      self.downloadError)
def DeleteTimerConfirmed(self, timerentry, answer):
    if answer:
        ip = "%d.%d.%d.%d" % tuple(self.partnerboxentry.ip.value)
        port = self.partnerboxentry.port.value
        http = "http://%s:%d" % (ip, port)
        if int(self.partnerboxentry.enigma.value) == 0:
            sCommand = http + "/web/timerdelete?sRef=" + timerentry.servicereference + "&begin=" + (
                "%s" %
                (timerentry.timebegin)) + "&end=" + ("%s" %
                                                     (timerentry.timeend))
        else:
            sCommand = http + "/deleteTimerEvent?ref=" + timerentry.servicereference + "&start=" + (
                "%s" % (timerentry.timebegin)) + "&type=" + (
                    "%s" % (timerentry.type)) + "&force=yes"
        sendPartnerBoxWebCommand(
            sCommand, None, 3, "root",
            self.partnerboxentry.password.value).addCallback(
                self.DeleteTimerCallback).addErrback(DeleteTimerCallbackError)
Exemple #16
0
 def menuCallback(self, choice):
     if choice is None:
         return
     try:
         sel = self["entrylist"].l.getCurrentSelection()[0]
     except:
         sel = None
     if sel is None:
         return
     password = sel.password.value
     username = "******"
     ip = "%d.%d.%d.%d" % tuple(sel.ip.value)
     port = sel.port.value
     http = "http://%s:%d" % (ip, port)
     enigma_type = int(sel.enigma.value)
     sCommand = http
     sCommand += enigma_type and "/cgi-bin/admin?command=" or "/web/powerstate?newstate="
     if choice[1] == 0:
         sCommand += enigma_type and "wakeup" or "4"
     elif choice[1] == 1:
         sCommand += enigma_type and "standby" or "5"
     elif choice[1] == 2:
         sCommand += enigma_type and "restart" or "3"
     elif choice[1] == 3:
         sCommand += enigma_type and "reboot" or "2"
     elif choice[1] == 4:
         sCommand += enigma_type and "shutdown" or "0"
     elif choice[1] == 5:
         if enigma_type:
             return
         sCommand += "1"
     elif choice[1] == 6:
         self.sendWOL(sel.mac.value)
         return
     elif choice[1] == 10:
         self.setFallbackTuner(sel.name.value, ip)
         return
     else:
         return
     from PartnerboxFunctions import sendPartnerBoxWebCommand
     sendPartnerBoxWebCommand(sCommand, None, 3, username, password)
Exemple #17
0
def getEPGNowCallback(self, result):
	text = ""
	try:
		root = xml.etree.cElementTree.fromstring(result)
	except:
		pass
	
	event = root.find("e2event", None)
	if event is not None:
		eventid = event.findtext("e2eventid", None)
		if eventid is not None:
			# add a timer for the current event
			url = "http://%s:%d/web/timeraddbyeventid?sRef=%s&eventid=%s" %(self.ip, self.port, self.sref, eventid)
		else:
			begin = int(time())
			end = begin + 3600
			name = urllib.quote(_("Instant Record"))
			#todo: read insta rec dir		
			dir = urllib.quote("/media/hdd/movie/")
			url = "http://%s:%d/web/timeradd?sRef=%s&begin=%d&end=%d&name=%s&dirname=%s&eit=0" %(self.ip, self.port, self.sref, begin, end, name, dir)
	
		sendPartnerBoxWebCommand(url).addCallback(boundFunction(RemoteInstantRecordCallback, self)).addErrback(boundFunction(RemoteInstantRecordError, self))