- Fix Wstream

- Fix Unshortenit
 - Fix Spostamento Videoteca
This commit is contained in:
Alhaziel01
2020-12-21 09:10:25 +01:00
parent 3ffb7498f4
commit 8fa69efc71
5 changed files with 41 additions and 40 deletions
+1 -1
View File
@@ -300,7 +300,7 @@ def downloadpage(url, **opt):
else: else:
req_headers = dict(opt['headers']) 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 req_headers['Host'] = domain
url = urlparse.urlunparse(parse._replace(netloc=directIP.get(domain))) url = urlparse.urlunparse(parse._replace(netloc=directIP.get(domain)))
+2 -2
View File
@@ -534,7 +534,7 @@ class UnshortenIt(object):
if spl[3] == 'wss1': if spl[3] == 'wss1':
spl[4] = b64encode(spl[4].encode('utf-8')).decode('utf-8') spl[4] = b64encode(spl[4].encode('utf-8')).decode('utf-8')
uri = '/'.join(spl) 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: if 'Wait 1 hour' in r.data:
uri = '' uri = ''
logger.error('IP bannato da vcrypt, aspetta un ora') logger.error('IP bannato da vcrypt, aspetta un ora')
@@ -552,7 +552,7 @@ class UnshortenIt(object):
splitted = path.split('/') splitted = path.split('/')
splitted[1] = 'outlink' splitted[1] = 'outlink'
new_uri = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]}).headers['location'] 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 uri = new_uri
else: else:
uri = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False, post={'url': splitted[2]}).headers['location'] uri = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False, post={'url': splitted[2]}).headers['location']
+2 -2
View File
@@ -7,11 +7,11 @@
"find_videos": { "find_videos": {
"patterns": [ "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" "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" "url": "http://wstream.video/\\1"
}, },
{ {
+3 -1
View File
@@ -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']] 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) 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 global data, real_url
data = resp.data data = resp.data
+33 -34
View File
@@ -47,9 +47,9 @@ def update(path, p_dialog, i, t, serie, overwrite):
url = module.host + urlsplit(url).path url = module.host + urlsplit(url).path
serie.url = url 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: 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: if it.emergency_urls:
serie.emergency_urls = it.emergency_urls serie.emergency_urls = it.emergency_urls
serie.category = category serie.category = category
@@ -75,7 +75,7 @@ def update(path, p_dialog, i, t, serie, overwrite):
try: try:
if int(overwrite) == 3: 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) insertados, sobreescritos, fallidos, notusedpath = videolibrarytools.save_tvshow(serie, itemlist)
#serie= videolibrary.check_season_playcount(serie, serie.contentSeason) #serie= videolibrary.check_season_playcount(serie, serie.contentSeason)
#if filetools.write(path + '/tvshow.nfo', head_nfo + it.tojson()): #if filetools.write(path + '/tvshow.nfo', head_nfo + it.tojson()):
@@ -104,9 +104,9 @@ def update(path, p_dialog, i, t, serie, overwrite):
else: else:
logger.debug("Channel %s not active is not updated" % serie.channel) 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: 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 from platformcode import xbmc_videolibrary
xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo')) xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo'))
except: except:
@@ -151,27 +151,27 @@ def check_for_update(overwrite=True):
logger.debug("serie=" + serie.contentSerieName) logger.debug("serie=" + serie.contentSerieName)
p_dialog.update(int(math.ceil((i + 1) * t)), heading, 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: try:
estado = False 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") 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 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) #También se pasa si falta un PlayCount por completo serie, estado = videolibrary.verify_playcount_series(serie, path) # Also happens if a PlayCount is missing completely
except: except:
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
else: else:
if estado: #Si ha tenido éxito la actualización... if estado: # If the update was successful ...
estado_verify_playcount_series = True #... se marca para cambiar la opción de la Videoteca 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: if not serie.active:
# si la serie no esta activa descartar # if the series is not active discard
if not overwrite: 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: 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 from platformcode import xbmc_videolibrary
xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo')) xbmc_videolibrary.mark_content_as_watched_on_kod(filetools.join(path,'tvshow.nfo'))
except: except:
@@ -179,7 +179,7 @@ def check_for_update(overwrite=True):
continue 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 update_next = serie.update_next
if update_next: if update_next:
y, m, d = update_next.split('-') y, m, d = update_next.split('-')
@@ -194,33 +194,33 @@ def check_for_update(overwrite=True):
else: else:
update_last = hoy update_last = hoy
# si la serie esta activa ... # if the series is active ...
if overwrite or config.get_setting("updatetvshows_interval", "videolibrary") == 0: 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) serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
if not serie_actualizada: if not serie_actualizada:
update_next = hoy + datetime.timedelta(days=interval) update_next = hoy + datetime.timedelta(days=interval)
elif interval == 1 and update_next <= hoy: elif interval == 1 and update_next <= hoy:
# ...actualizacion diaria # ...daily update
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
if not serie_actualizada and update_last <= hoy - datetime.timedelta(days=7): 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 interval = 7
update_next = hoy + datetime.timedelta(days=interval) update_next = hoy + datetime.timedelta(days=interval)
elif interval == 7 and update_next <= hoy: elif interval == 7 and update_next <= hoy:
# ...actualizacion semanal # ... weekly update
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
if not serie_actualizada: if not serie_actualizada:
if update_last <= hoy - datetime.timedelta(days=14): 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 interval = 30
update_next += datetime.timedelta(days=interval) update_next += datetime.timedelta(days=interval)
elif interval == 30 and update_next <= hoy: elif interval == 30 and update_next <= hoy:
# ...actualizacion mensual # ... monthly update
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite) serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
if not serie_actualizada: if not serie_actualizada:
update_next += datetime.timedelta(days=interval) update_next += datetime.timedelta(days=interval)
@@ -229,7 +229,7 @@ def check_for_update(overwrite=True):
update_last = hoy update_last = hoy
update_next = hoy + datetime.timedelta(days=interval) 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: 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') serie.update_last = update_last.strftime('%Y-%m-%d')
if update_next > hoy: if update_next > hoy:
@@ -241,18 +241,18 @@ def check_for_update(overwrite=True):
if serie_actualizada: if serie_actualizada:
if config.get_setting("search_new_content", "videolibrary") == 0: 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"): if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary from platformcode import xbmc_videolibrary
xbmc_videolibrary.update(folder=filetools.basename(path)) xbmc_videolibrary.update(folder=filetools.basename(path))
else: else:
update_when_finished = True update_when_finished = True
if estado_verify_playcount_series: #Si se ha cambiado algún playcount, ... if estado_verify_playcount_series: # If any playcount has been changed, ...
estado = config.set_setting("verify_playcount", True, "videolibrary") #... actualizamos la opción de Videolibrary 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: 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"): if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary from platformcode import xbmc_videolibrary
xbmc_videolibrary.update() xbmc_videolibrary.update()
@@ -365,11 +365,10 @@ class AddonMonitor(xbmc.Monitor):
xbmc_videolibrary.update_sources(settings_post.get('downloadpath', None), xbmc_videolibrary.update_sources(settings_post.get('downloadpath', None),
self.settings_pre.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 # 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
# automaticamente si configurar la videoteca if self.settings_pre.get("videolibrarypath", None) and self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \
if 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_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):
self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None):
videolibrary.move_videolibrary(self.settings_pre.get("videolibrarypath", ''), videolibrary.move_videolibrary(self.settings_pre.get("videolibrarypath", ''),
settings_post.get("videolibrarypath", ''), settings_post.get("videolibrarypath", ''),
self.settings_pre.get("folder_movies", ''), self.settings_pre.get("folder_movies", ''),
@@ -377,7 +376,7 @@ class AddonMonitor(xbmc.Monitor):
self.settings_pre.get("folder_tvshows", ''), self.settings_pre.get("folder_tvshows", ''),
settings_post.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): if not self.settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None):
xbmc_videolibrary.ask_set_content(silent=True) xbmc_videolibrary.ask_set_content(silent=True)
elif self.settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None): elif self.settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None):