def check(): logger.info("deportesalacarta.channels.update_sports Comprobando versión") try: # Lee el fichero con la versión instalada global bin fichero = open(LOCAL_XML_FILE, "r") data = fichero.read() fichero.close() version_local = scrapertools.find_single_match( data, "<version>([^<]+)</version>").strip() url_repo = "" server = "" if float(version_local) > 1.15: for i in range(3): bin = base64.b64decode(bin) data = eval(httptools.downloadpage(bin, hide=True).data) version_publicada = data["version"] message = data["changes"] url_repo = data["link"] server = data["server"] else: data = scrapertools.downloadpage(REMOTE_VERSION_FILE) version_publicada = scrapertools.find_single_match( data, "<version>([^<]+)</version>").strip() message = scrapertools.find_single_match( data, "<changes>([^<]+)</changes>").strip() logger.info( "deportesalacarta.channels.update_sports Versión en el repositorio: %s" % version_publicada) logger.info( "deportesalacarta.channels.update_sports Versión local: %s" % version_local) if float(version_publicada) > float(version_local): logger.info( "deportesalacarta.channels.update_sports Nueva versión encontrada" ) return True, version_publicada, message, url_repo, server else: logger.info( "deportesalacarta.channels.update_sports No existe versión actualizada" ) return False, "", "", "", "" except: import traceback logger.error("deportesalacarta.platformcode.launcher " + traceback.format_exc()) return False, "", "", "", ""
def remote_call(url, parameters={}, require_session=True): logger.info("url=" + url + ", parameters=" + repr(parameters)) if not url.startswith("http"): url = MAIN_URL + "/" + url if not "api_key" in parameters: parameters["api_key"] = API_KEY # Add session token if not here # if not "s" in parameters and require_session: # parameters["s"] = get_session_token() headers = DEFAULT_HEADERS post = urllib.urlencode(parameters) response_body = scrapertools.downloadpage(url, post, headers) return jsontools.load(response_body)
def remote_call(url,parameters={},require_session=True): logger.info("streamondemand.core.api.remote_call url="+url+", parameters="+repr(parameters)) if not url.startswith("http"): url = MAIN_URL + "/" + url if not "api_key" in parameters: parameters["api_key"] = API_KEY # Add session token if not here #if not "s" in parameters and require_session: # parameters["s"] = get_session_token() headers = DEFAULT_HEADERS post = urllib.urlencode(parameters) response_body = scrapertools.downloadpage(url,post,headers) return jsontools.load_json(response_body)
def check(): logger.info("deportesalacarta.channels.update_sports Comprobando versión") try: data = scrapertools.downloadpage(REMOTE_VERSION_FILE) version_publicada = scrapertools.find_single_match( data, "<version>([^<]+)</version>").strip() message = scrapertools.find_single_match( data, "<changes>([^<]+)</changes>").strip() logger.info( "deportesalacarta.channels.update_sports Versión en el repositorio: %s" % version_publicada) # Lee el fichero con la versión instalada fichero = open(LOCAL_XML_FILE, "r") data = fichero.read() fichero.close() version_local = scrapertools.find_single_match( data, "<version>([^<]+)</version>").strip() logger.info( "deportesalacarta.channels.update_sports Versión local: %s" % version_local) if float(version_publicada) > float(version_local): logger.info( "deportesalacarta.channels.update_sports Nueva versión encontrada" ) return True, version_publicada, message else: logger.info( "deportesalacarta.channels.update_sports No existe versión actualizada" ) return False, "", "" except: import traceback logger.error("deportesalacarta.platformcode.launcher " + traceback.format_exc()) return False, "", ""
def pordede_play(params): plugintools.log("[%s %s] Pordede: Buscando enlaces... %s " % (addonName, addonVersion, repr(params))) # Marcar como visto #checkseen(item.extra.split("|")[1]) # Hace la llamada headers = DEFAULT_HEADERS[:] headers.append( ["Referer" , params.get("extra").split("|")[1] ]) data = scrapertools.cache_page(params.get("url"),post="_s="+params.get("extra").split("|")[0],headers=headers) url = plugintools.find_single_match(data,'<p class="links">\s+<a href="([^"]+)" target="_blank"') url = 'http://www.pordede.com'+url headers = DEFAULT_HEADERS[:] headers.append( ["Referer" , url ]) media_url = scrapertools.downloadpage(url,headers=headers,header_to_get="location",follow_redirects=False) #plugintools.log("media_url="+media_url) if media_url.find("allmyvideos") >= 0: params=plugintools.get_params() params["url"]=media_url allmyvideos(params) elif media_url.find("vidspot") >= 0: params=plugintools.get_params() params["url"]=media_url vidspot(params) elif media_url.find("played.to") >= 0: params=plugintools.get_params() params["url"]=media_url playedto(params) elif media_url.find("streamcloud") >= 0: params=plugintools.get_params() params["url"]=media_url streamcloud(params) elif media_url.find("nowvideo") >= 0: params=plugintools.get_params() params["url"]=media_url nowvideo(params) elif media_url.find("streamin.to") >= 0: params=plugintools.get_params() params["url"]=media_url streaminto(params) elif media_url.find("vk") >= 0: params=plugintools.get_params() params["url"]=media_url vk(params) elif media_url.find("tumi") >= 0: params=plugintools.get_params() params["url"]=media_url tumi(params) elif media_url.find("veehd") >= 0: params=plugintools.get_params() params["url"]=media_url veehd(params) elif media_url.find("powvideo") >= 0: params=plugintools.get_params() params["url"]=media_url powvideo(params) elif media_url.find("novamov") >= 0: params=plugintools.get_params() params["url"]=media_url novamov(params) elif media_url.find("gamovideo") >= 0: params=plugintools.get_params() params["url"]=media_url gamovideo(params) elif media_url.find("moevideos") >= 0: params=plugintools.get_params() params["url"]=media_url moevideos(params) elif media_url.find("movshare") >= 0: params=plugintools.get_params() params["url"]=media_url movshare(params) elif media_url.find("movreel") >= 0: params=plugintools.get_params() params["url"]=media_url movreel(params) elif media_url.find("videobam") >= 0: params=plugintools.get_params() params["url"]=media_url videobam(params) elif media_url.find("videoweed") >= 0: params=plugintools.get_params() params["url"]=media_url videoweed(params) elif media_url.find("streamable") >= 0: params=plugintools.get_params() params["url"]=media_url streamable(params) elif media_url.find("rocvideo") >= 0: params=plugintools.get_params() params["url"]=media_url rocvideo(params) elif media_url.find("realvid") >= 0: params=plugintools.get_params() params["url"]=media_url realvid(params) elif media_url.find("netu") >= 0: params=plugintools.get_params() params["url"]=media_url netu(params) elif media_url.find("videomega") >= 0: params=plugintools.get_params() params["url"]=media_url videomega(params) elif media_url.find("video.tt") >= 0: params=plugintools.get_params() params["url"]=media_url videott(params) elif media_url.find("flashx.tv") >= 0: params=plugintools.get_params() params["url"]=media_url flashx(params)
def pordede_play(params): plugintools.log("[%s %s] Pordede: Buscando enlaces... %s " % (addonName, addonVersion, repr(params))) # Marcar como visto #checkseen(item.extra.split("|")[1]) # Hace la llamada headers = DEFAULT_HEADERS[:] headers.append(["Referer", params.get("extra").split("|")[1]]) data = scrapertools.cache_page(params.get("url"), post="_s=" + params.get("extra").split("|")[0], headers=headers) url = plugintools.find_single_match( data, '<p class="links">\s+<a href="([^"]+)" target="_blank"') url = 'http://www.pordede.com' + url headers = DEFAULT_HEADERS[:] headers.append(["Referer", url]) media_url = scrapertools.downloadpage(url, headers=headers, header_to_get="location", follow_redirects=False) #plugintools.log("media_url="+media_url) if media_url.find("allmyvideos") >= 0: params = plugintools.get_params() params["url"] = media_url allmyvideos(params) elif media_url.find("vidspot") >= 0: params = plugintools.get_params() params["url"] = media_url vidspot(params) elif media_url.find("played.to") >= 0: params = plugintools.get_params() params["url"] = media_url playedto(params) elif media_url.find("streamcloud") >= 0: params = plugintools.get_params() params["url"] = media_url streamcloud(params) elif media_url.find("nowvideo") >= 0: params = plugintools.get_params() params["url"] = media_url nowvideo(params) elif media_url.find("streamin.to") >= 0: params = plugintools.get_params() params["url"] = media_url streaminto(params) elif media_url.find("vk") >= 0: params = plugintools.get_params() params["url"] = media_url vk(params) elif media_url.find("tumi") >= 0: params = plugintools.get_params() params["url"] = media_url tumi(params) elif media_url.find("veehd") >= 0: params = plugintools.get_params() params["url"] = media_url veehd(params) elif media_url.find("powvideo") >= 0: params = plugintools.get_params() params["url"] = media_url powvideo(params) elif media_url.find("novamov") >= 0: params = plugintools.get_params() params["url"] = media_url novamov(params) elif media_url.find("gamovideo") >= 0: params = plugintools.get_params() params["url"] = media_url gamovideo(params) elif media_url.find("moevideos") >= 0: params = plugintools.get_params() params["url"] = media_url moevideos(params) elif media_url.find("movshare") >= 0: params = plugintools.get_params() params["url"] = media_url movshare(params) elif media_url.find("movreel") >= 0: params = plugintools.get_params() params["url"] = media_url movreel(params) elif media_url.find("videobam") >= 0: params = plugintools.get_params() params["url"] = media_url videobam(params) elif media_url.find("videoweed") >= 0: params = plugintools.get_params() params["url"] = media_url videoweed(params) elif media_url.find("streamable") >= 0: params = plugintools.get_params() params["url"] = media_url streamable(params) elif media_url.find("rocvideo") >= 0: params = plugintools.get_params() params["url"] = media_url rocvideo(params) elif media_url.find("realvid") >= 0: params = plugintools.get_params() params["url"] = media_url realvid(params) elif media_url.find("netu") >= 0: params = plugintools.get_params() params["url"] = media_url netu(params) elif media_url.find("videomega") >= 0: params = plugintools.get_params() params["url"] = media_url videomega(params) elif media_url.find("video.tt") >= 0: params = plugintools.get_params() params["url"] = media_url videott(params) elif media_url.find("flashx.tv") >= 0: params = plugintools.get_params() params["url"] = media_url flashx(params)