KoD 1.7
- Aggiunto menu globale opzioni di KoD\n- Aggiunto canale tapmovie e server annessi\n- Notifica quando il tipo di vista viene salvata (con indicazione del tipo di contenuto)\n\n
This commit is contained in:
+1
-1
@@ -114,7 +114,7 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
|
||||
ret = super(CipherSuiteAdapter, self).send(request, **kwargs)
|
||||
if 400 <= ret.status_code < 500:
|
||||
raise Exception
|
||||
except Exception as e:
|
||||
except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError, requests.exceptions.SSLError) as e:
|
||||
logger.info('Request for ' + domain + ' with ip ' + ip + ' failed')
|
||||
logger.info(e)
|
||||
# if 'SSLError' in str(e):
|
||||
|
||||
+39
-18
@@ -152,6 +152,7 @@ def cleantitle(title):
|
||||
cleantitle = ''
|
||||
if title:
|
||||
if type(title) != str: title.decode('UTF-8')
|
||||
title = scrapertools.unescape(title)
|
||||
title = scrapertools.decodeHtmlentities(title)
|
||||
cleantitle = title.replace('"', "'").replace('×', 'x').replace('–', '-').strip()
|
||||
return cleantitle
|
||||
@@ -386,7 +387,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
contentSerieName= title if 'movie' not in [contentType] and function != 'episodios' else item.contentSerieName,
|
||||
contentTitle= title if 'movie' in [contentType] and function == 'peliculas' else item.contentTitle,
|
||||
contentLanguage = lang1,
|
||||
contentEpisodeNumber=episode if episode else '',
|
||||
contentSeason= infolabels.get('season', ''),
|
||||
contentEpisodeNumber=infolabels.get('episode', ''),
|
||||
news= item.news if item.news else '',
|
||||
other = scraped['other'] if scraped['other'] else '',
|
||||
grouped=group
|
||||
@@ -531,15 +533,25 @@ def scrape(func):
|
||||
itemlist = newFunc()
|
||||
itemlist = [i for i in itemlist if i.action not in ['add_pelicula_to_library', 'add_serie_to_library']]
|
||||
|
||||
if action != 'play' and function != 'episodios' and 'patronMenu' not in args and item.contentType in ['movie', 'tvshow', 'episode', 'undefined'] and not disabletmdb:
|
||||
if anime and inspect.stack()[1][3] not in ['find_episodes']:
|
||||
from platformcode import autorenumber
|
||||
if function == 'episodios': autorenumber.start(itemlist, item)
|
||||
else: autorenumber.start(itemlist)
|
||||
|
||||
if action != 'play' and 'patronMenu' not in args and not disabletmdb and function != 'episodios' and item.contentType in ['movie', 'tvshow', 'episode', 'undefined']:
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
if not group and not args.get('groupExplode') and ((pagination and len(matches) <= pag * pagination) or not pagination): # next page with pagination
|
||||
if patronNext and inspect.stack()[1][3] not in ['newest'] and len(inspect.stack()) > 2 and inspect.stack()[2][3] not in ['get_channel_results']:
|
||||
nextPage(itemlist, item, data, patronNext, function)
|
||||
|
||||
# if function == 'episodios':
|
||||
# scraper.sort_episode_list(itemlist)
|
||||
for it in itemlist:
|
||||
if it.contentEpisodeNumber and it.contentSeason:
|
||||
it.title = '[B]{:d}x{:02d} - {}[/B]'.format(it.contentSeason, it.contentEpisodeNumber, it.infoLabels['title'] if it.infoLabels['title'] else it.fulltitle)
|
||||
if it.contentLanguage:
|
||||
it.title += typo(it.contentLanguage, '_ [] color kod')
|
||||
if it.quality:
|
||||
it.title += typo(it.quality, '_ [] color kod')
|
||||
|
||||
# next page for pagination
|
||||
if pagination and len(matches) > pag * pagination and not search:
|
||||
@@ -557,13 +569,7 @@ def scrape(func):
|
||||
thumbnail=thumb(),
|
||||
prevthumb=item.prevthumb if item.prevthumb else item.thumbnail))
|
||||
|
||||
if anime and inspect.stack()[1][3] not in ['find_episodes']:
|
||||
from platformcode import autorenumber
|
||||
if function == 'episodios': autorenumber.start(itemlist, item)
|
||||
else: autorenumber.start(itemlist)
|
||||
# if anime and autorenumber.check(item) == False and len(itemlist)>0 and not scrapertools.find_single_match(itemlist[0].title, r'(\d+.\d+)'):
|
||||
# pass
|
||||
# else:
|
||||
|
||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
||||
if addVideolibrary and (item.infoLabels["title"] or item.fulltitle):
|
||||
# item.fulltitle = item.infoLabels["title"]
|
||||
@@ -1139,7 +1145,10 @@ def nextPage(itemlist, item, data='', patron='', function_or_level=1, next_page=
|
||||
if next_page != "":
|
||||
if resub: next_page = re.sub(resub[0], resub[1], next_page)
|
||||
if 'http' not in next_page:
|
||||
next_page = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+') + (next_page if next_page.startswith('/') else '/' + next_page)
|
||||
if '/' in next_page:
|
||||
next_page = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+') + (next_page if next_page.startswith('/') else '/' + next_page)
|
||||
else:
|
||||
next_page = '/'.join(item.url.split('/')[:-1]) + '/' + next_page
|
||||
next_page = next_page.replace('&', '&')
|
||||
logger.debug('NEXT= ', next_page)
|
||||
itemlist.append(
|
||||
@@ -1362,15 +1371,27 @@ def addQualityTag(item, itemlist, data, patron):
|
||||
info('nessun tag qualità trovato')
|
||||
|
||||
def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||
from core import jsontools
|
||||
|
||||
video_urls = []
|
||||
block = scrapertools.find_single_match(data, r'sources:\s*\[([^\]]+)\]') if not dataIsBlock else data
|
||||
block = scrapertools.find_single_match(data, r'sources:\s*([^\]]+\])') if not dataIsBlock else data
|
||||
if block:
|
||||
if 'file:' in block:
|
||||
sources = scrapertools.find_multiple_matches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
|
||||
elif 'src:' in block:
|
||||
sources = scrapertools.find_multiple_matches(block, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:,[^,]+,\s*label:\s*"([^"]+)")?')
|
||||
json = jsontools.load(block)
|
||||
if json:
|
||||
sources = []
|
||||
for s in json:
|
||||
if 'file' in s.keys():
|
||||
src = s['file']
|
||||
else:
|
||||
src = s['src']
|
||||
sources.append((src, s.get('label')))
|
||||
else:
|
||||
sources =[(block.replace('"',''), '')]
|
||||
if 'file:' in block:
|
||||
sources = scrapertools.find_multiple_matches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
|
||||
elif 'src:' in block:
|
||||
sources = scrapertools.find_multiple_matches(block, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:,[^,]+,\s*label:\s*"([^"]+)")?')
|
||||
else:
|
||||
sources =[(block.replace('"',''), '')]
|
||||
for url, quality in sources:
|
||||
quality = 'auto' if not quality else quality
|
||||
if url.split('.')[-1] != 'mpd':
|
||||
|
||||
+403
-344
File diff suppressed because it is too large
Load Diff
+13
-48
@@ -585,10 +585,17 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
|
||||
# process local episodes
|
||||
local_episodes_path = ''
|
||||
local_episodelist = []
|
||||
update = False
|
||||
nfo_path = filetools.join(path, "tvshow.nfo")
|
||||
head_nfo, item_nfo = read_nfo(nfo_path)
|
||||
local_episodelist = item_nfo.local_episodes_list if item_nfo.local_episodes_list else []
|
||||
|
||||
if config.get_setting('videolibrary_kodi'):
|
||||
from platformcode.xbmc_videolibrary import check_db
|
||||
for p in check_db(item_nfo.infoLabels['code']):
|
||||
local_episodelist += get_local_content(p)
|
||||
item_nfo.local_episodes_list = local_episodelist
|
||||
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
|
||||
|
||||
if item_nfo.update_last:
|
||||
local_episodes_path = item_nfo.local_episodes_path
|
||||
@@ -601,47 +608,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
|
||||
|
||||
if local_episodes_path:
|
||||
from platformcode.xbmc_videolibrary import check_db, clean
|
||||
# check if the local episodes are in the Kodi video library
|
||||
if check_db(local_episodes_path):
|
||||
local_episodelist += get_local_content(local_episodes_path)
|
||||
clean_list = []
|
||||
for f in filetools.listdir(path):
|
||||
match = scrapertools.find_single_match(f, r'[Ss]?(\d+)(?:x|_|\s+)?[Ee]?[Pp]?(\d+)')
|
||||
if match:
|
||||
ep = '%dx%02d' % (int(match[0]), int(match[1]))
|
||||
if ep in local_episodelist:
|
||||
del_file = filetools.join(path, f)
|
||||
filetools.remove(del_file)
|
||||
if f.endswith('strm'):
|
||||
sep = '\\' if '\\' in path else '/'
|
||||
clean_path = path[:-len(sep)] if path.endswith(sep) else path
|
||||
clean_path = '%/' + clean_path.split(sep)[-1] + '/' + f
|
||||
clean_list.append(clean_path)
|
||||
clean_list.append(clean_path.replace('/','\\'))
|
||||
|
||||
if clean_list:
|
||||
clean(clean_list)
|
||||
update = True
|
||||
|
||||
if item_nfo.local_episodes_list:
|
||||
difference = [x for x in item_nfo.local_episodes_list if (x not in local_episodelist)]
|
||||
if len(difference) > 0:
|
||||
clean_list = []
|
||||
for f in difference:
|
||||
sep = '\\' if '\\' in local_episodes_path else '/'
|
||||
clean_path = local_episodes_path[:-len(sep)] if local_episodes_path.endswith(sep) else local_episodes_path
|
||||
clean_path = '%/' + clean_path.split(sep)[-1] + '/%' + f.replace('x','%') + '%'
|
||||
clean_list.append(clean_path)
|
||||
clean_list.append(clean_path.replace('/','\\'))
|
||||
clean(clean_list)
|
||||
update = True
|
||||
|
||||
item_nfo.local_episodes_list = sorted(local_episodelist)
|
||||
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
|
||||
# the local episodes are not in the Kodi video library
|
||||
else:
|
||||
process_local_episodes(local_episodes_path, path)
|
||||
process_local_episodes(local_episodes_path, path, local_episodelist)
|
||||
|
||||
insertados = 0
|
||||
sobreescritos = 0
|
||||
@@ -930,24 +897,22 @@ def config_local_episodes_path(path, item, silent=False):
|
||||
return 0, local_episodes_path
|
||||
|
||||
|
||||
def process_local_episodes(local_episodes_path, path):
|
||||
def process_local_episodes(local_episodes_path, path, local_episodes_list):
|
||||
logger.debug()
|
||||
|
||||
sub_extensions = ['.srt', '.sub', '.sbv', '.ass', '.idx', '.ssa', '.smi']
|
||||
artwork_extensions = ['.jpg', '.jpeg', '.png']
|
||||
extensions = sub_extensions + artwork_extensions
|
||||
|
||||
local_episodes_list = []
|
||||
files_list = []
|
||||
for root, folders, files in filetools.walk(local_episodes_path):
|
||||
for file in files:
|
||||
if os.path.splitext(file)[1] in extensions:
|
||||
continue
|
||||
season_episode = scrapertools.get_season_and_episode(file)
|
||||
if season_episode == "":
|
||||
continue
|
||||
local_episodes_list.append(season_episode)
|
||||
files_list.append(file)
|
||||
if season_episode and season_episode not in local_episodes_list:
|
||||
local_episodes_list.append(season_episode)
|
||||
files_list.append(file)
|
||||
|
||||
nfo_path = filetools.join(path, "tvshow.nfo")
|
||||
head_nfo, item_nfo = read_nfo(nfo_path)
|
||||
|
||||
Reference in New Issue
Block a user