KoD 1.7.1
This commit is contained in:
@@ -132,11 +132,12 @@ class autorenumber():
|
||||
else:
|
||||
self.renumberdict = {}
|
||||
for item in self.itemlist:
|
||||
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
|
||||
"action": "start",
|
||||
"channel": "autorenumber",
|
||||
"from_channel": item.channel,
|
||||
"from_action": item.action}]
|
||||
if item.contentType != 'movie':
|
||||
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
|
||||
"action": "start",
|
||||
"channel": "autorenumber",
|
||||
"from_channel": item.channel,
|
||||
"from_action": item.action}]
|
||||
|
||||
def config(self):
|
||||
# Pulizia del Titolo
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Backup and restore video library
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import datetime, xbmc, os, shutil
|
||||
import datetime, xbmc, os, shutil, sys
|
||||
|
||||
from zipfile import ZipFile
|
||||
from core import videolibrarytools, filetools
|
||||
@@ -11,12 +11,15 @@ from platformcode import logger, config, platformtools, xbmc_videolibrary
|
||||
from distutils.dir_util import copy_tree
|
||||
from specials import videolibrary
|
||||
|
||||
temp_path = u'' + xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/")
|
||||
videolibrary_temp_path = u'' + xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/videolibrary")
|
||||
movies_path = u'' + filetools.join(videolibrary_temp_path, "movies")
|
||||
tvshows_path = u'' + filetools.join(videolibrary_temp_path, "tvshows")
|
||||
videolibrary_movies_path = u'' + videolibrarytools.MOVIES_PATH
|
||||
videolibrary_tvshows_path = u'' + videolibrarytools.TVSHOWS_PATH
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
temp_path = unicode(xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/"))
|
||||
videolibrary_temp_path = unicode(xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/videolibrary"))
|
||||
movies_path = unicode(filetools.join(videolibrary_temp_path, "movies"))
|
||||
tvshows_path = unicode(filetools.join(videolibrary_temp_path, "tvshows"))
|
||||
videolibrary_movies_path = unicode(videolibrarytools.MOVIES_PATH)
|
||||
videolibrary_tvshows_path = unicode(videolibrarytools.TVSHOWS_PATH)
|
||||
|
||||
|
||||
def export_videolibrary(item):
|
||||
@@ -25,7 +28,7 @@ def export_videolibrary(item):
|
||||
zip_file_folder = platformtools.dialog_browse(3, config.get_localized_string(80002))
|
||||
if zip_file_folder == "":
|
||||
return
|
||||
zip_file = u'' + xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip")
|
||||
zip_file = unicode(xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip"))
|
||||
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80003))
|
||||
# p_dialog.update(0)
|
||||
@@ -53,7 +56,7 @@ def export_videolibrary(item):
|
||||
def import_videolibrary(item):
|
||||
logger.info()
|
||||
|
||||
zip_file = u'' + platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip")
|
||||
zip_file = unicode(platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip"))
|
||||
if zip_file == "":
|
||||
return
|
||||
if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80006)):
|
||||
@@ -112,6 +115,7 @@ def zip(dir, file):
|
||||
if smb:
|
||||
filetools.move(file, temp)
|
||||
|
||||
|
||||
def unzip(dir, file):
|
||||
if file.lower().startswith('smb://'):
|
||||
temp = filetools.join(temp_path, os.path.split(file)[-1])
|
||||
|
||||
@@ -10,12 +10,14 @@ import channelselector
|
||||
addon_icon = filetools.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
|
||||
|
||||
background = 'FF232323'
|
||||
overlay = '77232323'
|
||||
text = 'FFFFFFFF'
|
||||
select = 'FF0082C2'
|
||||
if config.get_setting('icon_set') == 'dark':
|
||||
background = 'FFDCDCDC'
|
||||
overlay = '77DCDCDC'
|
||||
text = 'FF232323'
|
||||
select = '880082C2'
|
||||
select = 'FF78BDDF'
|
||||
|
||||
class KeyListener(xbmcgui.WindowXMLDialog):
|
||||
TIMEOUT = 10
|
||||
@@ -122,13 +124,15 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
|
||||
def menulist(self, menu):
|
||||
itemlist = []
|
||||
self.getControl(200).setLabel(background)
|
||||
self.getControl(201).setLabel(overlay)
|
||||
self.getControl(202).setLabel(select)
|
||||
self.getControl(203).setLabel(text)
|
||||
for menuentry in menu:
|
||||
# if not menuentry.channel: menuentry.channel = 'news'
|
||||
|
||||
title = re.sub(r'(\[[/]?COLOR[^\]]*\])','',menuentry.title)
|
||||
item = xbmcgui.ListItem(title)
|
||||
item.setProperty('background', background)
|
||||
item.setProperty('text', text)
|
||||
item.setProperty('select', select)
|
||||
item.setProperty('channel', menuentry.channel)
|
||||
item.setProperty('focus', '0')
|
||||
item.setProperty('thumbnail', menuentry.thumbnail)
|
||||
@@ -175,6 +179,7 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
|
||||
|
||||
def submenu(self):
|
||||
itmlist = []
|
||||
channel_name = self.MENU.getSelectedItem().getProperty('channel')
|
||||
focus = int(self.MENU.getSelectedItem().getProperty('focus'))
|
||||
if channel_name == 'channelselector':
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
# ------------------------------------------------------------
|
||||
# XBMC Launcher (xbmc / kodi)
|
||||
# ------------------------------------------------------------
|
||||
import datetime
|
||||
import json
|
||||
import sys, os
|
||||
|
||||
import requests
|
||||
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
@@ -144,7 +149,18 @@ def run(item=None):
|
||||
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
|
||||
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
|
||||
else:
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join((item.url[j:j+57] for j in range(0, len(item.url), 57))))
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
|
||||
elif item.action == "gotopage":
|
||||
page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
|
||||
if page:
|
||||
import xbmc
|
||||
item.action = item.real_action
|
||||
if item.page:
|
||||
item.page = page
|
||||
else:
|
||||
import re
|
||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url)
|
||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||
else:
|
||||
# Checks if channel exists
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
@@ -159,10 +175,10 @@ def run(item=None):
|
||||
channel = None
|
||||
|
||||
if os.path.exists(channel_file):
|
||||
# try:
|
||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None, None, ['%s.%s' % (CHANNELS, item.channel)])
|
||||
# except ImportError:
|
||||
# exec("import " + CHANNELS + "." + item.channel + " as channel")
|
||||
try:
|
||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None, None, ['%s.%s' % (CHANNELS, item.channel)])
|
||||
except ImportError:
|
||||
exec("import " + CHANNELS + "." + item.channel + " as channel")
|
||||
|
||||
logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__))
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ def render_items(itemlist, parent_item):
|
||||
xbmcplugin.addDirectoryItems(_handle, dirItems)
|
||||
|
||||
if parent_item.list_type == '':
|
||||
breadcrumb = parent_item.category.capitalize()
|
||||
breadcrumb = parent_item.category #.capitalize()
|
||||
else:
|
||||
if 'similar' in parent_item.list_type:
|
||||
if parent_item.contentTitle != '':
|
||||
@@ -614,7 +614,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
context_commands.append((config.get_localized_string(60350), "Container.Refresh (%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': 'search', 'action': "from_context", 'from_channel': item.channel, 'contextual': True, 'text': item.wanted}))))
|
||||
context_commands.append( (config.get_localized_string(70561), "Container.Update (%s?%s&%s)" % (sys.argv[0], item_url, 'channel=search&action=from_context&search_type=list&page=1&list_type=%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id']))))
|
||||
|
||||
if item.channel != "videolibrary" and item.videolibrary != False:
|
||||
if item.channel != "videolibrary" and item.videolibrary != False and not item.disable_videolibrary:
|
||||
# Add Series to the video library
|
||||
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(60352), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_serie_to_library&from_action=' + item.action)))
|
||||
@@ -625,7 +625,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
elif item.action in ['check'] and item.contentTitle:
|
||||
context_commands.append((config.get_localized_string(30161), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_to_library&from_action=' + item.action)))
|
||||
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled'):
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled') and not item.disable_videolibrary:
|
||||
# Download movie
|
||||
if item.contentType == "movie":
|
||||
context_commands.append((config.get_localized_string(60354), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
@@ -648,6 +648,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
if (item.contentTitle and item.contentType in ['movie', 'tvshow']) or "buscar_trailer" in context:
|
||||
context_commands.append((config.get_localized_string(60359), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({ 'channel': "trailertools", 'action': "buscartrailer", 'search_title': item.contentTitle if item.contentTitle else item.fulltitle, 'contextual': True}))))
|
||||
|
||||
if item.nextPage:
|
||||
context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action)))
|
||||
if config.dev_mode():
|
||||
context_commands.insert(0, ("item info", "Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl())))
|
||||
return context_commands
|
||||
@@ -974,7 +976,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
xlistitem.setProperty("inputstream.adaptive.license_type", item.drm)
|
||||
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
|
||||
xlistitem.setMimeType('application/dash+xml')
|
||||
elif item.manifest == 'hls' or mediaurl.split('|')[0].endswith('m3u8'):
|
||||
elif item.manifest == 'hls' or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')):
|
||||
if not install_inputstream():
|
||||
return
|
||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||
@@ -1055,23 +1057,23 @@ def get_seleccion(default_action, opciones, seleccion, video_urls):
|
||||
|
||||
|
||||
def calcResolution(option):
|
||||
match = scrapertools.find_single_match(option, '([0-9]{2,4})x([0-9]{2,4})')
|
||||
resolution = False
|
||||
match = scrapertools.find_single_match(option, '([0-9]{2,4})(?:p|i|x[0-9]{2,4}|)')
|
||||
resolution = 0
|
||||
|
||||
if match:
|
||||
resolution = int(match[0]) * int(match[1])
|
||||
else:
|
||||
if '240p' in option:
|
||||
resolution = 320 * 240
|
||||
elif '360p' in option:
|
||||
resolution = 480 * 360
|
||||
elif ('480p' in option) or ('480i' in option):
|
||||
resolution = 720 * 480
|
||||
elif ('576p' in option) or ('576p' in option):
|
||||
resolution = 720 * 576
|
||||
elif ('720p' in option) or ('HD' in option):
|
||||
resolution = 1280 * 720
|
||||
elif ('1080p' in option) or ('1080i' in option) or ('Full HD' in option):
|
||||
resolution = 1920 * 1080
|
||||
resolution = int(match)
|
||||
elif 'sd' in option.lower():
|
||||
resolution = 480
|
||||
elif 'hd' in option.lower():
|
||||
resolution = 720
|
||||
if 'full' in option.lower():
|
||||
resolution = 1080
|
||||
elif '2k' in option.lower():
|
||||
resolution = 1440
|
||||
elif '4k' in option.lower():
|
||||
resolution = 2160
|
||||
elif 'auto' in option.lower():
|
||||
resolution = 10000
|
||||
|
||||
return resolution
|
||||
|
||||
@@ -1725,18 +1727,16 @@ def get_played_time(item):
|
||||
if not ID:
|
||||
return 0
|
||||
|
||||
S = item.infoLabels.get('season', 0)
|
||||
E = item.infoLabels.get('episode')
|
||||
s = item.infoLabels.get('season', 0)
|
||||
e = item.infoLabels.get('episode')
|
||||
|
||||
result = None
|
||||
|
||||
try:
|
||||
if item.contentType == 'movie':
|
||||
result = db['viewed'].get(ID)
|
||||
elif S and E:
|
||||
result = db['viewed'].get(ID, {}).get(str(S)+'x'+str(E))
|
||||
|
||||
if result:
|
||||
played_time = result
|
||||
result = db['viewed'].get(ID)
|
||||
if type(result) == dict:
|
||||
result = db['viewed'].get(ID, {}).get('{}x{}'.format(s, e), 0)
|
||||
played_time = result
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
@@ -1757,22 +1757,23 @@ def set_played_time(item):
|
||||
if not ID:
|
||||
return
|
||||
|
||||
S = item.infoLabels.get('season', 0)
|
||||
E = item.infoLabels.get('episode')
|
||||
s = item.infoLabels.get('season', 0)
|
||||
e = item.infoLabels.get('episode')
|
||||
|
||||
try:
|
||||
if item.contentType == 'movie':
|
||||
db['viewed'][ID] = played_time
|
||||
elif E:
|
||||
if e:
|
||||
newDict = db['viewed'].get(ID, {})
|
||||
newDict[str(S) + 'x' + str(E)] = played_time
|
||||
newDict['{}x{}'.format(s, e)] = played_time
|
||||
db['viewed'][ID] = newDict
|
||||
else:
|
||||
db['viewed'][ID] = played_time
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
del db['viewed'][ID]
|
||||
|
||||
|
||||
|
||||
def prevent_busy(item):
|
||||
logger.debug()
|
||||
if not item.autoplay and not item.window:
|
||||
@@ -1780,3 +1781,7 @@ def prevent_busy(item):
|
||||
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||
xbmc.sleep(200)
|
||||
xbmc.Player().stop()
|
||||
# xbmc.executebuiltin('Action(Stop)')
|
||||
# xbmc.sleep(500)
|
||||
# xbmc.Player().stop()
|
||||
# xbmc.sleep(500)
|
||||
@@ -114,7 +114,6 @@ def mark_auto_as_watched(item):
|
||||
threading.Thread(target=mark_as_watched_subThread, args=[item]).start()
|
||||
|
||||
|
||||
|
||||
def sync_trakt_addon(path_folder):
|
||||
"""
|
||||
Updates the values of episodes seen if
|
||||
|
||||
Reference in New Issue
Block a user