KoD 1.5.2

- Migliorato Menu Rapido\n- Rimosso Menu Laterale\n- Fix Youtube\n- Fix Visualizza collegamenti della videoteca come pop-up\n- Riorganizzata sezione Aiuto\n- Reinserito canale tantifilm\n
This commit is contained in:
marco
2021-01-09 20:34:42 +01:00
parent d169179e15
commit 47f02db14b
38 changed files with 572 additions and 1128 deletions

View File

@@ -40,7 +40,7 @@ def download_and_play(url, file_name, download_path):
dialog.create(config.get_localized_string(60200), config.get_localized_string(60312))
dialog.update(0)
while not cancelled and download_thread.isAlive():
while not cancelled and download_thread.is_alive():
dialog.update(download_thread.get_progress(), config.get_localized_string(60313) + '\n' +
config.get_localized_string(60314) + str(int(old_div(download_thread.get_speed(), 1024))) + " KB/s " + str(
download_thread.get_actual_size()) + config.get_localized_string(60316) + str( download_thread.get_total_size()) + "MB",
@@ -67,15 +67,15 @@ def download_and_play(url, file_name, download_path):
logger.info("Terminated by user")
break
else:
if not download_thread.isAlive():
if not download_thread.is_alive():
logger.info("Download has finished")
break
else:
logger.info("Continua la descarga")
# When the player finishes, if you continue downloading it for now
logger.info("Download thread alive=" + str(download_thread.isAlive()))
if download_thread.isAlive():
logger.info("Download thread alive=" + str(download_thread.is_alive()))
if download_thread.is_alive():
logger.info("Killing download thread")
download_thread.force_stop()
@@ -106,11 +106,11 @@ class CustomPlayer(xbmc.Player):
def force_stop_download_thread(self):
logger.info()
if self.download_thread.isAlive():
if self.download_thread.is_alive():
logger.info("Killing download thread")
self.download_thread.force_stop()
# while self.download_thread.isAlive():
# while self.download_thread.is_alive():
# xbmc.sleep(1000)
def onPlayBackStarted(self):

View File

@@ -1,15 +1,21 @@
# -*- coding: utf-8 -*-
from builtins import map
import sys, xbmc, xbmcaddon, xbmcgui, base64, json, os
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
import xbmc, xbmcaddon, xbmcgui, re
from threading import Timer
from channelselector import get_thumb
from platformcode import config, logger
from platformcode import config, logger, platformtools, launcher
from core import filetools
from core.item import Item
import channelselector
addon_icon = os.path.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
addon_icon = filetools.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
background = 'FF232323'
text = 'FFFFFFFF'
select = 'FF0082C2'
if config.get_setting('icon_set') == 'dark':
background = 'FFDCDCDC'
text = 'FF232323'
select = '880082C2'
class KeyListener(xbmcgui.WindowXMLDialog):
TIMEOUT = 10
@@ -29,7 +35,6 @@ class KeyListener(xbmcgui.WindowXMLDialog):
def onInit(self):
try:
logger.debug('ICONA',addon_icon)
self.getControl(400).setImage(addon_icon)
self.getControl(401).addLabel(config.get_localized_string(70698))
self.getControl(402).addLabel(config.get_localized_string(70699) % self.TIMEOUT)
@@ -89,88 +94,111 @@ def delete_key():
config.set_setting("shortcut_key", '')
xbmc.executebuiltin('Action(reloadkeymaps)')
LEFT = 1
RIGHT = 2
UP = 3
DOWN = 4
EXIT = 10
BACKSPACE = 92
RIGHTCLICK = 101
MOUSEMOVE = 107
class Main(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.items = []
def onInit(self):
self.MENU = self.getControl(1)
self.SUBMENU = self.getControl(2)
#### Compatibility with Kodi 18 ####
if config.get_platform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
for menuentry in menu:
if not menuentry.channel: menuentry.channel = prevchannel
item = xbmcgui.ListItem(menuentry.title)
if not submenu and menuentry.channel in ['news', 'channelselector', 'search', 'videolibrary']:
item.setProperty('sub', 'Shortcut/sub.png')
if menuentry.title != 'Redirect':
for key , value in json.loads(menuentry.tojson()).items():
item.setProperty(key, str(value))
item.setProperty('run', menuentry.tojson())
self.items.append(item)
itemlist = self.menulist(channelselector.getmainlist())
self.getControl(32500).addItems(self.items)
self.setFocusId(32500)
self.MENU.addItems(itemlist)
self.setFocusId(1)
self.submenu()
def menulist(self, menu):
itemlist = []
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)
if menuentry.channel not in ['downloads', 'setting', 'help']:
item.setProperty('sub', 'true')
item.setProperty('run', menuentry.tourl())
itemlist.append(item)
return itemlist
def onClick(self, control_id):
if control_id == 32500:
action = self.getControl(32500).getSelectedItem().getProperty('run')
if control_id in [1, 2]:
action = self.getControl(control_id).getSelectedItem().getProperty('run')
self.close()
if self.getControl(32500).getSelectedItem().getProperty('folder') == 'False':
xbmc.executebuiltin('RunPlugin("plugin://plugin.video.kod/?' + base64.b64encode(action) + '")')
if Item().fromurl(action).folder == False:
xbmc.executebuiltin('RunPlugin("plugin://plugin.video.kod/?' + action + '")')
else:
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.kod/?' + base64.b64encode(action) + '")')
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.kod/?' + action + '")')
elif control_id in [101]:
self.setFocusId(2)
elif control_id in [102]:
self.setFocusId(1)
def onAction(self, action):
# exit
if action.getId() in [xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]:
if action.getButtonCode() == config.get_setting('shortcut_key'):
self.close()
if submenu: open_shortcut_menu(self=True)
if action.getId() == xbmcgui.ACTION_CONTEXT_MENU:
config.open_settings()
action = action.getId()
if action in [EXIT, BACKSPACE, RIGHTCLICK]:
self.close()
focus = self.getFocusId()
if action == 3:
if focus == 61:
self.setFocusId(32500)
elif submenu:
self.close()
open_shortcut_menu(self=True)
elif self.getControl(32500).getSelectedItem().getProperty('channel') in ['news', 'channelselector', 'search', 'videolibrary']:
channel_name = self.getControl(32500).getSelectedItem().getProperty('channel')
if channel_name == 'channelselector':
import channelselector
self.close()
open_shortcut_menu(channelselector.getchanneltypes(), channel_name, self=True)
else:
from core.item import Item
channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name])
self.close()
open_shortcut_menu(channel.mainlist(Item()), channel_name, self=True)
if action in [LEFT, RIGHT, MOUSEMOVE] and self.getFocusId() in [1]:
if focus in [1]:
self.submenu()
else:
itfocus = str(self.SUBMENU.getSelectedPosition())
self.MENU.getSelectedItem().setProperty('focus', itfocus)
def open_shortcut_menu(newmenu='', channel='', self=False):
if not self: xbmc.executebuiltin('Dialog.Close(all,true)')
global menu
global submenu
global prevchannel
prevchannel = channel
if newmenu:
menu = newmenu
submenu = True
else:
menu = channelselector.getmainlist()
submenu = False
XML = 'ShortCutMenu.xml'
if config.get_setting('icon_set') == 'dark':
XML = 'Dark' + XML
main = Main(XML, config.get_runtime_path())
main.doModal()
del main
def submenu(self):
channel_name = self.MENU.getSelectedItem().getProperty('channel')
focus = int(self.MENU.getSelectedItem().getProperty('focus'))
if channel_name == 'channelselector':
import channelselector
itemlist = self.menulist(channelselector.getchanneltypes())
elif channel_name not in ['downloads', 'setting', 'help']:
channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name])
itemlist = self.menulist(channel.mainlist(Item().fromurl(self.MENU.getSelectedItem().getProperty('run'))))
self.SUBMENU.reset()
self.SUBMENU.addItems(itemlist)
self.SUBMENU.selectItem(focus)
def context(self):
focus = self.getFocusId()
item_url = self.MENU.getSelectedItem().getProperty('run')
item = Item().fromurl(item_url)
commands = platformtools.set_context_commands(item, item_url, Item())
context = [c[0] for c in commands]
context_commands = [c[1].replace('Container.Refresh', 'RunPlugin').replace('Container.Update', 'RunPlugin') for c in commands]
index = xbmcgui.Dialog().contextmenu(context)
if index > 0: xbmc.executebuiltin(context_commands[index])
def open_shortcut_menu():
if xbmcgui.getCurrentWindowDialogId() == 9999:
main = Main('ShortCutMenu.xml', config.get_runtime_path())
main.doModal()

