Revert "Merge branch 'stable' into stable"

This reverts commit a641beef22, reversing
changes made to 04c9d46a99.
This commit is contained in:
marco
2019-11-01 21:45:34 +01:00
parent a641beef22
commit ed7b5e94e0
201 changed files with 4346 additions and 5094 deletions
+6 -10
View File
@@ -16,8 +16,6 @@ PLAYED = False
autoplay_node = {}
colorKOD = '0xFF65B3DA'
def context():
'''
@@ -38,7 +36,7 @@ def context():
context = context()
def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=None):
def show_option(channel, itemlist, text_color='yellow', thumbnail=None, fanart=None):
'''
Agrega la opcion Configurar AutoPlay en la lista recibida
@@ -56,8 +54,8 @@ def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=N
if thumbnail == None:
thumbnail = get_thumb('autoplay.png')
# if fanart == None:
# fanart = get_thumb('autoplay.png')
if fanart == None:
fanart = get_thumb('autoplay.png')
plot_autoplay = config.get_localized_string(60399)
itemlist.append(
@@ -65,12 +63,10 @@ def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=N
title=config.get_localized_string(60071),
action="autoplay_config",
text_color=text_color,
text_bold=True,
thumbnail=thumbnail,
# fanart=fanart,
fanart=fanart,
plot=plot_autoplay,
from_channel=channel,
folder=False
from_channel=channel
))
return itemlist
@@ -645,7 +641,7 @@ def get_languages(channel):
:return: list
'''
logger.info()
list_language = ['Non filtrare']
list_language = ['No filtrar']
list_controls, dict_settings = channeltools.get_channel_controls_settings(channel)
for control in list_controls:
try:
+1 -5
View File
@@ -192,8 +192,6 @@ def config_item(item, itemlist=[], typography='', active=False):
def renumber(itemlist, item='', typography=''):
log()
if 'fromchannel' in item:
item.channel = item.fromchannel if item.fromchannel else item.channel
# Seleziona la funzione Adatta, Menu Contestuale o Rinumerazione
if item:
settings_node = jsontools.get_node_from_file(item.channel, 'settings')
@@ -261,7 +259,7 @@ def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE,
return error(itemlist)
if len(EpisodeDict) >= len(itemlist):
for item in itemlist:
number = scrapertoolsV2.find_single_match(item.title, r'\d+').lstrip("0")
number = scrapertoolsV2.find_single_match(item.title, r'\d+')
item.title = typo(EpisodeDict[str(number)] + ' - ', typography) + item.title
else:
make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
@@ -270,7 +268,6 @@ def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE,
make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE):
from core import support
log()
page = 1
EpList = []
@@ -327,7 +324,6 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
for item in itemlist:
# Otiene Numerazione Episodi
episode = int(scrapertoolsV2.find_single_match(item.title, r'\d+'))
log('EPISODE= ',episode)
number = episode + FirstOfSeason - addiction
count = number + addiction
# find = episode + FirstOfSeason
+14 -100
View File
@@ -8,13 +8,11 @@ import re
import time
import unicodedata
from core import filetools, jsontools, scraper, scrapertools, servertools, videolibrarytools, support
from core.downloader import Downloader
from core.item import Item
from platformcode import config, logger
from platformcode import platformtools
from core.support import log
STATUS_COLORS = {0: "orange", 1: "orange", 2: "green", 3: "red"}
STATUS_CODES = type("StatusCode", (), {"stoped": 0, "canceled": 1, "completed": 2, "error": 3})
@@ -22,9 +20,6 @@ DOWNLOAD_LIST_PATH = config.get_setting("downloadlistpath")
DOWNLOAD_PATH = config.get_setting("downloadpath")
STATS_FILE = os.path.join(config.get_data_path(), "servers.json")
FOLDER_MOVIES = config.get_setting("folder_movies")
FOLDER_TVSHOWS = config.get_setting("folder_tvshows")
TITLE_FILE = "[COLOR %s][%i%%][/COLOR] %s"
TITLE_TVSHOW = "[COLOR %s][%i%%][/COLOR] %s [%s]"
@@ -267,20 +262,10 @@ def menu(item):
def move_to_libray(item):
if item.contentType == 'movie':
FOLDER = FOLDER_MOVIES
path_title = "%s [%s]" % (item.contentTitle.strip(), item.infoLabels['IMDBNumber'])
move_path = filetools.join(config.get_videolibrary_path(), FOLDER, path_title)
else:
FOLDER = FOLDER_TVSHOWS
path_title = "%s [%s]" % (item.contentSerieName, item.infoLabels['IMDBNumber'])
move_path = filetools.join(config.get_videolibrary_path(), FOLDER)
download_path = filetools.join(config.get_setting("downloadpath"), item.downloadFilename)
library_path = filetools.join(move_path, *filetools.split(item.downloadFilename))
library_path = filetools.join(config.get_videolibrary_path(), *filetools.split(item.downloadFilename))
final_path = download_path
if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", "downloads") == True:
if not filetools.isdir(filetools.dirname(library_path)):
filetools.mkdir(filetools.dirname(library_path))
@@ -294,35 +279,8 @@ def move_to_libray(item):
if len(filetools.listdir(filetools.dirname(download_path))) == 0:
filetools.rmdir(filetools.dirname(download_path))
logger.info('ITEM = ' + str(item))
name = item.contentTitle if item.contentType == 'movie' else str(item.infoLabels['season']) + 'x' + str(item.infoLabels['episode']).zfill(2)
list_item = os.listdir(filetools.join(config.get_videolibrary_path(), FOLDER, path_title))
clean = False
for File in list_item:
filename = File.lower()
name = name.lower()
if filename.startswith(name) and (filename.endswith('.strm') or filename.endswith('.json') or filename.endswith('.nfo')):
clean = True
logger.info('Delete File: ' + str(os.path.join(config.get_videolibrary_path(), FOLDER, path_title, File)))
os.remove(os.path.join(config.get_videolibrary_path(), FOLDER, path_title, File))
from platformcode import xbmc_videolibrary
xbmc_videolibrary.update(FOLDER)
if clean == True:
import xbmc
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
xbmc.sleep(500)
xbmc_videolibrary.clean()
if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", "downloads") == False:
if config.get_setting("library_add", "downloads") == True:
if filetools.isfile(final_path):
if item.contentType == "movie" and item.infoLabels["tmdb_id"]:
library_item = Item(title=config.get_localized_string(70228) % item.downloadFilename, channel="downloads",
@@ -335,7 +293,7 @@ def move_to_libray(item):
tvshow = Item(channel="downloads", contentType="tvshow",
infoLabels={"tmdb_id": item.infoLabels["tmdb_id"]})
videolibrarytools.save_tvshow(tvshow, [library_item])
def update_json(path, params):
item = Item().fromjson(filetools.read(path))
@@ -681,8 +639,6 @@ def select_server(item):
"downloadServer": {"url": play_items[seleccion - 1].url, "server": play_items[seleccion - 1].server}})
elif seleccion == 0:
update_json(item.path, {"downloadServer": {}})
if seleccion == 0:
update_json(item.path, {"downloadServer": {}})
platformtools.itemlist_refresh()
@@ -712,11 +668,6 @@ def start_download(item):
def get_episodes(item):
logger.info("contentAction: %s | contentChannel: %s | contentType: %s" % (
item.contentAction, item.contentChannel, item.contentType))
if 'dlseason' in item:
season = True
season_number = item.dlseason
else:
season = False
# El item que pretendemos descargar YA es un episodio
if item.contentType == "episode":
@@ -763,43 +714,14 @@ def get_episodes(item):
# Episodio, Temporada y Titulo
if not episode.contentTitle:
episode.contentTitle = re.sub(r"\[[^\]]+\]|\([^\)]+\)|\d*x\d*\s*-", "", episode.title).strip()
episode.contentTitle = re.sub("\[[^\]]+\]|\([^\)]+\)|\d*x\d*\s*-", "", episode.title).strip()
episode.downloadFilename = filetools.validate_path(os.path.join(item.downloadFilename, "%dx%0.2d - %s" % (
episode.contentSeason, episode.contentEpisodeNumber, episode.contentTitle.strip())))
if season:
log('SEASON= ',season)
log(int(scrapertools.find_single_match(episode.title, r'(\d+)x')))
log(season_number,' ',type(season_number))
if scrapertools.find_single_match(episode.title, r'(\d+)x') == season_number:
itemlist.append(episode)
else:
itemlist.append(episode)
itemlist.append(episode)
# Cualquier otro resultado no nos vale, lo ignoramos
else:
logger.info("Omitting invalid item: %s" % episode.tostring())
# if Multiple Languages or Qualities
list_lang = []
list_quality = []
for item in itemlist:
if not item.language: item.language = item.contentLanguage
if item.language not in list_lang: list_lang.append(item.language)
if item.infoLabels['quality'] not in list_quality: list_quality.append(item.infoLabels['quality'])
if len(list_lang) > 1:
selection = platformtools.dialog_select(config.get_localized_string(70725),list_lang)
it = []
for item in itemlist:
if not item.language: item.language = item.contentLanguage
if item.language == list_lang[selection]:
it.append(item)
itemlist = it
if len(list_quality) > 1:
selection = platformtools.dialog_select(config.get_localized_string(70726),list_quality)
it = []
for item in itemlist:
if item.infoLabels['quality'] == list_quality[selection]: it.append(item)
itemlist = it
return itemlist
@@ -837,17 +759,11 @@ def save_download(item):
del item.from_action
del item.from_channel
item.contentChannel = item.fromchannel if item.fromchannel else item.channel
item.contentAction = item.fromaction if item.fromaction else item.action
item.contentChannel = item.channel
item.contentAction = item.action
if item.contentType in ["tvshow", "episode", "season"]:
if 'download' in item:
heading = config.get_localized_string(70594) # <- Enter the season number
item.dlseason = platformtools.dialog_numeric(0, heading, '')
if item.dlseason:
save_download_tvshow(item)
else:
save_download_tvshow(item)
save_download_tvshow(item)
elif item.contentType == "movie":
save_download_movie(item)
@@ -888,7 +804,7 @@ def save_download_movie(item):
progreso.update(0, config.get_localized_string(60062))
item.downloadFilename = filetools.validate_path("%s [%s] [%s]" % (item.contentTitle.strip(), item.contentChannel, item.infoLabels['IMDBNumber']))
item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentTitle.strip(), item.contentChannel))
write_json(item)
@@ -909,11 +825,9 @@ def save_download_tvshow(item):
item.show = item.fulltitle
scraper.find_and_set_infoLabels(item)
item.contentSerieName = item.fulltitle
item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentSerieName, item.infoLabels['IMDBNumber']))
if config.get_setting("lowerize_title", "videolibrary") == 0:
item.downloadFilename = item.downloadFilename.lower()
item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentSerieName, item.contentChannel))
progreso.update(0, config.get_localized_string(70186), config.get_localized_string(70187) % item.contentChannel)
episodes = get_episodes(item)
@@ -928,7 +842,7 @@ def save_download_tvshow(item):
if not platformtools.dialog_yesno(config.get_localized_string(30101), config.get_localized_string(70189)):
platformtools.dialog_ok(config.get_localized_string(30101),
str(len(episodes)) + config.get_localized_string(30110) + item.contentSerieName,
str(len(episodes)) + " capitulos de: " + item.contentSerieName,
config.get_localized_string(30109))
else:
for i in episodes:
+1 -1
View File
@@ -49,7 +49,7 @@ def mainlist(item):
"action": "delFavourite",
"channel": "favorites",
"from_title": item.title},
{"title": config.get_localized_string(70278), # Rename
{"title": "Renombrar",
"action": "renameFavourite",
"channel": "favorites",
"from_title": item.title}
-2
View File
@@ -163,8 +163,6 @@ def load(item):
def check_conditions(_filter, list_item, item, list_language, list_quality, quality_count=0, language_count=0):
if not item.language: item.language = item.contentLanguage
is_language_valid = True
if _filter.language:
# logger.debug("title es %s" % item.title)
+2 -2
View File
@@ -28,8 +28,8 @@ perfil = [['0xFF0B7B92', '0xFF89FDFB', '0xFFACD5D4'],
['0xFFA5DEE5', '0xFFE0F9B5', '0xFFFEFDCA'],
['0xFFF23557', '0xFF22B2DA', '0xFFF0D43A']]
color1, color2, color3 = ["white", "white", "white"]
# color1, color2, color3 = perfil[__perfil__]
#color1, color2, color3 = ["white", "white", "white"]
color1, color2, color3 = perfil[__perfil__]
list_newest = []
list_newest_tourl = []
+1 -2
View File
@@ -15,7 +15,6 @@ from core import tmdb
from core.item import Item
from platformcode import config, logger
from platformcode import platformtools
from core.support import typo
addon = xbmcaddon.Addon('metadata.themoviedb.org')
def_lang = addon.getSetting('language')
@@ -720,7 +719,7 @@ def discover_list(item):
#if not 'similar' in item.list_type:
# itemlist.append(item.clone(title='Pagina Siguente', page=next_page))
#else:
itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'),
itemlist.append(Item(channel=item.channel, action='discover_list', title=config.get_localized_string(70065),
search_type=item.search_type, list_type=item.list_type, type=item.type, page=next_page))
return itemlist
+13 -13
View File
@@ -68,7 +68,7 @@ def list_movies(item, silent=False):
canal = generictools.verify_channel(canal_org)
try:
channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal])
logger.debug('Channel %s seems correct' % channel_verify)
logger.debug('El canal %s parece correcto' % channel_verify)
except:
dead_item = Item(multicanal=multicanal,
contentType='movie',
@@ -78,9 +78,9 @@ def list_movies(item, silent=False):
library_urls=new_item.library_urls,
infoLabels={'title': new_item.contentTitle})
if canal not in dead_list and canal not in zombie_list:
confirm = platformtools.dialog_yesno(config.get_localized_string(30131),
config.get_localized_string(30132) % canal.upper(),
config.get_localized_string(30133))
confirm = platformtools.dialog_yesno('Videoteca',
'Parece que el canal [COLOR red]%s[/COLOR] ya no existe.' % canal.upper(),
'Deseas eliminar los enlaces de este canal?')
elif canal in zombie_list:
confirm = False
@@ -198,9 +198,9 @@ def list_tvshows(item):
library_urls=item_tvshow.library_urls,
infoLabels={'title': item_tvshow.contentTitle})
if canal not in dead_list and canal not in zombie_list:
confirm = platformtools.dialog_yesno(config.get_localized_string(30131),
config.get_localized_string(30132) % canal.upper(),
config.get_localized_string(30133))
confirm = platformtools.dialog_yesno('Videoteca',
'Parece que el canal [COLOR red]%s[/COLOR] ya no existe.' % canal.upper(),
'Deseas eliminar los enlaces de este canal?')
elif canal in zombie_list:
confirm = False
@@ -238,7 +238,7 @@ def list_tvshows(item):
contador = 1
except:
logger.error('Not find: ' + str(tvshow_path))
logger.error('No encuentra: ' + str(tvshow_path))
logger.error(traceback.format_exc())
continue
@@ -435,7 +435,7 @@ def findvideos(item):
autoplay.set_status(False)
if not item.contentTitle or not item.strm_path:
logger.debug("Unable to search for videos due to lack of parameters")
logger.debug("No se pueden buscar videos por falta de parametros")
return []
content_title = filter(lambda c: c not in ":*?<>|\/", item.contentTitle.strip().lower())
@@ -533,7 +533,7 @@ def findvideos(item):
from core import servertools
list_servers = servertools.find_video_items(item_json)
except Exception, ex:
logger.error("The findvideos function for the channel %s failed" % nom_canal)
logger.error("Ha fallado la funcion findvideos para el canal %s" % nom_canal)
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.error(message)
@@ -623,7 +623,7 @@ def update_videolibrary(item):
break
if ficheros and not strm:
logger.debug("Deleting deleted movie folder: %s" % raiz)
logger.debug("Borrando carpeta de pelicula eliminada: %s" % raiz)
filetools.rmdirtree(raiz)
@@ -668,7 +668,7 @@ def verify_playcount_series(item, path):
nfo_path = filetools.join(path, "tvshow.nfo")
head_nfo, it = videolibrarytools.read_nfo(nfo_path) #Obtenemos el .nfo de la Serie
if not hasattr(it, 'library_playcounts') or not it.library_playcounts: #Si el .nfo no tiene library_playcounts se lo creamos
logger.error('** It does not have PlayCount')
logger.error('** No tiene PlayCount')
it.library_playcounts = {}
# Obtenemos los archivos de los episodios
@@ -879,7 +879,7 @@ def delete(item):
from platformcode import xbmc_videolibrary
xbmc_videolibrary.clean()
logger.info("All links removed")
logger.info("Eliminados todos los enlaces")
platformtools.itemlist_refresh()
# logger.info(item.contentTitle)