KoD 0.9.1
- fix vari ed eventuali
This commit is contained in:
@@ -450,9 +450,8 @@ def init(channel, list_servers, list_quality, reset=False):
|
||||
if not result:
|
||||
heading = config.get_localized_string(60077)
|
||||
msj = config.get_localized_string(60078)
|
||||
icon = 1
|
||||
|
||||
platformtools.dialog_notification(heading, msj, icon, sound=False)
|
||||
platformtools.dialog_notification(heading, msj, sound=False)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
+5
-3
@@ -46,7 +46,7 @@ def export_videolibrary(item):
|
||||
p_dialog.update(100)
|
||||
xbmc.sleep(1000)
|
||||
p_dialog.close()
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80004), icon=0, time=5000, sound=False)
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80004), time=5000, sound=False)
|
||||
|
||||
|
||||
def import_videolibrary(item):
|
||||
@@ -73,7 +73,9 @@ def import_videolibrary(item):
|
||||
filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH)
|
||||
p_dialog.update(50)
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
xbmc_videolibrary.clean(config.get_setting('videolibrarypath'))
|
||||
strm_list = []
|
||||
strm_list.append(config.get_setting('videolibrarypath'))
|
||||
xbmc_videolibrary.clean(strm_list)
|
||||
|
||||
config.verify_directories_created()
|
||||
if filetools.exists(movies_path):
|
||||
@@ -87,7 +89,7 @@ def import_videolibrary(item):
|
||||
p_dialog.update(100)
|
||||
xbmc.sleep(1000)
|
||||
p_dialog.close()
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80008), icon=0, time=5000, sound=False)
|
||||
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
|
||||
|
||||
@@ -9,6 +9,7 @@ from core.item import Item
|
||||
from platformcode import config, platformtools
|
||||
from specials import autoplay
|
||||
from channelselector import get_thumb
|
||||
from collections import OrderedDict
|
||||
|
||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||
try: lang = info_language[config.get_setting("info_language", "videolibrary")]
|
||||
@@ -588,7 +589,6 @@ def filter_thread(filter, key, item, description):
|
||||
# for load json from item or url
|
||||
def load_json(item):
|
||||
support.log()
|
||||
from collections import OrderedDict
|
||||
|
||||
url = item.url if type(item) == Item else item
|
||||
try:
|
||||
|
||||
+39
-85
@@ -61,8 +61,7 @@ def mainlist(item):
|
||||
# Comprobamos que la serie no este ya en el 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)
|
||||
title = TITLE_TVSHOW % (STATUS_COLORS[i.downloadStatus], i.downloadProgress, i.contentSerieName, i.contentChannel)
|
||||
|
||||
itemlist.append(Item(title=title, channel="downloads", action="mainlist", contentType="tvshow",
|
||||
contentSerieName=i.contentSerieName, contentChannel=i.contentChannel,
|
||||
@@ -78,8 +77,7 @@ def mainlist(item):
|
||||
STATUS_CODES.completed, STATUS_CODES.stoped]:
|
||||
s.downloadStatus = i.downloadStatus
|
||||
|
||||
s.title = TITLE_TVSHOW % (
|
||||
STATUS_COLORS[s.downloadStatus], downloadProgress, i.contentSerieName, i.contentChannel)
|
||||
s.title = TITLE_TVSHOW % (STATUS_COLORS[s.downloadStatus], downloadProgress, i.contentSerieName, i.contentChannel)
|
||||
|
||||
# Peliculas
|
||||
elif i.contentType == "movie" or i.contentType == "video":
|
||||
@@ -89,8 +87,7 @@ def mainlist(item):
|
||||
# Listado dentro de una serie
|
||||
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))
|
||||
i.title = TITLE_FILE % (STATUS_COLORS[i.downloadStatus], i.downloadProgress, "%dx%0.2d: %s" % (i.contentSeason, i.contentEpisodeNumber, i.contentTitle))
|
||||
itemlist.append(i)
|
||||
|
||||
estados = [i.downloadStatus for i in itemlist]
|
||||
@@ -186,11 +183,13 @@ def clean_all(item):
|
||||
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 not item.contentType == "tvshow" or (
|
||||
item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
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))
|
||||
if removeFiles:
|
||||
filetools.remove(filetools.join(DOWNLOAD_PATH, download_item.downloadFilename))
|
||||
dirName = filetools.join(DOWNLOAD_PATH, filetools.dirname(download_item.downloadFilename))
|
||||
if len(filetools.listdir(dirName)) == 0:
|
||||
filetools.rmdir(dirName)
|
||||
|
||||
xbmc.sleep(100)
|
||||
platformtools.itemlist_refresh()
|
||||
@@ -208,7 +207,7 @@ def stop_all(item=None):
|
||||
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
|
||||
if download_item.downloadStatus == 4:
|
||||
update_json(filetools.join(DOWNLOAD_LIST_PATH, fichero), {"downloadStatus": STATUS_CODES.stoped})
|
||||
xbmc.sleep(100)
|
||||
xbmc.sleep(300)
|
||||
if item:
|
||||
platformtools.itemlist_refresh()
|
||||
|
||||
@@ -218,8 +217,7 @@ def clean_ready(item):
|
||||
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 not item.contentType == "tvshow" or (
|
||||
item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
if not item.contentType == "tvshow" or ( item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
if download_item.downloadStatus == STATUS_CODES.completed:
|
||||
filetools.remove(filetools.join(DOWNLOAD_LIST_PATH, fichero))
|
||||
|
||||
@@ -232,8 +230,7 @@ def restart_error(item):
|
||||
if fichero.endswith(".json"):
|
||||
download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
|
||||
|
||||
if not item.contentType == "tvshow" or (
|
||||
item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
if not item.contentType == "tvshow" or ( item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
if download_item.downloadStatus == STATUS_CODES.error:
|
||||
if filetools.isfile(
|
||||
filetools.join(DOWNLOAD_PATH, download_item.downloadFilename)):
|
||||
@@ -259,8 +256,7 @@ def download_all_background(item):
|
||||
download_item = Item(path=filetools.join(DOWNLOAD_LIST_PATH, fichero)).fromjson(
|
||||
filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero)))
|
||||
|
||||
if not item.contentType == "tvshow" or (
|
||||
item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
if not item.contentType == "tvshow" or ( item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel):
|
||||
if download_item.downloadStatus in [STATUS_CODES.stoped, STATUS_CODES.canceled]:
|
||||
res = start_download(download_item)
|
||||
# platformtools.itemlist_refresh()
|
||||
@@ -361,14 +357,14 @@ def move_to_libray(item):
|
||||
move_path = filetools.join(config.get_videolibrary_path(), FOLDER)
|
||||
|
||||
download_path = filetools.join(DOWNLOAD_PATH, item.downloadFilename)
|
||||
library_path = filetools.join(move_path, *filetools.split(item.downloadFilename))
|
||||
library_path = filetools.join(move_path, *filetools.split(item.downloadFilename))
|
||||
final_path = download_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,
|
||||
fulltitle = item.fulltitle,action="findvideos", infoLabels=item.infoLabels, url=library_path)
|
||||
videolibrarytools.save_movie(library_item)
|
||||
videolibrarytools.save_movie(library_item, silent=True)
|
||||
|
||||
elif item.contentType == "episode" and item.infoLabels["tmdb_id"]:
|
||||
contentSerieName = item.contentSerieName if item.contentSerieName else item.fulltitle
|
||||
@@ -376,7 +372,7 @@ def move_to_libray(item):
|
||||
fulltitle = item.fulltitle, action="findvideos", infoLabels=item.infoLabels, url=library_path)
|
||||
tvshow = Item(channel="downloads", contentType="tvshow", contentSerieName = contentSerieName,
|
||||
fulltitle = item.fulltitle, infoLabels={"tmdb_id": item.infoLabels["tmdb_id"]})
|
||||
videolibrarytools.save_tvshow(tvshow, [library_item])
|
||||
videolibrarytools.save_tvshow(tvshow, [library_item], silent=True)
|
||||
|
||||
if not filetools.isdir(filetools.dirname(library_path)):
|
||||
filetools.mkdir(filetools.dirname(library_path))
|
||||
@@ -410,61 +406,11 @@ def move_to_libray(item):
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
from platformcode import xbmc_videolibrary
|
||||
if clean == True:
|
||||
xbmc_videolibrary.clean(file_strm_path)
|
||||
strm_list = []
|
||||
strm_list.append(file_strm_path)
|
||||
xbmc_videolibrary.clean(strm_list)
|
||||
xbmc_videolibrary.update(FOLDER, path_title)
|
||||
|
||||
"""if config.get_setting("library_add") == True and config.get_setting("library_move") == 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):
|
||||
final_path = library_path
|
||||
|
||||
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 = filetools.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(filetools.join(config.get_videolibrary_path(), FOLDER, path_title, File)))
|
||||
filetools.remove(filetools.join(config.get_videolibrary_path(), FOLDER, path_title, File))
|
||||
|
||||
if config.get_setting("videolibrary_kodi"):
|
||||
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") == True and config.get_setting("library_move") == False:
|
||||
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",
|
||||
action="findvideos", infoLabels=item.infoLabels, url=final_path)
|
||||
videolibrarytools.save_movie(library_item)
|
||||
|
||||
elif item.contentType == "episode" and item.infoLabels["tmdb_id"]:
|
||||
library_item = Item(title=config.get_localized_string(70228) % item.downloadFilename, channel="downloads",
|
||||
action="findvideos", infoLabels=item.infoLabels, url=final_path)
|
||||
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))
|
||||
@@ -550,8 +496,7 @@ def get_match_list(data, match_list, order_list=None, only_ascii=False, ignoreca
|
||||
# Si ascii = True, eliminamos todos los accentos y Ñ
|
||||
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)
|
||||
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.
|
||||
for match in sorted(match_dict, key=lambda x: len(x), reverse=True):
|
||||
@@ -836,7 +781,13 @@ def select_server(item):
|
||||
if not i.server and hasattr(channel, "play"):
|
||||
play_items[x] = getattr(channel, "play")(i)
|
||||
|
||||
seleccion = platformtools.dialog_select(config.get_localized_string(70192), ["Auto"] + [s.title for s in play_items])
|
||||
if len(play_items) == 1:
|
||||
# if there is only one server select it
|
||||
seleccion = 1
|
||||
else:
|
||||
# altrimenti mostra la finestra di selezione
|
||||
seleccion = platformtools.dialog_select(config.get_localized_string(70192), ["Auto"] + [s.title for s in play_items])
|
||||
|
||||
if seleccion >= 1:
|
||||
update_json(item.path, {
|
||||
"downloadServer": {"url": play_items[seleccion - 1].url, "server": play_items[seleccion - 1].server}})
|
||||
@@ -959,8 +910,7 @@ def write_json(item):
|
||||
if not item.contentThumbnail:
|
||||
item.contentThumbnail = item.thumbnail
|
||||
|
||||
for name in ["text_bold", "text_color", "text_italic", "context", "totalItems", "viewmode", "title", "contentTitle",
|
||||
"thumbnail"]:
|
||||
for name in ["text_bold", "text_color", "text_italic", "context", "totalItems", "viewmode", "title", "contentTitle", "thumbnail"]:
|
||||
if name in item.__dict__:
|
||||
item.__dict__.pop(name)
|
||||
|
||||
@@ -996,7 +946,10 @@ def save_download_background(item):
|
||||
if item.channel == 'videolibrary':
|
||||
from specials import videolibrary
|
||||
|
||||
parent = Item().fromurl(item.parent)
|
||||
if not item.parent:
|
||||
parent = item
|
||||
else:
|
||||
parent = Item().fromurl(item.parent)
|
||||
parent.contentChannel = 'videolibrary'
|
||||
if item.downloadItemlist: # episode
|
||||
parent.downloadItemlist = item.downloadItemlist
|
||||
@@ -1047,15 +1000,13 @@ def save_download_video(item):
|
||||
write_json(item)
|
||||
|
||||
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:
|
||||
start_download(item)
|
||||
|
||||
|
||||
def save_download_movie(item):
|
||||
logger.info("contentAction: %s | contentChannel: %s | contentTitle: %s" % (
|
||||
item.contentAction, item.contentChannel, item.contentTitle))
|
||||
logger.info("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))
|
||||
|
||||
@@ -1068,7 +1019,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.infoLabels['IMDBNumber']))
|
||||
|
||||
write_json(item)
|
||||
|
||||
@@ -1096,11 +1047,15 @@ def save_download_tvshow(item):
|
||||
try:
|
||||
item.show = item.fulltitle
|
||||
scraper.find_and_set_infoLabels(item)
|
||||
|
||||
if not item.contentSerieName: item.contentSerieName = item.fulltitle
|
||||
|
||||
item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentSerieName, item.infoLabels['IMDBNumber']))
|
||||
if item.strm_path: item.downloadFilename = filetools.validate_path(item.strm_path.split(os.sep)[-2])
|
||||
else: item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentSerieName, item.infoLabels['IMDBNumber']))
|
||||
|
||||
if config.get_setting("lowerize_title", "videolibrary"):
|
||||
item.downloadFilename = item.downloadFilename.lower()
|
||||
|
||||
progreso.update(0, config.get_localized_string(70186), config.get_localized_string(70180) % item.contentChannel)
|
||||
|
||||
episodes = get_episodes(item)
|
||||
@@ -1108,8 +1063,7 @@ def save_download_tvshow(item):
|
||||
progreso.update(0, config.get_localized_string(70190), " ")
|
||||
|
||||
for x, i in enumerate(episodes):
|
||||
progreso.update(old_div(x * 100, len(episodes)),
|
||||
"%dx%0.2d: %s" % (i.contentSeason, i.contentEpisodeNumber, i.contentTitle))
|
||||
progreso.update(old_div(x * 100, len(episodes)), "%dx%0.2d: %s" % (i.contentSeason, i.contentEpisodeNumber, i.contentTitle))
|
||||
write_json(i)
|
||||
finally:
|
||||
progreso.close()
|
||||
|
||||
@@ -1,51 +1,76 @@
|
||||
|
||||
from core import filetools, downloadtools, support
|
||||
from platformcode import config, platformtools, updater
|
||||
from time import sleep
|
||||
|
||||
import xbmc, xbmcaddon, os, sys, platform
|
||||
import xbmc, xbmcaddon, sys, platform
|
||||
|
||||
host = 'https://github.com'
|
||||
quasar_url = host + '/scakemyer/plugin.video.quasar/releases'
|
||||
filename = filetools.join(config.get_data_path(),'quasar.zip')
|
||||
addon_path = xbmc.translatePath("special://home/addons/")
|
||||
quasar_path = filetools.join(addon_path,'plugin.video.quasar')
|
||||
elementum_url = host + '/elgatito/plugin.video.elementum/releases'
|
||||
filename = filetools.join(config.get_data_path(),'elementum.zip')
|
||||
addon_path = xbmc.translatePath('special://home/addons/')
|
||||
setting_path = xbmc.translatePath('special://profile/addon_data/')
|
||||
elementum_path = filetools.join(addon_path,'plugin.video.elementum')
|
||||
elementum_setting = filetools.join(setting_path,'plugin.video.elementum')
|
||||
elementum_setting_file = filetools.join(elementum_setting,'settings.xml')
|
||||
kod_setting_file = filetools.join(addon_path,'plugin.video.kod', 'resources', 'settings', 'elementum', 'settings.xml')
|
||||
|
||||
|
||||
def download(item=None):
|
||||
if filetools.exists(quasar_path):
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "plugin.video.quasar", "enabled": false }}')
|
||||
sleep(1)
|
||||
filetools.rmdirtree(quasar_path)
|
||||
|
||||
if filetools.exists(filename):
|
||||
filetools.remove(filename)
|
||||
return download()
|
||||
if filetools.exists(elementum_path):
|
||||
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70783)):
|
||||
setting()
|
||||
platformtools.dialog_ok('Elementum', config.get_localized_string(70783))
|
||||
|
||||
else:
|
||||
platform = get_platform()
|
||||
support.log('OS:', platform)
|
||||
support.log('Extract IN:', quasar_path)
|
||||
url = support.match(quasar_url, patronBlock=r'<div class="release-entry">(.*?)<!-- /.release-body -->', patron=r'<a href="([a-zA-Z0-9/\.-]+%s.zip)' % platform).match
|
||||
support.log('URL:', url)
|
||||
if url:
|
||||
downloadtools.downloadfile(host + url, filename)
|
||||
extract()
|
||||
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70782)):
|
||||
pform = get_platform()
|
||||
url = support.match(elementum_url, patronBlock=r'<div class="release-entry">(.*?)<!-- /.release-body -->', patron=r'<a href="([a-zA-Z0-9/\.-]+%s.zip)' % pform).match
|
||||
support.log('OS:', pform)
|
||||
support.log('Extract IN:', elementum_path)
|
||||
support.log('URL:', url)
|
||||
if url:
|
||||
downloadtools.downloadfile(host + url, filename)
|
||||
extract()
|
||||
xbmc.sleep(1000)
|
||||
setting()
|
||||
|
||||
|
||||
def extract():
|
||||
import zipfile
|
||||
support.log('Estraggo Quasar in:', quasar_path)
|
||||
support.log('Estraggo Elementum in:', elementum_path)
|
||||
with zipfile.ZipFile(filename, 'r') as zip_ref:
|
||||
zip_ref.extractall(xbmc.translatePath("special://home/addons/"))
|
||||
zip_ref.extractall(xbmc.translatePath(addon_path))
|
||||
|
||||
|
||||
def setting():
|
||||
# support.dbg()
|
||||
xbmc.executebuiltin('UpdateLocalAddons')
|
||||
if platformtools.dialog_ok('Quasar', config.get_localized_string(70783)):
|
||||
if filetools.exists(filename):
|
||||
filetools.remove(filename)
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "plugin.video.quasar", "enabled": true }}')
|
||||
updater.refreshLang()
|
||||
xbmcaddon.Addon(id="plugin.video.quasar").setSetting('download_path', config.get_setting('downloadpath'))
|
||||
xbmc.executebuiltin('UpdateLocalAddons')
|
||||
sleep(2)
|
||||
xbmc.sleep(1000)
|
||||
if filetools.isfile(elementum_setting_file):
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "plugin.video.elementum", "enabled": true }}')
|
||||
Continue = True
|
||||
while Continue:
|
||||
try:
|
||||
__settings__ = xbmcaddon.Addon(id="plugin.video.elementum")
|
||||
__settings__.setSetting('skip_burst_search', 'true')
|
||||
__settings__.setSetting('greeting_enabled', 'false')
|
||||
__settings__.setSetting('do_not_disturb', 'true')
|
||||
Continue = False
|
||||
except:
|
||||
support.log('RIPROVO')
|
||||
xbmc.sleep(100)
|
||||
else:
|
||||
if not filetools.exists(elementum_path):
|
||||
filetools.mkdir(elementum_path)
|
||||
filetools.copy(kod_setting_file, elementum_setting_file)
|
||||
xbmc.sleep(1000)
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "plugin.video.elementum", "enabled": true }}')
|
||||
|
||||
|
||||
updater.refreshLang()
|
||||
|
||||
if filetools.exists(filename):
|
||||
filetools.remove(filename)
|
||||
|
||||
|
||||
def get_platform():
|
||||
@@ -64,8 +89,7 @@ def get_platform():
|
||||
if "arm" in platform.machine() or "aarch" in platform.machine():
|
||||
ret["arch"] = "arm"
|
||||
if "64" in platform.machine() and ret["auto_arch"] == "64-bit":
|
||||
ret["arch"] = "arm"
|
||||
#ret["arch"] = "x64" #The binary is corrupted in install package
|
||||
ret["arch"] = "arm64"
|
||||
elif xbmc.getCondVisibility("system.platform.linux"):
|
||||
ret["os"] = "linux"
|
||||
if "aarch" in platform.machine() or "arm64" in platform.machine():
|
||||
+2
-1
@@ -156,6 +156,7 @@ def new_search(item):
|
||||
thumbnail=thumbnail,
|
||||
fanart=fanart,
|
||||
mode=item.mode,
|
||||
contentType=item.mode,
|
||||
infoLabels=result)
|
||||
|
||||
if item.mode == 'movie':
|
||||
@@ -629,7 +630,7 @@ def discover_list(item):
|
||||
new_item = Item(channel='search', title=typo(title, 'bold'), infoLabels=elem,
|
||||
action='channel_search', text=title,
|
||||
thumbnail=thumbnail, fanart=fanart,
|
||||
context='', mode=mode,
|
||||
context='', mode=mode, contentType=mode,
|
||||
release_date=year)
|
||||
|
||||
if tvshow:
|
||||
|
||||
+122
-86
@@ -363,7 +363,7 @@ def get_seasons(item):
|
||||
# Creamos un item por cada temporada
|
||||
for season, title in list(dict_temp.items()):
|
||||
new_item = item.clone(action="get_episodes", title=title, contentSeason=season,
|
||||
filtrar_season=True)
|
||||
filtrar_season=True, channel='videolibrary')
|
||||
|
||||
# Menu contextual: Marcar la temporada como vista o no
|
||||
visto = item_nfo.library_playcounts.get("season %s" % season, 0)
|
||||
@@ -407,7 +407,7 @@ def get_episodes(item):
|
||||
|
||||
# Crear un item en la lista para cada strm encontrado
|
||||
for i in ficheros:
|
||||
if i.split('.')[-1] not in ['json','nfo']: #i.endswith('.strm'):
|
||||
if i.split('.')[-1] not in ['json','nfo']: #i.endswith('.strm'):
|
||||
season_episode = scrapertools.get_season_and_episode(i)
|
||||
if not season_episode:
|
||||
# El fichero no incluye el numero de temporada y episodio
|
||||
@@ -419,38 +419,39 @@ def get_episodes(item):
|
||||
|
||||
# Obtener los datos del season_episode.nfo
|
||||
nfo_path = filetools.join(raiz, '%sx%s.nfo' % (season, episode))#.replace('.strm', '.nfo')
|
||||
head_nfo, epi = videolibrarytools.read_nfo(nfo_path)
|
||||
if filetools.isfile(nfo_path):
|
||||
head_nfo, epi = videolibrarytools.read_nfo(nfo_path)
|
||||
|
||||
# Fijar el titulo del capitulo si es posible
|
||||
if epi.contentTitle:
|
||||
title_episodie = epi.contentTitle.strip()
|
||||
else:
|
||||
title_episodie = config.get_localized_string(60031) % \
|
||||
(epi.contentSeason, str(epi.contentEpisodeNumber).zfill(2))
|
||||
# Fijar el titulo del capitulo si es posible
|
||||
if epi.contentTitle:
|
||||
title_episodie = epi.contentTitle.strip()
|
||||
else:
|
||||
title_episodie = config.get_localized_string(60031) % \
|
||||
(epi.contentSeason, str(epi.contentEpisodeNumber).zfill(2))
|
||||
|
||||
epi.contentTitle = "%sx%s" % (epi.contentSeason, str(epi.contentEpisodeNumber).zfill(2))
|
||||
epi.title = "%sx%s - %s" % (epi.contentSeason, str(epi.contentEpisodeNumber).zfill(2), title_episodie)
|
||||
epi.contentTitle = "%sx%s" % (epi.contentSeason, str(epi.contentEpisodeNumber).zfill(2))
|
||||
epi.title = "%sx%s - %s" % (epi.contentSeason, str(epi.contentEpisodeNumber).zfill(2), title_episodie)
|
||||
|
||||
if item_nfo.library_filter_show:
|
||||
epi.library_filter_show = item_nfo.library_filter_show
|
||||
if item_nfo.library_filter_show:
|
||||
epi.library_filter_show = item_nfo.library_filter_show
|
||||
|
||||
# Menu contextual: Marcar episodio como visto o no
|
||||
visto = item_nfo.library_playcounts.get(season_episode, 0)
|
||||
epi.infoLabels["playcount"] = visto
|
||||
if visto > 0:
|
||||
texto = config.get_localized_string(60032)
|
||||
value = 0
|
||||
else:
|
||||
texto = config.get_localized_string(60033)
|
||||
value = 1
|
||||
epi.context = [{"title": texto,
|
||||
"action": "mark_content_as_watched",
|
||||
"channel": "videolibrary",
|
||||
"playcount": value,
|
||||
"nfo": item.nfo}]
|
||||
# Menu contextual: Marcar episodio como visto o no
|
||||
visto = item_nfo.library_playcounts.get(season_episode, 0)
|
||||
epi.infoLabels["playcount"] = visto
|
||||
if visto > 0:
|
||||
texto = config.get_localized_string(60032)
|
||||
value = 0
|
||||
else:
|
||||
texto = config.get_localized_string(60033)
|
||||
value = 1
|
||||
epi.context = [{"title": texto,
|
||||
"action": "mark_content_as_watched",
|
||||
"channel": "videolibrary",
|
||||
"playcount": value,
|
||||
"nfo": item.nfo}]
|
||||
|
||||
# logger.debug("epi:\n" + epi.tostring('\n'))
|
||||
itemlist.append(epi)
|
||||
# logger.debug("epi:\n" + epi.tostring('\n'))
|
||||
itemlist.append(epi)
|
||||
|
||||
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
|
||||
add_download_items(item, itemlist)
|
||||
@@ -754,7 +755,7 @@ def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_
|
||||
xbmc.sleep(1000)
|
||||
progress.close()
|
||||
if notify:
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80014), icon=0, time=5000, sound=False)
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80014), time=5000, sound=False)
|
||||
|
||||
|
||||
def delete_videolibrary(item):
|
||||
@@ -772,14 +773,16 @@ def delete_videolibrary(item):
|
||||
p_dialog.update(80)
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.clean(config.get_setting('videolibrarypath'))
|
||||
strm_list = []
|
||||
strm_list.append(config.get_setting('videolibrarypath'))
|
||||
xbmc_videolibrary.clean(strm_list)
|
||||
|
||||
p_dialog.update(90)
|
||||
config.verify_directories_created()
|
||||
p_dialog.update(100)
|
||||
xbmc.sleep(1000)
|
||||
p_dialog.close()
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80039), icon=0, time=5000, sound=False)
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80039), time=5000, sound=False)
|
||||
|
||||
|
||||
# metodos de menu contextual
|
||||
@@ -1024,12 +1027,22 @@ def delete(item):
|
||||
raiz, carpeta_serie, ficheros = next(filetools.walk(_item.path))
|
||||
if ficheros == []:
|
||||
filetools.rmdir(_item.path)
|
||||
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)
|
||||
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.clean(_item.extra)
|
||||
strm_list = []
|
||||
strm_list.append(_item.extra)
|
||||
xbmc_videolibrary.clean(strm_list)
|
||||
|
||||
logger.info("All links removed")
|
||||
xbmc.sleep(1000)
|
||||
platformtools.itemlist_refresh()
|
||||
|
||||
# logger.info(item.contentTitle)
|
||||
@@ -1042,46 +1055,68 @@ def delete(item):
|
||||
if item.multicanal:
|
||||
# Obtener listado de canales
|
||||
if item.dead == '':
|
||||
opciones = [config.get_localized_string(70086) % k.capitalize() for k in list(item.library_urls.keys()) if
|
||||
k != "downloads"]
|
||||
opciones = []
|
||||
channels = []
|
||||
for k in list(item.library_urls.keys()):
|
||||
if k != "downloads":
|
||||
opciones.append(config.get_localized_string(70086) % k.capitalize())
|
||||
channels.append(k)
|
||||
opciones.insert(0, heading)
|
||||
|
||||
index = platformtools.dialog_select(config.get_localized_string(30163), opciones)
|
||||
|
||||
if index == 0:
|
||||
# Seleccionado Eliminar pelicula/serie
|
||||
canal = None
|
||||
delete_all(item)
|
||||
|
||||
elif index > 0:
|
||||
# Seleccionado Eliminar canal X
|
||||
canal = opciones[index].replace(config.get_localized_string(70079), "").lower()
|
||||
channels.remove(canal)
|
||||
else:
|
||||
return
|
||||
else:
|
||||
canal = item.dead
|
||||
|
||||
num_enlaces = 0
|
||||
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
|
||||
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'))
|
||||
|
||||
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 config.is_xbmc() and config.get_setting("videolibrary_kodi") and strm_list:
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.clean(strm_list)
|
||||
|
||||
msg_txt = config.get_localized_string(70087) % (num_enlaces, canal)
|
||||
logger.info(msg_txt)
|
||||
platformtools.dialog_notification(heading, msg_txt)
|
||||
platformtools.itemlist_refresh()
|
||||
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()
|
||||
|
||||
else:
|
||||
if platformtools.dialog_yesno(heading,
|
||||
config.get_localized_string(70088) % item.infoLabels['title']):
|
||||
if platformtools.dialog_yesno(heading, config.get_localized_string(70088) % item.infoLabels['title']):
|
||||
delete_all(item)
|
||||
|
||||
|
||||
@@ -1133,37 +1168,38 @@ def check_tvshow_playcount(item, season):
|
||||
|
||||
|
||||
def add_download_items(item, itemlist):
|
||||
localOnly = True
|
||||
for i in itemlist:
|
||||
if i.contentChannel != 'local':
|
||||
localOnly = False
|
||||
break
|
||||
if not item.fromLibrary and not localOnly:
|
||||
downloadItem = Item(channel='downloads',
|
||||
from_channel=item.channel,
|
||||
title=typo(config.get_localized_string(60355), "color kod bold"),
|
||||
fulltitle=item.fulltitle,
|
||||
show=item.fulltitle,
|
||||
contentType=item.contentType,
|
||||
contentSerieName=item.contentSerieName,
|
||||
url=item.url,
|
||||
action='save_download',
|
||||
from_action="findvideos",
|
||||
contentTitle=item.contentTitle,
|
||||
path=item.path,
|
||||
thumbnail=thumb(thumb='downloads.png'),
|
||||
parent=item.tourl())
|
||||
if item.action == 'findvideos':
|
||||
if item.contentType == 'episode':
|
||||
downloadItem.title = typo(config.get_localized_string(60356), "color kod bold")
|
||||
else: # film
|
||||
downloadItem.title = typo(config.get_localized_string(60354), "color kod bold")
|
||||
downloadItem.downloadItemlist = [i.tourl() for i in itemlist]
|
||||
itemlist.append(downloadItem)
|
||||
else:
|
||||
if item.contentSeason: # season
|
||||
downloadItem.title = typo(config.get_localized_string(60357), "color kod bold")
|
||||
if config.get_setting('downloadenabled'):
|
||||
localOnly = True
|
||||
for i in itemlist:
|
||||
if i.contentChannel != 'local':
|
||||
localOnly = False
|
||||
break
|
||||
if not item.fromLibrary and not localOnly:
|
||||
downloadItem = Item(channel='downloads',
|
||||
from_channel=item.channel,
|
||||
title=typo(config.get_localized_string(60355), "color kod bold"),
|
||||
fulltitle=item.fulltitle,
|
||||
show=item.fulltitle,
|
||||
contentType=item.contentType,
|
||||
contentSerieName=item.contentSerieName,
|
||||
url=item.url,
|
||||
action='save_download',
|
||||
from_action="findvideos",
|
||||
contentTitle=item.contentTitle,
|
||||
path=item.path,
|
||||
thumbnail=thumb(thumb='downloads.png'),
|
||||
parent=item.tourl())
|
||||
if item.action == 'findvideos':
|
||||
if item.contentType == 'episode':
|
||||
downloadItem.title = typo(config.get_localized_string(60356), "color kod bold")
|
||||
else: # film
|
||||
downloadItem.title = typo(config.get_localized_string(60354), "color kod bold")
|
||||
downloadItem.downloadItemlist = [i.tourl() for i in itemlist]
|
||||
itemlist.append(downloadItem)
|
||||
else: # tvshow + not seen
|
||||
itemlist.append(downloadItem)
|
||||
itemlist.append(downloadItem.clone(title=typo(config.get_localized_string(60003), "color kod bold"), unseen=True))
|
||||
else:
|
||||
if item.contentSeason: # season
|
||||
downloadItem.title = typo(config.get_localized_string(60357), "color kod bold")
|
||||
itemlist.append(downloadItem)
|
||||
else: # tvshow + not seen
|
||||
itemlist.append(downloadItem)
|
||||
itemlist.append(downloadItem.clone(title=typo(config.get_localized_string(60003), "color kod bold"), unseen=True))
|
||||
Reference in New Issue
Block a user