diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index cb3e3fbc..1598a383 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -218,13 +218,13 @@ def findvideos(item): def videourls(res): newurl = '{}/{}{}'.format(url, res, token) if requests.head(newurl, headers=headers).status_code == 200: - video_urls.append(["m3u8 {} [StreamingCommunity]".format(res), newurl]) + video_urls.append({'type':'m3u8', 'res':res, 'url':newurl}) with futures.ThreadPoolExecutor() as executor: for res in ['480p', '720p', '1080p']: executor.submit(videourls, res) - if not video_urls: video_urls = [["m3u8 [StreamingCommunity]", url + token]] + if not video_urls: video_urls = [{'type':'m3u8', 'url':url + token}] else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match)) itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, thumbnail=channeltools.get_channel_parameters(item.channel)["thumbnail"], forcethumb=True)] return support.server(item, itemlist=itemlist) \ No newline at end of file diff --git a/core/autoplay.py b/core/autoplay.py index 1894c15a..e78f5c07 100644 --- a/core/autoplay.py +++ b/core/autoplay.py @@ -9,13 +9,6 @@ __channel__ = "autoplay" PLAYED = False -quality_list = ['4k', '2160p', '2160', '4k2160p', '4k2160', '4k 2160p', '4k 2160', '2k', - 'fullhd', 'fullhd 1080', 'fullhd 1080p', 'full hd', 'full hd 1080', 'full hd 1080p', 'hd1080', 'hd1080p', 'hd 1080', 'hd 1080p', '1080', '1080p', - 'hd', 'hd720', 'hd720p', 'hd 720', 'hd 720p', '720', '720p', 'hdtv', - 'sd', '480p', '480', '360p', '360', '240p', '240', - 'default'] - - def start(itemlist, item): ''' Main method from which the links are automatically reproduced diff --git a/core/servertools.py b/core/servertools.py index 66d01c0b..8c05ed7c 100644 --- a/core/servertools.py +++ b/core/servertools.py @@ -254,7 +254,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo if isinstance(video_password, list): return video_password, len(video_password) > 0, "
".join(error_messages) logger.info("Server: %s, url is good" % server) - video_urls.append(["%s [%s]" % (urlparse.urlparse(url)[2][-4:], config.get_localized_string(30137)), url]) + video_urls.append({'type':urlparse.urlparse(url)[2].split('.')[-1], 'url':url}) # Find out the video URL else: @@ -270,7 +270,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo # Count the available options, to calculate the percentage - orden = [ + order = [ ["free"] + [server] + [premium for premium in server_parameters["premium"] if not premium == server], [server] + [premium for premium in server_parameters["premium"] if not premium == server] + ["free"], [premium for premium in server_parameters["premium"] if not premium == server] + [server] + ["free"] @@ -282,7 +282,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo [premium for premium in server_parameters["premium"] if config.get_setting("premium", server=premium)]) priority = int(config.get_setting("resolve_priority")) - opciones = sorted(opciones, key=lambda x: orden[priority].index(x)) + opciones = sorted(opciones, key=lambda x: order[priority].index(x)) logger.info("Available options: %s | %s" % (len(opciones), opciones)) else: @@ -685,6 +685,7 @@ def sort_servers(servers_list): blacklisted_servers = config.get_setting("black_list", server='servers', default=[]) favorite_servers = config.get_setting('favorites_servers_list', server='servers', default=[]) favorite_servers = [s for s in favorite_servers if s not in blacklisted_servers] + if isinstance(servers_list[0], str): servers_list = sorted(servers_list, key=lambda x: favorite_servers.index(x) if x in favorite_servers else 999) return servers_list @@ -720,8 +721,9 @@ def sort_servers(servers_list): continue element["index_server"] = index(favorite_servers, item.server.lower()) - element["index_quality"] = platformtools.calcResolution(item.quality) + element["index_quality"] = index(favorite_quality, item.quality.lower()) element['index_language'] = 0 if item.contentLanguage == 'ITA' else 1 + element['videoitem'] = item sorted_list.append(element) diff --git a/core/support.py b/core/support.py index 9202b860..fa4b2617 100755 --- a/core/support.py +++ b/core/support.py @@ -1445,9 +1445,9 @@ def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False): for url, quality in sources: quality = 'auto' if not quality else quality if url.split('.')[-1] != 'mpd': - video_urls.append(['.' + url.split('.')[-1].split('?')[0] + ' [' + quality + '] [' + srvName + ']', url.replace(' ', '%20') if not onlyHttp else url.replace('https://', 'http://')]) + video_urls.append({'type':url.split('.')[-1], 'res':quality, 'url':url if not onlyHttp else url.replace('https://', 'http://')}) - video_urls.sort(key=lambda x: x[0].split()[1]) + # video_urls.sort(key=lambda x: x[0].split()[1]) return video_urls diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index cbc4fd38..a50694bc 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -30,11 +30,6 @@ if not FOLDER_MOVIES or not FOLDER_TVSHOWS or not VIDEOLIBRARY_PATH or not filet addon_name = "plugin://plugin.video.%s/" % config.PLUGIN_NAME -quality_order = ['4k', '2160p', '2160', '4k2160p', '4k2160', '4k 2160p', '4k 2160', '2k', - 'fullhd', 'fullhd 1080', 'fullhd 1080p', 'full hd', 'full hd 1080', 'full hd 1080p', 'hd1080', 'hd1080p', 'hd 1080', 'hd 1080p', '1080', '1080p', - 'hd', 'hd720', 'hd720p', 'hd 720', 'hd 720p', '720', '720p', 'hdtv', - 'sd', '480p', '480', '360p', '360', '240p', '240'] - video_extensions = ['3g2', '3gp', '3gp2', 'asf', 'avi', 'divx', 'flv', 'iso', 'm4v', 'mk2', 'mk3d', 'mka', 'mkv', 'mov', 'mp4', 'mp4a', 'mpeg', 'mpg', 'ogg', 'ogm', 'ogv', 'qt', 'ra', 'ram', 'rm', 'ts', 'vob', 'wav', 'webm', 'wma', 'wmv'] subtitle_extensions = ['srt', 'idx', 'sub', 'ssa', 'ass'] image_extensions = ['.jpg', '.jpeg', '.png'] diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index a0a2261a..3dfaf5b2 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -301,8 +301,8 @@ def itemlist_refresh(offset=0): ctl = win.getControl(cid) pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + offset logger.debug('ID:', _id, 'POSITION:', pos) - # xbmc.executebuiltin("Container.Refresh") - xbmc.executebuiltin('ReloadSkin()') + xbmc.executebuiltin("Container.Refresh") + # xbmc.executebuiltin('ReloadSkin()') while xbmcgui.getCurrentWindowDialogId() != 10138: pass @@ -989,8 +989,7 @@ def get_window(): def play_video(item, strm=False, force_direct=False, autoplay=False): - logger.debug() - logger.debug(item.tostring('\n')) + logger.debug(item) def play(): if item.channel == 'downloads': @@ -1010,23 +1009,27 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): httptools.default_headers['Referer'] = item.referer # Open the selection dialog to see the available options - opciones, video_urls, seleccion, salir = get_dialogo_opciones(item, default_action, strm, autoplay) - if salir: return + options, video_urls, selection, _exit = get_options_dialog(item, default_action, strm, autoplay) + if _exit: return # get default option of addon configuration - seleccion = get_seleccion(default_action, opciones, seleccion, video_urls) - if seleccion < 0: return # Canceled box + selection = get_selection(default_action, options, selection, video_urls) - logger.debug("selection=%d" % seleccion) - logger.debug("selection=%s" % opciones[seleccion]) + # Canceled box + if selection < 0: + prevent_busy(item) + return + + logger.debug("selection=%d" % selection) + logger.debug("selection=%s" % options[selection]) # run the available option, jdwonloader, download, favorites, add to the video library ... IF IT IS NOT PLAY - salir = set_opcion(item, seleccion, opciones, video_urls) - if salir: + _exit = set_option(item, selection, options, video_urls) + if _exit: return # we get the selected video - mediaurl, view, mpd = get_video_seleccionado(item, seleccion, video_urls, autoplay) + mediaurl, view, mpd, m3u8 = get_selected_video(item, selection, video_urls, autoplay) if not mediaurl: return # video information is obtained. @@ -1035,8 +1038,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): set_infolabels(xlistitem, item, True) # if it is a video in mpd format, the listitem is configured to play it ith the inpustreamaddon addon implemented in Kodi 17 - # from core.support import dbg;dbg() - if mpd or item.manifest =='mpd': + if mpd or item.manifest == 'mpd': if not install_inputstream(): return xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive') @@ -1046,7 +1048,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): xlistitem.setProperty("inputstream.adaptive.license_type", item.drm) xlistitem.setProperty("inputstream.adaptive.license_key", item.license) xlistitem.setMimeType('application/dash+xml') - elif item.manifest == 'hls' or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')): + elif m3u8 or item.manifest == 'hls': if not install_inputstream(): return xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive') @@ -1068,62 +1070,22 @@ def stop_video(): xbmc_player.stop() -def get_seleccion(default_action, opciones, seleccion, video_urls): - fixpri = False - # to know what priority you work on - priority = int(config.get_setting("resolve_priority")) - # will be used to check for premium or debrider links - check = [] - # Check if resolve stop is disabled - if config.get_setting("resolve_stop") == False: - fixpri = True - # ask +def get_selection(default_action, options, selection, video_urls): + resolutions = [] + for url in video_urls: + resolutions.append(calcResolution(url['res']) if 'res' in url else 0) + + resolutions.sort() + if default_action == 2: resolutions.reverse() + + # ask if default_action == 0: # "Choose an option" - seleccion = dialog_select(config.get_localized_string(30163), opciones) - # View in low quality - elif default_action == 1: - resolutions = [] - for url in video_urls: - if "debrid]" in url[0] or "Premium)" in url[0]: - check.append(True) - res = calcResolution(url[0]) - if res: - resolutions.append(res) - if resolutions: - if (fixpri == True and - check and - priority == 2): - seleccion = 0 - else: - seleccion = resolutions.index(min(resolutions)) - else: - seleccion = 0 - # See in high quality - elif default_action == 2: - resolutions = [] - for url in video_urls: - if "debrid]" in url[0] or "Premium)" in url[0]: - check.append(True) - res = calcResolution(url[0]) - if res: - resolutions.append(res) - - if resolutions: - if (fixpri == True and - check and - priority == 2): - seleccion = 0 - else: - seleccion = resolutions.index(max(resolutions)) - else: - if fixpri == True and check: - seleccion = 0 - else: - seleccion = len(video_urls) - 1 + selection = dialog_select(config.get_localized_string(30163), options) else: - seleccion = 0 - return seleccion + selection = 0 + + return selection def calcResolution(option): @@ -1215,12 +1177,12 @@ def handle_wait(time_to_wait, title, text): return True -def get_dialogo_opciones(item, default_action, strm, autoplay): +def get_options_dialog(item, default_action, strm, autoplay): logger.debug() # logger.debug(item.tostring('\n')) from core import servertools - opciones = [] + options = [] error = False try: @@ -1244,37 +1206,41 @@ def get_dialogo_opciones(item, default_action, strm, autoplay): item.server, item.url, item.password, muestra_dialogo) if play_canceled: - return opciones, [], 0, True + return options, [], 0, True - seleccion = 0 + selection = 0 # If you can see the video, present the options if puedes: + video_urls = sorted(video_urls, key=lambda k: calcResolution(k['res']) if 'res' in k else 0) + video_urls.reverse() for video_url in video_urls: - opciones.append(config.get_localized_string(60221) + " " + video_url[0]) + name = '{} {} [{}]'.format(config.get_localized_string(60221), video_url.get('type'), servertools.get_server_parameters(item.server)['name']) + if video_url.get('res',''): name += ' [{}]'.format(video_url.get('res','')) + options.append(name) if item.server == "local": - opciones.append(config.get_localized_string(30164)) + options.append(config.get_localized_string(30164)) else: # "Download" downloadenabled = config.get_setting('downloadenabled') if downloadenabled != False and item.channel != 'videolibrary': opcion = config.get_localized_string(30153) - opciones.append(opcion) + options.append(opcion) if item.isFavourite: # "Remove from favorites" - opciones.append(config.get_localized_string(30154)) + options.append(config.get_localized_string(30154)) else: # "Add to Favorites" - opciones.append(config.get_localized_string(30155)) + options.append(config.get_localized_string(30155)) if default_action == 3: - seleccion = len(opciones) - 1 + selection = len(options) - 1 # Search for trailers if item.channel not in ["trailertools"]: # "Search Trailer" - opciones.append(config.get_localized_string(30162)) + options.append(config.get_localized_string(30162)) # If you can't see the video it informs you else: @@ -1291,21 +1257,21 @@ def get_dialogo_opciones(item, default_action, strm, autoplay): (sys.argv[0], Item(action="open_browser", url=item.url).tourl())) if item.channel == "favorites": # "Remove from favorites" - opciones.append(config.get_localized_string(30154)) + options.append(config.get_localized_string(30154)) - if len(opciones) == 0: + if len(options) == 0: error = True - return opciones, video_urls, seleccion, error + return options, video_urls, selection, error -def set_opcion(item, seleccion, opciones, video_urls): +def set_option(item, selection, options, video_urls): logger.debug() # logger.debug(item.tostring('\n')) - salir = False + _exit = False # You have not chosen anything, most likely because you have given the ESC - if seleccion == -1: + if selection == -1: # To avoid the error "One or more elements failed" when deselecting from strm file listitem = xbmcgui.ListItem(item.title) @@ -1318,62 +1284,74 @@ def set_opcion(item, seleccion, opciones, video_urls): xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem) # "Download" - elif opciones[seleccion] == config.get_localized_string(30153): + elif options[selection] == config.get_localized_string(30153): from specials import downloads if item.contentType == "list" or item.contentType == "tvshow": item.contentType = "video" item.play_menu = True downloads.save_download(item) - salir = True + _exit = True # "Remove from favorites" - elif opciones[seleccion] == config.get_localized_string(30154): + elif options[selection] == config.get_localized_string(30154): from specials import favorites favorites.delFavourite(item) - salir = True + _exit = True # "Add to Favorites": - elif opciones[seleccion] == config.get_localized_string(30155): + elif options[selection] == config.get_localized_string(30155): from specials import favorites item.from_channel = "favorites" favorites.addFavourite(item) - salir = True + _exit = True # "Search Trailer": - elif opciones[seleccion] == config.get_localized_string(30162): + elif options[selection] == config.get_localized_string(30162): config.set_setting("subtitulo", False) xbmc.executebuiltin("RunPlugin(%s?%s)" % (sys.argv[0], item.clone(channel="trailertools", action="buscartrailer", contextual=True).tourl())) - salir = True + _exit = True - return salir + return _exit -def get_video_seleccionado(item, seleccion, video_urls, autoplay=False): +def get_selected_video(item, selection, video_urls, autoplay=False): logger.debug() mediaurl = "" view = False wait_time = 0 + file_type = '' mpd = False - + m3u8 = False + # video_urls Format: + # [{'type':'Video Extension', 'url': 'Video url', 'wait':seconds to wait, 'sub':'subtitle url'}] # You have chosen one of the videos - if seleccion < len(video_urls): - mediaurl = video_urls[seleccion][1] - if len(video_urls[seleccion]) > 4: - wait_time = video_urls[seleccion][2] - if not item.subtitle: - item.subtitle = video_urls[seleccion][3] - mpd = True - elif len(video_urls[seleccion]) > 3: - wait_time = video_urls[seleccion][2] - if not item.subtitle: - item.subtitle = video_urls[seleccion][3] - elif len(video_urls[seleccion]) > 2: - wait_time = video_urls[seleccion][2] + if selection < len(video_urls): + video_url = video_urls[selection] + mediaurl = video_url.get('url', '') + wait_time = video_url.get('wait', 0) + file_type = video_url.get('type', 'Video').lower() + if not item.subtitle: item.subtitle = video_url.get('sub', '') view = True + # if selection < len(video_urls): + # mediaurl = video_urls[selection][1] + # if len(video_urls[selection]) > 4: + # wait_time = video_urls[selection][2] + # if not item.subtitle: + # item.subtitle = video_urls[selection][3] + # mpd = True + # elif len(video_urls[selection]) > 3: + # wait_time = video_urls[selection][2] + # if not item.subtitle: + # item.subtitle = video_urls[selection][3] + # elif len(video_urls[selection]) > 2: + # wait_time = video_urls[selection][2] + # view = True - if 'mpd' in video_urls[seleccion][0]: + if 'mpd' in file_type: mpd = True + elif 'm3u8' in file_type: + m3u8 = True # If there is no mediaurl it is because the video is not there :) logger.debug("mediaurl=" + mediaurl) @@ -1389,7 +1367,7 @@ def get_video_seleccionado(item, seleccion, video_urls, autoplay=False): if not continuar: mediaurl = "" - return mediaurl, view, mpd + return mediaurl, view, mpd, m3u8 def set_player(item, xlistitem, mediaurl, view, strm): @@ -1842,10 +1820,18 @@ def set_played_time(item): del db['viewed'][ID] +# def prevent_busy(item): +# logger.debug() +# if not item.autoplay and not item.window: +# xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) +# xbmc.sleep(200) +# xbmc.Player().stop() + def prevent_busy(item): logger.debug() if not item.autoplay and not item.window: - xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) + if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) + else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))) xbmc.sleep(200) xbmc.Player().stop() diff --git a/servers/akvideo.py b/servers/akvideo.py index cabb9b02..c8909e64 100644 --- a/servers/akvideo.py +++ b/servers/akvideo.py @@ -61,4 +61,4 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= video_urls = support.get_jwplayer_mediaurl(data, 'akvideo', onlyHttp=True) - return sorted(video_urls, key=lambda x: int(x[0].split('x')[0])) if vres else video_urls + return video_urls diff --git a/servers/animeid.py b/servers/animeid.py index 1eb8414a..4e3a3392 100644 --- a/servers/animeid.py +++ b/servers/animeid.py @@ -22,5 +22,5 @@ def get_video_url(page_url, user="", password="", video_password=""): label, videourl = scrapertools.find_single_match(data, 'label":"([^"]+)".*?file":"([^"]+)') if "animeid.tv" in videourl: videourl = httptools.downloadpage(videourl, follow_redirects=False, only_headers=True).headers.get("location", "") - video_urls.append([".MP4 " + label + " [animeid]", videourl]) + video_urls.append({'type':'mp4', 'res':label, 'url':videourl}) return video_urls diff --git a/servers/anonfile.py b/servers/anonfile.py index 9d48396b..bf857228 100644 --- a/servers/anonfile.py +++ b/servers/anonfile.py @@ -24,6 +24,5 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= match = scrapertools.find_multiple_matches(data, patron) for media_url in match: media_url += "|Referer=%s" %page_url - title = "mp4 [anonfile]" - video_urls.append([title, media_url]) + video_urls.append({'type':'mp4', 'url':media_url}) return video_urls diff --git a/servers/archiveorg.py b/servers/archiveorg.py index df81e381..fff81723 100644 --- a/servers/archiveorg.py +++ b/servers/archiveorg.py @@ -23,5 +23,5 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= patron = '' matches = scrapertools.find_multiple_matches(data, patron) for url in matches: - video_urls.append(['.MP4 [ArchiveOrg]', url]) + video_urls.append({'type':'mp4', 'url':url}) return video_urls diff --git a/servers/backin.py b/servers/backin.py index 9e844fd1..27ff3a94 100644 --- a/servers/backin.py +++ b/servers/backin.py @@ -45,9 +45,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= logger.debug("URL=" + str(url)) # URL del vídeo - video_urls.append([".mp4" + " [backin]", url]) + video_urls.append({'type':'mp4', 'url':url}) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], httptools.get_url_headers(video_url[1]))) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], httptools.get_url_headers(video_url[1]))) return video_urls diff --git a/servers/badshare.py b/servers/badshare.py index 7e713a9a..d319956c 100644 --- a/servers/badshare.py +++ b/servers/badshare.py @@ -28,6 +28,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= data = re.sub(r'\n|\r|\t|\s{2,}', "", data) media_url, ext = scrapertools.find_single_match(data, r'file:\s*"([^"]+)",type:\s*"([^"]+)"') - video_urls.append(["%s [Badshare]" % ext, media_url]) + video_urls.append({'type':ext, 'url':media_url}) return video_urls diff --git a/servers/bdupload.py b/servers/bdupload.py index cd72b590..ff39256b 100644 --- a/servers/bdupload.py +++ b/servers/bdupload.py @@ -34,5 +34,5 @@ def get_video_url(page_url, user="", password="", video_password=""): file += "&Host=fs30.indifiles.com:182" video_urls = [] videourl = file - video_urls.append([".MP4 [bdupload]", videourl]) + video_urls.append({'type':'mp4', 'url':videourl}) return video_urls diff --git a/servers/cinemaupload.py b/servers/cinemaupload.py index a4d75d56..88e2507f 100644 --- a/servers/cinemaupload.py +++ b/servers/cinemaupload.py @@ -27,5 +27,5 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= matches = scrapertools.find_multiple_matches(data, patron) for url in matches: url += "|Referer=%s" %page_url - video_urls.append(['.m3u8 [CinemaUpload]', url]) + video_urls.append({'type':'m3u8', 'url':url}) return video_urls diff --git a/servers/clicknupload.py b/servers/clicknupload.py index a2f95930..2a415dde 100755 --- a/servers/clicknupload.py +++ b/servers/clicknupload.py @@ -49,9 +49,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= # Solo es necesario codificar la ultima parte de la url url_strip = urllib.quote(media.rsplit('/', 1)[1]) media_url = media.rsplit('/', 1)[0] + "/" + url_strip - video_urls.append([scrapertools.get_filename_from_url(media_url)[-4:] + " [clicknupload]", media_url]) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + video_urls.append({'type':scrapertools.get_filename_from_url(media_url).split('.')[-1], 'url':media_url}) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/clipwatching.py b/servers/clipwatching.py index 3d359171..d6878b93 100644 --- a/servers/clipwatching.py +++ b/servers/clipwatching.py @@ -35,7 +35,7 @@ def get_video_url(page_url, user="", password="", video_password=""): else: label = video.split('.')[-1] multires = False - video_urls.append([label + " [clipwatching]", video]) - if multires: - video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0])) + video_urls.append({'type':label, 'url':video}) + # if multires: + # video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0])) return video_urls diff --git a/servers/cloudvideo.py b/servers/cloudvideo.py index 36e299fc..acf10512 100644 --- a/servers/cloudvideo.py +++ b/servers/cloudvideo.py @@ -37,5 +37,5 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= url = url.split(',') video_url = url[0] Type = url[1].replace('label:','') - video_urls.append(['%s [CloudVideo]' % Type, video_url]) + video_urls.append({'type':Type, 'url':video_url}) return video_urls diff --git a/servers/crunchyroll.py b/servers/crunchyroll.py index 31384209..84087bfb 100755 --- a/servers/crunchyroll.py +++ b/servers/crunchyroll.py @@ -92,9 +92,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= import traceback logger.error(traceback.format_exc()) file_sub = "" - video_urls.append(["%s %sp [crunchyroll]" % (filename, quality), media_url, 0, file_sub]) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + video_urls.append({'type':filename, 'res':quality, 'url':media_url, 'sub':file_sub}) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/dailymotion.py b/servers/dailymotion.py index b6d3ddbc..798a9e8a 100644 --- a/servers/dailymotion.py +++ b/servers/dailymotion.py @@ -38,7 +38,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= stream_url_http = scrapertools.find_single_match(data_m3u8, r'PROGRESSIVE-URI="([^"]+)"') if stream_url_http: stream_url = stream_url_http - video_urls.append(["%sp .%s [dailymotion]" % (calidad, stream_type), stream_url, 0, subtitle]) + video_urls.append({'type':calidad, 'res':stream_type, 'url':stream_url, 'sub':subtitle}) for video_url in video_urls: logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls \ No newline at end of file diff --git a/servers/directo.py b/servers/directo.py index 2ad2e56b..f11ec674 100644 --- a/servers/directo.py +++ b/servers/directo.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from platformcode import logger, config +from platformcode import logger +from core import scrapertools def test_video_exists(page_url): @@ -9,7 +10,6 @@ def test_video_exists(page_url): # Returns an array of possible video url's from the page_url def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.debug("(page_url='%s')" % page_url) - - video_urls = [["%s %s" % (page_url[-4:], config.get_localized_string(30137)), page_url]] + video_urls=[{'type':scrapertools.get_filename_from_url(page_url).split('.')[-1], 'url':page_url}] return video_urls diff --git a/servers/doodstream.py b/servers/doodstream.py index 9b7d2967..36f4ab5d 100644 --- a/servers/doodstream.py +++ b/servers/doodstream.py @@ -31,7 +31,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= if match: url, token = match ret = scraper.get(host + url, headers=headers).text - video_urls.append(['mp4 [DooD Stream]', '{}{}{}{}|Referer={}'.format(randomize(ret), url, token, int(time.time() * 1000), host)]) + video_urls.append({'type':'mp4', 'url':'{}{}{}{}|Referer={}'.format(randomize(ret), url, token, int(time.time() * 1000), host)}) return video_urls diff --git a/servers/dostream.py b/servers/dostream.py index 258509f4..d27b6d49 100644 --- a/servers/dostream.py +++ b/servers/dostream.py @@ -24,6 +24,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= patron += '"src":"(http.*?)".*?' matches = scrapertools.find_multiple_matches(data, patron) for label, url in matches: - video_urls.append(['%s [dostream]' %label, url]) - video_urls.sort(key=lambda it: int(it[0].split("p ")[0])) + video_urls.append({'type':label, 'url':url}) + # video_urls.sort(key=lambda it: int(it[0].split("p ")[0])) return video_urls diff --git a/servers/downace.py b/servers/downace.py index 9fec2d44..ab41d855 100644 --- a/servers/downace.py +++ b/servers/downace.py @@ -22,6 +22,6 @@ def get_video_url(page_url, user="", password="", video_password=""): data = httptools.downloadpage(page_url).data video_urls = [] videourl = scrapertools.find_single_match(data, 'controls preload.*?src="([^"]+)') - video_urls.append([".MP4 [downace]", videourl]) + video_urls.append({'type':'mp4', 'url':videourl}) return video_urls diff --git a/servers/facebook.py b/servers/facebook.py index 3b540c62..7d83537e 100755 --- a/servers/facebook.py +++ b/servers/facebook.py @@ -31,7 +31,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= videourl = match videourl = videourl.replace('%5C', '') videourl = urllib.unquote(videourl) - video_urls.append(["[facebook]", videourl]) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + video_urls.append({'url':videourl}) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/fastplay.py b/servers/fastplay.py index 2c39e1d9..40278689 100644 --- a/servers/fastplay.py +++ b/servers/fastplay.py @@ -32,7 +32,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= for video_url, video_calidad in videos: extension = scrapertools.get_filename_from_url(video_url)[-4:] if extension not in [".vtt", ".srt"]: - video_urls.append(["%s %s [fastplay]" % (extension, video_calidad), video_url, 0, subtitulo]) + video_urls.append({'type':extension, 'res':video_calidad, 'url':video_url, 'sub':subtitulo}) try: video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0].rsplit(" ")[1])) except: diff --git a/servers/fembed.py b/servers/fembed.py index c7d65aad..c417af74 100644 --- a/servers/fembed.py +++ b/servers/fembed.py @@ -32,6 +32,6 @@ def get_video_url(page_url, user="", password="", video_password=""): media_url = file['file'] label = file['label'] extension = file['type'] - video_urls.append([ extension + ' ' + label + ' [Fembed]', media_url]) - video_urls.sort(key=lambda x: int(x[0].split()[1].replace('p',''))) + video_urls.append({'type':extension, 'quality':label, 'url':media_url}) + # video_urls.sort(key=lambda x: int(x[0].split()[1].replace('p',''))) return video_urls diff --git a/servers/fex.py b/servers/fex.py index ed4cbb90..ca4a928b 100644 --- a/servers/fex.py +++ b/servers/fex.py @@ -23,5 +23,5 @@ def get_video_url(page_url, user="", password="", video_password=""): data = httptools.downloadpage(page_url, follow_redirects=False, only_headers=True) logger.debug(data.headers) url = data.headers['location'] - video_urls.append(['Fex', url]) + video_urls.append({'url':url}) return video_urls diff --git a/servers/filepup.py b/servers/filepup.py index 2f69930d..864a961a 100644 --- a/servers/filepup.py +++ b/servers/filepup.py @@ -26,15 +26,15 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= qualities = scrapertools.find_multiple_matches(qualities, ' "([^"]+)') for calidad in qualities: media = media_url - title = "%s [filepup]" % (calidad) + # title = "%s [filepup]" % (calidad) if "480" not in calidad: med = media_url.split(".mp4") - media = med[0] + "-%s.mp4" %calidad + med[1] + media = med[0] + "-%s.mp4" % calidad + med[1] media += "|Referer=%s" %page_url media += "&User-Agent=" + httptools.get_user_agent() - video_urls.append([title, media, int(calidad.replace("p", ""))]) - video_urls.sort(key=lambda x: x[2]) - for video_url in video_urls: - video_url[2] = 0 - logger.debug("%s - %s" % (video_url[0], video_url[1])) + video_urls.append({'type':'mp4', 'res':calidad, 'url':media}) + # video_urls.sort(key=lambda x: x[2]) + # for video_url in video_urls: + # video_url[2] = 0 + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/filescdn.py b/servers/filescdn.py index 42cb6b3f..a3e29dbc 100644 --- a/servers/filescdn.py +++ b/servers/filescdn.py @@ -21,6 +21,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= data = httptools.downloadpage(page_url).data url = scrapertools.find_single_match(data, '(?i)link:\s*"(https://.*?filescdn\.com.*?mp4)"') url = url.replace(':443', '') - video_urls.append(['filescdn', url]) + video_urls.append({'url':url}) return video_urls diff --git a/servers/filesmonster.json b/servers/filesmonster.json index 66a3794d..f600d618 100644 --- a/servers/filesmonster.json +++ b/servers/filesmonster.json @@ -1,5 +1,5 @@ { - "active": true, + "active": false, "find_videos": { "ignore_urls": [], "patterns": [ diff --git a/servers/flashx.py b/servers/flashx.py index 1197c4ec..a2d1dc19 100644 --- a/servers/flashx.py +++ b/servers/flashx.py @@ -123,10 +123,10 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= for media_url, label in media_urls: if not media_url.endswith("png") and not media_url.endswith(".srt"): - video_urls.append(["." + media_url.rsplit('.', 1)[1] + " [flashx]", media_url, 0, subtitle]) + video_urls.append({'type':media_url.rsplit('.', 1)[1], 'url':media_url, 'sub':subtitle}) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) except: pass diff --git a/servers/fourshared.py b/servers/fourshared.py index 9d6927b2..c96ead9b 100644 --- a/servers/fourshared.py +++ b/servers/fourshared.py @@ -22,13 +22,13 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= matches = re.compile(patron, re.DOTALL).findall(page_url) try: - video_urls.append(["[fourshared]", matches[0]]) + video_urls.append({'url':matches[0]}) except: pass else: - video_urls.append(["[fourshared]", page_url]) + video_urls.append({'url':page_url}) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/gamovideo.py b/servers/gamovideo.py index f9078151..97948114 100755 --- a/servers/gamovideo.py +++ b/servers/gamovideo.py @@ -83,11 +83,11 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= 0] + " playpath=" + playpath + " swfUrl=http://gamovideo.com/player61/jwplayer.flash.swf" video_urls = [] - video_urls.append(["RTMP [gamovideo]", rtmp_url]) - video_urls.append([scrapertools.get_filename_from_url(mediaurl)[-4:] + " [gamovideo]", mediaurl]) + video_urls.append({'type':'rtmp', 'url':rtmp_url}) + video_urls.append({'type':scrapertools.get_filename_from_url(mediaurl).split('.')[-1], 'url':mediaurl}) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/gigasize.json b/servers/gigasize.json index 7363b07f..745b21e5 100644 --- a/servers/gigasize.json +++ b/servers/gigasize.json @@ -1,5 +1,5 @@ { - "active": true, + "active": false, "find_videos": { "ignore_urls": [], "patterns": [ diff --git a/servers/googlevideo.py b/servers/googlevideo.py index 8f857fde..7a13a2da 100755 --- a/servers/googlevideo.py +++ b/servers/googlevideo.py @@ -21,9 +21,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= newpatron = '.*?' newmatches = re.compile(newpatron, re.DOTALL).findall(data) if len(newmatches) > 0: - video_urls.append(["[googlevideo]", newmatches[0]]) + video_urls.append({'url':newmatches[0]}) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/gounlimited.py b/servers/gounlimited.py index 53642c2f..0a54fa79 100644 --- a/servers/gounlimited.py +++ b/servers/gounlimited.py @@ -36,5 +36,5 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= for url in matches: if url.startswith('//'): url= 'http:' + url url += "|Referer=%s" %page_url - video_urls.append(['mp4 [Go Unlimited]', url]) + video_urls.append({'type':'mp4', 'url':url}) return video_urls diff --git a/servers/gvideo.json b/servers/gvideo.json index 67d97b3b..87f3fe00 100644 --- a/servers/gvideo.json +++ b/servers/gvideo.json @@ -3,10 +3,6 @@ "find_videos": { "ignore_urls": [], "patterns": [ - { - "pattern": "(?s)https://youtube.googleapis.com.*?docid=([A-z0-9-_=]+)", - "url": "http://docs.google.com/get_video_info?docid=\\1" - }, { "pattern": "(?s)http://docs.google.com/get_video_info.*?docid=([A-z0-9-_=]+)", "url": "http://docs.google.com/get_video_info?docid=\\1" diff --git a/servers/gvideo.py b/servers/gvideo.py index edaaf8ac..bce41623 100644 --- a/servers/gvideo.py +++ b/servers/gvideo.py @@ -77,8 +77,8 @@ def get_video_url(page_url, user="", password="", video_password=""): for itag, video_url in streams: if not video_url in urls: video_url += headers_string - video_urls.append([itags.get(itag, ''), video_url]) + video_urls.append({'res':itags.get(itag, ''), 'type':video_url.split('.')[-1], 'url':video_url}) urls.append(video_url) - video_urls.sort(key=lambda video_urls: int(video_urls[0].replace("p", ""))) + # video_urls.sort(key=lambda video_urls: int(video_urls[0].replace("p", ""))) return video_urls diff --git a/servers/hdload.py b/servers/hdload.py index 35392d6a..72403e5f 100644 --- a/servers/hdload.py +++ b/servers/hdload.py @@ -25,6 +25,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= logger.debug(data) url = base64.b64decode(data) - itemlist.append([".mp4 [HDLoad]", url]) + itemlist.append({'type':'mp4', 'url':url}) return itemlist diff --git a/servers/hdmario.py b/servers/hdmario.py index 1f795cce..1b1adf30 100644 --- a/servers/hdmario.py +++ b/servers/hdmario.py @@ -140,6 +140,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= data = httptools.downloadpage(baseUrl + '/pl/' + page_url.split('/')[-1].replace('?', '') + '.m3u8', headers=[['X-Secure-Proof', secureProof]]).data filetools.write(xbmc.translatePath('special://temp/hdmario.m3u8'), data, 'w') - video_urls = [['.m3u8 [HDmario]', 'special://temp/hdmario.m3u8']] + video_urls = [{'type':'m3u8', 'url':'special://temp/hdmario.m3u8'}] return video_urls diff --git a/servers/hugefiles.py b/servers/hugefiles.py index f0efc272..ba38d135 100755 --- a/servers/hugefiles.py +++ b/servers/hugefiles.py @@ -42,9 +42,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= mediaurl = r[0] video_urls = [] - video_urls.append([scrapertools.get_filename_from_url(mediaurl)[-4:] + " [hugefiles]", mediaurl]) + video_urls.append({'type':scrapertools.get_filename_from_url(mediaurl).split('.')[-1], 'url':mediaurl}) - for video_url in video_urls: - logger.debug("%s - %s" % (video_url[0], video_url[1])) + # for video_url in video_urls: + # logger.debug("%s - %s" % (video_url[0], video_url[1])) return video_urls diff --git a/servers/idtbox.py b/servers/idtbox.py index 7840c22a..08be1bd1 100644 --- a/servers/idtbox.py +++ b/servers/idtbox.py @@ -34,6 +34,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= ext = ext.split("/")[1] except: ext = ".mp4" - video_urls.append(["%s (%s) [idtbox]" % (ext, res), url]) + video_urls.append({'type':ext, 'res':res, 'url':url}) return video_urls diff --git a/servers/jawcloud.py b/servers/jawcloud.py index 60e633dc..49d496ca 100644 --- a/servers/jawcloud.py +++ b/servers/jawcloud.py @@ -18,6 +18,6 @@ def get_video_url(page_url, user="", password="", video_password=""): data = httptools.downloadpage(page_url).data video_urls = [] videourl = scrapertools.find_single_match(data, 'source src="([^"]+)') - video_urls.append([".MP4 [jawcloud]", videourl]) + video_urls.append({'type':'mp4', 'url':videourl}) return video_urls diff --git a/servers/jetload.py b/servers/jetload.py index 0a6465a2..b77b454b 100644 --- a/servers/jetload.py +++ b/servers/jetload.py @@ -25,9 +25,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= video_urls = [] media_url = scrapertools.find_single_match(data, 'http') ext = scrapertools.get_filename_from_url(media_url) - video_urls.append(["%s [Uppom]" % ext, media_url]) + video_urls.append({'type':ext, 'url':media_url}) return video_urls diff --git a/servers/upstream.py b/servers/upstream.py index 9ac6fbb1..299f7e89 100644 --- a/servers/upstream.py +++ b/servers/upstream.py @@ -24,7 +24,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= if new_data != "": from lib import jsunpack data = jsunpack.unpack(new_data) - media_url = scrapertools.find_single_match(data, r'file:"([^"]+)"') + '|Referer=' + page_url - video_urls.append(["%s [UPstream]" % media_url.split('.')[-1], media_url]) + media_url = scrapertools.find_single_match(data, r'file:"([^"]+)"') + video_urls.append({'type':media_url.split('.')[-1], 'url':media_url + '|Referer=' + page_url}) return video_urls diff --git a/servers/uptobox.py b/servers/uptobox.py index 70444cbd..cd9fe71e 100755 --- a/servers/uptobox.py +++ b/servers/uptobox.py @@ -74,8 +74,8 @@ def uptostream(data): tipo = tipo.replace("video/","") if lang: extension = "{} - {} [{}]".format(tipo, res, lang.upper()) else: extension = "{} - {}".format(tipo, res) - video_urls.append([extension + " [UPtoStream]", media_url, 0, subtitle]) - video_urls.sort(key=lambda url: int(match(url[0], patron=r'(\d+)p').match)) + video_urls.append({'type':extension, 'url':media_url, 'sub':subtitle}) + # video_urls.sort(key=lambda url: int(match(url[0], patron=r'(\d+)p').match)) return video_urls def atob(s): @@ -93,6 +93,6 @@ def uptobox(url, data): media = match(url, post=post[:-1], patron=r'\s*').match url_strip = media.rsplit('/', 1)[1] media_url = media.rsplit('/', 1)[0] + "/" + url_strip - video_urls.append([media_url[-4:] + " [UPtoStream]", media_url]) + video_urls.append({'type':media_url.split('.')[-1], 'url':media_url}) return video_urls \ No newline at end of file diff --git a/servers/upvid.py b/servers/upvid.py index e1de4583..efc0e048 100644 --- a/servers/upvid.py +++ b/servers/upvid.py @@ -43,7 +43,7 @@ def get_video_url(page_url, premium = False, user = "", password = "", video_pas oculto = re.findall('[^\"']+)[^>]+label=[\"'](?P