Languages fix, and more efficent thumb function

This commit is contained in:
Alhaziel
2019-03-27 18:10:05 +01:00
committed by mac12m99
parent f8a4d2d62b
commit 43517d4eed
16 changed files with 151 additions and 72 deletions

View File

@@ -6,7 +6,7 @@
"language": ["ita"],
"thumbnail": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/altadefinizioneclick.png",
"bannermenu": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/altadefinizioneciclk.png",
"categories": ["tvshow","movie","vos"],
"categories": ["tvshow","movie","vosi"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -6,7 +6,7 @@
"adult": false,
"thumbnail": "cb01.png",
"banner": "cb01.png",
"categories": ["tvshow", "movie", "vos"],
"categories": ["tvshow", "movie", "vosi"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -6,7 +6,7 @@
"adult": false,
"thumbnail": "http://www.dreamsub.it/res/img/logo.png",
"banner": "http://www.dreamsub.it/res/img/logo.png",
"categories": ["anime","vos"],
"categories": ["anime","vosi"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -6,7 +6,7 @@
"adult": false,
"thumbnail": "http://fastsubita.ml/wp-content/uploads/2017/10/Untitled-222255xxx.jpg",
"banner": "http://fastsubita.ml/wp-content/uploads/2017/10/Untitled-222255xxx.jpg",
"categories": ["tvshow", "vos"],
"categories": ["tvshow", "vosi"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -6,7 +6,7 @@
"language": ["ita"],
"thumbnail": "https:\/\/filmperevolvere.it\/wp-content\/uploads\/2017\/06\/cropped-coversito.jpg",
"bannermenu": "https:\/\/filmperevolvere.it\/wp-content\/uploads\/2017\/06\/cropped-coversito.jpg",
"categories": ["vos","movie"],
"categories": ["vosi","movie"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -6,7 +6,7 @@
"adult": false,
"thumbnail": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/serietvsubita.png",
"banner": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/serietvsubita.png",
"categories": ["tvshow","vos"],
"categories": ["tvshow","vosi"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -6,7 +6,7 @@
"adult": false,
"thumbnail": "https://www.visions.tn/wp-content/uploads/2015/11/large_news_HD-STREAMING.jpg",
"banner": "https://www.visions.tn/wp-content/uploads/2015/11/large_news_HD-STREAMING.jpg",
"categories": ["tvshow","movie","vos"],
"categories": ["tvshow","movie","vosi"],
"settings": [
{
"id": "include_in_global_search",

View File

@@ -263,10 +263,13 @@ def get_thumb(thumb_name, view="thumb_", auto=False):
if auto_filter() == 'ita' and icon_pack_name == "default":
icon_pack_name = 'default_ita'
resource_path = os.path.join(config.get_runtime_path(), "resources", "media", "themes")
media_path = os.path.join(resource_path, icon_pack_name)
if config.get_setting('enable_custom_theme') and config.get_setting('custom_theme'):
if config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and os.path.isfile(config.get_setting('custom_theme') + view + thumb_name):
media_path = config.get_setting('custom_theme')
elif os.path.isdir(media_path) == False:
media_path = os.path.join("https://raw.githubusercontent.com/alfa-addon/media/master/themes/", icon_pack_name)
else:
@@ -283,10 +286,18 @@ def set_channel_info(parameters):
language = ''
content = ''
langs = parameters['language']
lang_dict = {'lat':'Latino', 'cast':'Castellano', '*':'Latino, Castellano, VOSE, VO'}
lang_dict = {'ita':'Italiano',
'lat':'Latino',
'cast':'Castellano',
'esp':'Latino, Castellano, VOSE, VO',
'*':'Latino, Castellano, VOSE, VO'}
for lang in langs:
if 'vos' in parameters['categories']:
lang = '*'
if 'vosi' in parameters['categories']:
lang = 'ita'
if 'vose' in parameters['categories']:
lang = 'esp'
if lang in lang_dict:
if language != '' and language != '*' and not parameters['adult']:
@@ -303,7 +314,8 @@ def set_channel_info(parameters):
else:
content = config.get_localized_category(cat)
info = '[COLOR yellow]Tipo de contenido:[/COLOR] %s\n\n[COLOR yellow]Idiomas:[/COLOR] %s' % (content, language)
info = '[COLOR yellow]' + config.get_localized_string(70567) + ' [/COLOR]' + content + '\n\n'
info += '[COLOR yellow]' + config.get_localized_string(70568) + ' [/COLOR] ' + language
return info
@@ -312,66 +324,63 @@ def auto_filter():
addon = xbmcaddon.Addon('metadata.themoviedb.org')
def_lang = addon.getSetting('language')
lang = 'all'
lang_dict = {'ita':'it',
'esp':'es',
'cast':'eu-ES',
'lat':'es-MX'}
if config.get_setting("channel_language") == 'auto':
if def_lang == 'it':
lang = 'ita'
elif def_lang == 'eu-ES' :
lang = 'cast'
elif def_lang == 'es' :
lang = 'esp'
elif def_lang == 'es-MX':
lang = 'lat'
else:
lang = 'all'
for langs, variant in lang_dict.items():
if def_lang in variant:
lang = langs
else:
lang = config.get_setting("channel_language", default="all")
return lang
def thumb(itemlist=[]):
def suffix(item):
thumb = ''
if any( word in item.title.lower() for word in ['hd', 'rip']):
thumb = '_hd'
if '4k' in item.title.lower():
thumb = '_4k'
if any( word in item.title.lower() for word in ['lettera','lista','alfabetico','a-z']):
thumb = '_az'
if 'anno' in item.title.lower():
thumb = '_year'
if any( word in item.title.lower() for word in ['genere', 'categori']):
thumb = '_genre'
return thumb
if itemlist:
import re
icon_dict = {'channels_movie':['film'],
'channels_tvshow':['serie','tv'],
'news':['novità', "novita'"],
'now_playing':['cinema'],
'channels_anime':['anime'],
'genres':['genere', 'generi', 'categorie', 'categoria']}
suffix_dict = {'_hd':['hd'],
'_4k':['4K'],
'_az':['lettera','lista','alfabetico','a-z'],
'_year':['anno'],
'_genre':['genere', 'generi', 'categorie', 'categoria']}
search = ['cerca']
search_suffix ={'_movie':['film'],
'_tvshow':['sarie','tv']}
for item in itemlist:
thumb = ''
logger.info("TITLE= " + item.title.lower())
if any( word in item.title.lower() for word in ['genere', 'categori']):
thumb = thumb + 'genres'
if 'film' in item.title.lower():
thumb = 'channels_movie' + suffix(item)
if 'serie' in item.title.lower():
thumb = 'channels_tvshow' + suffix(item)
if 'novit' in item.title.lower():
thumb = 'news'
if 'cinema' in item.title.lower():
thumb = 'now_playing'
if 'anime' in item.title.lower():
thumb = 'channels_anime'
if 'cerca' in item.title.lower():
thumb = 'search'
if 'film' in item.title.lower():
thumb = thumb + '_movie'
if 'serie' in item.title.lower():
thumb = thumb + '_tvshow'
item.thumbnail = get_thumb(thumb + '.png')
item.fanart = get_thumb(thumb + '.png', 'fanart_')
logger.info("Thumb= " + item.thumbnail)
for thumb, titles in icon_dict.items():
if any( word in item.title.lower() for word in search):
thumb = 'search'
for suffix, titles in search_suffix.items():
if any( word in item.title.lower() for word in titles ):
thumb = thumb + suffix
item.thumbnail = get_thumb(thumb + '.png')
elif any( word in item.title.lower() for word in titles ):
thumb = thumb
if thumb == 'channels_movie' or 'channels_tvshow':
for suffix, titles in suffix_dict.items():
if any( word in item.title.lower() for word in titles ):
thumb = thumb + suffix
item.thumbnail = get_thumb(thumb + '.png')
else:
thumb = item.thumbnails
return itemlist
else:

View File

@@ -301,7 +301,7 @@ def get_localized_string(code):
def get_localized_category(categ):
categories = {'movie': get_localized_string(30122), 'tvshow': get_localized_string(30123),
'anime': get_localized_string(30124), 'documentary': get_localized_string(30125),
'vos': get_localized_string(30136), 'adult': get_localized_string(30126),
'vos': get_localized_string(30136), 'vosi': get_localized_string(70566), 'adult': get_localized_string(30126),
'direct': get_localized_string(30137), 'torrent': get_localized_string(70015)}
return categories[categ] if categ in categories else categ

View File

@@ -223,6 +223,8 @@ def set_lang(language):
lat=['latino','lat','la', 'espanol latino', 'espaol latino', 'zl', 'mx', 'co', 'vl']
vose=['subtitulado','subtitulada','sub','sub espanol','vose','espsub','su','subs castellano',
'sub: español', 'vs', 'zs', 'vs', 'english-spanish subs', 'ingles sub espanol']
vosi=['sottotitolato','sottotitolata','sub','sub ita','vosi','sub-ita','subs italiano',
'sub: italiano', 'inglese sottotitolato']
vos=['vos', 'sub ingles', 'engsub', 'vosi','ingles subtitulado', 'sub: ingles']
vo=['ingles', 'en','vo', 'ovos', 'eng','v.o', 'english']
dual=['dual']
@@ -248,6 +250,8 @@ def set_lang(language):
language = 'vo'
elif language in dual:
language = 'dual'
elif language in dual:
language = 'vosi'
else:
language = 'otro'

View File

@@ -4942,3 +4942,15 @@ msgstr ""
msgctxt "#70565"
msgid "Custom Theme Path"
msgstr ""
msgctxt "#70566"
msgid "VOSI (Original Subtitled Italian Version)"
msgstr ""
msgctxt "#70567"
msgid "Type of content:"
msgstr ""
msgctxt "#70568"
msgid "Languages:"
msgstr ""

View File

@@ -3255,15 +3255,15 @@ msgstr "Qualita"
msgctxt "#70142"
msgid "VOSE (Original Subtitled Spanish Version)"
msgstr "VOSE (Version Original Sottotitolato Spagnolo)"
msgstr "VOSE (Versione Originale Sottotitolato Spagnolo)"
msgctxt "#70143"
msgid "VOS (Original Subtitled Version)"
msgstr "VOS (Version Original Sottotitolato)"
msgstr "VOS (Versione Originale Sottotitolato)"
msgctxt "#70144"
msgid "VO (Original Version)"
msgstr "VO (Original)"
msgstr "VO (Versione Originale)"
msgctxt "#70145"
msgid "Servers"
@@ -3992,12 +3992,12 @@ msgid "Error in the user and/or password. Check your credentials"
msgstr "Errore in username e/o password. Controlla le tue credenziali"
msgctxt "#70331"
msgid "Error during login. Check your credentials
msgid "Error during login. Check your credentials"
msgstr "Errore durante il login. Controlla le tue credenziali"
msgctxt "#70332"
msgid "My votes"
msgstr "I miei voti
msgstr "I miei voti"
msgctxt "#70333"
msgid "Add new list"
@@ -4932,4 +4932,19 @@ msgstr "Abilita Tema Personalizzato"
msgctxt "#70565"
msgid "Custom Theme Path"
msgstr "Percorso Tema Personalizzato"
<<<<<<< HEAD
>>>>>>> e253911b... Add Custom Theme Setting and Auto Thumb (partial)
=======
msgctxt "#70566"
msgid "VOSI (Original Subtitled Italian Version)"
msgstr "VOSI (Versione Originale Sottotitolato Italiano)"
msgctxt "#70567"
msgid "Type of content:"
msgstr "Tipo di contenuto:"
msgctxt "#70568"
msgid "Languages:"
msgstr "Lingue"
>>>>>>> a2ca6152... Languages fix, and more efficent thumb function

View File

@@ -4942,3 +4942,15 @@ msgstr "Abilita Tema Personalizado"
msgctxt "#70565"
msgid "Custom Theme Path"
msgstr "Percorso Tema Personalizado"
msgctxt "#70566"
msgid "VOSI (Original Subtitled Italian Version)"
msgstr "VOSI (Versión Original Subtitulado Italiano)"
msgctxt "#70567"
msgid "Type of content:"
msgstr "Tipo de contenido:"
msgctxt "#70568"
msgid "Languages:"
msgstr "Idiomas"

View File

@@ -4942,3 +4942,15 @@ msgstr "Abilita Tema Personalizado"
msgctxt "#70565"
msgid "Custom Theme Path"
msgstr "Percorso Tema Personalizado"
msgctxt "#70566"
msgid "VOSI (Original Subtitled Italian Version)"
msgstr "VOSI (Versión Original Subtitulado Italiano)"
msgctxt "#70567"
msgid "Type of content:"
msgstr "Tipo de contenido:"
msgctxt "#70568"
msgid "Languages:"
msgstr "Idiomas"

View File

@@ -4942,3 +4942,15 @@ msgstr "Abilita Tema Personalizado"
msgctxt "#70565"
msgid "Custom Theme Path"
msgstr "Percorso Tema Personalizado"
msgctxt "#70566"
msgid "VOSI (Original Subtitled Italian Version)"
msgstr "VOSI (Versión Original Subtitulado Italiano)"
msgctxt "#70567"
msgid "Type of content:"
msgstr "Tipo de contenido:"
msgctxt "#70568"
msgid "Languages:"
msgstr "Idiomas"

View File

@@ -85,24 +85,27 @@
<setting id="vose_color" type="labelenum" label="70142"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-10,true)+eq(-11,true)"/>
<setting id="vos_color" type="labelenum" label="70143"
<setting id="vosi_color" type="labelenum" label="70566"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-11,true)+eq(-12,true)"/>
<setting id="vo_color" type="labelenum" label="70144"
<setting id="vos_color" type="labelenum" label="70143"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-12,true)+eq(-13,true)"/>
<setting id="server_color" type="labelenum" label="70145"
<setting id="vo_color" type="labelenum" label="70144"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-13,true)+eq(-14,true)"/>
<setting id="library_color" type="labelenum" label="70146"
<setting id="server_color" type="labelenum" label="70145"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-14,true)+eq(-15,true)"/>
<setting id="update_color" type="labelenum" label="70147"
<setting id="library_color" type="labelenum" label="70146"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-15,true)+eq(-16,true)"/>
<setting id="no_update_color" type="labelenum" label="70148"
<setting id="update_color" type="labelenum" label="70147"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-16,true)+eq(-17,true)"/>
<setting id="no_update_color" type="labelenum" label="70148"
values="[COLOR white]white[/COLOR]|[COLOR cyan]cyan[/COLOR]|[COLOR deepskyblue]deepskyblue[/COLOR]|[COLOR firebrick]firebrick[/COLOR]|[COLOR gold]gold[/COLOR]|[COLOR goldenrod]goldenrod[/COLOR]|[COLOR hotpink]hotpink[/COLOR]|[COLOR limegreen]limegreen[/COLOR]|[COLOR orange]orange[/COLOR]|[COLOR orchid]orchid[/COLOR]|[COLOR red]red[/COLOR]|[COLOR salmon]salmon[/COLOR]|[COLOR yellow]yellow[/COLOR]"
default="white" visible="eq(-17,true)+eq(-18,true)"/>
</category>
<category label="70149">
<setting label="70150" type="lsep"/>