diff --git a/core/httptools.py b/core/httptools.py index a5d78c75..0c2ee68d 100755 --- a/core/httptools.py +++ b/core/httptools.py @@ -300,7 +300,7 @@ def downloadpage(url, **opt): else: req_headers = dict(opt['headers']) - if domain in directIP.keys(): + if domain in directIP.keys() and not opt.get('disable_directIP', False): req_headers['Host'] = domain url = urlparse.urlunparse(parse._replace(netloc=directIP.get(domain))) diff --git a/lib/unshortenit.py b/lib/unshortenit.py index 9ac43432..74f19510 100644 --- a/lib/unshortenit.py +++ b/lib/unshortenit.py @@ -534,7 +534,7 @@ class UnshortenIt(object): if spl[3] == 'wss1': spl[4] = b64encode(spl[4].encode('utf-8')).decode('utf-8') uri = '/'.join(spl) - r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False) + r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False, verify=False) if 'Wait 1 hour' in r.data: uri = '' logger.error('IP bannato da vcrypt, aspetta un ora') @@ -552,7 +552,7 @@ class UnshortenIt(object): splitted = path.split('/') splitted[1] = 'outlink' new_uri = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]}).headers['location'] - if new_uri != uri: + if new_uri and new_uri != uri: uri = new_uri else: uri = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False, post={'url': splitted[2]}).headers['location'] diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index b36b9e65..68cd0921 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1110,9 +1110,7 @@ def play_torrent(item, xlistitem, mediaurl): selection = 0 if selection >= 0: - - xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xlistitem) - time.sleep(1) + prevent_busy(item) mediaurl = urllib.quote_plus(item.url) torr_client = torrent_options[selection][0] @@ -1131,8 +1129,9 @@ def play_torrent(item, xlistitem, mediaurl): torrent.mark_auto_as_watched(item) - while is_playing() and not xbmc.Monitor().abortRequested(): - time.sleep(3) + if not item.globalsearch: + while is_playing() and not xbmc.Monitor().abortRequested(): + time.sleep(3) def resume_playback(played_time): diff --git a/platformcode/xbmc_info_window.py b/platformcode/xbmc_info_window.py index ac588928..1fbbd37e 100644 --- a/platformcode/xbmc_info_window.py +++ b/platformcode/xbmc_info_window.py @@ -64,7 +64,7 @@ class InfoWindow(xbmcgui.WindowXMLDialog): def onClick(self, control_id): if control_id == SELECT: - self.response = self.results[self.getControl(SELECT).getSelectedPosition()] + self.response = self.results[int(self.getControl(SELECT).getSelectedItem().getProperty('position'))] self.close() elif control_id == CLOSE: self.close() diff --git a/servers/supervideo.py b/servers/supervideo.py index 2ab9ae1a..8333e0a6 100644 --- a/servers/supervideo.py +++ b/servers/supervideo.py @@ -12,6 +12,9 @@ def test_video_exists(page_url): logger.debug("(page_url='%s')" % page_url) global data data = httptools.downloadpage(page_url, cookies=False).data + if 'Video embed restricted for this domain'in data: + headers = {'Referer':''} + data = httptools.downloadpage(page_url, headers=headers, cookies=False).data if 'File is no longer available as it expired or has been deleted' in data: return False, config.get_localized_string(70449) % "SuperVideo" diff --git a/servers/wstream.json b/servers/wstream.json index 8fdab5dd..0362a130 100644 --- a/servers/wstream.json +++ b/servers/wstream.json @@ -7,11 +7,11 @@ "find_videos": { "patterns": [ { - "pattern": "(?:wstream\\.video|wstream\\.icu)(?!<)(?:=|/)(?:video[a-zA-Z0-9.?_]*|embed[a-zA-Z0-9]*|)?(?!api|swembedid)(?:-|/|=)?(?:[a-z0-9A-Z]+/)?([a-z0-9A-Z]+)", + "pattern": "(?:wstream\\.video|wstream\\.icu)(?!<)(?:=|/)(?:video[a-zA-Z0-9.?_]*|embed[a-zA-Z0-9]*|)?(?!api|swembedid|swvideoid)(?:-|/|=)?(?:[a-z0-9A-Z]+/)?([a-z0-9A-Z]+)", "url": "http://wstream.video/video.php?file_code=\\1" }, { - "pattern": "(?:wstream\\.video|wstream\\.icu)/((?:api/vcmod/fastredirect/streaming\\.php\\?id=|swembedid/)[$0-9]+)", + "pattern": "(?:wstream\\.video|wstream\\.icu)/((?:api/vcmod/fastredirect/streaming\\.php\\?id=|swembedid|swvideoid/)[$0-9]+)", "url": "http://wstream.video/\\1" }, { diff --git a/servers/wstream.py b/servers/wstream.py index 46312815..83ce24f3 100644 --- a/servers/wstream.py +++ b/servers/wstream.py @@ -21,7 +21,9 @@ def test_video_exists(page_url): headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0']] logger.debug("(page_url='%s')" % page_url) - resp = httptools.downloadpage(page_url, headers=headers, verify=False) + disable_directIP = False + if 'swvideoid' in page_url: disable_directIP = True + resp = httptools.downloadpage(page_url, headers=headers, verify=False, disable_directIP=disable_directIP) global data, real_url data = resp.data diff --git a/service.py b/service.py index 69204fa6..0f8bc7c7 100644 --- a/service.py +++ b/service.py @@ -47,9 +47,9 @@ def update(path, p_dialog, i, t, serie, overwrite): url = module.host + urlsplit(url).path serie.url = url - ###### Redirección al canal NewPct1.py si es un clone, o a otro canal y url si ha intervención judicial + ###### Redirection to the NewPct1.py channel if it is a clone, or to another channel and url if there has been judicial intervention try: - head_nfo, it = videolibrarytools.read_nfo(nfo_file) #Refresca el .nfo para recoger actualizaciones + head_nfo, it = videolibrarytools.read_nfo(nfo_file) # Refresh the .nfo to collect updates if it.emergency_urls: serie.emergency_urls = it.emergency_urls serie.category = category @@ -75,7 +75,7 @@ def update(path, p_dialog, i, t, serie, overwrite): try: if int(overwrite) == 3: - # Sobrescribir todos los archivos (tvshow.nfo, 1x01.nfo, 1x01 [canal].json, 1x01.strm, etc...) + # Overwrite all files (tvshow.nfo, 1x01.nfo, 1x01 [channel] .json, 1x01.strm, etc ...) insertados, sobreescritos, fallidos, notusedpath = videolibrarytools.save_tvshow(serie, itemlist) #serie= videolibrary.check_season_playcount(serie, serie.contentSeason) #if filetools.write(path + '/tvshow.nfo', head_nfo + it.tojson()): @@ -104,9 +104,9 @@ def update(path, p_dialog, i, t, serie, overwrite): else: logger.debug("Channel %s not active is not updated" % serie.channel) - #Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa + # Synchronize the episodes seen from the Kodi video library with that of KoD try: - if config.is_xbmc(): #Si es Kodi, lo hacemos + if config.is_xbmc(): # If it's Kodi, we do it from platformcode import xbmc_videolibrary xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo')) except: @@ -151,27 +151,27 @@ def check_for_update(overwrite=True): logger.debug("serie=" + serie.contentSerieName) p_dialog.update(int(math.ceil((i + 1) * t)), heading, serie.contentSerieName) - #Verificamos el estado del serie.library_playcounts de la Serie por si está incompleto + # Check the status of the series.library_playcounts of the Series in case it is incomplete try: estado = False - #Si no hemos hecho la verificación o no tiene playcount, entramos + # If we have not done the verification or do not have a playcount, we enter estado = config.get_setting("verify_playcount", "videolibrary") - if not estado or estado == False or not serie.library_playcounts: #Si no se ha pasado antes, lo hacemos ahora - serie, estado = videolibrary.verify_playcount_series(serie, path) #También se pasa si falta un PlayCount por completo + if not estado or estado == False or not serie.library_playcounts: # If it hasn't happened before, we do it now + serie, estado = videolibrary.verify_playcount_series(serie, path) # Also happens if a PlayCount is missing completely except: logger.error(traceback.format_exc()) else: - if estado: #Si ha tenido éxito la actualización... - estado_verify_playcount_series = True #... se marca para cambiar la opción de la Videoteca + if estado: # If the update was successful ... + estado_verify_playcount_series = True # ... is checked to change the Video Library option - interval = int(serie.active) # Podria ser del tipo bool + interval = int(serie.active) # Could be the bool type if not serie.active: - # si la serie no esta activa descartar + # if the series is not active discard if not overwrite: - #Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa, aunque la serie esté desactivada + # Synchronize the episodes seen from the Kodi video library with that of Alpha, even if the series is deactivated try: - if config.is_xbmc(): #Si es Kodi, lo hacemos + if config.is_xbmc(): # If it's Kodi, we do it from platformcode import xbmc_videolibrary xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo')) except: @@ -179,7 +179,7 @@ def check_for_update(overwrite=True): continue - # obtenemos las fecha de actualizacion y de la proxima programada para esta serie + # Obtain the update date and the next scheduled for this series update_next = serie.update_next if update_next: y, m, d = update_next.split('-') @@ -194,33 +194,33 @@ def check_for_update(overwrite=True): else: update_last = hoy - # si la serie esta activa ... + # if the series is active ... if overwrite or config.get_setting("updatetvshows_interval", "videolibrary") == 0: - # ... forzar actualizacion independientemente del intervalo + # ... force update regardless of interval serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) if not serie_actualizada: update_next = hoy + datetime.timedelta(days=interval) elif interval == 1 and update_next <= hoy: - # ...actualizacion diaria + # ...daily update serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) if not serie_actualizada and update_last <= hoy - datetime.timedelta(days=7): - # si hace una semana q no se actualiza, pasar el intervalo a semanal + # if it hasn't been updated for a week, change the interval to weekly interval = 7 update_next = hoy + datetime.timedelta(days=interval) elif interval == 7 and update_next <= hoy: - # ...actualizacion semanal + # ... weekly update serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) if not serie_actualizada: if update_last <= hoy - datetime.timedelta(days=14): - # si hace 2 semanas q no se actualiza, pasar el intervalo a mensual + # if it has not been updated for 2 weeks, change the interval to monthly interval = 30 update_next += datetime.timedelta(days=interval) elif interval == 30 and update_next <= hoy: - # ...actualizacion mensual + # ... monthly update serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) if not serie_actualizada: update_next += datetime.timedelta(days=interval) @@ -229,7 +229,7 @@ def check_for_update(overwrite=True): update_last = hoy update_next = hoy + datetime.timedelta(days=interval) - head_nfo, serie = videolibrarytools.read_nfo(tvshow_file) #Vuelve a leer el.nfo, que ha sido modificado + head_nfo, serie = videolibrarytools.read_nfo(tvshow_file) # Reread the .nfo, which has been modified if interval != int(serie.active) or update_next.strftime('%Y-%m-%d') != serie.update_next or update_last.strftime('%Y-%m-%d') != serie.update_last: serie.update_last = update_last.strftime('%Y-%m-%d') if update_next > hoy: @@ -241,18 +241,18 @@ def check_for_update(overwrite=True): if serie_actualizada: if config.get_setting("search_new_content", "videolibrary") == 0: - # Actualizamos la videoteca de Kodi: Buscar contenido en la carpeta de la serie + # We update the Kodi video library: Find content in the series folder if config.is_xbmc() and config.get_setting("videolibrary_kodi"): from platformcode import xbmc_videolibrary xbmc_videolibrary.update(folder=filetools.basename(path)) else: update_when_finished = True - if estado_verify_playcount_series: #Si se ha cambiado algún playcount, ... - estado = config.set_setting("verify_playcount", True, "videolibrary") #... actualizamos la opción de Videolibrary + if estado_verify_playcount_series: # If any playcount has been changed, ... + estado = config.set_setting("verify_playcount", True, "videolibrary") # ... we update the Videolibrary option if config.get_setting("search_new_content", "videolibrary") == 1 and update_when_finished: - # Actualizamos la videoteca de Kodi: Buscar contenido en todas las series + # We update the Kodi video library: Find content in all series if config.is_xbmc() and config.get_setting("videolibrary_kodi"): from platformcode import xbmc_videolibrary xbmc_videolibrary.update() @@ -365,11 +365,10 @@ class AddonMonitor(xbmc.Monitor): xbmc_videolibrary.update_sources(settings_post.get('downloadpath', None), self.settings_pre.get('downloadpath', None)) - # si se ha cambiado la ruta de la videoteca llamamos a comprobar directorios para que lo cree y pregunte - # automaticamente si configurar la videoteca - if self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \ - self.settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \ - self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None): + # If the path of the video library has been changed, we call to check directories so that it creates it and automatically asks if to configure the video library + if self.settings_pre.get("videolibrarypath", None) and self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \ + self.settings_pre.get("folder_movies", None) and self.settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \ + self.settings_pre.get("folder_tvshows", None) and self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None): videolibrary.move_videolibrary(self.settings_pre.get("videolibrarypath", ''), settings_post.get("videolibrarypath", ''), self.settings_pre.get("folder_movies", ''), @@ -377,7 +376,7 @@ class AddonMonitor(xbmc.Monitor): self.settings_pre.get("folder_tvshows", ''), settings_post.get("folder_tvshows", '')) - # si se ha puesto que se quiere autoconfigurar y se había creado el directorio de la videoteca + # if you want to autoconfigure and the video library directory had been created if not self.settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None): xbmc_videolibrary.ask_set_content(silent=True) elif self.settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None): diff --git a/specials/globalsearch.py b/specials/globalsearch.py index b2425bd2..21bfedb0 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -397,7 +397,8 @@ class SearchWindow(xbmcgui.WindowXMLDialog): for result in results: resultsList += result.tourl() + '|' item.setProperty('items',resultsList) - self.channels[int(self.results[name])].setProperty('results', str(len(resultsList).split('|') - 1)) + logger.log(self.channels[int(self.results[name])]) + self.channels[int(self.results[name])].setProperty('results', str(len(resultsList.split('|')) - 1)) pos = self.CHANNELS.getSelectedPosition() self.CHANNELS.reset() self.CHANNELS.addItems(self.channels) @@ -745,9 +746,10 @@ class SearchWindow(xbmcgui.WindowXMLDialog): server.window = True server.globalsearch = True platformtools.prevent_busy(server) - run(server) + Thread(target=run, args=[server]).start() + # run(server) try: - while not xbmc.Player().getTime() > 0: + while not platformtools.is_playing() or not xbmc.Player().getTime() > 0: xbmc.sleep(500) self.close() xbmc.sleep(500)