View File

@@ -51,27 +51,7 @@ def run(item=None):
item.__setattr__(key, val)
# If no item, this is mainlist
else:
if config.get_setting("start_page"):
if not config.get_setting("custom_start"):
dictCategory = {
config.get_localized_string(70137): 'peliculas',
config.get_localized_string(30123): 'series',
config.get_localized_string(30124): 'anime',
config.get_localized_string(60513): 'documentales',
config.get_localized_string(70171): 'torrent',
}
if not config.get_setting("category") in dictCategory.keys():
config.set_setting('category', config.get_localized_string(70137))
category = dictCategory[config.get_setting("category")]
item = Item(channel="news", action="novedades", extra=category, mode = 'silent')
else:
from platformcode import side_menu
item= Item()
item = side_menu.check_user_home(item)
item.start = True
else:
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
if not config.get_setting('show_once'):
if not config.get_all_settings_addon():
logger.error('corrupted settings.xml!!')
@@ -455,6 +435,18 @@ def play_from_library(item):
@type item: item
@param item: item with information
"""
def get_played_time(item):
if item.contentType == 'movie': nfo_path = item.nfo
else: nfo_path = item.strm_path.replace('strm','nfo')
if nfo_path and filetools.isfile(nfo_path):
from core import videolibrarytools
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
sleep(1)
played_time = platformtools.get_played_time(item_nfo)
else: played_time = 0
return played_time
import xbmcgui, xbmcplugin, xbmc
from time import sleep
@@ -482,16 +474,7 @@ def play_from_library(item):
item.play_from = 'window'
itemlist = videolibrary.findvideos(item)
p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
while platformtools.is_playing(): sleep(1)
if item.contentType == 'movie': nfo_path = item.nfo
else: nfo_path = item.strm_path.replace('strm','nfo')
if nfo_path and filetools.isfile(nfo_path):
from core import videolibrarytools
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
played_time = platformtools.get_played_time(item_nfo)
else: played_time = 0
if not played_time:
return
played = False
# The number of links to show is limited
if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
@@ -499,9 +482,16 @@ def play_from_library(item):
if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
# from core.support import dbg;dbg()
if len(itemlist) > 0:
reopen = False
while not xbmc.Monitor().abortRequested():
played = True
# The user chooses the mirror
if not platformtools.is_playing():
# from core.support import dbg;dbg()
if config.get_setting('autoplay') or reopen:
played_time = get_played_time(item)
if not played_time and played:
return
options = []
selection_implementation = 0
for item in itemlist:
@@ -525,4 +515,6 @@ def play_from_library(item):
else:
item = videolibrary.play(itemlist[selection + selection_implementation])[0]
platformtools.play_video(item)
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break
reopen = True
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break

View File

@@ -576,11 +576,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
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']))))
# Set as Home Page
if config.get_setting('start_page'):
if item.action not in ['episodios', 'seasons', 'findvideos', 'play']:
context_commands.insert(0, (config.get_localized_string(60351), "RunPlugin(%s?%s)" % (sys.argv[0], Item(channel='side_menu', action="set_custom_start", parent=item.tourl()).tourl())))
if item.channel != "videolibrary":
# Add Series to the video library
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
@@ -602,7 +597,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
context_commands.append((config.get_localized_string(60355), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
context_commands.append((config.get_localized_string(60357), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action)))
# Download episode
elif item.contentType == "episode" or item.action in ['findvideos']:
elif item.contentType == "episode" and item.action in ['findvideos']:
context_commands.append((config.get_localized_string(60356), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
# Download season
elif item.contentType == "season":
@@ -1012,7 +1007,7 @@ def get_video_seleccionado(item, seleccion, video_urls):
def set_player(item, xlistitem, mediaurl, view, strm):
logger.debug()
item.options = {'strm':False, 'continue':False}
item.options = {'strm':False}
# logger.debug("item:\n" + item.tostring('\n'))
# Moved del conector "torrent" here
@@ -1039,7 +1034,6 @@ def set_player(item, xlistitem, mediaurl, view, strm):
prevent_busy(item)
if player_mode in [1]:
item.played_time = resume_playback(get_played_time(item))
item.options['continue'] = True
logger.info('Player Mode:',['Direct', 'Bookmark'][player_mode])
# Add the listitem to a playlist

View File

@@ -7,20 +7,14 @@ def context():
context = []
# original
# if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="shortcut_menu").tourl()))
# if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts',action="Side_menu").tourl()))
# if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl()))
# pre-serialised
if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360), 'RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
if config.get_setting('Side_menu'): context.append((config.get_localized_string(70737), 'RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJTaWRlX21lbnUiLCAKICAgICJjaGFubmVsIjogInNob3J0Y3V0cyIsIAogICAgImluZm9MYWJlbHMiOiB7fQp9)'))
if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), 'RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
return context
def Side_menu(item):
from platformcode import side_menu
side_menu.open_menu(item)
def shortcut_menu(item):
from platformcode import keymaptools
keymaptools.open_shortcut_menu()
@@ -49,12 +43,13 @@ def servers_menu(item):
ids.append(server)
select = platformtools.dialog_select(config.get_localized_string(60552), names)
ID = ids[select]
if select != -1:
ID = ids[select]
it = Item(channel = 'settings',
action = action,
config = ID)
return setting.server_debrid_config(it)
it = Item(channel = 'settings',
action = action,
config = ID)
setting.server_debrid_config(it)
else:
action = 'server_config'
server_list = list(servertools.get_servers_list().keys())
@@ -65,13 +60,16 @@ def servers_menu(item):
ids.append(server)
select = platformtools.dialog_select(config.get_localized_string(60538), names)
ID = ids[select]
if select != -1:
ID = ids[select]
it = Item(channel = 'settings',
action = action,
config = ID)
it = Item(channel = 'settings',
action = action,
config = ID)
return setting.server_config(it)
setting.server_config(it)
if select != -1:
servers_menu(item)
def channels_menu(item):
import channelselector
@@ -93,13 +91,15 @@ def channels_menu(item):
ids.append(channel.channel)
select = platformtools.dialog_select(config.get_localized_string(60537), names)
ID = ids[select]
if select != -1:
ID = ids[select]
it = Item(channel='settings',
action="channel_config",
config=ID)
it = Item(channel='settings',
action="channel_config",
config=ID)
return setting.channel_config(it)
setting.channel_config(it)
return channels_menu(item)
def check_channels(item):
from specials import setting
@@ -132,6 +132,7 @@ def SettingOnPosition(item):
def select(item):
from core.support import dbg;dbg()
from platformcode import config, platformtools
# item.id = setting ID
# item.type = labels or values
@@ -146,6 +147,7 @@ def select(item):
values.append(config.get_localized_string(int(val)))
else:
values = item.values.split('|')
ID = config.get_setting(item.id) if config.get_setting(item.id) else 0
select = platformtools.dialog_select(label, values, ID)
select = platformtools.dialog_select(label, values, config.get_setting(item.id))
config.set_setting(item.id, values[select])

View File

@@ -1,364 +0,0 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# from builtins import str
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
import os
from core.item import Item
from core import jsontools
from platformcode import config, logger, launcher
import xbmc, xbmcgui
media_path = os.path.join(config.get_runtime_path(), "resources/skins/Default/media/side_menu/")
menu_settings_path = os.path.join(config.get_data_path(), "settings_channels", 'menu_settings_data.json')
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_setting_data.json', 'menu')
else:
menu_node = {'categoria actual':config.get_setting('category')}
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
def_lang = info_language[config.get_setting("info_language", "videolibrary")]
ACTION_SHOW_FULLSCREEN = 36
ACTION_GESTURE_SWIPE_LEFT = 511
ACTION_SELECT_ITEM = 7
ACTION_PREVIOUS_MENU = 10
ACTION_MOVE_LEFT = 1
ACTION_MOVE_RIGHT = 2
ACTION_MOVE_DOWN = 4
ACTION_MOVE_UP = 3
def set_menu_settings(item):
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
else:
menu_node = {}
menu_node['categoria actual'] = item.extra
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def check_user_home(item):
logger.debug()
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:
item = Item().fromurl(menu_node['user_home'])
else:
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
from platformcode import platformtools
undefined_start = platformtools.dialog_ok(config.get_localized_string(70664), config.get_localized_string(70665) + '\n' + config.get_localized_string(70666))
return item
def set_custom_start(item):
logger.debug()
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
else:
menu_node={}
parent_item= Item().fromurl(item.parent)
parent_item.start=True
config.set_setting("custom_start",True)
if config.get_setting("news_start"):
config.set_setting("news_start", False)
menu_node['user_home']=parent_item.tourl()
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def get_start_page():
logger.debug()
dictCategory = {
config.get_localized_string(70137): 'peliculas',
config.get_localized_string(30123): 'series',
config.get_localized_string(30124): 'anime',
config.get_localized_string(70018): 'infantiles',
config.get_localized_string(60513): 'documentales',
config.get_localized_string(70013): 'terror',
config.get_localized_string(30124): 'castellano',
config.get_localized_string(59976): 'latino',
config.get_localized_string(70171): 'torrent',
}
category = dictCategory[config.get_setting("category")]
custom_start= config.get_setting("custom_start")
#if category != 'definido':
if custom_start == False:
item = Item(channel="news", action="novedades", extra=category, mode='silent')
else:
item = Item()
item = side_menu.check_user_home(item)
return item
def open_menu(item):
main = Main('side_menu.xml', config.get_runtime_path())
main.doModal()
del main
def open_shortcut_menu(item):
from platformcode import keymaptools
keymaptools.open_shortcut_menu()
class Main(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.items = []
def onInit(self):
#### Kodi 18 compatibility ####
if config.get_platform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
self.focus = -1
self.buttons = []
posx= 0
posy= 145
space = 30
selected = 'selected0.png'
width = 260
height = 30
textcolor = "0xFFCCCCCC"
conditional_textcolor = "0xFF0081C2"
shadow = "0x00000000"
offsetx = 30
offsety = 5
font = 'font25_title'
if config.get_setting('start_page'):
label = config.get_localized_string(70663)
self.button_start = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=offsety)
self.addControl(self.button_start)
self.buttons.append(self.button_start)
posy += space * 2
label = config.get_localized_string(70009)
self.button_alfa = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path+selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=offsety)
self.addControl(self.button_alfa)
self.buttons.append(self.button_alfa)
posy += space
label = config.get_localized_string(30100)
self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=offsety)
self.addControl(self.button_config)
self.buttons.append(self.button_config)
posy += space*2
label = config.get_localized_string(30122)
self.button_peliculas = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
self.addControl(self.button_peliculas)
self.buttons.append(self.button_peliculas)
posy += space
label = config.get_localized_string(70017)
self.button_series = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
self.addControl(self.button_series)
self.buttons.append(self.button_series)
posy += space
label = config.get_localized_string(30124)
self.button_anime = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path+selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=offsety)
self.addControl(self.button_anime)
self.buttons.append(self.button_anime)
# posy += space
# label = config.get_localized_string(70018)
# self.button_infantil = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
# alignment=0x00000000, noFocusTexture='',
# focusTexture=media_path+selected, textColor=textcolor,
# shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
# self.addControl(self.button_infantil)
# self.buttons.append(self.button_infantil)
posy += space
label = config.get_localized_string(70019)
self.button_docu = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='',
focusTexture=media_path + selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
self.addControl(self.button_docu)
self.buttons.append(self.button_docu)
posy += space
# label = config.get_localized_string(70013)
# self.button_terror = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
# alignment=0x00000000, noFocusTexture='',
# focusTexture=media_path+selected, textColor=textcolor,
# shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
# self.addControl(self.button_terror)
# self.buttons.append(self.button_terror)
# if channelselector.auto_filter() == 'esp':
# posy += space
# label = config.get_localized_string(59981)
# self.button_lat = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
# noFocusTexture='', focusTexture=media_path+selected,
# textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
# textOffsetY=offsety)
# self.addControl(self.button_lat)
# self.buttons.append(self.button_lat)
# posy += space
# label = config.get_localized_string(70014)
# self.button_cast = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
# noFocusTexture='', focusTexture=media_path + selected,
# textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
# textOffsetY=offsety)
# self.addControl(self.button_cast)
# self.buttons.append(self.button_cast)
# posy += space
# label = config.get_localized_string(70015)
# self.button_torrent = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
# alignment=0x00000000, noFocusTexture='',
# focusTexture=media_path+selected, textColor=textcolor,
# shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
# self.addControl(self.button_torrent)
# self.buttons.append(self.button_torrent)
start_page_item = get_start_page()
if config.get_setting('start_page') and start_page_item.channel == 'news':
posy += space
label = config.get_localized_string(70016)
self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=conditional_textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
self.addControl(self.button_config)
self.buttons.append(self.button_config)
posy += space*2
label = config.get_localized_string(60423)
self.button_buscar = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=offsety)
self.addControl(self.button_buscar)
self.buttons.append(self.button_buscar)
posy += space
label = config.get_localized_string(70036)
self.button_actor = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=offsety)
self.addControl(self.button_actor)
self.buttons.append(self.button_actor)
posy += space
label = config.get_localized_string(70010)
self.button_config_search = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=conditional_textcolor, shadowColor=shadow,
textOffsetX=offsetx, textOffsetY=offsety)
self.addControl(self.button_config_search)
self.buttons.append(self.button_config_search)
label=''
self.button_close = xbmcgui.ControlButton(260, 0, 1020, 725, label, noFocusTexture='', focusTexture='')
self.addControl(self.button_close)
def onClick(self, control):
new_item=''
control = self.getControl(control).getLabel()
if control == config.get_localized_string(70663):
new_item = get_start_page()
elif control == config.get_localized_string(70009):
new_item = Item(channel='', action='getmainlist', title='Menú Alfa')
elif control == config.get_localized_string(30100):
new_item = Item(channel='setting', action="settings")
elif control == config.get_localized_string(30122):
new_item = Item(channel='news', action="novedades", extra="peliculas", mode='silent')
elif control == config.get_localized_string(70017):
new_item = Item(channel='news', action="novedades", extra="series", mode='silent')
elif control == config.get_localized_string(30124):
new_item = Item(channel='news', action="novedades", extra="anime", mode='silent')
elif control == config.get_localized_string(70018):
new_item = Item(channel='news', action="novedades", extra="infantiles", mode='silent')
elif control == config.get_localized_string(70019):
new_item = Item(channel='news', action="novedades", extra="documentales", mode='silent')
elif control == config.get_localized_string(70013):
new_item = Item(channel='news', action="novedades", extra="terror", mode='silent')
elif control == config.get_localized_string(59981):
new_item = Item(channel='news', action="novedades", extra="castellano", mode='silent')
elif control == config.get_localized_string(70014):
new_item = Item(channel='news', action="novedades", extra="latino", mode='silent')
elif control == config.get_localized_string(70015):
new_item = Item(channel='news', action="novedades", extra="torrent", mode='silent')
elif control == config.get_localized_string(70016):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
if 'categoria actual' in menu_node:
category = menu_node['categoria actual']
new_item = Item(channel='news', action="setting_channel", extra=category, menu=True)
elif control == config.get_localized_string(60423):
new_item = Item(channel='search', action="search")
elif control == config.get_localized_string(70036):
new_item = Item(channel='tvmoviedb', title="Buscar actor/actriz", action="search_",
search={'url': 'search/person', 'language': def_lang, 'page': 1}, star=True)
elif control == config.get_localized_string(70010):
new_item = Item(channel='search', action="setting_channel")
elif control == '':
self.close()
if new_item !='':
self.run_action(new_item)
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU or action == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92:
self.close()
if action == ACTION_MOVE_RIGHT or action == ACTION_MOVE_DOWN:
self.focus += 1
if self.focus > len(self.buttons)-1:
self.focus = 0
while True:
id_focus = str(self.buttons[self.focus].getId())
if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
self.setFocus(self.buttons[self.focus])
break
self.focus += 1
if action == ACTION_MOVE_LEFT or action == ACTION_MOVE_UP:
self.focus -= 1
if self.focus < 0:
self.focus = len(self.buttons) - 1
while True:
id_focus = str(self.buttons[self.focus].getId())
if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
self.setFocus(self.buttons[self.focus])
break
self.focus -= 1
def run_action(self, item):
logger.debug()
if item.menu != True:
self.close()
xbmc.executebuiltin("Container.update(%s)"%launcher.run(item))

View File

@@ -34,6 +34,7 @@ def mark_auto_as_watched(item):
marked = False
sync = False
next_episode = None
show_server = True
@@ -60,7 +61,10 @@ def mark_auto_as_watched(item):
if actual_time > mark_time and not marked:
logger.info("Marked as Watched")
item.playcount = 1
if item.options['strm'] : marked = True
marked = True
item.played_time = 0
platformtools.set_played_time(item)
if item.options['strm'] : sync = True
show_server = False
from specials import videolibrary
videolibrary.mark_content_as_watched2(item)
@@ -68,7 +72,7 @@ def mark_auto_as_watched(item):
break
# check for next Episode
if next_episode and marked and time_from_end >= difference:
if next_episode and sync and time_from_end >= difference:
nextdialog = NextDialog(ND, config.get_runtime_path())
nextdialog.show()
while platformtools.is_playing() and not nextdialog.is_exit():
@@ -80,20 +84,20 @@ def mark_auto_as_watched(item):
break
xbmc.sleep(1000)
if item.options['continue']:
if 120 < actual_time < (total_time / 100) * 80:
item.played_time = actual_time
else: item.played_time = 0
platformtools.set_played_time(item)
# if item.options['continue']:
if actual_time < mark_time:
item.played_time = actual_time
else: item.played_time = 0
platformtools.set_played_time(item)
# Silent sync with Trakt
if marked and config.get_setting("trakt_sync"): sync_trakt_kodi()
if sync and config.get_setting("trakt_sync"): sync_trakt_kodi()
while platformtools.is_playing():
xbmc.sleep(100)
if not show_server and item.play_from != 'window' and not item.no_return:
xbmc.sleep(700)
xbmc.executebuiltin('Action(Back)')
xbmc.executebuiltin('Action(ParentDir)')
xbmc.sleep(500)
if next_episode and next_episode.next_ep:
from platformcode.launcher import play_from_library