def initSlimerJS(): Log("Initializing SlimerJS") firefox_dir = Prefs['firefox_dir'] if firefox_dir == None: firefox_dir = "" python_dir = Prefs['python_dir'] if python_dir == None: python_dir = "" res = slimerjs.einthusan(python_dir=python_dir, firefox_dir=firefox_dir, url="https://einthusan.tv") if res == "": res = "Success" Log("Initialized SlimerJS: " + res)
def GetVideoUrl(url, **kwargs): VideoURL['GetVideoUrlComplete'] = 'False' furl = 'error-fail' datacenter = 'Unknown' debug = Prefs['use_debug'] if url not in LAST_PROCESSED_URL: del LAST_PROCESSED_URL[:] if Prefs["use_slimerjs"]: if debug: Log("Running SlimerJS routine for : " + url) firefox_dir = Prefs['firefox_dir'] python_dir = Prefs['python_dir'] res = slimerjs.einthusan(python_dir=python_dir, firefox_dir=firefox_dir, url=url, debug=debug) out = "{" + find_between(out, "{", "}") + "}" else: if debug: Log("Internal routine for : %s" % url) out = einthusan.GetEinthusanData(url=url, debug=debug) if 'error-fail' not in out and 'MP4Link' in out: try: res2 = json.loads(out) furl = res2['MP4Link'] datacenter = res2["Datacenter"] #Log("vidfile: " + furl) LAST_PROCESSED_URL.append(url) LAST_PROCESSED_URL.append(furl) LAST_PROCESSED_URL.append(datacenter) if debug: Log("Output: %s" % out) except: Log("Error: No Video link. Output: %s" % out) else: Log("Output: %s" % out) else: furl = LAST_PROCESSED_URL[1] datacenter = LAST_PROCESSED_URL[2] # fix San Jose datacenter label if datacenter == 'San': datacenter = 'San Jose' VideoURL['GetVideoUrlComplete'] = furl VideoURL['GetVideoUrlDatacenter'] = datacenter