- completato il supporto ai torrent e aggiunto ilcorsaronero.xyz
- aggiunto supporto agli episodi locali, ovvero poter inserire nella libreria di kodi un misto tra puntate di kod e file scaricati altrove
- le viste ora si salvano di nuovo dal menu laterale, ma rimangono salvate per il tipo di contenuto visualizzato e non per il singolo menu
- ripensato il menu rapido, che ora è più rapido, ridisegnate alcune finestre
This commit is contained in:
marco
2020-05-14 21:26:48 +02:00
parent cdf84d5573
commit a8d5fad1a8
778 changed files with 49736 additions and 40697 deletions
+38 -13
View File
@@ -56,6 +56,7 @@ def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=N
:return:
'''
from channelselector import get_thumb
from core.support import typo
logger.info()
if not config.is_xbmc():
@@ -69,7 +70,7 @@ def show_option(channel, itemlist, text_color=colorKOD, thumbnail=None, fanart=N
plot_autoplay = config.get_localized_string(60399)
itemlist.append(
Item(channel=__channel__,
title=config.get_localized_string(60071),
title=typo(config.get_localized_string(60071), 'bold color kod'),
action="autoplay_config",
text_color=text_color,
text_bold=True,
@@ -113,12 +114,12 @@ def start(itemlist, item):
if item.channel == 'videolibrary':
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
channel_id = item.contentChannel
try:
active = autoplay_node['status']
except:
active = is_active(item.channel)
# try:
# active = autoplay_node['status']
# except:
# active = is_active(item.channel)
if not channel_id in autoplay_node or not active:
if not channel_id in autoplay_node: # or not active:
return itemlist
# Agrega servidores y calidades que no estaban listados a autoplay_node
@@ -724,19 +725,40 @@ def reset(item, dict):
return
def set_status(status):
logger.info()
# Obtiene el nodo AUTOPLAY desde el json
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
autoplay_node['status'] = status
# def set_status(status):
# logger.info()
# # Obtiene el nodo AUTOPLAY desde el json
# autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
# autoplay_node['status'] = status
#
# result, json_data = jsontools.update_node(autoplay_node, 'autoplay', 'AUTOPLAY')
result, json_data = jsontools.update_node(autoplay_node, 'autoplay', 'AUTOPLAY')
# return if item channel has autoplay and hideserver enabled
def get_channel_AP_HS(item):
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
channel_node = autoplay_node.get(item.channel, {})
if not channel_node: # non ha mai aperto il menu del canale quindi in autoplay_data.json non c'e la key
try:
channelFile = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
except:
channelFile = __import__('specials.' + item.channel, fromlist=["specials.%s" % item.channel])
if hasattr(channelFile, 'list_servers') and hasattr(channelFile, 'list_quality'):
init(item.channel, channelFile.list_servers, channelFile.list_quality)
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
channel_node = autoplay_node.get(item.channel, {})
settings_node = channel_node.get('settings', {})
AP = get_setting('autoplay') or (settings_node['active'] if 'active' in settings_node else False)
HS = config.get_setting('hide_servers') or (
settings_node['hide_servers'] if 'hide_server' in settings_node else False)
return AP, HS
def play_multi_channel(item, itemlist):
logger.info()
global PLAYED
video_dict = dict()
set_status(True)
# set_status(True)
for video_item in itemlist:
if is_active(video_item.contentChannel):
@@ -751,3 +773,6 @@ def play_multi_channel(item, itemlist):
start(videos, item)
else:
break
AP, HS = get_channel_AP_HS(item)
return HS
+7 -10
View File
@@ -10,6 +10,7 @@ import xbmc
from core import ziptools, videolibrarytools, filetools
from platformcode import logger, config, platformtools, xbmc_videolibrary
from distutils.dir_util import copy_tree
from specials import videolibrary
temp_path = xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/")
movies_path = os.path.join(temp_path, "movies")
@@ -67,15 +68,14 @@ def import_videolibrary(item):
unzipper = ziptools.ziptools()
unzipper.extract(zip_file, temp_path)
p_dialog.update(25)
p_dialog.update(20)
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
xbmc_videolibrary.clean()
p_dialog.update(30)
filetools.rmdirtree(videolibrarytools.MOVIES_PATH)
filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH)
p_dialog.update(50)
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
strm_list = []
strm_list.append(config.get_setting('videolibrarypath'))
xbmc_videolibrary.clean(strm_list)
config.verify_directories_created()
if filetools.exists(movies_path):
@@ -91,9 +91,6 @@ def import_videolibrary(item):
p_dialog.close()
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80008), time=5000, sound=False)
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80009)):
import service
service.check_for_update(overwrite=True)
videolibrary.update_videolibrary()
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
xbmc_videolibrary.update()
xbmc_videolibrary.update()
+14 -15
View File
@@ -20,7 +20,7 @@ LIST_SITE = ['http://www.ansa.it/', 'https://www.google.it']#, 'https://www.goog
# lista di siti che non verranno raggiunti con i DNS del gestore
LST_SITE_CHCK_DNS = ['https://casacinema.space', 'https://documentari-streaming-da.com']
LST_SITE_CHCK_DNS = ['https://www.casacinema.me/', 'https://cb01-nuovo-indirizzo.info/']
#'https://www.italia-film.pw', 'https://www.cb01.uno/',] # tolti
class Kdicc():
@@ -224,25 +224,24 @@ def test_conn(is_exit, check_dns, view_msg,
exit()
# se ha i DNS filtrati lo comunico all'utente
if check_dns == True:
if ktest.check_Dns():
if not ktest.check_Dns():
if view_msg == True:
ktest.view_Advise(config.get_localized_string(70722))
if not ktest.check_Dns():
if view_msg == True:
ktest.view_Advise(config.get_localized_string(70722))
xbmc.log("############ Inizio Check DNS ############", level=xbmc.LOGNOTICE)
xbmc.log("## IP: %s" % (ktest.ip_addr), level=xbmc.LOGNOTICE)
xbmc.log("## DNS: %s" % (ktest.dns), level=xbmc.LOGNOTICE)
xbmc.log("############ Fine Check DNS ############", level=xbmc.LOGNOTICE)
if check_dns == True:
if ktest.check_Ip() == True and ktest.check_Adsl() == True and ktest.check_Dns() == True:
return True
else:
return False
else:
if ktest.check_Ip() == True and ktest.check_Adsl() == True:
return True
else:
return False
# if check_dns == True:
# if ktest.check_Ip() == True and ktest.check_Adsl() == True and ktest.check_Dns() == True:
# return True
# else:
# return False
# else:
# if ktest.check_Ip() == True and ktest.check_Adsl() == True:
# return True
# else:
# return False
# def per la creazione del file channels.json
def check_channels(inutile=''):
-1
View File
@@ -2,7 +2,6 @@
"id": "community",
"name": "Community",
"active": true,
"adult": false,
"language": ["*"],
"thumbnail": "",
"banner": "",
-1
View File
@@ -2,7 +2,6 @@
"id": "downloads",
"name": "Descargas",
"active": false,
"adult": false,
"language": ["*"],
"categories": [
"movie"
+191 -156
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Gestor de descargas
# Download manager
# ------------------------------------------------------------
from __future__ import division
@@ -22,6 +22,8 @@ from core.downloader import Downloader
from core.item import Item
from platformcode import config, logger
from platformcode import platformtools
from core.support import log, dbg, typo
from servers import torrent
kb = '0xFF65B3DA'
kg = '0xFF65DAA8'
@@ -38,27 +40,28 @@ 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]"
extensions_list = ['.aaf', '.3gp', '.asf', '.avi', '.flv', '.mpeg', '.m1v', '.m2v', '.m4v', '.mkv', '.mov', '.mpg', '.mpe', '.mp4', '.ogg', '.wmv']
def mainlist(item):
logger.info()
log()
itemlist = []
# Lista de archivos
# File list
for file in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
# Saltamos todos los que no sean JSON
# We skip all the non JSON
if not file.endswith(".json"): continue
# cargamos el item
# we load the item
file = filetools.join(DOWNLOAD_LIST_PATH, file)
i = Item(path=file).fromjson(filetools.read(file))
i.thumbnail = i.contentThumbnail
# Listado principal
# Main listing
if not item.contentType == "tvshow":
# Series
if i.contentType == "episode":
# Comprobamos que la serie no este ya en el itemlist
# We check that the series is not already in the itemlist
if not [x for x in itemlist if x.contentSerieName == i.contentSerieName and x.contentChannel == i.contentChannel]:
title = TITLE_TVSHOW % (STATUS_COLORS[i.downloadStatus], i.downloadProgress, i.contentSerieName, i.contentChannel)
@@ -79,12 +82,12 @@ def mainlist(item):
s.title = TITLE_TVSHOW % (STATUS_COLORS[s.downloadStatus], downloadProgress, i.contentSerieName, i.contentChannel)
# Peliculas
# Movies
elif i.contentType == "movie" or i.contentType == "video":
i.title = TITLE_FILE % (STATUS_COLORS[i.downloadStatus], i.downloadProgress, i.contentTitle)
itemlist.append(i)
# Listado dentro de una serie
# Listed within a series
else:
if i.contentType == "episode" and i.contentSerieName == item.contentSerieName and i.contentChannel == item.contentChannel:
i.title = TITLE_FILE % (STATUS_COLORS[i.downloadStatus], i.downloadProgress, "%dx%0.2d: %s" % (i.contentSeason, i.contentEpisodeNumber, i.contentTitle))
@@ -92,19 +95,19 @@ def mainlist(item):
estados = [i.downloadStatus for i in itemlist]
# Si hay alguno completado
# If there is any completed
if 2 in estados:
itemlist.insert(0, Item(channel=item.channel, action="clean_ready", title=config.get_localized_string(70218),
contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('delete.png'),
contentSerieName=item.contentSerieName, text_color=STATUS_COLORS[STATUS_CODES.completed]))
# Si hay alguno con error
# If there is any error
if 3 in estados:
itemlist.insert(0, Item(channel=item.channel, action="restart_error", title=config.get_localized_string(70219),
contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('update.png'),
contentSerieName=item.contentSerieName, text_color=STATUS_COLORS[STATUS_CODES.error]))
# Si hay alguno pendiente
# If there is any pending
if 1 in estados or 0 in estados:
itemlist.insert(0, Item(channel=item.channel, action="download_all", title=support.typo(config.get_localized_string(70220),'bold'),
contentType=item.contentType, contentChannel=item.contentChannel, thumbnail=get_thumb('downloads.png'),
@@ -126,7 +129,7 @@ def mainlist(item):
itemlist.insert(0, Item(channel=item.channel, action="browser", title=support.typo(config.get_localized_string(70222),'bold'), thumbnail=get_thumb('search.png'), url=DOWNLOAD_PATH))
if not item.contentType == "tvshow":
itemlist.append(Item(channel='shortcuts', action="SettingOnPosition", category=4, setting=0, title= support.typo(config.get_localized_string(70288),'bold color kod'), thumbnail=get_thumb('setting_0.png')))
itemlist.append(Item(channel='shortcuts', action="SettingOnPosition", category=6, setting=0, title= support.typo(config.get_localized_string(70288),'bold color kod'), thumbnail=get_thumb('setting_0.png')))
# Reload
if estados:
@@ -144,7 +147,7 @@ def settings(item):
def browser(item):
logger.info()
log()
itemlist = []
for file in filetools.listdir(item.url):
@@ -152,7 +155,11 @@ def browser(item):
if filetools.isdir(filetools.join(item.url, file)):
itemlist.append(Item(channel=item.channel, title=file, action=item.action, url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30037), 'channel': 'downloads', 'action': "del_dir"}]))
else:
itemlist.append(Item(channel=item.channel, title=file, action="play", url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30039), 'channel': 'downloads', 'action': "del_file"}]))
if not item.infoLabels:
infoLabels = {"mediatype":"video"}
else:
infoLabels = item.infoLabels
itemlist.append(Item(channel=item.channel, title=file, action="play", infoLabels=infoLabels, url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30039), 'channel': 'downloads', 'action': "del_file"}]))
return itemlist
@@ -174,17 +181,17 @@ def del_dir(item):
def clean_all(item):
logger.info()
log()
stop_all()
removeFiles = False
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(30300)):
removeFiles = True
for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
if fichero.endswith(".json"):
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
for File in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
if File.endswith(".json"):
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, File)))
if not item.contentType == "tvshow" or ( item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
filetools.remove(filetools.join(DOWNLOAD_LIST_PATH, fichero))
filetools.remove(filetools.join(DOWNLOAD_LIST_PATH, File))
if removeFiles:
filetools.remove(filetools.join(DOWNLOAD_PATH, download_item.downloadFilename))
dirName = filetools.join(DOWNLOAD_PATH, filetools.dirname(download_item.downloadFilename))
@@ -200,11 +207,16 @@ def reload(item):
def stop_all(item=None):
logger.info()
log()
for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
if fichero.endswith(".json"):
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
if download_item.TorrentName:
from inspect import stack
if stack()[1][3] == 'clean_all': action = 'delete'
else: action = 'pause'
torrent.elementum_actions(action, download_item.TorrentName)
if download_item.downloadStatus == 4:
update_json(filetools.join(DOWNLOAD_LIST_PATH, fichero), {"downloadStatus": STATUS_CODES.stoped})
xbmc.sleep(300)
@@ -213,7 +225,7 @@ def stop_all(item=None):
def clean_ready(item):
logger.info()
log()
for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
if fichero.endswith(".json"):
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
@@ -225,7 +237,7 @@ def clean_ready(item):
def restart_error(item):
logger.info()
log()
for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
if fichero.endswith(".json"):
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
@@ -237,8 +249,7 @@ def restart_error(item):
filetools.remove(
filetools.join(DOWNLOAD_PATH, download_item.downloadFilename))
update_json(item.path,
{"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0})
update_json(item.path, {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0})
platformtools.itemlist_refresh()
@@ -260,91 +271,108 @@ def download_all_background(item):
if download_item.downloadStatus in [STATUS_CODES.stoped, STATUS_CODES.canceled]:
res = start_download(download_item)
# platformtools.itemlist_refresh()
# Si se ha cancelado paramos
# If canceled, we stop
if res == STATUS_CODES.canceled: break
def menu(item):
logger.info()
log(item)
if item.downloadServer:
servidor = item.downloadServer.get("server", "Auto")
else:
servidor = "Auto"
# Opciones disponibles para el menu
# Options available for the menu
op = [config.get_localized_string(70225), config.get_localized_string(70226), config.get_localized_string(70227),
config.get_localized_string(30165) % (servidor.capitalize()), config.get_localized_string(60220),
config.get_localized_string(60221)]
opciones = []
# Opciones para el menu
# Options for the menu
if item.downloadStatus == STATUS_CODES.stoped:
opciones.append(op[0]) # Descargar
if not item.server: opciones.append(op[3]) # Elegir Servidor
opciones.append(op[1]) # Eliminar de la lista
opciones.append(op[0]) # Download
if not item.server: opciones.append(op[3]) # Choose Server
opciones.append(op[1]) # Remove from the list
if item.downloadStatus == STATUS_CODES.canceled:
opciones.append(op[0]) # Descargar
if not item.server: opciones.append(op[3]) # Elegir Servidor
opciones.append(op[2]) # Reiniciar descarga
opciones.append(op[1]) # Eliminar de la lista
opciones.append(op[0]) # Download
if not item.server: opciones.append(op[3]) # Choose Server
opciones.append(op[2]) # Restart download
opciones.append(op[1]) # Remove from the list
if item.downloadStatus == STATUS_CODES.completed:
opciones.append(op[5]) # Play
opciones.append(op[1]) # Eliminar de la lista
opciones.append(op[2]) # Reiniciar descarga
opciones.append(op[5]) # Play
opciones.append(op[1]) # Remove from the list
opciones.append(op[2]) # Restart download
if item.downloadStatus == STATUS_CODES.error: # descarga con error
opciones.append(op[2]) # Reiniciar descarga
opciones.append(op[1]) # Eliminar de la lista
if item.downloadStatus == STATUS_CODES.error: # Download with error
opciones.append(op[2]) # Restart download
opciones.append(op[1]) # Remove from the list
if item.downloadStatus == STATUS_CODES.downloading:
opciones.append(op[5]) # Play
opciones.append(op[4]) # pause download
opciones.append(op[1]) # Eliminar de la lista
opciones.append(op[5]) # Play
opciones.append(op[4]) # Pause Download
opciones.append(op[1]) # Remove from the list
# Mostramos el dialogo
# Show Dialog
seleccion = platformtools.dialog_select(config.get_localized_string(30163), opciones)
logger.info('SELECTION: '+ op[seleccion])
# -1 es cancelar
# -1 is cancel
if seleccion == -1: return
logger.info("option=%s" % (opciones[seleccion]))
# Opcion Eliminar
# Delete
if opciones[seleccion] == op[1]:
filetools.remove(item.path)
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(30300)):
filetools.remove(filetools.join(DOWNLOAD_PATH, item.downloadFilename))
if item.TorrentName:
torrent.elementum_actions('delete', item.TorrentName)
else:
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(30300)):
filetools.remove(filetools.join(DOWNLOAD_PATH, item.downloadFilename))
# Opcion inicaiar descarga
# Start Download
if opciones[seleccion] == op[0]:
item.action = "start_download"
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")
# Elegir Servidor
# Select Server
if opciones[seleccion] == op[3]:
select_server(item)
# Reiniciar descarga
# Restart Download
if opciones[seleccion] == op[2]:
if filetools.isfile(filetools.join(DOWNLOAD_PATH, item.downloadFilename)):
filetools.remove(filetools.join(DOWNLOAD_PATH, item.downloadFilename))
update_json(item.path, {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0,
"downloadServer": {}})
update_json(item.path, {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0, "downloadServer": {}})
if opciones[seleccion] == op[4]:
if item.TorrentName:
torrent.elementum_actions('pause', item.TorrentName)
update_json(item.path, {"downloadStatus": STATUS_CODES.stoped})
if opciones[seleccion] == op[5]:
xbmc.executebuiltin('PlayMedia(' + filetools.join(DOWNLOAD_PATH, item.downloadFilename) + ',resume)')
path = filetools.join(DOWNLOAD_PATH, item.downloadFilename)
if filetools.isdir(path):
videos = []
files = filetools.listdir(path)
for f in files:
if os.path.splitext(f)[-1] in extensions_list:
videos.append(f)
if len(videos) > 1:
selection = platformtools.dialog_select(config.get_localized_string(30034), files)
else:
selection = 0
xbmc.executebuiltin('PlayMedia(' + filetools.join(path, files[selection]) + ',resume)')
else:
xbmc.executebuiltin('PlayMedia(' + path + ',resume)')
if opciones[seleccion] != op[5]:
platformtools.itemlist_refresh()
def move_to_libray(item):
logger.info()
log()
if item.contentType == 'movie':
FOLDER = FOLDER_MOVIES
@@ -360,6 +388,9 @@ def move_to_libray(item):
library_path = filetools.join(move_path, *filetools.split(item.downloadFilename))
final_path = download_path
if not filetools.isdir(filetools.dirname(library_path)):
filetools.mkdir(filetools.dirname(library_path))
if item.contentType == "movie" and item.infoLabels["tmdb_id"]:
contentTitle = item.contentTitle if item.contentTitle else item.fulltitle
library_item = Item(title= filetools.split(item.downloadFilename)[-1], channel="downloads", contentTitle = contentTitle,
@@ -374,14 +405,11 @@ def move_to_libray(item):
fulltitle = item.fulltitle, infoLabels={"tmdb_id": item.infoLabels["tmdb_id"]})
videolibrarytools.save_tvshow(tvshow, [library_item], silent=True)
if not filetools.isdir(filetools.dirname(library_path)):
filetools.mkdir(filetools.dirname(library_path))
if filetools.isfile(library_path) and filetools.isfile(download_path):
filetools.remove(library_path)
if filetools.isfile(download_path):
if filetools.move(download_path, library_path):
if filetools.move(download_path, library_path, silent=True):
final_path = library_path
if len(filetools.listdir(filetools.dirname(download_path))) == 0:
@@ -398,7 +426,7 @@ def move_to_libray(item):
if filename.startswith(name) and (filename.endswith('.strm') or (filename.endswith('.json') and 'downloads' not in filename)):
clean = True
file_path = filetools.join(config.get_setting("videolibrarypath"), FOLDER, path_title, File)
logger.info('Delete File: ' + str(file_path))
log('Delete File:', str(file_path))
filetools.remove(file_path)
if file_path.endswith('.strm'):
file_strm_path = file_path
@@ -406,9 +434,8 @@ def move_to_libray(item):
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary
if clean == True:
strm_list = []
strm_list.append(file_strm_path)
xbmc_videolibrary.clean(strm_list)
path_list = [file_strm_path]
xbmc_videolibrary.clean(path_list)
xbmc_videolibrary.update(FOLDER, path_title)
@@ -446,9 +473,7 @@ def get_server_position(server):
servers = {}
if server in servers:
pos = [s for s in sorted(servers, key=lambda x: (old_div(sum(servers[x]["speeds"]), (len(servers[x]["speeds"]) or 1)),
float(sum(servers[x]["success"])) / (
len(servers[x]["success"]) or 1)), reverse=True)]
pos = [s for s in sorted(servers, key=lambda x: (old_div(sum(servers[x]["speeds"]), (len(servers[x]["speeds"]) or 1)), float(sum(servers[x]["success"])) / ( len(servers[x]["success"]) or 1)), reverse=True)]
return pos.index(server) + 1
else:
return 0
@@ -456,27 +481,26 @@ def get_server_position(server):
def get_match_list(data, match_list, order_list=None, only_ascii=False, ignorecase=False):
"""
Busca coincidencias en una cadena de texto, con un diccionario de "ID" / "Listado de cadenas de busqueda":
{ "ID1" : ["Cadena 1", "Cadena 2", "Cadena 3"],
"ID2" : ["Cadena 4", "Cadena 5", "Cadena 6"]
}
Search for matches in a text string, with a dictionary of "ID" / "List of search strings":
    {"ID1": ["String 1", "String 2", "String 3"],
      "ID2": ["String 4", "String 5", "String 6"]
    }
El diccionario no pude contener una misma cadena de busqueda en varías IDs.
La busqueda se realiza por orden de tamaño de cadena de busqueda (de mas larga a mas corta) si una cadena coincide,
se elimina de la cadena a buscar para las siguientes, para que no se detecten dos categorias si una cadena es parte de otra:
por ejemplo: "Idioma Español" y "Español" si la primera aparece en la cadena "Pablo sabe hablar el Idioma Español"
coincidira con "Idioma Español" pero no con "Español" ya que la coincidencia mas larga tiene prioridad.
    The dictionary could not contain the same search string in several IDs.
    The search is performed in order of search string size (from longest to shortest) if a string matches,
    it is removed from the search string for the following, so that two categories are not detected if one string is part of another:
    for example: "Spanish Language" and "Spanish" if the first appears in the string "Pablo knows how to speak the Spanish Language"
    It will match "Spanish Language" but not "Spanish" since the longest match has priority.
"""
match_dict = dict()
matches = []
# Pasamos la cadena a unicode
# We pass the string to unicode
if not PY3:
data = unicode(data, "utf8")
# Pasamos el diccionario a {"Cadena 1": "ID1", "Cadena 2", "ID1", "Cadena 4", "ID2"} y los pasamos a unicode
# We pass the dictionary to {"String 1": "ID1", "String 2", "ID1", "String 4", "ID2"} and we pass them to unicode
for key in match_list:
if order_list and not key in order_list:
raise Exception("key '%s' not in match_list" % key)
@@ -488,17 +512,17 @@ def get_match_list(data, match_list, order_list=None, only_ascii=False, ignoreca
else:
match_dict[value] = key
# Si ignorecase = True, lo pasamos todo a mayusculas
# If ignorecase = True, we pass everything to capital letters
if ignorecase:
data = data.upper()
match_dict = dict((key.upper(), match_dict[key]) for key in match_dict)
# Si ascii = True, eliminamos todos los accentos y Ñ
# If ascii = True, we remove all accents and Ñ
if only_ascii:
data = ''.join((c for c in unicodedata.normalize('NFD', data) if unicodedata.category(c) != 'Mn'))
match_dict = dict((''.join((c for c in unicodedata.normalize('NFD', key) if unicodedata.category(c) != 'Mn')), match_dict[key]) for key in match_dict)
# Ordenamos el listado de mayor tamaño a menor y buscamos.
# We sort the list from largest to smallest and search.
for match in sorted(match_dict, key=lambda x: len(x), reverse=True):
s = data
for a in matches:
@@ -507,8 +531,7 @@ def get_match_list(data, match_list, order_list=None, only_ascii=False, ignoreca
matches.append(match)
if matches:
if order_list:
return type("Mtch_list", (),
{"key": match_dict[matches[-1]], "index": order_list.index(match_dict[matches[-1]])})
return type("Mtch_list", (), {"key": match_dict[matches[-1]], "index": order_list.index(match_dict[matches[-1]])})
else:
return type("Mtch_list", (), {"key": match_dict[matches[-1]], "index": None})
else:
@@ -563,22 +586,23 @@ def sort_method(item):
def download_from_url(url, item):
logger.info("Attempting to download: %s" % (url))
if url.lower().endswith(".m3u8") or url.lower().startswith("rtmp"):
log("Attempting to download:", url)
if url.lower().split('|')[0].endswith(".m3u8") or url.lower().startswith("rtmp"):
save_server_statistics(item.server, 0, False)
platformtools.dialog_notification('m3u8 Download',config.get_localized_string(60364), sound=False)
return {"downloadStatus": STATUS_CODES.error}
# Obtenemos la ruta de descarga y el nombre del archivo
# We get the download path and the file name
item.downloadFilename = item.downloadFilename
download_path = filetools.dirname(filetools.join(DOWNLOAD_PATH, item.downloadFilename))
file_name = filetools.basename(filetools.join(DOWNLOAD_PATH, item.downloadFilename))
# Creamos la carpeta si no existe
# We create the folder if it does not exist
if not filetools.exists(download_path):
filetools.mkdir(download_path)
# Lanzamos la descarga
# We launch the download
d = Downloader(url, download_path, file_name,
max_connections=1 + int(config.get_setting("max_connections", "downloads")),
block_size=2 ** (17 + int(config.get_setting("block_size", "downloads"))),
@@ -593,20 +617,20 @@ def download_from_url(url, item):
d.start_dialog(config.get_localized_string(60332))
# Descarga detenida. Obtenemos el estado:
# Se ha producido un error en la descarga
# Download stopped. We get the state:
# Download failed
if d.state == d.states.error:
logger.info("Error trying to download %s" % (url))
log("Error trying to download", url)
status = STATUS_CODES.error
# La descarga se ha detenifdo
# Download has stopped
elif d.state == d.states.stopped:
logger.info("Stop download")
log("Stop download")
status = STATUS_CODES.canceled
# La descarga ha finalizado
# Download is complete
elif d.state == d.states.completed:
logger.info("Downloaded correctly")
log("Downloaded correctly")
status = STATUS_CODES.completed
if (item.downloadSize and item.downloadSize != d.size[0]) or d.size[0] < 5000000: # if size don't correspond or file is too little (gounlimited for example send a little video to say the server is overloaded)
@@ -622,7 +646,7 @@ def download_from_url(url, item):
def download_from_server(item):
logger.info(item.tostring())
log(item.tostring())
unsupported_servers = ["torrent"]
if item.contentChannel == 'local':
@@ -652,34 +676,39 @@ def download_from_server(item):
item.video_urls = itemlist
if not item.server: item.server = "directo"
else:
logger.info("There is nothing to reproduce")
log("There is nothing to reproduce")
return {"downloadStatus": STATUS_CODES.error}
finally:
progreso.close()
logger.info("contentAction: %s | contentChannel: %s | server: %s | url: %s" % (
item.contentAction, item.contentChannel, item.server, item.url))
log("contentAction: %s | contentChannel: %s | server: %s | url: %s" % (item.contentAction, item.contentChannel, item.server, item.url))
if item.server == 'torrent':
import xbmcgui
xlistitem = xbmcgui.ListItem(path=item.url)
xlistitem.setArt({'icon': item.thumbnail, 'thumb': item.thumbnail, 'poster': item.thumbnail, 'fanart': item.thumbnail})
platformtools.set_infolabels(xlistitem, item)
platformtools.play_torrent(item, xlistitem, item.url)
if not item.server or not item.url or not item.contentAction == "play" or item.server in unsupported_servers:
logger.error("The Item does not contain the necessary parameters.")
return {"downloadStatus": STATUS_CODES.error}
if not item.video_urls:
video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing(item.server, item.url, item.password,
True, True)
video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing(item.server, item.url, item.password, True, True)
else:
video_urls, puedes, motivo = item.video_urls, True, ""
# Si no esta disponible, salimos
# If it is not available, we go out
if not puedes:
logger.info("The video is NOT available")
log("The video is NOT available")
return {"downloadStatus": STATUS_CODES.error}
else:
logger.info("YES Video is available")
log("YES Video is available")
result = {}
# Recorre todas las opciones hasta que consiga descargar una correctamente
# Go through all the options until I can download one correctly
for video_url in reversed(video_urls):
result = download_from_url(video_url[1], item)
@@ -687,23 +716,23 @@ def download_from_server(item):
if result["downloadStatus"] in [STATUS_CODES.canceled, STATUS_CODES.completed]:
break
# Error en la descarga, continuamos con la siguiente opcion
# Download error, we continue with the next option
if result["downloadStatus"] == STATUS_CODES.error:
continue
# Devolvemos el estado
# We return the state
return result
def download_from_best_server(item):
logger.info("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
result = {"downloadStatus": STATUS_CODES.error}
progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70179))
try:
if item.downloadItemlist:
logger.info('using cached servers')
log('using cached servers')
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
else:
if item.contentChannel in ['community', 'videolibrary']:
@@ -730,7 +759,7 @@ def download_from_best_server(item):
finally:
progreso.close()
# Recorremos el listado de servers, hasta encontrar uno que funcione
# We go through the list of servers, until we find one that works
for play_item in play_items:
play_item = item.clone(**play_item.__dict__)
play_item.contentAction = play_item.action
@@ -741,7 +770,7 @@ def download_from_best_server(item):
# if progreso.iscanceled():
# result["downloadStatus"] = STATUS_CODES.canceled
# Tanto si se cancela la descarga como si se completa dejamos de probar mas opciones
# Whether the download is canceled or completed, we stop trying more options
if result["downloadStatus"] in [STATUS_CODES.canceled, STATUS_CODES.completed]:
result["downloadServer"] = {"url": play_item.url, "server": play_item.server}
break
@@ -752,12 +781,11 @@ def download_from_best_server(item):
def select_server(item):
if item.server:
return "Auto"
logger.info(
"contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70179))
try:
if item.downloadItemlist:
logger.info('using cached servers')
log('using cached servers')
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
else:
if item.contentChannel in ['community', 'videolibrary']:
@@ -785,7 +813,7 @@ def select_server(item):
# if there is only one server select it
seleccion = 1
else:
# altrimenti mostra la finestra di selezione
# otherwise it shows the selection window
seleccion = platformtools.dialog_select(config.get_localized_string(70192), ["Auto"] + [s.title for s in play_items])
if seleccion >= 1:
@@ -799,16 +827,15 @@ def select_server(item):
def start_download(item):
logger.info(
"contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
# Ya tenemnos server, solo falta descargar
log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
# We already have a server, we just need to download
if item.contentAction == "play":
ret = download_from_server(item)
elif item.downloadServer and item.downloadServer.get("server"):
ret = download_from_server(
item.clone(server=item.downloadServer.get("server"), url=item.downloadServer.get("url"),
contentAction="play"))
# No tenemos server, necesitamos buscar el mejor
# We don't have a server, we need to find the best
else:
ret = download_from_best_server(item)
@@ -820,29 +847,28 @@ def start_download(item):
def get_episodes(item):
logger.info("contentAction: %s | contentChannel: %s | contentType: %s" % (
item.contentAction, item.contentChannel, item.contentType))
log("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
# The item we want to download NOW is an episode
if item.contentType == "episode":
episodes = [item.clone()]
# El item es uma serie o temporada
# The item is a series or season
elif item.contentType in ["tvshow", "season"]:
if item.downloadItemlist:
episodes = [Item().fromurl(i) for i in item.downloadItemlist]
else:
# importamos el canal
# The item is a series or season...
if item.contentChannel in ['community', 'videolibrary']:
channel = __import__('specials.%s' % item.contentChannel, None, None, ["specials.%s" % item.contentChannel])
else:
channel = __import__('channels.%s' % item.contentChannel, None, None, ["channels.%s" % item.contentChannel])
# Obtenemos el listado de episodios
# We get the list of episodes
episodes = getattr(channel, item.contentAction)(item)
itemlist = []
@@ -855,38 +881,38 @@ def get_episodes(item):
else:
renumber(episodes, item)
# Tenemos las lista, ahora vamos a comprobar
# We get the list of episodes...
for episode in episodes:
# Si partiamos de un item que ya era episodio estos datos ya están bien, no hay que modificarlos
# If we started from an item that was already an episode, this data is already good, it should not be modified
if item.contentType != "episode":
episode.contentAction = episode.action
episode.contentChannel = episode.channel
# Si el resultado es una temporada, no nos vale, tenemos que descargar los episodios de cada temporada
# If the result is a season, it is not worth it, we have to download the episodes of each season
if episode.contentType == "season":
itemlist.extend(get_episodes(episode))
# Si el resultado es un episodio ya es lo que necesitamos, lo preparamos para añadirlo a la descarga
# If the result is an episode is already what we need, we prepare it to add it to the download
if episode.contentType == "episode":
# Pasamos el id al episodio
# We pass the id to the episode
if not episode.infoLabels["tmdb_id"]:
episode.infoLabels["tmdb_id"] = item.infoLabels["tmdb_id"]
# Episodio, Temporada y Titulo
# Episode, Season and Title
if not episode.contentSeason or not episode.contentEpisodeNumber:
season_and_episode = scrapertools.get_season_and_episode(episode.title)
if season_and_episode:
episode.contentSeason = season_and_episode.split("x")[0]
episode.contentEpisodeNumber = season_and_episode.split("x")[1]
# Buscamos en tmdb
# Episode, Season and Title...
if item.infoLabels["tmdb_id"]:
scraper.find_and_set_infoLabels(episode)
# Episodio, Temporada y Titulo
# Episode, Season and Title
if not episode.contentTitle:
episode.contentTitle = re.sub("\[[^\]]+\]|\([^\)]+\)|\d*x\d*\s*-", "", episode.title).strip()
episode.contentTitle = re.sub(r"\[[^\]]+\]|\([^\)]+\)|\d*x\d*\s*-", "", episode.title).strip()
episode.downloadFilename = filetools.validate_path(filetools.join(item.downloadFilename, "%dx%0.2d - %s" % (episode.contentSeason, episode.contentEpisodeNumber, episode.contentTitle.strip())))
if season:
@@ -896,25 +922,27 @@ def get_episodes(item):
itemlist.append(episode)
# Cualquier otro resultado no nos vale, lo ignoramos
# Any other result is not worth it, we ignore it
else:
logger.info("Omitiendo item no válido: %s" % episode.tostring())
log("Omitiendo item no válido:", episode.tostring())
# if Multiple Languages or Qualities
# Any other result is not worth it, we ignore it...
itemlist = videolibrarytools.filter_list(itemlist)
return itemlist
def write_json(item):
logger.info()
log()
channel = item.from_channel if item.from_channel else item.channel
item.action = "menu"
item.channel = "downloads"
item.downloadStatus = STATUS_CODES.stoped
item.downloadProgress = 0
item.downloadSize = 0
item.downloadCompleted = 0
title = re.sub(r'(?:\[[^\]]+\]|%s[^-]+-\s*)' %config.get_localized_string(60356), '', item.title).strip()
if not item.contentThumbnail:
item.contentThumbnail = item.thumbnail
@@ -922,7 +950,17 @@ def write_json(item):
if name in item.__dict__:
item.__dict__.pop(name)
path = filetools.join(DOWNLOAD_LIST_PATH, str(time.time()) + ".json")
if item.contentType == 'episode':
naming = title + typo(item.infoLabels['IMDBNumber'], '_ []') + typo(channel, '_ []')
else:
naming = item.fulltitle + typo(item.infoLabels['IMDBNumber'], '_ []') + typo(channel, '_ []')
naming += typo(item.contentLanguage, '_ []') if item.contentLanguage else ''
naming += typo(item.quality, '_ []') if item.quality else ''
path = filetools.join(DOWNLOAD_LIST_PATH, naming + ".json")
if filetools.isfile(path):
filetools.remove(path)
item.path = path
filetools.write(path, item.tojson())
time.sleep(0.1)
@@ -940,7 +978,7 @@ def save_download(item):
def save_download_background(item):
logger.info()
log()
# Menu contextual
if item.from_action and item.from_channel:
item.channel = item.from_channel
@@ -989,7 +1027,7 @@ def save_download_background(item):
def save_download_videolibrary(item):
logger.info()
log()
show_disclaimer()
item.contentChannel = 'videolibrary'
item.channel = "downloads"
@@ -998,8 +1036,7 @@ def save_download_videolibrary(item):
def save_download_video(item):
logger.info("contentAction: %s | contentChannel: %s | contentTitle: %s" % (
item.contentAction, item.contentChannel, item.contentTitle))
log("contentAction: %s | contentChannel: %s | contentTitle: %s" % (item.contentAction, item.contentChannel, item.contentTitle))
set_movie_title(item)
@@ -1014,7 +1051,7 @@ def save_download_video(item):
def save_download_movie(item):
logger.info("contentAction: %s | contentChannel: %s | contentTitle: %s" % ( item.contentAction, item.contentChannel, item.contentTitle))
log("contentAction: %s | contentChannel: %s | contentTitle: %s" % ( item.contentAction, item.contentChannel, item.contentTitle))
progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70191))
@@ -1028,14 +1065,14 @@ def save_download_movie(item):
progreso.update(0, config.get_localized_string(60062))
item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentTitle.strip(), item.infoLabels['IMDBNumber']))
item.backupFilename = filetools.validate_path("%s [%s]" % (item.contentTitle.strip(), item.infoLabels['IMDBNumber']))
write_json(item)
progreso.close()
if not platformtools.dialog_yesno(config.get_localized_string(30101), config.get_localized_string(70189)):
platformtools.dialog_ok(config.get_localized_string(30101), item.contentTitle,
config.get_localized_string(30109))
platformtools.dialog_ok(config.get_localized_string(30101), item.contentTitle, config.get_localized_string(30109))
else:
play_item = select_server(item)
if play_item == 'Auto':
@@ -1048,8 +1085,7 @@ def save_download_movie(item):
def save_download_tvshow(item):
logger.info("contentAction: %s | contentChannel: %s | contentType: %s | contentSerieName: %s" % (
item.contentAction, item.contentChannel, item.contentType, item.contentSerieName))
log("contentAction: %s | contentChannel: %s | contentType: %s | contentSerieName: %s" % (item.contentAction, item.contentChannel, item.contentType, item.contentSerieName))
progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70188))
try:
@@ -1077,9 +1113,8 @@ def save_download_tvshow(item):
progreso.close()
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,
config.get_localized_string(30109))
platformtools.dialog_ok(config.get_localized_string(30101), str(len(episodes)) + config.get_localized_string(30110) + item.contentSerieName, config.get_localized_string(30109))
else:
if len(episodes) == 1:
play_item = select_server(episodes[0])
@@ -1101,10 +1136,10 @@ def save_download_tvshow(item):
def set_movie_title(item):
if not item.contentTitle:
item.contentTitle = re.sub("\[[^\]]+\]|\([^\)]+\)", "", item.contentTitle).strip()
item.contentTitle = re.sub(r"\[[^\]]+\]|\([^\)]+\)", "", item.contentTitle).strip()
if not item.contentTitle:
item.contentTitle = re.sub("\[[^\]]+\]|\([^\)]+\)", "", item.title).strip()
item.contentTitle = re.sub(r"\[[^\]]+\]|\([^\)]+\)", "", item.title).strip()
def show_disclaimer():
-1
View File
@@ -3,7 +3,6 @@
"name": "Film in tv",
"language": ["ita"],
"active": false,
"adult": false,
"thumbnail": null,
"banner": null,
"categories": [],
-1
View File
@@ -2,6 +2,5 @@
"id": "help",
"name": "Ayuda",
"active": false,
"adult": false,
"language": ["*"]
}
-1
View File
@@ -2,7 +2,6 @@
"id": "news",
"name": "Novedades",
"active": false,
"adult": false,
"language": ["*"],
"categories": [
"movie"
+1 -9
View File
@@ -119,7 +119,7 @@ def mainlist(item):
set_category_context(new_item)
itemlist.append(new_item)
thumbnail = get_thumb("setting_0.png")
itemlist.append(Item(channel='shortcuts', action="SettingOnPosition", category=5, setting=0,
itemlist.append(Item(channel='shortcuts', action="SettingOnPosition", category=7, setting=1,
title=typo(config.get_localized_string(70285), 'bold color kod'), thumbnail=thumbnail))
return itemlist
@@ -155,10 +155,6 @@ def get_channels_list():
if not channel_parameters["active"]:
continue
# No incluir si es un canal para adultos, y el modo adulto está desactivado
if channel_parameters["adult"] and config.get_setting("adult_mode") == 0:
continue
# No incluir si el canal es en un idioma filtrado
if channel_language != "all" and channel_language not in str(channel_parameters["language"]) \
and "*" not in channel_parameters["language"]:
@@ -630,10 +626,6 @@ def setting_channel(item):
if not channel_parameters["active"]:
continue
# No incluir si es un canal para adultos, y el modo adulto está desactivado
if channel_parameters["adult"] and config.get_setting("adult_mode") == 0:
continue
# No incluir si el canal es en un idioma filtrado
if channel_language != "all" and channel_language not in str(channel_parameters["language"]) \
and "*" not in channel_parameters["language"]:
+5 -1
View File
@@ -10,6 +10,7 @@ from lib.requests_toolbelt.adapters import host_header_ssl
from lib import doh
from platformcode import logger, config
import requests
from core import scrapertools
try:
import _sqlite3 as sql
@@ -107,7 +108,10 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
domain = parse.netloc
else:
raise requests.exceptions.URLRequired
ip = self.getIp(domain)
if not scrapertools.find_single_match(domain, '\d+\.\d+\.\d+\.\d+'):
ip = self.getIp(domain)
else:
ip = None
if ip:
self.ssl_context = CustomContext(protocol, domain)
if self.CF:
-1
View File
@@ -2,7 +2,6 @@
"id": "search",
"name": "search",
"active": false,
"adult": false,
"thumbnail": "",
"banner": "",
"categories": [],
+17 -23
View File
@@ -46,7 +46,7 @@ def mainlist(item):
Item(channel=item.channel, title=typo(config.get_localized_string(59994), 'color kod bold'), action='opciones', thumbnail=get_thumb('setting_0.png')),
Item(channel='shortcuts', title=typo(config.get_localized_string(70286), 'color kod bold'), action='SettingOnPosition', category=3, thumbnail=get_thumb('setting_0.png'))]
Item(channel='shortcuts', title=typo(config.get_localized_string(70286), 'color kod bold'), action='SettingOnPosition', category=5, setting=1, thumbnail=get_thumb('setting_0.png'))]
itemlist = set_context(itemlist)
@@ -298,34 +298,30 @@ def channel_search(item):
def get_channel_results(ch, item):
max_results = 10
results = list()
try:
ch_params = channeltools.get_channel_parameters(ch)
ch_params = channeltools.get_channel_parameters(ch)
module = __import__('channels.%s' % ch_params["channel"], fromlist=["channels.%s" % ch_params["channel"]])
mainlist = getattr(module, 'mainlist')(Item(channel=ch_params["channel"]))
search_action = [elem for elem in mainlist if elem.action == "search" and (item.mode == 'all' or elem.contentType == item.mode)]
module = __import__('channels.%s' % ch_params["channel"], fromlist=["channels.%s" % ch_params["channel"]])
mainlist = getattr(module, 'mainlist')(Item(channel=ch_params["channel"]))
search_action = [elem for elem in mainlist if elem.action == "search" and (item.mode == 'all' or elem.contentType == item.mode)]
if search_action:
for search_ in search_action:
try:
if search_action:
for search_ in search_action:
results.extend(module.search(search_, item.text))
except:
pass
else:
try:
else:
results.extend(module.search(item, item.text))
except:
pass
if len(results) < 0 and len(results) < max_results and item.mode != 'all':
if len(results) < 0 and len(results) < max_results and item.mode != 'all':
if len(results) == 1:
if not results[0].action or config.get_localized_string(30992).lower() in results[0].title.lower():
return [ch, []]
if len(results) == 1:
if not results[0].action or config.get_localized_string(30992).lower() in results[0].title.lower():
return [ch, []]
results = get_info(results)
results = get_info(results)
return [ch, results]
return [ch, results]
except:
return [ch, results]
def get_info(itemlist):
@@ -418,8 +414,6 @@ def setting_channel_new(item):
presel_values = ['skip', 'actual', 'all', 'none']
categs = ['movie', 'tvshow', 'documentary', 'anime', 'vos', 'direct', 'torrent']
if config.get_setting('adult_mode') > 0:
categs.append('adult')
for c in categs:
preselecciones.append(config.get_localized_string(70577) + config.get_localized_category(c))
presel_values.append(c)
+138 -138
View File
@@ -107,142 +107,142 @@ def autostart(item): # item necessario launcher.py linea 265
# xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70710))
def setting_torrent(item):
logger.info()
# def setting_torrent(item):
# logger.info()
LIBTORRENT_PATH = config.get_setting("libtorrent_path", server="torrent", default="")
LIBTORRENT_ERROR = config.get_setting("libtorrent_error", server="torrent", default="")
default = config.get_setting("torrent_client", server="torrent", default=0)
BUFFER = config.get_setting("mct_buffer", server="torrent", default="50")
DOWNLOAD_PATH = config.get_setting("mct_download_path", server="torrent", default=config.get_setting("downloadpath"))
if not DOWNLOAD_PATH: DOWNLOAD_PATH = filetools.join(config.get_data_path(), 'downloads')
BACKGROUND = config.get_setting("mct_background_download", server="torrent", default=True)
RAR = config.get_setting("mct_rar_unpack", server="torrent", default=True)
DOWNLOAD_LIMIT = config.get_setting("mct_download_limit", server="torrent", default="")
BUFFER_BT = config.get_setting("bt_buffer", server="torrent", default="50")
DOWNLOAD_PATH_BT = config.get_setting("bt_download_path", server="torrent", default=config.get_setting("downloadpath"))
if not DOWNLOAD_PATH_BT: DOWNLOAD_PATH_BT = filetools.join(config.get_data_path(), 'downloads')
MAGNET2TORRENT = config.get_setting("magnet2torrent", server="torrent", default=False)
# LIBTORRENT_PATH = config.get_setting("libtorrent_path", server="torrent", default="")
# LIBTORRENT_ERROR = config.get_setting("libtorrent_error", server="torrent", default="")
# default = config.get_setting("torrent_client", server="torrent", default=0)
# BUFFER = config.get_setting("mct_buffer", server="torrent", default="50")
# DOWNLOAD_PATH = config.get_setting("mct_download_path", server="torrent", default=config.get_setting("downloadpath"))
# if not DOWNLOAD_PATH: DOWNLOAD_PATH = filetools.join(config.get_data_path(), 'downloads')
# BACKGROUND = config.get_setting("mct_background_download", server="torrent", default=True)
# RAR = config.get_setting("mct_rar_unpack", server="torrent", default=True)
# DOWNLOAD_LIMIT = config.get_setting("mct_download_limit", server="torrent", default="")
# BUFFER_BT = config.get_setting("bt_buffer", server="torrent", default="50")
# DOWNLOAD_PATH_BT = config.get_setting("bt_download_path", server="torrent", default=config.get_setting("downloadpath"))
# if not DOWNLOAD_PATH_BT: DOWNLOAD_PATH_BT = filetools.join(config.get_data_path(), 'downloads')
# MAGNET2TORRENT = config.get_setting("magnet2torrent", server="torrent", default=False)
torrent_options = [config.get_localized_string(30006), config.get_localized_string(70254), config.get_localized_string(70255)]
torrent_options.extend(platformtools.torrent_client_installed())
# torrent_options = [config.get_localized_string(30006), config.get_localized_string(70254), config.get_localized_string(70255)]
# torrent_options.extend(platformtools.torrent_client_installed())
list_controls = [
{
"id": "libtorrent_path",
"type": "text",
"label": "Libtorrent path",
"default": LIBTORRENT_PATH,
"enabled": True,
"visible": False
},
{
"id": "libtorrent_error",
"type": "text",
"label": "libtorrent error",
"default": LIBTORRENT_ERROR,
"enabled": True,
"visible": False
},
{
"id": "list_torrent",
"type": "list",
"label": config.get_localized_string(70256),
"default": default,
"enabled": True,
"visible": True,
"lvalues": torrent_options
},
{
"id": "mct_buffer",
"type": "text",
"label": "MCT - " + config.get_localized_string(70758),
"default": BUFFER,
"enabled": True,
"visible": "eq(-1,%s)" % torrent_options[2]
},
{
"id": "mct_download_path",
"type": "text",
"label": "MCT - " + config.get_localized_string(30017),
"default": DOWNLOAD_PATH,
"enabled": True,
"visible": "eq(-2,%s)" % torrent_options[2]
},
{
"id": "bt_buffer",
"type": "text",
"label": "BT - " + config.get_localized_string(70758),
"default": BUFFER_BT,
"enabled": True,
"visible": "eq(-3,%s)" % torrent_options[1]
},
{
"id": "bt_download_path",
"type": "text",
"label": "BT - " + config.get_localized_string(30017),
"default": DOWNLOAD_PATH_BT,
"enabled": True,
"visible": "eq(-4,%s)" % torrent_options[1]
},
{
"id": "mct_download_limit",
"type": "text",
"label": config.get_localized_string(70759),
"default": DOWNLOAD_LIMIT,
"enabled": True,
"visible": "eq(-5,%s) | eq(-5,%s)" % (torrent_options[1], torrent_options[2])
},
{
"id": "mct_rar_unpack",
"type": "bool",
"label": config.get_localized_string(70760),
"default": RAR,
"enabled": True,
"visible": True
},
{
"id": "mct_background_download",
"type": "bool",
"label": config.get_localized_string(70761),
"default": BACKGROUND,
"enabled": True,
"visible": True
},
{
"id": "magnet2torrent",
"type": "bool",
"label": config.get_localized_string(70762),
"default": MAGNET2TORRENT,
"enabled": True,
"visible": True
}
]
# list_controls = [
# {
# "id": "libtorrent_path",
# "type": "text",
# "label": "Libtorrent path",
# "default": LIBTORRENT_PATH,
# "enabled": True,
# "visible": False
# },
# {
# "id": "libtorrent_error",
# "type": "text",
# "label": "libtorrent error",
# "default": LIBTORRENT_ERROR,
# "enabled": True,
# "visible": False
# },
# {
# "id": "list_torrent",
# "type": "list",
# "label": config.get_localized_string(70256),
# "default": default,
# "enabled": True,
# "visible": True,
# "lvalues": torrent_options
# },
# {
# "id": "mct_buffer",
# "type": "text",
# "label": "MCT - " + config.get_localized_string(70758),
# "default": BUFFER,
# "enabled": True,
# "visible": "eq(-1,%s)" % torrent_options[2]
# },
# {
# "id": "mct_download_path",
# "type": "text",
# "label": "MCT - " + config.get_localized_string(30017),
# "default": DOWNLOAD_PATH,
# "enabled": True,
# "visible": "eq(-2,%s)" % torrent_options[2]
# },
# {
# "id": "bt_buffer",
# "type": "text",
# "label": "BT - " + config.get_localized_string(70758),
# "default": BUFFER_BT,
# "enabled": True,
# "visible": "eq(-3,%s)" % torrent_options[1]
# },
# {
# "id": "bt_download_path",
# "type": "text",
# "label": "BT - " + config.get_localized_string(30017),
# "default": DOWNLOAD_PATH_BT,
# "enabled": True,
# "visible": "eq(-4,%s)" % torrent_options[1]
# },
# {
# "id": "mct_download_limit",
# "type": "text",
# "label": config.get_localized_string(70759),
# "default": DOWNLOAD_LIMIT,
# "enabled": True,
# "visible": "eq(-5,%s) | eq(-5,%s)" % (torrent_options[1], torrent_options[2])
# },
# {
# "id": "mct_rar_unpack",
# "type": "bool",
# "label": config.get_localized_string(70760),
# "default": RAR,
# "enabled": True,
# "visible": True
# },
# {
# "id": "mct_background_download",
# "type": "bool",
# "label": config.get_localized_string(70761),
# "default": BACKGROUND,
# "enabled": True,
# "visible": True
# },
# {
# "id": "magnet2torrent",
# "type": "bool",
# "label": config.get_localized_string(70762),
# "default": MAGNET2TORRENT,
# "enabled": True,
# "visible": True
# }
# ]
platformtools.show_channel_settings(list_controls=list_controls, callback='save_setting_torrent', item=item,
caption=config.get_localized_string(70257), custom_button={'visible': False})
# platformtools.show_channel_settings(list_controls=list_controls, callback='save_setting_torrent', item=item,
# caption=config.get_localized_string(70257), custom_button={'visible': False})
def save_setting_torrent(item, dict_data_saved):
if dict_data_saved and "list_torrent" in dict_data_saved:
config.set_setting("torrent_client", dict_data_saved["list_torrent"], server="torrent")
if dict_data_saved and "mct_buffer" in dict_data_saved:
config.set_setting("mct_buffer", dict_data_saved["mct_buffer"], server="torrent")
if dict_data_saved and "mct_download_path" in dict_data_saved:
config.set_setting("mct_download_path", dict_data_saved["mct_download_path"], server="torrent")
if dict_data_saved and "mct_background_download" in dict_data_saved:
config.set_setting("mct_background_download", dict_data_saved["mct_background_download"], server="torrent")
if dict_data_saved and "mct_rar_unpack" in dict_data_saved:
config.set_setting("mct_rar_unpack", dict_data_saved["mct_rar_unpack"], server="torrent")
if dict_data_saved and "mct_download_limit" in dict_data_saved:
config.set_setting("mct_download_limit", dict_data_saved["mct_download_limit"], server="torrent")
if dict_data_saved and "bt_buffer" in dict_data_saved:
config.set_setting("bt_buffer", dict_data_saved["bt_buffer"], server="torrent")
if dict_data_saved and "bt_download_path" in dict_data_saved:
config.set_setting("bt_download_path", dict_data_saved["bt_download_path"], server="torrent")
if dict_data_saved and "magnet2torrent" in dict_data_saved:
config.set_setting("magnet2torrent", dict_data_saved["magnet2torrent"], server="torrent")
# def save_setting_torrent(item, dict_data_saved):
# if dict_data_saved and "list_torrent" in dict_data_saved:
# config.set_setting("torrent_client", dict_data_saved["list_torrent"], server="torrent")
# if dict_data_saved and "mct_buffer" in dict_data_saved:
# config.set_setting("mct_buffer", dict_data_saved["mct_buffer"], server="torrent")
# if dict_data_saved and "mct_download_path" in dict_data_saved:
# config.set_setting("mct_download_path", dict_data_saved["mct_download_path"], server="torrent")
# if dict_data_saved and "mct_background_download" in dict_data_saved:
# config.set_setting("mct_background_download", dict_data_saved["mct_background_download"], server="torrent")
# if dict_data_saved and "mct_rar_unpack" in dict_data_saved:
# config.set_setting("mct_rar_unpack", dict_data_saved["mct_rar_unpack"], server="torrent")
# if dict_data_saved and "mct_download_limit" in dict_data_saved:
# config.set_setting("mct_download_limit", dict_data_saved["mct_download_limit"], server="torrent")
# if dict_data_saved and "bt_buffer" in dict_data_saved:
# config.set_setting("bt_buffer", dict_data_saved["bt_buffer"], server="torrent")
# if dict_data_saved and "bt_download_path" in dict_data_saved:
# config.set_setting("bt_download_path", dict_data_saved["bt_download_path"], server="torrent")
# if dict_data_saved and "magnet2torrent" in dict_data_saved:
# config.set_setting("magnet2torrent", dict_data_saved["magnet2torrent"], server="torrent")
def menu_servers(item):
logger.info()
@@ -468,16 +468,16 @@ def check_quickfixes(item):
return False
def update_quasar(item):
logger.info()
# def update_quasar(item):
# logger.info()
from platformcode import custom_code, platformtools
stat = False
stat = custom_code.update_external_addon("quasar")
if stat:
platformtools.dialog_notification("Actualización Quasar", "Realizada con éxito")
else:
platformtools.dialog_notification("Actualización Quasar", "Ha fallado. Consulte el log")
# from platformcode import custom_code, platformtools
# stat = False
# stat = custom_code.update_external_addon("quasar")
# if stat:
# platformtools.dialog_notification("Actualización Quasar", "Realizada con éxito")
# else:
# platformtools.dialog_notification("Actualización Quasar", "Ha fallado. Consulte el log")
def conf_tools(item):
+5 -35
View File
@@ -8,12 +8,12 @@ def context():
# original
# if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="shortcut_menu").tourl()))
# if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts',action="side_menu").tourl()))
# if config.get_setting('kod_menu'): context.append((config.get_localized_string(30025), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl()))
# if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl()))
# pre-serialised
if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaWRlX21lbnUiLCAKICAgICJjaGFubmVsIjogInNob3J0Y3V0cyIsIAogICAgImluZm9MYWJlbHMiOiB7fQp9)'))
if config.get_setting('kod_menu'): context.append((config.get_localized_string(30025), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
if config.get_setting('side_menu'): context.append((config.get_localized_string(70737), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaWRlX21lbnUiLCAKICAgICJjaGFubmVsIjogInNob3J0Y3V0cyIsIAogICAgImluZm9MYWJlbHMiOiB7fQp9)'))
if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
return context
@@ -29,36 +29,6 @@ def settings_menu(item):
from platformcode import config
config.open_settings()
def view_mode(item):
logger.info(str(item))
import xbmc
from core import filetools, jsontools
from core.support import typo
from platformcode import config, platformtools
skin_name = xbmc.getSkinDir()
config.set_setting('skin_name', skin_name)
path = filetools.join(config.get_runtime_path(), 'resources', 'views', skin_name + '.json')
if filetools.isfile(path):
json_file = open(path, "r").read()
json = jsontools.load(json_file)
Type = 'addon'if item.type in ['channel', 'server'] else item.type
skin = json[Type]
list_type = []
for key in skin:
list_type.append(key)
list_type.sort()
list_type.insert(0, config.get_localized_string(70003))
select = platformtools.dialog_select(config.get_localized_string(70754), list_type)
value = list_type[select] + ' , ' + str(skin[list_type[select]] if list_type[select] in skin else 0)
config.set_setting('view_mode_%s' % item.type, value)
else:
platformtools.dialog_ok(config.get_localized_string(30141), config.get_localized_string(30142) % typo(skin_name.replace('skin.','').replace('.',' '), 'capitalize bold'))
def servers_menu(item):
# from core.support import dbg; dbg()
from core import servertools
@@ -177,5 +147,5 @@ def select(item):
else:
values = item.values.split('|')
select = platformtools.dialog_select(label, values)
select = platformtools.dialog_select(label, values, config.get_setting(item.id))
config.set_setting(item.id, values[select])
+1 -1
View File
@@ -64,7 +64,7 @@ def buscartrailer(item, trailers=[]):
itemlist = []
if item.search_title:
item.contentTitle = item.search_title
item.contentTitle = urllib.unquote_plus(item.search_title)
elif item.contentTitle != "":
item.contentTitle = item.contentTitle.strip()
elif keyboard:
-1
View File
@@ -2,7 +2,6 @@
"id": "tvmoviedb",
"name": "TvMovieDB",
"active": false,
"adult": false,
"language": ["*"],
"thumbnail": "http://i.imgur.com/HA7fvgD.png",
"categories": [
-1
View File
@@ -2,7 +2,6 @@
"id": "url",
"name": "URL",
"active": false,
"adult": false,
"thumbnail": "url.png",
"banner": "url.png"
}
+70 -68
View File
@@ -2,9 +2,78 @@
"id": "videolibrary",
"name": "Videoteca",
"active": false,
"adult": false,
"language": ["*"],
"settings": [
{
"id": "update",
"type": "list",
"label": "@60601",
"default": 1,
"visible": true,
"lvalues": [
"@60602",
"@60603",
"@60604",
"@60605"
]
},
{
"id": "update_wait",
"type": "list",
"label": "@60606",
"default": 0,
"enabled": "eq(-1,@60603)|eq(-1,@60605)",
"lvalues": [
"No",
"@60609",
"@60610",
"@60611",
"@60612"
]
},
{
"id": "everyday_delay",
"type": "list",
"label": "@60613",
"default": 1,
"enabled": "eq(-2,@60604)|eq(-2,@60605)",
"lvalues": [
"00:00",
"04:00",
"08:00",
"12:00",
"16:00",
"20:00"
]
},
{
"id": "updatetvshows_interval",
"type": "list",
"label": "@60614",
"default": 0,
"enabled": "!eq(-3,@60615)",
"lvalues": [
"@60616",
"@60617"
]
},
{
"id": "search_new_content",
"type": "list",
"label": "@60618",
"default": 0,
"enabled": "!eq(-4,@60615)",
"lvalues": [
"@60619",
"@60620"
]
},
{
"id": "local_episodes",
"type": "bool",
"label": "@80042",
"default": false
},
{
"id": "lab_1",
"type": "label",
@@ -56,73 +125,6 @@
"pt"
]
},
{
"id": "update",
"type": "list",
"label": "@60601",
"default": 1,
"visible": true,
"lvalues": [
"@60602",
"@60603",
"@60604",
"@60605"
]
},
{
"id": "update_wait",
"type": "list",
"label": "@60606",
"default": 0,
"visible": true,
"enabled": "eq(-1,@60603)|eq(-1,@60605)",
"lvalues": [
"No",
"@60609",
"@60610",
"@60611",
"@60612"
]
},
{
"id": "everyday_delay",
"type": "list",
"label": "@60613",
"default": 1,
"visible": true,
"enabled": "eq(-2,@60604)|eq(-2,@60605)",
"lvalues": [
"00:00",
"04:00",
"08:00",
"12:00",
"16:00",
"20:00"
]
},
{
"id": "updatetvshows_interval",
"type": "list",
"label": "@60614",
"default": 0,
"visible": true,
"enabled": "!eq(-3,@60615)",
"lvalues": [
"@60616",
"@60617"
]
},
{
"id": "search_new_content",
"type": "list",
"label": "@60618",
"default": 0,
"enabled": "!eq(-4,@60615)",
"lvalues": [
"@60619",
"@60620"
]
},
{
"id": "window_type",
"type": "list",
+118 -60
View File
@@ -32,7 +32,7 @@ def mainlist(item):
category=config.get_localized_string(70271),
thumbnail=get_thumb("videolibrary_tvshow.png")))
itemlist.append(Item(channel='shortcuts', action="SettingOnPosition",
category=2, setting=0, title=typo(config.get_localized_string(70287),'bold color kod'),
category=2, setting=1, title=typo(config.get_localized_string(70287),'bold color kod'),
thumbnail = get_thumb("setting_0.png")))
return itemlist
@@ -306,6 +306,14 @@ def list_tvshows(item):
{"title": config.get_localized_string(70269),
"action": "update_tvshow",
"channel": "videolibrary"}]
if item_tvshow.local_episodes_path == "":
item_tvshow.context.append({"title": config.get_localized_string(80048),
"action": "add_local_episodes",
"channel": "videolibrary"})
else:
item_tvshow.context.append({"title": config.get_localized_string(80049),
"action": "remove_local_episodes",
"channel": "videolibrary"})
# ,{"title": "Cambiar contenido (PENDIENTE)",
# "action": "",
# "channel": "videolibrary"}]
@@ -322,7 +330,7 @@ def list_tvshows(item):
itemlist = sorted(itemlist, key=lambda it: it.title.lower())
itemlist.append(Item(channel=item.channel, action="update_videolibrary", thumbnail=item.thumbnail,
title=config.get_localized_string(60026), folder=False))
title=typo(config.get_localized_string(70269), 'bold color kod'), folder=False))
return itemlist
@@ -468,7 +476,7 @@ def findvideos(item):
item_local = None
# Desactiva autoplay
autoplay.set_status(False)
# 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")
@@ -587,7 +595,7 @@ def findvideos(item):
list_servers = servertools.filter_servers(list_servers)
elif item_json.action == 'play':
from platformcode import platformtools
autoplay.set_status(True)
# autoplay.set_status(True)
item_json.contentChannel = item_json.channel
item_json.channel = "videolibrary"
platformtools.play_video(item_json)
@@ -629,7 +637,8 @@ def findvideos(item):
itemlist.append(server)
# return sorted(itemlist, key=lambda it: it.title.lower())
autoplay.play_multi_channel(item, itemlist)
if autoplay.play_multi_channel(item, itemlist): # hideserver
return []
from inspect import stack
from specials import nextep
if nextep.check(item) and stack()[1][3] == 'run':
@@ -678,7 +687,7 @@ def play(item):
return itemlist
def update_videolibrary(item):
def update_videolibrary(item=''):
logger.info()
# Actualizar las series activas sobreescribiendo
@@ -767,17 +776,15 @@ def delete_videolibrary(item):
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80038))
p_dialog.update(0)
filetools.rmdirtree(videolibrarytools.MOVIES_PATH)
p_dialog.update(40)
filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH)
p_dialog.update(80)
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary
strm_list = []
strm_list.append(config.get_setting('videolibrarypath'))
xbmc_videolibrary.clean(strm_list)
xbmc_videolibrary.clean()
p_dialog.update(10)
filetools.rmdirtree(videolibrarytools.MOVIES_PATH)
p_dialog.update(50)
filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH)
p_dialog.update(90)
config.verify_directories_created()
p_dialog.update(100)
xbmc.sleep(1000)
@@ -795,12 +802,59 @@ def update_tvshow(item):
p_dialog.update(0, heading, item.contentSerieName)
import service
if service.update(item.path, p_dialog, 1, 1, item, False) and config.is_xbmc() and config.get_setting("videolibrary_kodi"):
if service.update(item.path, p_dialog, 0, 100, item, False) and config.is_xbmc() and config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary
xbmc_videolibrary.update(folder=filetools.basename(item.path))
p_dialog.close()
# check if the TV show is ended or has been canceled and ask the user to remove it from the video library update
nfo_path = filetools.join(item.path, "tvshow.nfo")
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
if item.active and not item_nfo.active:
if not platformtools.dialog_yesno(config.get_localized_string(60037).replace('...',''), config.get_localized_string(70268) % item.contentSerieName):
item_nfo.active = 1
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
platformtools.itemlist_refresh()
def add_local_episodes(item):
logger.info()
done, local_episodes_path = videolibrarytools.config_local_episodes_path(item.path, item.contentSerieName, silent=True)
if done < 0:
logger.info("An issue has occurred while configuring local episodes")
elif local_episodes_path:
nfo_path = filetools.join(item.path, "tvshow.nfo")
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
item_nfo.local_episodes_path = local_episodes_path
if not item_nfo.active:
item_nfo.active = 1
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
update_tvshow(item)
platformtools.itemlist_refresh()
def remove_local_episodes(item):
logger.info()
nfo_path = filetools.join(item.path, "tvshow.nfo")
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
for season_episode in item_nfo.local_episodes_list:
filetools.remove(filetools.join(item.path, season_episode + '.strm'))
item_nfo.local_episodes_list = []
item_nfo.local_episodes_path = ''
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
update_tvshow(item)
platformtools.itemlist_refresh()
def verify_playcount_series(item, path):
logger.info()
@@ -1024,22 +1078,24 @@ def delete(item):
for file in filetools.listdir(_item.path):
if file.endswith(".strm") or file.endswith(".nfo") or file.endswith(".json")or file.endswith(".torrent"):
filetools.remove(filetools.join(_item.path, file))
raiz, carpeta_serie, ficheros = next(filetools.walk(_item.path))
if ficheros == []:
filetools.rmdir(_item.path)
if _item.contentType == 'movie':
heading = config.get_localized_string(70084)
else:
if _item.contentType == 'movie':
heading = config.get_localized_string(70084)
else:
heading = config.get_localized_string(70085)
if platformtools.dialog_yesno(heading, config.get_localized_string(70081)):
filetools.rmdirtree(_item.path)
heading = config.get_localized_string(70085)
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary
strm_list = []
strm_list.append(_item.extra)
xbmc_videolibrary.clean(strm_list)
if _item.local_episodes_path:
platformtools.dialog_ok(heading, config.get_localized_string(80047) % _item.infoLabels['title'])
path_list = [_item.extra]
xbmc_videolibrary.clean(path_list)
raiz, carpeta_serie, ficheros = next(filetools.walk(_item.path))
if ficheros == []:
filetools.rmdir(_item.path)
elif platformtools.dialog_yesno(heading, config.get_localized_string(70081) % os.path.basename(_item.path)):
filetools.rmdirtree(_item.path)
logger.info("All links removed")
xbmc.sleep(1000)
@@ -1067,8 +1123,8 @@ def delete(item):
if index == 0:
# Seleccionado Eliminar pelicula/serie
canal = None
delete_all(item)
return
elif index > 0:
# Seleccionado Eliminar canal X
@@ -1079,41 +1135,43 @@ def delete(item):
else:
canal = item.dead
if canal:
num_enlaces = 0
strm_list = []
for fd in filetools.listdir(item.path):
if fd.endswith(canal + '].json') or scrapertools.find_single_match(fd, '%s]_\d+.torrent' % canal):
if filetools.remove(filetools.join(item.path, fd)):
num_enlaces += 1
# Remove strm and nfo if no other channel
episode = fd.replace(' [' + canal + '].json', '')
found_ch = False
for ch in channels:
if filetools.exists(filetools.join(item.path, episode + ' [' + ch + '].json')):
found_ch = True
break
if found_ch == False:
filetools.remove(filetools.join(item.path, episode + '.nfo'))
filetools.remove(filetools.join(item.path, episode + '.strm'))
strm_list.append(filetools.join(item.extra, episode + '.strm'))
num_enlaces = 0
path_list = []
for fd in filetools.listdir(item.path):
if fd.endswith(canal + '].json') or scrapertools.find_single_match(fd, '%s]_\d+.torrent' % canal):
if filetools.remove(filetools.join(item.path, fd)):
num_enlaces += 1
# Remove strm and nfo if no other channel
episode = fd.replace(' [' + canal + '].json', '')
found_ch = False
for ch in channels:
if filetools.exists(filetools.join(item.path, episode + ' [' + ch + '].json')):
found_ch = True
break
if found_ch == False:
filetools.remove(filetools.join(item.path, episode + '.nfo'))
strm_path = filetools.join(item.path, episode + '.strm')
# if it is a local episode, do not delete the strm
if 'plugin://plugin.video.kod/?' in filetools.read(strm_path):
filetools.remove(strm_path)
path_list.append(filetools.join(item.extra, episode + '.strm'))
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and strm_list:
from platformcode import xbmc_videolibrary
xbmc_videolibrary.clean(strm_list)
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and path_list:
from platformcode import xbmc_videolibrary
xbmc_videolibrary.clean(path_list)
if num_enlaces > 0:
# Actualizar .nfo
head_nfo, item_nfo = videolibrarytools.read_nfo(item.nfo)
del item_nfo.library_urls[canal]
if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False):
del item_nfo.emergency_urls[canal]
filetools.write(item.nfo, head_nfo + item_nfo.tojson())
if num_enlaces > 0:
# Actualizar .nfo
head_nfo, item_nfo = videolibrarytools.read_nfo(item.nfo)
del item_nfo.library_urls[canal]
if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False):
del item_nfo.emergency_urls[canal]
filetools.write(item.nfo, head_nfo + item_nfo.tojson())
msg_txt = config.get_localized_string(70087) % (num_enlaces, canal)
logger.info(msg_txt)
platformtools.dialog_notification(heading, msg_txt)
platformtools.itemlist_refresh()
msg_txt = config.get_localized_string(70087) % (num_enlaces, canal)
logger.info(msg_txt)
platformtools.dialog_notification(heading, msg_txt)
platformtools.itemlist_refresh()
else:
if platformtools.dialog_yesno(heading, config.get_localized_string(70088) % item.infoLabels['title']):