Migliorie al Filtro Lingua/Qualità
This commit is contained in:
+70
-22
@@ -7,6 +7,7 @@ import errno
|
|||||||
import math
|
import math
|
||||||
import traceback
|
import traceback
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
from core import filetools
|
from core import filetools
|
||||||
from core import scraper
|
from core import scraper
|
||||||
@@ -223,43 +224,71 @@ def save_movie(item):
|
|||||||
return 0, 0, -1
|
return 0, 0, -1
|
||||||
|
|
||||||
def filter_list(episodelist, action=None, path=None):
|
def filter_list(episodelist, action=None, path=None):
|
||||||
lang_sel = quality_sel = ''
|
lang_sel = quality_sel = show_title = channel =''
|
||||||
if action:
|
if action:
|
||||||
tvshow_path = filetools.join(path, "tvshow.nfo")
|
tvshow_path = filetools.join(path, "tvshow.nfo")
|
||||||
head_nfo, tvshow_item = read_nfo(tvshow_path)
|
head_nfo, tvshow_item = read_nfo(tvshow_path)
|
||||||
channel = episodelist[0].channel
|
channel = episodelist[0].channel
|
||||||
|
show_title = tvshow_item.infoLabels['tvshowtitle']
|
||||||
if not tvshow_item.channel_prefs:
|
if not tvshow_item.channel_prefs:
|
||||||
tvshow_item.channel_prefs={channel:{}}
|
tvshow_item.channel_prefs={channel:{}}
|
||||||
|
|
||||||
|
list_item = os.listdir(path)
|
||||||
|
for File in list_item:
|
||||||
|
if (File.endswith('.strm') or File.endswith('.json') or File.endswith('.nfo')) and not File == 'twshow.info':
|
||||||
|
os.remove(os.path.join(path, File))
|
||||||
if channel not in tvshow_item.channel_prefs:
|
if channel not in tvshow_item.channel_prefs:
|
||||||
tvshow_item.channel_prefs[channel] = {}
|
tvshow_item.channel_prefs[channel] = {}
|
||||||
channel_prefs = tvshow_item.channel_prefs[channel]
|
channel_prefs = tvshow_item.channel_prefs[channel]
|
||||||
|
logger.info(str(tvshow_item))
|
||||||
if action == 'get_seasons':
|
if action == 'get_seasons':
|
||||||
if channel_prefs:
|
if 'favourite_language' not in channel_prefs:
|
||||||
|
channel_prefs['favourite_language'] = ''
|
||||||
|
if 'favourite_quality' not in channel_prefs:
|
||||||
|
channel_prefs['favourite_quality'] = ''
|
||||||
if channel_prefs['favourite_language']:
|
if channel_prefs['favourite_language']:
|
||||||
lang_sel = channel_prefs['favourite_language']
|
lang_sel = channel_prefs['favourite_language']
|
||||||
if channel_prefs['favourite_quality']:
|
if channel_prefs['favourite_quality']:
|
||||||
quality_sel = channel_prefs['favourite_quality']
|
quality_sel = channel_prefs['favourite_quality']
|
||||||
|
# if Download
|
||||||
|
if not show_title: show_title = episodelist[0].fulltitle
|
||||||
|
if not channel: channel= episodelist[0].channel
|
||||||
# SELECT EISODE BY LANG AND QUALITY
|
# SELECT EISODE BY LANG AND QUALITY
|
||||||
quality_dict = {"N/A": ["n/a"],
|
quality_dict = {'N/A': ['n/a'],
|
||||||
"BLURAY": ["br", "bluray"],
|
'BLURAY': ['br', 'bluray'],
|
||||||
"FULLHD": ["fullhd", "fullhd 1080", "fullhd 1080p", "full hd", "full hd 1080", "full hd 1080p", "hd1080", "hd1080p", "hd 1080", "hd 1080p", "1080", "1080p"],
|
'FULLHD': ['fullhd', 'fullhd 1080', 'fullhd 1080p', 'full hd', 'full hd 1080', 'full hd 1080p', 'hd1080', 'hd1080p', 'hd 1080', 'hd 1080p', '1080', '1080p'],
|
||||||
"HD": ["hd", "hd720", "hd720p", "hd 720", "hd 720p", "720", "720p", "hdtv"],
|
'HD': ['hd', 'hd720', 'hd720p', 'hd 720', 'hd 720p', '720', '720p', 'hdtv'],
|
||||||
"480P": ["sd", "480p", '480'],
|
'480P': ['sd', '480p', '480'],
|
||||||
"360P": ["360p", "360"],
|
'360P': ['360p', '360'],
|
||||||
"240P": ["240p", "240"],
|
'240P': ['240p', '240'],
|
||||||
config.get_localized_string(70241):["MAX"]}
|
'MAX':['MAX']}
|
||||||
quality_order = ["N/A", "240P", "360P","480P", "HD", "FULLHD", "BLURAY", config.get_localized_string(70241)]
|
quality_order = ['N/A', '240P', '360P','480P', 'HD', 'FULLHD', 'BLURAY', 'MAX']
|
||||||
|
|
||||||
|
|
||||||
ep_list = []
|
|
||||||
lang_list = []
|
lang_list = []
|
||||||
quality_list = [config.get_localized_string(70241)]
|
sub_list = []
|
||||||
|
quality_list = ['MAX']
|
||||||
# Make lang_list and Quality_list
|
|
||||||
|
|
||||||
|
# Make Language List
|
||||||
|
for episode in episodelist:
|
||||||
|
if episode.contentLanguage and episode.contentLanguage not in lang_list:
|
||||||
|
# Make list of subtitled languages
|
||||||
|
if 'sub' in episode.contentLanguage.lower():
|
||||||
|
sub = re.sub('Sub-','', episode.contentLanguage)
|
||||||
|
if sub not in sub_list: sub_list.append(sub)
|
||||||
|
else:
|
||||||
|
lang_list.append(episode.contentLanguage)
|
||||||
|
# add to Language List subtitled languages
|
||||||
|
if sub_list:
|
||||||
|
for sub in sub_list:
|
||||||
|
if sub in lang_list:
|
||||||
|
lang_list.insert(lang_list.index(sub) + 1, 'Sub-' + sub)
|
||||||
|
lang_list.insert(lang_list.index(sub) + 2, sub + ' + Sub-' + sub)
|
||||||
|
else:
|
||||||
|
lang_list.append('Sub-' + sub)
|
||||||
|
|
||||||
|
# Make Quality List
|
||||||
for episode in episodelist:
|
for episode in episodelist:
|
||||||
if episode.contentLanguage and episode.contentLanguage not in lang_list: lang_list.append(episode.contentLanguage)
|
|
||||||
for name, var in quality_dict.items():
|
for name, var in quality_dict.items():
|
||||||
if not episode.quality and 'N/A' not in quality_list:
|
if not episode.quality and 'N/A' not in quality_list:
|
||||||
quality_list.append('N/A')
|
quality_list.append('N/A')
|
||||||
@@ -269,17 +298,34 @@ def filter_list(episodelist, action=None, path=None):
|
|||||||
|
|
||||||
# if more than one language
|
# if more than one language
|
||||||
if len(lang_list) > 1:
|
if len(lang_list) > 1:
|
||||||
selection = lang_list.index(lang_sel) if lang_sel else platformtools.dialog_select(config.get_localized_string(70725),lang_list)
|
selection = lang_list.index(lang_sel) if lang_sel else platformtools.dialog_select(config.get_localized_string(70725) % (show_title, channel),lang_list)
|
||||||
|
if action: lang_sel = channel_prefs['favourite_language'] = lang_list[selection]
|
||||||
|
langs = lang_list[selection].split(' + ')
|
||||||
|
|
||||||
|
ep_list = []
|
||||||
|
count = 0
|
||||||
|
stop = False
|
||||||
|
while not stop:
|
||||||
|
for episode in episodelist:
|
||||||
|
title = scrapertools.find_single_match(episode.title, '(\d+x\d+)')
|
||||||
|
if not any(title in word for word in ep_list) and episode.contentLanguage == langs[count]:
|
||||||
|
ep_list.append(episode.title)
|
||||||
|
if count < len(langs)-1: count += 1
|
||||||
|
else: stop = True
|
||||||
it = []
|
it = []
|
||||||
for episode in episodelist:
|
for episode in episodelist:
|
||||||
if episode.contentLanguage == lang_list[selection]:
|
if episode.title in ep_list:
|
||||||
if action: lang_sel = channel_prefs['favourite_language'] = lang_list[selection]
|
|
||||||
it.append(episode)
|
it.append(episode)
|
||||||
episodelist = it
|
episodelist = it
|
||||||
|
|
||||||
|
else: channel_prefs['favourite_language'] = ''
|
||||||
|
|
||||||
# if more than one quality
|
# if more than one quality
|
||||||
if len(quality_list) > 2:
|
if len(quality_list) > 2:
|
||||||
selection = favourite_quality_selection = quality_list.index(quality_sel) if quality_sel else platformtools.dialog_select(config.get_localized_string(70726),quality_list)
|
if config.get_setting('videolibrary_max_quality'): selection = favourite_quality_selection = len(quality_list)-1
|
||||||
|
else: selection = favourite_quality_selection = quality_list.index(quality_sel) if quality_sel else platformtools.dialog_select(config.get_localized_string(70726) % (show_title, channel) ,quality_list)
|
||||||
|
|
||||||
|
ep_list = []
|
||||||
stop = False
|
stop = False
|
||||||
while not stop:
|
while not stop:
|
||||||
for episode in episodelist:
|
for episode in episodelist:
|
||||||
@@ -301,6 +347,8 @@ def filter_list(episodelist, action=None, path=None):
|
|||||||
it.append(episode)
|
it.append(episode)
|
||||||
episodelist = it
|
episodelist = it
|
||||||
|
|
||||||
|
else:channel_prefs['favourite_quality'] = ''
|
||||||
|
|
||||||
if action: filetools.write(tvshow_path, head_nfo + tvshow_item.tojson())
|
if action: filetools.write(tvshow_path, head_nfo + tvshow_item.tojson())
|
||||||
|
|
||||||
return episodelist
|
return episodelist
|
||||||
|
|||||||
@@ -5618,11 +5618,11 @@ msgid "Channel"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70725"
|
msgctxt "#70725"
|
||||||
msgid "Select the language"
|
msgid "Select the language of [B]%s[/B] in [B]%s[/B]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70726"
|
msgctxt "#70726"
|
||||||
msgid "Seleziona la qualità"
|
msgid "Select the preferred quality of [B]%s[/B] in [B]%s[/B]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70727"
|
msgctxt "#70727"
|
||||||
@@ -5632,3 +5632,7 @@ msgstr ""
|
|||||||
msgctxt "#70728"
|
msgctxt "#70728"
|
||||||
msgid "Include in Global Search"
|
msgid "Include in Global Search"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#70729"
|
||||||
|
msgid "Always add the highest quality"
|
||||||
|
msgstr ""
|
||||||
|
|||||||
@@ -5618,12 +5618,12 @@ msgid "Channel"
|
|||||||
msgstr "Canale"
|
msgstr "Canale"
|
||||||
|
|
||||||
msgctxt "#70725"
|
msgctxt "#70725"
|
||||||
msgid "Select the language"
|
msgid "Select the language of [B]%s[/B] in [B]%s[/B]"
|
||||||
msgstr "Seleziona la lingua"
|
msgstr "Seleziona la lingua di [B]%s[/B] su [B]%s[/B]"
|
||||||
|
|
||||||
msgctxt "#70726"
|
msgctxt "#70726"
|
||||||
msgid "Seleziona la qualità"
|
msgid "Select the preferred quality of [B]%s[/B] in [B]%s[/B]"
|
||||||
msgstr "Select the quality"
|
msgstr "Seleziona la qualità preferita di [B]%s[/B] su [B]%s[/B]"
|
||||||
|
|
||||||
msgctxt "#70727"
|
msgctxt "#70727"
|
||||||
msgid "Include in News"
|
msgid "Include in News"
|
||||||
@@ -5632,3 +5632,7 @@ msgstr "Includi in Novità"
|
|||||||
msgctxt "#70728"
|
msgctxt "#70728"
|
||||||
msgid "Include in Global Search"
|
msgid "Include in Global Search"
|
||||||
msgstr "Includi in Ricerca Globale"
|
msgstr "Includi in Ricerca Globale"
|
||||||
|
|
||||||
|
msgctxt "#70729"
|
||||||
|
msgid "Always add the highest quality"
|
||||||
|
msgstr "Aggiungi sempre la qualità più alta"
|
||||||
|
|||||||
@@ -44,16 +44,18 @@
|
|||||||
<setting id="enable_library_menu" label="30131" type="bool" default="true"/>
|
<setting id="enable_library_menu" label="30131" type="bool" default="true"/>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="30501">
|
<category label="30131">
|
||||||
<!-- <setting id="downloadpath" type="folder" label="30017" default=""/>
|
<!-- <setting id="downloadpath" type="folder" label="30017" default=""/>
|
||||||
<setting id="downloadlistpath" type="folder" label="30018" default=""/> -->
|
<setting id="downloadlistpath" type="folder" label="30018" default=""/> -->
|
||||||
|
<setting label="30501" type="lsep"/>
|
||||||
<setting id="videolibrarypath" type="folder" label="30067" default=""/>
|
<setting id="videolibrarypath" type="folder" label="30067" default=""/>
|
||||||
<setting label="30131" type="lsep"/>
|
|
||||||
<setting id="folder_tvshows" type="text" label="70118" default="SERIES"/>
|
<setting id="folder_tvshows" type="text" label="70118" default="SERIES"/>
|
||||||
<setting id="folder_movies" type="text" label="70119" default="CINE"/>
|
<setting id="folder_movies" type="text" label="70119" default="CINE"/>
|
||||||
|
<setting label="59997" type="lsep"/>
|
||||||
<setting id="videolibrary_kodi_flag" type="number" label="" default="0" visible="false"/>
|
<setting id="videolibrary_kodi_flag" type="number" label="" default="0" visible="false"/>
|
||||||
<setting id="videolibrary_kodi_force" type="bool" label="" default="false" visible="false"/>
|
<setting id="videolibrary_kodi_force" type="bool" label="" default="false" visible="false"/>
|
||||||
<setting id="videolibrary_kodi" type="bool" label="70120" enable="lt(-1,2)+eq(0,false)" default="false"/>
|
<setting id="videolibrary_kodi" type="bool" label="70120" enable="lt(-1,2)+eq(0,false)" default="false"/>
|
||||||
|
<setting id="videolibrary_max_quality" type="bool" label="70729" default="false" visible="true"/>
|
||||||
</category>
|
</category>
|
||||||
<category label="70121">
|
<category label="70121">
|
||||||
<setting id="start_page" type="bool" label="70121" default="false"/>
|
<setting id="start_page" type="bool" label="70121" default="false"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user