riscritto logger

This commit is contained in:
marco
2020-09-19 16:32:37 +02:00
parent d37050b85e
commit 0b605cf215
218 changed files with 1425 additions and 1511 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ def start(itemlist, item):
if item.global_search:
return itemlist
logger.log()
logger.info()
global PLAYED
PLAYED = False
@@ -274,7 +274,7 @@ def start(itemlist, item):
def play_multi_channel(item, itemlist):
logger.log()
logger.info()
start(itemlist, item)
+13 -13
View File
@@ -33,7 +33,7 @@ except:
xbmcgui = None
import re, base64, json, inspect
from core import jsontools, tvdb, scrapertools, filetools
from core.support import typo, log
from core.support import typo, info
from platformcode import config, platformtools
TAG_TVSHOW_RENUMERATE = "TVSHOW_AUTORENUMBER"
@@ -49,7 +49,7 @@ TAG_TYPE = "Type"
def renumber(itemlist, item='', typography=''):
log()
info()
dict_series = load(itemlist[0]) if len(itemlist) > 0 else {}
if item:
@@ -103,7 +103,7 @@ def renumber(itemlist, item='', typography=''):
def config_item(item, itemlist=[], typography='', active=False):
log()
info()
# Configurazione Automatica, Tenta la numerazione Automatica degli episodi
title = item.fulltitle.rstrip()
@@ -140,7 +140,7 @@ def config_item(item, itemlist=[], typography='', active=False):
def semiautomatic_config_item(item):
log()
info()
# Configurazione Semi Automatica, utile in caso la numerazione automatica fallisca
tvdb.find_and_set_infoLabels(item)
@@ -254,7 +254,7 @@ def renumeration (itemlist, item, typography, dict_series, ID, Season, Episode,
def manual_renumeration(item, modify=False):
log()
info()
_list = []
if item.from_channel: item.channel = item.from_channel
title = item.fulltitle.rstrip()
@@ -342,7 +342,7 @@ def manual_renumeration(item, modify=False):
def delete_renumeration(item):
log()
info()
if item.from_channel: item.channel = item.from_channel
title = item.fulltitle.rstrip()
@@ -352,7 +352,7 @@ def delete_renumeration(item):
def make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, title):
log()
info()
exist = True
item.infoLabels['tvdb_id'] = ID
tvdb.set_infoLabels_item(item)
@@ -478,7 +478,7 @@ def make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode
def check(item):
log()
info()
dict_series = load(item)
title = item.fulltitle.rstrip()
if title in dict_series: title = dict_series[title]
@@ -493,7 +493,7 @@ def error(itemlist):
def find_episodes(item):
log()
info()
ch = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
itemlist = ch.episodios(item)
return itemlist
@@ -501,7 +501,7 @@ def find_episodes(item):
def RepresentsInt(s):
# Controllo Numro Stagione
log()
info()
try:
int(s)
return True
@@ -537,7 +537,7 @@ def select_type(item):
def filename(item):
log()
info()
name_file = item.channel + "_data.json"
path = filetools.join(config.get_data_path(), "settings_channels")
fname = filetools.join(path, name_file)
@@ -546,7 +546,7 @@ def filename(item):
def load(item):
log()
info()
try:
json_file = open(filename(item), "r").read()
json = jsontools.load(json_file)[TAG_TVSHOW_RENUMERATE]
@@ -558,7 +558,7 @@ def load(item):
def write(item, json):
log()
info()
json_file = open(filename(item), "r").read()
js = jsontools.load(json_file)
js[TAG_TVSHOW_RENUMERATE] = json
+2 -2
View File
@@ -18,7 +18,7 @@ videolibrary_tvshows_path = u'' + videolibrarytools.TVSHOWS_PATH
def export_videolibrary(item):
logger.log()
logger.info()
zip_file_folder = platformtools.dialog_browse(3, config.get_localized_string(80002))
if zip_file_folder == "":
@@ -51,7 +51,7 @@ def export_videolibrary(item):
def import_videolibrary(item):
logger.log()
logger.info()
zip_file = u'' + platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip")
if zip_file == "":
+5 -5
View File
@@ -37,7 +37,7 @@ class Kdicc():
self.view_msg = view_msg
self.lst_site_check_dns = lst_site_check_dns
self.urls = []
#logger.log("check #### INIZIO INIT#### ")
#logger.info("check #### INIZIO INIT#### ")
def check_Ip(self):
"""
@@ -248,7 +248,7 @@ def check_channels(inutile=''):
This is because it can happen that at any time the connection may have problems. If it does, check it
relative writing of the file is interrupted with a warning message
"""
logger.log()
logger.info()
folderJson = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8')
fileJson = 'channels.json'
@@ -264,7 +264,7 @@ def check_channels(inutile=''):
# to get an idea of the timing
# useful only if you control all channels
# for channels with error 522 about 40 seconds are lost ...
logger.log("check #### INIZIO #### channel - host :%s - %s " % (chann, host))
logger.info("check #### INIZIO #### channel - host :%s - %s " % (chann, host))
rslt = Kdicc(lst_urls = [host]).http_Resp()
@@ -288,10 +288,10 @@ def check_channels(inutile=''):
# risultato[chann] = 'Errore Sconosciuto - '+str(rslt['code']) +' - '+ host
risultato[chann] = host
logger.log("check #### FINE #### rslt :%s " % (rslt))
logger.info("check #### FINE #### rslt :%s " % (rslt))
fileJson_test = 'channels-test.json'
# I write the updated file
with open(folderJson+'/'+fileJson_test, 'w') as f:
data = json.dump(risultato, f, sort_keys=True, indent=4)
logger.log(data)
logger.info(data)
+22 -22
View File
@@ -26,7 +26,7 @@ list_quality = ['SD', '720', '1080', '4k']
tmdb_api = 'a1ab8b8669da03637a4b98fa39c39228'
def mainlist(item):
support.log()
support.info()
path = filetools.join(config.get_data_path(), 'community_channels.json')
if not filetools.exists(path):
@@ -38,7 +38,7 @@ def mainlist(item):
def show_channels(item):
support.log()
support.info()
itemlist = []
# add context menu
@@ -78,7 +78,7 @@ def show_channels(item):
def show_menu(item):
support.log()
support.info()
itemlist = []
@@ -114,12 +114,12 @@ def show_menu(item):
if 'channel_name' in json and not 'disable_search' in json and 'search' not in json:
itemlist += get_search_menu(item, json, channel_name=json['channel_name'])
support.log('PAGINATION:', disable_pagination)
support.info('PAGINATION:', disable_pagination)
return itemlist
def search(item, text):
support.log(text)
support.info(text)
itemlist = []
if item.custom_search:
@@ -164,7 +164,7 @@ def global_search(item, text):
def peliculas(item, json='', key='', itemlist=[]):
item.plot = item.thumb = item.fanart =''
support.log('PAGINATION:', item.disable_pagination)
support.info('PAGINATION:', item.disable_pagination)
if not json:
key = item.key
json = load_json(item)[key]
@@ -233,7 +233,7 @@ def peliculas(item, json='', key='', itemlist=[]):
def get_seasons(item):
support.log()
support.info()
itemlist = []
infoLabels = item.infoLabels
json = item.url if type(item.url) == dict else item.url
@@ -273,7 +273,7 @@ def get_seasons(item):
def episodios(item, json ='', key='', itemlist =[]):
support.log()
support.info()
infoLabels = item.infoLabels
itm=item
@@ -384,7 +384,7 @@ def episodios(item, json ='', key='', itemlist =[]):
# Find Servers
def findvideos(item):
support.log()
support.info()
itemlist = []
if 'links' in item.url:
json = item.url['links']
@@ -404,7 +404,7 @@ def findvideos(item):
################################ Menu ################################
def get_menu(item, json, key, itemlist=[]):
support.log()
support.info()
json = json[key]
for option in json:
title = option['title'] if 'title' in option else json[option] if 'search' not in option else ''
@@ -439,7 +439,7 @@ def get_menu(item, json, key, itemlist=[]):
def get_sub_menu(item, json, key, itemlist=[]):
support.log()
support.info()
json = json[key]
search = False
if item.menu:
@@ -478,7 +478,7 @@ def get_sub_menu(item, json, key, itemlist=[]):
def get_search_menu(item, json='', itemlist=[], channel_name=''):
support.log()
support.info()
if 'title' in json:
title = json['title']
elif channel_name:
@@ -504,7 +504,7 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''):
def submenu(item, json, key, itemlist = [], filter_list = []):
support.log(item)
support.info(item)
import sys
if sys.version_info[0] >= 3:
from concurrent import futures
@@ -575,7 +575,7 @@ def filter_thread(filter, key, item, description):
if id:
thumbnail = 'http://image.tmdb.org/t/p/original' + results['profile_path'] if results['profile_path'] else item.thumbnail
json_file = httptools.downloadpage('http://api.themoviedb.org/3/person/'+ str(id) + '?api_key=' + tmdb_api + '&language=en', use_requests=True).data
support.log(json_file)
support.info(json_file)
plot += jsontools.load(json_file)['biography']
if description:
@@ -609,7 +609,7 @@ def filter_thread(filter, key, item, description):
# for load json from item or url
def load_json(item, no_order=False):
support.log()
support.info()
if type(item) == Item:
url = item.url
filterkey = item.filterkey
@@ -634,7 +634,7 @@ def load_json(item, no_order=False):
# Load Channels json and check that the paths and channel titles are correct
def load_and_check(item):
support.log()
support.info()
path = filetools.join(config.get_data_path(), 'community_channels.json')
file = open(path, "r")
json = jsontools.load(file.read())
@@ -655,7 +655,7 @@ def load_and_check(item):
# set extra values
def set_extra_values(item, json, path):
support.log()
support.info()
ret = Item()
for key in json:
if key == 'quality':
@@ -701,7 +701,7 @@ def set_extra_values(item, json, path):
# format titles
def set_title(title, language='', quality=''):
support.log()
support.info()
t = support.match(title, patron=r'\{([^\}]+)\}').match
if 'bold' not in t: t += ' bold'
@@ -722,7 +722,7 @@ def set_title(title, language='', quality=''):
# for relative path
def relative(key, json, path):
support.log()
support.info()
ret = ''
if key in json:
if key in ['thumbnail', 'poster']:
@@ -734,7 +734,7 @@ def relative(key, json, path):
def pagination(item, itemlist = []):
support.log()
support.info()
import json
itlist = []
@@ -775,7 +775,7 @@ def pagination(item, itemlist = []):
return itlist
def add_channel(item):
support.log()
support.info()
channel_to_add = {}
json_file = ''
result = platformtools.dialog_select(config.get_localized_string(70676), [config.get_localized_string(70678), config.get_localized_string(70679)])
@@ -828,7 +828,7 @@ def add_channel(item):
return
def remove_channel(item):
support.log()
support.info()
path = filetools.join(config.get_data_path(), 'community_channels.json')
+34 -34
View File
@@ -18,7 +18,7 @@ from core import filetools, jsontools, scraper, scrapertools, servertools, video
from core.downloader import Downloader
from core.item import Item
from platformcode import config, logger, platformtools
from core.support import log, dbg, typo
from core.support import info, dbg, typo
from servers import torrent
kb = '0xFF65B3DA'
@@ -40,7 +40,7 @@ extensions_list = ['.aaf', '.3gp', '.asf', '.avi', '.flv', '.mpeg', '.m1v', '.m2
def mainlist(item):
log()
info()
itemlist = []
# File list
@@ -143,7 +143,7 @@ def settings(item):
def browser(item):
log()
info()
itemlist = []
for file in filetools.listdir(item.url):
@@ -177,7 +177,7 @@ def del_dir(item):
def clean_all(item):
log()
info()
stop_all()
removeFiles = False
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(30300)):
@@ -203,7 +203,7 @@ def reload(item):
def stop_all(item=None):
log()
info()
for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)):
if fichero.endswith(".json"):
@@ -221,7 +221,7 @@ def stop_all(item=None):
def clean_ready(item):
log()
info()
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)))
@@ -233,7 +233,7 @@ def clean_ready(item):
def restart_error(item):
log()
info()
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)))
@@ -272,7 +272,7 @@ def download_all_background(item):
def menu(item):
log(item)
info(item)
if item.downloadServer:
servidor = item.downloadServer.get("server", "Auto")
else:
@@ -312,7 +312,7 @@ def menu(item):
# Show Dialog
seleccion = platformtools.dialog_select(config.get_localized_string(30163), opciones)
logger.log('SELECTION: '+ op[seleccion])
logger.info('SELECTION: '+ op[seleccion])
# -1 is cancel
if seleccion == -1: return
@@ -368,7 +368,7 @@ def menu(item):
def move_to_libray(item):
log()
info()
if item.contentType == 'movie':
FOLDER = FOLDER_MOVIES
@@ -422,7 +422,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)
log('Delete File:', str(file_path))
info('Delete File:', str(file_path))
filetools.remove(file_path)
if file_path.endswith('.strm'):
file_strm_path = file_path
@@ -578,7 +578,7 @@ def sort_method(item):
def download_from_url(url, item):
log("Attempting to download:", url)
info("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)
@@ -607,22 +607,22 @@ def download_from_url(url, item):
update_json(item.path, {"downloadUrl": d.download_url, "downloadStatus": STATUS_CODES.downloading, "downloadSize": d.size[0],
"downloadProgress": d.progress, "downloadCompleted": d.downloaded[0], "downloadFilename": file})
d.start_dialog(config.get_localized_string(60332))
d.start_diainfo(config.get_localized_string(60332))
# Download stopped. We get the state:
# Download failed
if d.state == d.states.error:
log("Error trying to download", url)
info("Error trying to download", url)
status = STATUS_CODES.error
# Download has stopped
elif d.state == d.states.stopped:
log("Stop download")
info("Stop download")
status = STATUS_CODES.canceled
# Download is complete
elif d.state == d.states.completed:
log("Downloaded correctly")
info("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)
@@ -638,7 +638,7 @@ def download_from_url(url, item):
def download_from_server(item):
log(item.tostring())
info(item.tostring())
unsupported_servers = ["torrent"]
if item.contentChannel == 'local':
@@ -668,11 +668,11 @@ def download_from_server(item):
item.video_urls = itemlist
if not item.server: item.server = "directo"
else:
log("There is nothing to reproduce")
info("There is nothing to reproduce")
return {"downloadStatus": STATUS_CODES.error}
finally:
progreso.close()
log("contentAction: %s | contentChannel: %s | server: %s | url: %s" % (item.contentAction, item.contentChannel, item.server, item.url))
info("contentAction: %s | contentChannel: %s | server: %s | url: %s" % (item.contentAction, item.contentChannel, item.server, item.url))
if item.server == 'torrent':
import xbmcgui
@@ -692,11 +692,11 @@ def download_from_server(item):
# If it is not available, we go out
if not puedes:
log("The video is NOT available")
info("The video is NOT available")
return {"downloadStatus": STATUS_CODES.error}
else:
log("YES Video is available")
info("YES Video is available")
result = {}
@@ -717,14 +717,14 @@ def download_from_server(item):
def download_from_best_server(item):
log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
info("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:
log('using cached servers')
info('using cached servers')
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
else:
if item.contentChannel in ['community', 'videolibrary']:
@@ -773,11 +773,11 @@ def download_from_best_server(item):
def select_server(item):
if item.server:
return "Auto"
log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
info("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:
log('using cached servers')
info('using cached servers')
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
else:
if item.contentChannel in ['community', 'videolibrary']:
@@ -819,7 +819,7 @@ def select_server(item):
def start_download(item):
log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
info("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)
@@ -839,7 +839,7 @@ def start_download(item):
def get_episodes(item):
log("contentAction: %s | contentChannel: %s | contentType: %s" % (item.contentAction, item.contentChannel, item.contentType))
info("contentAction: %s | contentChannel: %s | contentType: %s" % (item.contentAction, item.contentChannel, item.contentType))
if 'dlseason' in item:
season = True
@@ -916,7 +916,7 @@ def get_episodes(item):
# Any other result is not worth it, we ignore it
else:
log("Omitiendo item no válido:", episode.tostring())
info("Omitiendo item no válido:", episode.tostring())
# Any other result is not worth it, we ignore it...
itemlist = videolibrarytools.filter_list(itemlist)
@@ -925,7 +925,7 @@ def get_episodes(item):
def write_json(item):
log()
info()
channel = item.from_channel if item.from_channel else item.channel
item.action = "menu"
@@ -970,7 +970,7 @@ def save_download(item):
def save_download_background(item):
log()
info()
# Menu contextual
if item.from_action and item.from_channel:
item.channel = item.from_channel
@@ -1019,7 +1019,7 @@ def save_download_background(item):
def save_download_videolibrary(item):
log()
info()
show_disclaimer()
item.contentChannel = 'videolibrary'
item.channel = "downloads"
@@ -1028,7 +1028,7 @@ def save_download_videolibrary(item):
def save_download_video(item):
log("contentAction: %s | contentChannel: %s | contentTitle: %s" % (item.contentAction, item.contentChannel, item.contentTitle))
info("contentAction: %s | contentChannel: %s | contentTitle: %s" % (item.contentAction, item.contentChannel, item.contentTitle))
set_movie_title(item)
@@ -1043,7 +1043,7 @@ def save_download_video(item):
def save_download_movie(item):
log("contentAction: %s | contentChannel: %s | contentTitle: %s" % ( item.contentAction, item.contentChannel, item.contentTitle))
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))
@@ -1077,7 +1077,7 @@ def save_download_movie(item):
def save_download_tvshow(item):
log("contentAction: %s | contentChannel: %s | contentType: %s | contentSerieName: %s" % (item.contentAction, item.contentChannel, item.contentType, item.contentSerieName))
info("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:
item.show = item.fulltitle
+9 -9
View File
@@ -25,9 +25,9 @@ def download(item=None):
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)
support.info('OS:', pform)
support.info('Extract IN:', elementum_path)
support.info('URL:', url)
if url:
downloadtools.downloadfile(host + url, filename)
extract()
@@ -38,19 +38,19 @@ def download(item=None):
def extract():
import zipfile
from platformcode.updater import fixZipGetHash
support.log('Estraggo Elementum in:', elementum_path)
support.info('Estraggo Elementum in:', elementum_path)
try:
hash = fixZipGetHash(filename)
support.log(hash)
support.info(hash)
with zipfile.ZipFile(filetools.file_open(filename, 'rb', vfs=False)) as zip_ref:
zip_ref.extractall(xbmc.translatePath(addon_path))
except Exception as e:
support.log('Non sono riuscito ad estrarre il file zip')
support.logger.error(e)
support.info('Non sono riuscito ad estrarre il file zip')
support.infoger.error(e)
import traceback
support.logger.error(traceback.print_exc())
support.infoger.error(traceback.print_exc())
def setting():
@@ -68,7 +68,7 @@ def setting():
__settings__.setSetting('do_not_disturb', 'true')
Continue = False
except:
support.log('RIPROVO')
support.info('RIPROVO')
xbmc.sleep(100)
else:
if not filetools.exists(elementum_path):
+6 -6
View File
@@ -24,7 +24,7 @@ except:
def mainlist(item):
logger.log()
logger.info()
itemlist = []
for name, thumb, data in read_favourites():
@@ -81,7 +81,7 @@ def save_favourites(favourites_list):
def addFavourite(item):
logger.log()
logger.info()
# logger.debug(item.tostring('\n'))
# If you get here through the context menu, you must retrieve the action and channel parameters
@@ -100,7 +100,7 @@ def addFavourite(item):
def delFavourite(item):
logger.log()
logger.info()
# logger.debug(item.tostring('\n'))
if item.from_title:
@@ -118,7 +118,7 @@ def delFavourite(item):
def renameFavourite(item):
logger.log()
logger.info()
# logger.debug(item.tostring('\n'))
# Find the item we want to rename in favorites.xml
@@ -137,7 +137,7 @@ def renameFavourite(item):
##################################################
# Features to migrate old favorites (.txt)
def readbookmark(filepath):
logger.log()
logger.info()
import urllib
bookmarkfile = filetools.file_open(filepath)
@@ -230,6 +230,6 @@ try:
if config.get_setting("bookmarkpath") != "":
check_bookmark(config.get_setting("bookmarkpath"))
else:
logger.log("No path to old version favorites")
logger.info("No path to old version favorites")
except:
pass
+4 -4
View File
@@ -15,7 +15,7 @@ blacklisted_genres = ['attualita', 'scienza', 'religione', 'cucina', 'notiziario
def mainlist(item):
support.log()
support.info()
itemlist = [Item(title=support.typo('Film in onda oggi', 'bold'), channel=item.channel, action='category', contentType='movie', thumbnail=support.thumb('movie')),
Item(title=support.typo('Serie Tv in onda oggi', 'bold'), channel=item.channel, action='peliculas', contentType='tvshow', thumbnail=support.thumb('tvshow')),
@@ -31,13 +31,13 @@ def getEpg():
archiveName = fileName + '.gz'
xmlName = fileName + '.xml'
if not filetools.exists(xmlName):
support.log('downloading epg')
support.info('downloading epg')
# cancello quelli vecchi
for f in glob.glob(support.config.get_temp_file('guidatv-') + '*'):
filetools.remove(f, silent=True)
# inmemory = io.BytesIO(httptools.downloadpage(host).data)
downloadtools.downloadfile(host, archiveName)
support.log('opening gzip and writing xml')
support.info('opening gzip and writing xml')
with gzip.GzipFile(fileobj=filetools.file_open(archiveName, mode='rb', vfs=False)) as f:
guide = f.read().decode('utf-8')
guide = guide.replace('\n', ' ').replace('><', '>\n<')
@@ -194,7 +194,7 @@ def listaCanali(item):
thumbnail = None
skip = False
# return itemlist
# logger.log([i.title for i in itemlist])
# logger.info([i.title for i in itemlist])
f.close()
return sorted(itemlist, key=lambda x: x.title)
+13 -13
View File
@@ -234,7 +234,7 @@ def get_link(list_item, item, list_language, list_quality=None, global_filter_la
@return: Item list
@rtype: list[Item]
"""
logger.log()
logger.info()
# if the required fields are None we leave
if list_item is None or item is None:
@@ -274,7 +274,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
@return: lista de Item
@rtype: list[Item]
"""
logger.log()
logger.info()
# if the required fields are None we leave
@@ -362,7 +362,7 @@ def no_filter(item):
@return: lista de enlaces
@rtype: list[Item]
"""
logger.log()
logger.info()
itemlist = []
for i in item.list_item_all:
@@ -384,7 +384,7 @@ def mainlist(channel, list_language, list_quality):
@return: Item list
@rtype: list[Item]
"""
logger.log()
logger.info()
itemlist = []
dict_series = jsontools.get_node_from_file(channel, TAG_TVSHOW_FILTER)
@@ -425,8 +425,8 @@ def config_item(item):
@param item: item
@type item: Item
"""
logger.log()
logger.log("item %s" % item.tostring())
logger.info()
logger.info("item %s" % item.tostring())
# WE GET THE JSON DATA
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
@@ -448,8 +448,8 @@ def config_item(item):
else:
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, default_lang)
list_quality = dict_series.get(tvshow, {}).get(TAG_QUALITY_ALLOWED, [x.lower() for x in item.list_quality])
# logger.log("lang selected {}".format(lang_selected))
# logger.log("list quality {}".format(list_quality))
# logger.info("lang selected {}".format(lang_selected))
# logger.info("list quality {}".format(list_quality))
active = True
custom_button = {'visible': False}
@@ -516,7 +516,7 @@ def config_item(item):
def delete(item, dict_values):
logger.log()
logger.info()
if item:
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
@@ -554,7 +554,7 @@ def save(item, dict_data_saved):
@param dict_data_saved: dictionary with saved data
@type dict_data_saved: dict
"""
logger.log()
logger.info()
if item and dict_data_saved:
logger.debug('item: %s\ndatos: %s' % (item.tostring(), dict_data_saved))
@@ -564,7 +564,7 @@ def save(item, dict_data_saved):
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.strip().lower()
logger.log("Data is updated")
logger.info("Data is updated")
list_quality = []
for _id, value in list(dict_data_saved.items()):
@@ -599,7 +599,7 @@ def save_from_context(item):
@param item: item
@type item: item
"""
logger.log()
logger.info()
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.strip().lower()
@@ -630,7 +630,7 @@ def delete_from_context(item):
@param item: item
@type item: item
"""
logger.log()
logger.info()
# We come from get_links and no result has been obtained, in context menu and we delete
if item.to_channel != "":
+1 -1
View File
@@ -37,7 +37,7 @@ if config.is_xbmc():
def mainlist(item):
logger.log()
logger.info()
itemlist = []
if config.is_xbmc():
+2 -2
View File
@@ -432,7 +432,7 @@ class main(xbmcgui.WindowDialog):
else:
for button, title, id, poster in self.idps:
logger.log('INFOS',button, title, id, poster)
logger.info('INFOS',button, title, id, poster)
if control == button:
new_item=self.item.clone(title=title, infoLabels={'tmdb_id':id}, contentType=self.item.contentType)
self.close()
@@ -602,7 +602,7 @@ class GlobalSearch(xbmcgui.WindowXMLDialog):
def globalSearch(item, infoLabels, org_title=False):
logger.log()
logger.info()
if item.contentType == "movie": cat = ["movie"]
else: cat = ["serie"]
cat += ["infoPlus"]
+25 -25
View File
@@ -126,7 +126,7 @@ class KodfavouritesData(object):
# ============================
def addFavourite(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
# If you get here through the context menu, you must retrieve the action and channel parameters
@@ -179,7 +179,7 @@ def addFavourite(item):
# ====================
def mainlist(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
item.category = get_name_from_filename(os.path.basename(alfav.user_favorites_file))
@@ -216,7 +216,7 @@ def mainlist(item):
def mostrar_perfil(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
itemlist = []
@@ -289,7 +289,7 @@ def _crea_perfil(alfav):
# Profile and link management
def crear_perfil(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not _crea_perfil(alfav): return False
@@ -299,7 +299,7 @@ def crear_perfil(item):
def editar_perfil_titulo(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -316,7 +316,7 @@ def editar_perfil_titulo(item):
def eliminar_perfil(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -332,7 +332,7 @@ def eliminar_perfil(item):
def acciones_enlace(item):
logger.log()
logger.info()
acciones = [config.get_localized_string(70620), config.get_localized_string(70621), config.get_localized_string(70622), config.get_localized_string(70623),
config.get_localized_string(70624), config.get_localized_string(70548), config.get_localized_string(70625),
@@ -364,7 +364,7 @@ def acciones_enlace(item):
def editar_enlace_titulo(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -386,7 +386,7 @@ def editar_enlace_titulo(item):
def editar_enlace_color(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -410,7 +410,7 @@ def editar_enlace_color(item):
def editar_enlace_thumbnail(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -470,7 +470,7 @@ def editar_enlace_thumbnail(item):
def editar_enlace_carpeta(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -489,7 +489,7 @@ def editar_enlace_carpeta(item):
def editar_enlace_lista(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -527,7 +527,7 @@ def editar_enlace_lista(item):
def eliminar_enlace(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -542,7 +542,7 @@ def eliminar_enlace(item):
# Move profiles and links (up, down, top, bottom)
def mover_perfil(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
alfav.user_favorites = _mover_item(alfav.user_favorites, item.i_perfil, item.direccion)
@@ -552,7 +552,7 @@ def mover_perfil(item):
return True
def mover_enlace(item):
logger.log()
logger.info()
alfav = KodfavouritesData()
if not alfav.user_favorites[item.i_perfil]: return False
@@ -597,7 +597,7 @@ def _mover_item(lista, i_selected, direccion):
# ------------------------------------------
def mainlist_listas(item):
logger.log()
logger.info()
itemlist = []
item.category = 'Listas'
@@ -619,7 +619,7 @@ def mainlist_listas(item):
def acciones_lista(item):
logger.log()
logger.info()
acciones = [config.get_localized_string(70604), config.get_localized_string(70629),
config.get_localized_string(70605), config.get_localized_string(70606), config.get_localized_string(70607)]
@@ -641,7 +641,7 @@ def acciones_lista(item):
def activar_lista(item):
logger.log()
logger.info()
fullfilename = os.path.join(config.get_data_path(), item.lista)
if not os.path.exists(fullfilename):
@@ -659,7 +659,7 @@ def activar_lista(item):
def renombrar_lista(item):
logger.log()
logger.info()
fullfilename_current = os.path.join(config.get_data_path(), item.lista)
if not os.path.exists(fullfilename_current):
@@ -695,7 +695,7 @@ def renombrar_lista(item):
def eliminar_lista(item):
logger.log()
logger.info()
fullfilename = os.path.join(config.get_data_path(), item.lista)
if not os.path.exists(fullfilename):
@@ -714,7 +714,7 @@ def eliminar_lista(item):
def informacion_lista(item):
logger.log()
logger.info()
fullfilename = os.path.join(config.get_data_path(), item.lista)
if not os.path.exists(fullfilename):
@@ -741,7 +741,7 @@ def informacion_lista(item):
def compartir_lista(item):
logger.log()
logger.info()
fullfilename = os.path.join(config.get_data_path(), item.lista)
if not os.path.exists(fullfilename):
@@ -796,7 +796,7 @@ def compartir_lista(item):
def acciones_nueva_lista(item):
logger.log()
logger.info()
acciones = [config.get_localized_string(70651),
config.get_localized_string(70652),
@@ -830,7 +830,7 @@ def acciones_nueva_lista(item):
def crear_lista(item):
logger.log()
logger.info()
titulo = platformtools.dialog_input(default='', heading=config.get_localized_string(70612))
if titulo is None or titulo == '':
@@ -853,7 +853,7 @@ def crear_lista(item):
def descargar_lista(item, url):
logger.log()
logger.info()
from core import httptools, scrapertools
if 'tinyupload.com/' in url:
+18 -18
View File
@@ -42,7 +42,7 @@ menu_settings_path = os.path.join(config.get_data_path(), "settings_channels", '
def mainlist(item):
logger.log()
logger.info()
itemlist = []
# list_canales, any_active = get_channels_list()
@@ -128,7 +128,7 @@ def set_category_context(item):
def get_channels_list():
logger.log()
logger.info()
## import web_pdb; web_pdb.set_trace()
## list_canales = {'peliculas': [], '4k': [], 'terror': [], 'infantiles': [], 'series': [], 'anime': [],
## 'castellano': [], 'latino':[], 'italiano':[], 'torrent':[], 'documentales': []}
@@ -166,14 +166,14 @@ def get_channels_list():
return list_canales, any_active
def set_cache(item):
logger.log()
logger.info()
item.mode = 'set_cache'
t = Thread(target=novedades, args=[item])
t.start()
#t.join()
def get_from_cache(item):
logger.log()
logger.info()
itemlist=[]
cache_node = jsontools.get_node_from_file('menu_cache_data.json', 'cached')
first=item.last
@@ -198,7 +198,7 @@ def get_from_cache(item):
return itemlist
def add_menu_items(item, itemlist):
logger.log()
logger.info()
menu_icon = get_thumb('menu.png')
menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon, title='Menu')
@@ -215,7 +215,7 @@ def add_menu_items(item, itemlist):
return itemlist
def novedades(item):
logger.log()
logger.info()
global list_newest
threads = []
@@ -231,7 +231,7 @@ def novedades(item):
return get_from_cache(item)
multithread = config.get_setting("multithread", "news")
logger.log("multithread= " + str(multithread))
logger.info("multithread= " + str(multithread))
if not multithread:
if platformtools.dialog_yesno(config.get_localized_string(60515),
@@ -270,7 +270,7 @@ def novedades(item):
# if progreso.iscanceled():
# progreso.close()
# logger.log("Búsqueda cancelada")
# logger.info("Búsqueda cancelada")
# return itemlist
# Modo Multi Thread
@@ -284,7 +284,7 @@ def novedades(item):
# Modo single Thread
else:
if mode == 'normal':
logger.log("Obteniendo novedades de channel_id=" + channel_id)
logger.info("Obteniendo novedades de channel_id=" + channel_id)
progreso.update(percentage, "", config.get_localized_string(60520) % channel_title)
get_newest(channel_id, item.extra)
@@ -304,7 +304,7 @@ def novedades(item):
logger.debug(mensaje)
if progreso.iscanceled():
logger.log("Busqueda de novedades cancelada")
logger.info("Busqueda de novedades cancelada")
break
time.sleep(0.5)
@@ -312,7 +312,7 @@ def novedades(item):
if mode == 'normal':
mensaje = config.get_localized_string(60522) % (len(list_newest), time.time() - start_time)
progreso.update(100, mensaje)
logger.log(mensaje)
logger.info(mensaje)
start_time = time.time()
# logger.debug(start_time)
@@ -345,7 +345,7 @@ def novedades(item):
def get_newest(channel_id, categoria):
logger.log("channel_id=" + channel_id + ", categoria=" + categoria)
logger.info("channel_id=" + channel_id + ", categoria=" + categoria)
global list_newest
global list_newest_tourl
@@ -366,9 +366,9 @@ def get_newest(channel_id, categoria):
if not puede:
return
logger.log("running channel " + modulo.__name__ + " " + modulo.__file__)
logger.info("running channel " + modulo.__name__ + " " + modulo.__file__)
list_result = modulo.newest(categoria)
logger.log("canal= %s %d resultados" % (channel_id, len(list_result)))
logger.info("canal= %s %d resultados" % (channel_id, len(list_result)))
exist=False
if os.path.exists(menu_cache_path):
cache_node = jsontools.get_node_from_file('menu_cache_data.json', 'cached')
@@ -377,7 +377,7 @@ def get_newest(channel_id, categoria):
cache_node = {}
# logger.debug('cache node: %s' % cache_node)
for item in list_result:
# logger.log("item="+item.tostring())
# logger.info("item="+item.tostring())
item.channel = channel_id
list_newest.append(item)
list_newest_tourl.append(item.tourl())
@@ -393,7 +393,7 @@ def get_newest(channel_id, categoria):
def get_title(item):
# support.log("ITEM NEWEST ->", item)
# support.info("ITEM NEWEST ->", item)
# item.contentSerieName c'è anche se è un film
if item.contentSerieName and item.contentType != 'movie': # Si es una serie
title = item.contentSerieName
@@ -446,7 +446,7 @@ def no_group(list_result_canal):
global channels_id_name
for i in list_result_canal:
# support.log("NO GROUP i -> ", i)
# support.info("NO GROUP i -> ", i)
canale = channels_id_name[i.channel]
canale = canale # to differentiate it from the color of the other items
i.title = get_title(i) + " [" + canale + "]"
@@ -532,7 +532,7 @@ def group_by_content(list_result_canal):
def show_channels(item):
logger.log()
logger.info()
global channels_id_name
channels_id_name = item.extra
itemlist = []
+5 -5
View File
@@ -66,13 +66,13 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
try:
self.cur.execute('select ip from dnscache where domain=?', (domain,))
ip = self.cur.fetchall()[0][0]
logger.log('Cache DNS: ' + domain + ' = ' + str(ip))
logger.info('Cache DNS: ' + domain + ' = ' + str(ip))
except:
pass
if not ip: # not cached
try:
ip = doh.query(domain)[0]
logger.log('Query DoH: ' + domain + ' = ' + str(ip))
logger.info('Query DoH: ' + domain + ' = ' + str(ip))
self.writeToCache(domain, ip)
except Exception:
logger.error('Failed to resolve hostname, fallback to normal dns')
@@ -133,8 +133,8 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
try:
ret = super(CipherSuiteAdapter, self).send(request, **kwargs)
except Exception as e:
logger.log('Request for ' + domain + ' with ip ' + ip + ' failed')
logger.log(e)
logger.info('Request for ' + domain + ' with ip ' + ip + ' failed')
logger.info(e)
# if 'SSLError' in str(e):
# # disabilito
# config.set_setting("resolver_dns", False)
@@ -143,7 +143,7 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
# else:
tryFlush = True
if tryFlush and not flushedDns: # re-request ips and update cache
logger.log('Flushing dns cache for ' + domain)
logger.info('Flushing dns cache for ' + domain)
return self.flushDns(request, domain, **kwargs)
ret.url = realUrl
else:
+10 -10
View File
@@ -31,7 +31,7 @@ def_lang = info_language[config.get_setting("info_language", "videolibrary")]
def mainlist(item):
logger.log()
logger.info()
itemlist = [Item(channel=item.channel, title=config.get_localized_string(70276), action='new_search', mode='all', thumbnail=get_thumb("search.png")),
Item(channel=item.channel, title=config.get_localized_string(70741) % config.get_localized_string(30122), action='new_search', mode='movie', thumbnail=get_thumb("search_movie.png")),
@@ -48,7 +48,7 @@ def mainlist(item):
def sub_menu(item):
logger.log()
logger.info()
itemlist = [Item(channel=item.channel, action='genres_menu', title=config.get_localized_string(70306), mode='movie', thumbnail=get_thumb("movie_genre.png")),
Item(channel=item.channel, action='years_menu', title=config.get_localized_string(70742), mode='movie', thumbnail=get_thumb("movie_year.png")),
@@ -66,7 +66,7 @@ def sub_menu(item):
def saved_search(item):
logger.log()
logger.info()
itemlist = list()
saved_searches_list = get_saved_searches()
@@ -93,7 +93,7 @@ def saved_search(item):
def new_search(item):
logger.log()
logger.info()
temp_search_file = config.get_temp_file('temp-search')
if filetools.isfile(temp_search_file):
@@ -163,7 +163,7 @@ def new_search(item):
def channel_search(item):
logger.log(item)
logger.debug(item)
start = time.time()
searching = list()
@@ -389,14 +389,14 @@ def get_servers(item, module_dict):
def get_info(itemlist):
logger.log()
logger.info()
tmdb.set_infoLabels_itemlist(itemlist, True, forced=True)
return itemlist
def get_channels(item):
logger.log()
logger.info()
channels_list = list()
title_list = list()
@@ -717,7 +717,7 @@ def discover_list(item):
def from_context(item):
logger.log()
logger.info()
select = setting_channel_new(item)
@@ -738,7 +738,7 @@ def from_context(item):
def set_context(itemlist):
logger.log()
logger.info()
for elem in itemlist:
elem.context = [{"title": config.get_localized_string(60412),
@@ -755,7 +755,7 @@ def set_context(itemlist):
def get_from_temp(item):
logger.log()
logger.info()
n = 30
nTotal = len(item.itemlist)
+23 -23
View File
@@ -21,7 +21,7 @@ CHANNELNAME = "setting"
AUTOSTART = config.is_autorun_enabled()
def mainlist(item):
logger.log()
logger.info()
itemlist = list()
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60535), action="settings", folder=False,
@@ -62,7 +62,7 @@ def mainlist(item):
def menu_channels(item):
logger.log()
logger.info()
itemlist = list()
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60545), action="conf_tools", folder=False,
@@ -98,15 +98,15 @@ def channel_config(item):
def autostart(item): # item required launcher.py line 265
if config.enable_disable_autorun(AUTOSTART):
logger.log('AUTOSTART ENABLED')
logger.info('AUTOSTART ENABLED')
# xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70709))
else:
logger.log('AUTOSTART ENABLED')
logger.info('AUTOSTART ENABLED')
# xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70710))
# def setting_torrent(item):
# logger.log()
# logger.info()
# LIBTORRENT_PATH = config.get_setting("libtorrent_path", server="torrent", default="")
# LIBTORRENT_ERROR = config.get_setting("libtorrent_error", server="torrent", default="")
@@ -243,7 +243,7 @@ def autostart(item): # item required launcher.py line 265
# config.set_setting("magnet2torrent", dict_data_saved["magnet2torrent"], server="torrent")
def menu_servers(item):
logger.log()
logger.info()
itemlist = list()
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60550), action="servers_blacklist", folder=False,
@@ -272,7 +272,7 @@ def menu_servers(item):
for server in sorted(server_list):
server_parameters = servertools.get_server_parameters(server)
logger.log(server_parameters)
logger.info(server_parameters)
if server_parameters["has_settings"] and [x for x in server_parameters["settings"] if x["id"] not in ["black_list", "white_list"]]:
itemlist.append(
Item(channel=CHANNELNAME, title=". " + config.get_localized_string(60553) % server_parameters["name"],
@@ -406,7 +406,7 @@ def cb_servers_favorites(server_names, dict_values):
i += 1
c = 1
logger.log(dict_favorites)
logger.info(dict_favorites)
favorites_servers_list = []
while c in dict_favorites:
favorites_servers_list.append(dict_favorites[c])
@@ -424,7 +424,7 @@ def settings(item):
def submenu_tools(item):
logger.log()
logger.info()
itemlist = list()
# Custom tools
@@ -465,7 +465,7 @@ def submenu_tools(item):
def check_quickfixes(item):
logger.log()
logger.info()
if not config.dev_mode():
from platformcode import updater
@@ -476,7 +476,7 @@ def check_quickfixes(item):
# def update_quasar(item):
# logger.log()
# logger.info()
# from platformcode import custom_code, platformtools
# stat = False
@@ -488,7 +488,7 @@ def check_quickfixes(item):
def conf_tools(item):
logger.log()
logger.info()
# Enable or disable channels
if item.extra == "channels_onoff":
@@ -590,14 +590,14 @@ def conf_tools(item):
action="", folder=False,
thumbnail=channel.thumbnail))
continue
# logger.log(channel.channel + " SALTADO!")
# logger.info(channel.channel + " SALTADO!")
# The json file settings of the channel are loaded
file_settings = os.path.join(config.get_data_path(), "settings_channels", channel.channel + "_data.json")
dict_settings = {}
dict_file = {}
if filetools.exists(file_settings):
# logger.log(channel.channel + " Has _data.json file")
# logger.info(channel.channel + " Has _data.json file")
channeljson_exists = True
# We get saved settings from ../settings/channel_data.json
try:
@@ -607,7 +607,7 @@ def conf_tools(item):
except EnvironmentError:
logger.error("ERROR when reading the file: %s" % file_settings)
else:
# logger.log(channel.channel + " No _data.json file")
# logger.info(channel.channel + " No _data.json file")
channeljson_exists = False
if channeljson_exists:
@@ -627,7 +627,7 @@ def conf_tools(item):
# Default settings are loaded
list_controls, default_settings = channeltools.get_channel_controls_settings(
channel.channel)
# logger.log(channel.title + " | Default: %s" % default_settings)
# logger.info(channel.title + " | Default: %s" % default_settings)
except:
import traceback
logger.error(channel.title + config.get_localized_string(60570) % traceback.format_exc())
@@ -649,7 +649,7 @@ def conf_tools(item):
list_status = config.get_localized_string(60571)
else:
# logger.log(channel.channel + " - NO correction needed!")
# logger.info(channel.channel + " - NO correction needed!")
needsfix = False
# If the channel status has been set it is added to the list
@@ -748,7 +748,7 @@ def channel_status(item, dict_values):
for k in dict_values:
if k == "all_channels":
logger.log("All channels | Selected state: %s" % dict_values[k])
logger.info("All channels | Selected state: %s" % dict_values[k])
if dict_values[k] != 0:
excluded_channels = ['url', 'search',
'videolibrary', 'setting',
@@ -789,9 +789,9 @@ def channel_status(item, dict_values):
continue
else:
logger.log("Channel: %s | State: %s" % (k, dict_values[k]))
logger.info("Channel: %s | State: %s" % (k, dict_values[k]))
config.set_setting("enabled", dict_values[k], k)
logger.log("the value is like %s " % config.get_setting("enabled", k))
logger.info("the value is like %s " % config.get_setting("enabled", k))
platformtools.itemlist_update(Item(channel=CHANNELNAME, action="mainlist"))
@@ -879,7 +879,7 @@ def restore_tools(item):
def report_menu(item):
logger.log('URL: ' + item.url)
logger.info('URL: ' + item.url)
from channelselector import get_thumb
@@ -952,7 +952,7 @@ def report_menu(item):
def activate_debug(item):
logger.log(item.extra)
logger.info(item.extra)
from platformcode import platformtools
#Enable / disable DEBUB option in settings.xml
@@ -1232,7 +1232,7 @@ def report_send(item, description='', fatal=False):
continue
status = True # Upload operation completed successfully
logger.log('Report created: ' + str(item.url)) # The URL of the user report is saved
logger.info('Report created: ' + str(item.url)) # The URL of the user report is saved
# if fatal: # For future use, for logger.crash
# platformtools.dialog_ok('KoD CREATED ERROR report', 'Report it in the forum by adding FATAL ERROR and this URL: ', '[COLOR gold]%s[/COLOR]' % item.url, pastebin_one_use_msg)
# else: # Report URL passed to user
+1 -1
View File
@@ -126,7 +126,7 @@ def SettingOnPosition(item):
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.kod)')
category = item.category if item.category else 0
setting = item.setting if item.setting else 0
logger.log('SETTING= ' + str(setting))
logger.info('SETTING= ' + str(setting))
xbmc.executebuiltin('SetFocus(%i)' % (category - 100))
xbmc.executebuiltin('SetFocus(%i)' % (setting - 80))
+4 -4
View File
@@ -43,7 +43,7 @@ def set_menu_settings(item):
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def check_user_home(item):
logger.log()
logger.info()
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
if 'user_home' in menu_node:
@@ -55,7 +55,7 @@ def check_user_home(item):
return item
def set_custom_start(item):
logger.log()
logger.info()
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
else:
@@ -69,7 +69,7 @@ def set_custom_start(item):
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def get_start_page():
logger.log()
logger.info()
dictCategory = {
config.get_localized_string(70137): 'peliculas',
@@ -356,7 +356,7 @@ class Main(xbmcgui.WindowXMLDialog):
self.focus -= 1
def run_action(self, item):
logger.log()
logger.info()
if item.menu != True:
self.close()
xbmc.executebuiltin("Container.update(%s)"%launcher.run(item))
+10 -10
View File
@@ -43,7 +43,7 @@ else:
def buscartrailer(item, trailers=[]):
logger.log()
logger.info()
# List of actions if run from context menu
if item.action == "manual_search" and item.contextual:
@@ -78,8 +78,8 @@ def buscartrailer(item, trailers=[]):
item.year = item.infoLabels['year']
logger.log("Search: %s" % item.contentTitle)
logger.log("Year: %s" % item.year)
logger.info("Search: %s" % item.contentTitle)
logger.info("Year: %s" % item.year)
if item.infoLabels['trailer'] and not trailers:
url = item.infoLabels['trailer']
if "youtube" in url:
@@ -122,7 +122,7 @@ def buscartrailer(item, trailers=[]):
def manual_search(item):
logger.log()
logger.info()
texto = platformtools.dialog_input(default=item.contentTitle, heading=config.get_localized_string(30112))
if texto is not None:
if item.extra == "mymovies":
@@ -134,7 +134,7 @@ def manual_search(item):
def tmdb_trailers(item, tipo="movie"):
logger.log()
logger.info()
from core.tmdb import Tmdb
itemlist = []
@@ -153,7 +153,7 @@ def tmdb_trailers(item, tipo="movie"):
def youtube_search(item):
logger.log()
logger.info()
itemlist = []
title = item.contentTitle
if item.extra != "youtube":
@@ -192,7 +192,7 @@ def youtube_search(item):
def mymovies_search(item):
logger.log()
logger.info()
import json
title = item.contentTitle
@@ -216,7 +216,7 @@ def mymovies_search(item):
def search_links_mymovies(item):
logger.log()
logger.info()
trailer_url = match(item, patron=r'<li class="bottone_playlist"[^>]+><a href="([^"]+)"').match
itemlist = []
data = httptools.downloadpage(item.url).data
@@ -236,7 +236,7 @@ def search_links_mymovies(item):
def filmaffinity_search(item):
logger.log()
logger.info()
if item.filmaffinity:
item.url = item.filmaffinity
@@ -284,7 +284,7 @@ def filmaffinity_search(item):
def search_links_filmaff(item):
logger.log()
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
+23 -23
View File
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
import re
from core import support, filetools, jsontools, trakt_tools
from core import filetools, jsontools, trakt_tools
from core.tmdb import Tmdb
from core.scrapertools import htmlclean, decodeHtmlentities
from core.support import thumb, typo, match, Item, dbg
from core.support import thumb, typo, match, Item
from platformcode import config, platformtools
from platformcode.logger import log, error
from platformcode.logger import info, error
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
def_lang = info_language[config.get_setting("info_language", "videolibrary")]
@@ -28,7 +28,7 @@ default_fan = filetools.join(config.get_runtime_path(), "fanart.jpg")
def mainlist(item):
log()
info()
itemlist = [
# TMDB
# item.clone(title=typo(config.get_localized_string(70021), 'bold'), action=""),
@@ -55,7 +55,7 @@ def configuracion(item):
return ret
def search_star(item):
log()
info()
itemlist = []
item.type='movie'
@@ -97,7 +97,7 @@ def search_(item):
def searcing(item):
log()
info()
new_item = Item(title=item.contentTitle, text=item.contentTitle.replace("+", " "), mode=item.contentType, infoLabels=item.infoLabels)
@@ -625,7 +625,7 @@ def indices_tmdb(item):
def filter(item):
log()
info()
from datetime import datetime
list_controls = []
@@ -705,7 +705,7 @@ def filtered(item, values):
def musica_movie(item):
log()
info()
itemlist = []
data = match(item).data
matches = match(data, patron=r'<td class="left">([^<]+)<br><small>([^<]+)</small>.*?<td>(\d+:\d+).*?<p id="([^"]+)"').matches
@@ -729,7 +729,7 @@ def list_imdb(item):
url = 'http://www.imdb.com/search/title?' + item.url
# data = httptools.downloadpage(url, headers=headers, replace_headers=True).data
data = match(url, headers=headers).data
log(data)
info(data)
# data = re.sub(r"\n|\r|\t|&nbsp;", "", data)
# data = re.sub(r"\s{2}", " ", data)
@@ -812,7 +812,7 @@ def list_imdb(item):
def filter_imdb(item):
log()
info()
from datetime import datetime
list_controls = []
@@ -1392,7 +1392,7 @@ def indices_imdb(item):
# def filter_fa(item):
# log()
# info()
# from datetime import datetime
# list_controls = []
@@ -1494,7 +1494,7 @@ def indices_imdb(item):
# def login_fa():
# log()
# info()
# try:
# user = config.get_setting("usuariofa", "tvmoviedb")
@@ -1519,7 +1519,7 @@ def indices_imdb(item):
# userid = scrapertools.find_single_match(data, 'id-user=(\d+)')
# if userid:
# config.set_setting("userid", userid, "tvmoviedb")
# log("Login correcto")
# info("Login correcto")
# return True, ""
# except:
# import traceback
@@ -1644,7 +1644,7 @@ def indices_imdb(item):
# def votar_fa(item):
# # Window to select the vote
# log()
# info()
# list_controls = []
# valores = {}
@@ -1920,7 +1920,7 @@ def acciones_trakt(item):
ratings = []
try:
for i, entry in enumerate(data):
log('ENTRY:',entry)
info('ENTRY:',entry)
if i <= item.pagina: continue
# try: entry = entry[item.args]
# except: pass
@@ -1996,7 +1996,7 @@ def acciones_trakt(item):
def order_list(item):
log()
info()
list_controls = []
valores1 = ['rating', 'added', 'title', 'released', 'runtime', 'popularity', 'percentage', 'votes']
@@ -2338,7 +2338,7 @@ def indices_mal(item):
matches = match("https://myanimelist.net/anime.php", cookies=False, patronBlock=patronBlock, patron=patron).matches
for url, title in matches:
genero = title.split(" (", 1)[0]
log(url_base, genero)
info(url_base, genero)
thumbnail = url_base + genero.lower().replace(" ", "%20")
if genero in ["Hentai", "Yaoi", "Yuri"] and not adult_mal:
continue
@@ -2487,7 +2487,7 @@ def detail_staff(item):
patron_bio = r'<?<div class="spaceit_pad">(.*?)</td>'
bio = match(data, patron=patron_bio).match
bio = htmlclean(bio.replace("</div>", "\n"))
log(bio)
info(bio)
infoLabels = {'plot': bio}
if not "No voice acting roles" in data:
itemlist.append(Item(channel=item.channel, title=typo(config.get_localized_string(70374),'bold bullet'), action="", thumbnail=item.thumbnail, infoLabels=infoLabels))
@@ -2625,7 +2625,7 @@ def info_anidb(item, itemlist, url):
def filter_mal(item):
log()
info()
list_controls = []
valores = {}
@@ -2703,7 +2703,7 @@ def callback_mal(item, values):
def musica_anime(item):
# List available anime and songs similar to the anime title
log()
info()
itemlist = []
data = match("http://www.freeanimemusic.org/song_search.php", post=item.post).data
@@ -2738,7 +2738,7 @@ def musica_anime(item):
def login_mal(from_list=False):
log()
info()
from core import httptools
from base64 import b64decode as bdec
@@ -2767,7 +2767,7 @@ def login_mal(from_list=False):
else:
if generic:
return False, config.get_localized_string(70393), user
log("Correct login")
info("Correct login")
return True, "", user
except:
import traceback
@@ -2799,7 +2799,7 @@ def cuenta_mal(item):
def items_mal(item):
# Scraper for personal lists
log()
info()
itemlist = []
data = match(item.url).data
+3 -3
View File
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from core import servertools
from core.support import match, log
from core.support import match, info
from core.item import Item
from platformcode import config, logger
def mainlist(item):
log()
info()
itemlist = []
itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60089), thumbnail=item.thumbnail, args='server'))
@@ -19,7 +19,7 @@ def mainlist(item):
# When the function "search" is called, the launcher asks for a text to search for and adds it as a parameter
def search(item, text):
log(text)
info(text)
if not text.startswith("http"):
text = "http://" + text
+36 -36
View File
@@ -21,7 +21,7 @@ else:
def mainlist(item):
logger.log()
logger.info()
itemlist = [Item(channel=item.channel, action="list_movies", title=config.get_localized_string(60509),
category=config.get_localized_string(70270), thumbnail=thumb("videolibrary_movie")),
@@ -38,7 +38,7 @@ def channel_config(item):
def list_movies(item, silent=False):
logger.log()
logger.info()
itemlist = []
movies_path = []
for root, folders, files in filetools.walk(videolibrarytools.MOVIES_PATH):
@@ -64,7 +64,7 @@ def list_movies(item, silent=False):
def list_tvshows(item):
from time import time
start = time()
logger.log()
logger.info()
itemlist = []
lista = []
tvshows_path = []
@@ -89,7 +89,7 @@ def list_tvshows(item):
title=typo(config.get_localized_string(70269), 'bold color kod'), folder=False),
Item(channel=item.channel, action="configure_update_videolibrary", thumbnail=item.thumbnail,
title=typo(config.get_localized_string(60599), 'bold color kod'), lista=lista, folder=False)]
logger.log('TEMPO= ' + str(time() - start))
logger.info('TEMPO= ' + str(time() - start))
return itemlist
@@ -189,7 +189,7 @@ def get_results(nfo_path, root, Type, local=False):
# Contextual menu: Mark as seen / not seen
visto = item.library_playcounts.get(item.contentTitle, 0)
item.infoLabels["playcount"] = visto
logger.log('item\n' + str(item))
logger.info('item\n' + str(item))
if visto > 0:
seen_text = config.get_localized_string(60020)
counter = 0
@@ -261,7 +261,7 @@ def configure_update_videolibrary(item):
def get_seasons(item):
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
itemlist = []
dict_temp = {}
@@ -320,7 +320,7 @@ def get_seasons(item):
def get_episodes(item):
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
itemlist = []
@@ -384,7 +384,7 @@ def get_episodes(item):
def findvideos(item):
from specials import autoplay
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
videolibrarytools.check_renumber_options(item)
itemlist = []
@@ -537,7 +537,7 @@ def findvideos(item):
def play(item):
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
if not item.contentChannel == "local":
@@ -577,7 +577,7 @@ def play(item):
def update_videolibrary(item=''):
logger.log()
logger.info()
# Update active series by overwriting
import service
@@ -597,17 +597,17 @@ def update_videolibrary(item=''):
def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_folder, current_tvshows_folder, new_tvshows_folder):
logger.log()
logger.info()
backup_current_path = current_path
backup_new_path = new_path
logger.log('current_path: ' + current_path)
logger.log('new_path: ' + new_path)
logger.log('current_movies_folder: ' + current_movies_folder)
logger.log('new_movies_folder: ' + new_movies_folder)
logger.log('current_tvshows_folder: ' + current_tvshows_folder)
logger.log('new_tvshows_folder: ' + new_tvshows_folder)
logger.info('current_path: ' + current_path)
logger.info('new_path: ' + new_path)
logger.info('current_movies_folder: ' + current_movies_folder)
logger.info('new_movies_folder: ' + new_movies_folder)
logger.info('current_tvshows_folder: ' + current_tvshows_folder)
logger.info('new_tvshows_folder: ' + new_tvshows_folder)
notify = False
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80011))
@@ -618,14 +618,14 @@ def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_
current_tvshows_path = u'' + filetools.join(current_path, current_tvshows_folder)
new_tvshows_path = u'' + filetools.join(new_path, new_tvshows_folder)
logger.log('current_movies_path: ' + current_movies_path)
logger.log('new_movies_path: ' + new_movies_path)
logger.log('current_tvshows_path: ' + current_tvshows_path)
logger.log('new_tvshows_path: ' + new_tvshows_path)
logger.info('current_movies_path: ' + current_movies_path)
logger.info('new_movies_path: ' + new_movies_path)
logger.info('current_tvshows_path: ' + current_tvshows_path)
logger.info('new_tvshows_path: ' + new_tvshows_path)
from platformcode import xbmc_videolibrary
movies_path, tvshows_path = xbmc_videolibrary.check_sources(new_movies_path, new_tvshows_path)
logger.log('check_sources: ' + str(movies_path) + ', ' + str(tvshows_path))
logger.info('check_sources: ' + str(movies_path) + ', ' + str(tvshows_path))
if movies_path or tvshows_path:
if not movies_path:
filetools.rmdir(new_movies_path)
@@ -670,7 +670,7 @@ def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_
def delete_videolibrary(item):
logger.log()
logger.info()
if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80037)):
return
@@ -696,7 +696,7 @@ def delete_videolibrary(item):
# context menu methods
def update_tvshow(item):
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
heading = config.get_localized_string(60037)
@@ -722,11 +722,11 @@ def update_tvshow(item):
def add_local_episodes(item):
logger.log()
logger.info()
done, local_episodes_path = videolibrarytools.config_local_episodes_path(item.path, item, silent=True)
if done < 0:
logger.log("An issue has occurred while configuring local episodes")
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)
@@ -741,7 +741,7 @@ def add_local_episodes(item):
def remove_local_episodes(item):
logger.log()
logger.info()
nfo_path = filetools.join(item.path, "tvshow.nfo")
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
@@ -759,7 +759,7 @@ def remove_local_episodes(item):
def verify_playcount_series(item, path):
logger.log()
logger.info()
"""
This method reviews and repairs the PlayCount of a series that has become out of sync with the actual list of episodes in its folder. Entries for missing episodes, seasons, or series are created with the "not seen" mark. Later it is sent to verify the counters of Seasons and Series
@@ -822,7 +822,7 @@ def verify_playcount_series(item, path):
def mark_content_as_watched2(item):
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
if filetools.isfile(item.nfo):
head_nfo, it = videolibrarytools.read_nfo(item.nfo)
@@ -860,7 +860,7 @@ def mark_content_as_watched2(item):
def mark_content_as_watched(item):
logger.log()
logger.info()
#logger.debug("item:\n" + item.tostring('\n'))
if filetools.exists(item.nfo):
@@ -898,7 +898,7 @@ def mark_content_as_watched(item):
def mark_season_as_watched(item):
logger.log()
logger.info()
# logger.debug("item:\n" + item.tostring('\n'))
# Get dictionary of marked episodes
@@ -951,7 +951,7 @@ def mark_season_as_watched(item):
def mark_tvshow_as_updatable(item, silent=False):
logger.log()
logger.info()
head_nfo, it = videolibrarytools.read_nfo(item.nfo)
it.active = item.active
filetools.write(item.nfo, head_nfo + it.tojson())
@@ -984,7 +984,7 @@ def delete(item):
elif platformtools.dialog_yesno(heading, config.get_localized_string(70081) % filetools.basename(_item.path)):
filetools.rmdirtree(_item.path)
logger.log("All links removed")
logger.info("All links removed")
xbmc.sleep(1000)
platformtools.itemlist_refresh()
@@ -1055,7 +1055,7 @@ def delete(item):
filetools.write(item.nfo, head_nfo + item_nfo.tojson())
msg_txt = config.get_localized_string(70087) % (num_enlaces, canal)
logger.log(msg_txt)
logger.info(msg_txt)
platformtools.dialog_notification(heading, msg_txt)
platformtools.itemlist_refresh()
@@ -1065,7 +1065,7 @@ def delete(item):
def check_season_playcount(item, season):
logger.log()
logger.info()
if season:
episodios_temporada = 0
@@ -1087,7 +1087,7 @@ def check_season_playcount(item, season):
def check_tvshow_playcount(item, season):
logger.log()
logger.info()
if season:
temporadas_serie = 0
temporadas_vistas_serie = 0