def StartProxy(self, li): session = self.parent.session id = li.getProperty("id") zonid = defines.ADDON.getSetting("proxy_zoneid") print "proxy_hls = %s" % defines.ADDON.getSetting("proxy_hls") if defines.ADDON.getSetting("proxy_hls") == "true": nohls = "0" else: nohls = "1" if (li.getProperty("type") == "channel"): data = defines.GET( "http://1ttvxbmc.top/v3/translation_http.php?session=%s&channel_id=%s&typeresult=json&zone_id=%s&nohls=%s" % (session, id, zonid, nohls)) elif (li.getProperty("type") == "record"): data = defines.GET( "http://1ttvxbmc.top/v3/arc_http.php?session=%s&record_id=%s&typeresult=json" % (self.parent.session, li.getProperty("id"))) jdata = json.loads(data) if not jdata["success"]: self.parent.showStatus("Канал временно не доступен") return url = jdata["source"] lit = xbmcgui.ListItem(li.getLabel(), iconImage=li.getProperty('icon'), thumbnailImage=li.getProperty('icon')) xbmc.Player().play(url, lit)
def Start(self, li): pass print "Start play " if not self.TSPlayer: LogToXBMC('InitTS') self.TSPlayer = tsengine(parent=self.parent) self.li = li LogToXBMC('Load Torrent') self.parent.showStatus("Получение ссылки...") data = None print li.getProperty("type") print li.getProperty("id") if (li.getProperty("type") == "channel"): data = defines.GET( "http://1ttvxbmc.top/v3/translation_stream.php?session=%s&channel_id=%s&typeresult=json" % (self.parent.session, li.getProperty("id"))) elif (li.getProperty("type") == "record"): data = defines.GET( "http://1ttvxbmc.top/v3/arc_stream.php?session=%s&record_id=%s&typeresult=json" % (self.parent.session, li.getProperty("id"))) else: self.parent.showStatus("Неизвестный тип контента") return if not data: self.parent.showStatus("Ошибка Torrent-TV.RU") return jdata = json.loads(data) print jdata if not jdata["success"]: self.parent.showStatus("Канал временно не доступен") return if jdata["success"] == 0: self.parent.showStatus(data["error"]) return if not jdata["source"]: self.parent.showStatus("Канал временно не доступен") return url = jdata["source"] mode = jdata["type"].upper().replace("CONTENTID", "PID") self.parent.hideStatus() LogToXBMC('Play torrent') self.TSPlayer.play_url_ind(0, li.getLabel(), li.getProperty('icon'), li.getProperty('icon'), torrent=url, mode=mode)
def StartNox(self, li): if not checkNox(self.nox_ip, self.nox_port): defines.showMessage("Noxbit незапущен") return data = defines.GET( "http://1ttvxbmc.top/v3/get_noxbit_cid.php?session=%s&channel_id=%s&typeresult=json" % (self.parent.session, li.getProperty("id"))) if not data: self.parent.showStatus("Ошибка Torrent-TV.AE") return jdata = json.loads(data) print jdata if not jdata["success"]: self.parent.showStatus("Канал временно не доступен") return if jdata["success"] == 0: self.parent.showStatus(data["error"]) return cid = jdata["cid"] if self.nox_hls: file = "hls" print "nox file = %s" % file else: file = "stream" url = "http://%s:%s/%s?cid=%s" % (self.nox_ip, self.nox_port, file, cid) lit = xbmcgui.ListItem(li.getLabel(), iconImage=li.getProperty('icon'), thumbnailImage=li.getProperty('icon')) xbmc.Player().play(url, lit)
def getAddr(self, params): data = defines.GET("http://2ip.ru/") beautifulSoup = BeautifulSoup(data) addr = beautifulSoup.find('big', attrs={'id': 'd_clip_button'}) addr = addr.string self.addrLabel.setLabel(addr) print "InfoForm адрес получен"