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

@@ -1,4 +1,4 @@
<addon id="plugin.video.kod" name="Kodi on Demand" version="1.5.1" provider-name="KoD Team">
<addon id="plugin.video.kod" name="Kodi on Demand" version="1.5.2" provider-name="KoD Team">
<requires>
<!-- <import addon="script.module.libtorrent" optional="true"/> -->
<import addon="metadata.themoviedb.org"/>
@@ -26,9 +26,12 @@
<screenshot>resources/media/themes/ss/2.png</screenshot>
<screenshot>resources/media/themes/ss/3.png</screenshot>
</assets>
<news>- corretta e migliorata la nuova ricerca globale
- salvataggio punto di visione basato sull'id tmdb (disponibile su qualunque canale / server anche senza salvare in videoteca)
- alcuni fix e migliore</news>
<news>- Migliorato Menu Rapido
- Rimosso Menu Laterale
- Fix Youtube
- Fix Visualizza collegamenti della videoteca come pop-up
- Riorganizzata sezione Aiuto
- Reinserito canale tantifilm</news>
<description lang="it">Naviga velocemente sul web e guarda i contenuti presenti</description>
<disclaimer>[COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR]
[COLOR yellow]Kodi © is a registered trademark of the XBMC Foundation. We are not connected to or in any other way affiliated with Kodi, Team Kodi, or the XBMC Foundation. Furthermore, any software, addons, or products offered by us will receive no support in official Kodi channels, including the Kodi forums and various social networks.[/COLOR]</disclaimer>

View File

@@ -32,7 +32,7 @@
"ilgeniodellostreaming": "https://ilgeniodellostreaming.cat",
"ilgeniodellostreaming_cam": "https://ilgeniodellostreaming.gold",
"italiaserie": "https://italiaserie.best",
"mediasetplay": "https://www.mediasetplay.mediaset.it",
"mediasetplay": "https://www.mediasetplay.mediaset.it",
"mondoserietv": "https://mondoserietv.fun",
"piratestreaming": "https://www.piratestreaming.date",
"polpotv": "https://roma.polpo.tv",

View File

@@ -24,7 +24,8 @@ entries = 'https://api.one.accedo.tv/content/entries?id={id}&locale=it'
sessionUrl = "https://api.one.accedo.tv/session?appKey=59ad346f1de1c4000dfd09c5&uuid={uuid}&gid=default"
current_session = requests.Session()
current_session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(), 'Referer': support.config.get_channel_url()})
current_session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(),
'Referer': support.config.get_channel_url()})
# login anonimo
res = current_session.post(loginUrl, json=loginData, verify=False)

View File

@@ -5,6 +5,7 @@
import json, requests
from core import support
from platformcode import logger
host = support.config.get_channel_url()
session = requests.Session()
@@ -173,6 +174,7 @@ def episodios(item):
plot=it['plot'],
action='findvideos',
contentType='episode',
contentSerieName=item.fulltitle,
url=host + '/watch/' + str(episodes['title_id']) + '?e=' + str(it['id'])))
support.videolibrary(itemlist, item)
@@ -185,5 +187,8 @@ def findvideos(item):
support.info()
itemlist=[]
url = support.match(support.match(item).data.replace('&quot;','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match
itemlist=[item.clone(title=support.config.get_localized_string(30137), server='directo', url=url, action='play')]
for res in ['480p', '720p', '1080p']:
newurl = '{}/{}'.format(url, res)
if session.head(newurl, headers=headers).status_code == 200:
itemlist += [item.clone(title=support.config.get_localized_string(30137), server='directo', url=newurl, quality=res, action='play')]
return support.server(item, itemlist=itemlist)

View File

@@ -2,7 +2,7 @@
"id": "tantifilm",
"name": "Tantifilm",
"language": ["ita"],
"active": false,
"active": true,
"thumbnail": "tantifilm.png",
"banner": "tantifilm.png",
"categories": ["tvshow", "movie", "anime"],

View File

@@ -20,7 +20,7 @@ def findhost(url):
host = config.get_channel_url(findhost)
headers = [['Referer', host]]
player_iframe = r'<iframe src="([^"]+)"[^>]+></iframe>\s?<div class="player'
player_iframe = r'<iframe.*?src="([^"]+)"[^>]+></iframe>\s*<div class="player'
@support.menu
def mainlist(item):
@@ -49,11 +49,12 @@ def mainlist(item):
@support.scrape
def peliculas(item):
# debug=True
if item.args == 'search':
patron = r'<a href="(?P<url>[^"]+)" title="Permalink to\s*(?P<title>[^"]+) \((?P<year>[0-9]+)[^<]*\)[^"]*"[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)".*?<div class="calitate">\s*<p>(?P<quality>[^<]+)<\/p>'
else:
patronNext = r'<a class="nextpostslink" rel="next" href="([^"]+)">'
patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*<img[^s]+src="([^"]+)"[^>]+>\s*<\/a>[^>]+>[^>]+>[^>]+>(?P<title>.+?)(?P<lang>[sSuUbB\-iItTaA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)'
patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?'
patronBlock = r'<div id="main_col">(?P<block>.*?)<!\-\- main_col \-\->'
# if item.args != 'all' and item.args != 'search':
@@ -63,60 +64,49 @@ def peliculas(item):
return locals()
@support.scrape
def episodios(item):
info()
if not item.data:
data_check = httptools.downloadpage(item.url, headers=headers).data
data_check = re.sub('\n|\t', ' ', data_check)
data_check = re.sub(r'>\s+<', '> <', data_check)
else:
data_check = item.data
data = httptools.downloadpage(scrapertools.find_single_match(data_check, player_iframe), headers=headers).data
data = data.replace("'", '"')
data = re.sub('\n|\t', ' ', data)
data = re.sub(r'>\s+<', '> <', data)
def get_season(pageData, seas_url, season):
data = ''
episodes = support.match(pageData if pageData else seas_url, patronBlock=patron_episode, patron=patron_option).matches
for episode_url, episode in episodes:
title = season + "x" + episode.zfill(2) + ' - ' + item.fulltitle
data += title + '|' + episode_url + '\n'
return data
patronBlock = r'Stagioni<\/a>.*?<ul class="nav navbar-nav">(?P<block>.*?)<\/ul>'
patron = r'<a href="(?P<url>[^"]+)"\s*>\s*<i[^>]+><\/i>\s*(?P<episode>\d+)<\/a>'
# debugBlock = True
patron_season = 'Stagioni<\/a>.*?<ul class="nav navbar-nav">(.*?)<\/ul>'
patron_episode = 'Episodio<\/a>.*?<ul class="nav navbar-nav">(?P<block>.*?)<\/ul>'
patron_option = r'<a href="([^"]+?)".*?>[^>]+></i>\s*(\d+)'
otherLinks = support.match(data_check, patronBlock='<div class="content-left-film">.*?Keywords', patron='([0-9]+)(?:×|x)([0-9]+(?:-[0-9]+)?)(.*?)(?:<br|$)').matches
url = support.match(item, patron=player_iframe).match
seasons = support.match(url, patronBlock=patron_season, patron=patron_option)
data = ''
import sys
if sys.version_info[0] >= 3: from concurrent import futures
else: from concurrent_py2 import futures
with futures.ThreadPoolExecutor() as executor:
thL = []
for i, season in enumerate(seasons.matches):
thL.append(executor.submit(get_season, seasons.data if i == 0 else '', season[0], season[1]))
for res in futures.as_completed(thL):
if res.result():
data += res.result()
patron = r'(?P<season>\d+)x(?P<episode>\d+)\s*-\s*(?P<title>[^\|]+)\|(?P<url>[^ ]+)'
action = 'findvideos'
def itemlistHook(itemlist):
retItemlist = []
itemlist.sort(key=lambda item: (item.infoLabels['season'], item.infoLabels['episode']))
return itemlist
for item in itemlist:
item.contentType = 'episode'
season = unify.remove_format(item.title)
season_data = httptools.downloadpage(item.url).data
season_data = re.sub('\n|\t', ' ', season_data)
season_data = re.sub(r'>\s+<', '> <', season_data)
# block = scrapertools.find_single_match(season_data, 'Episodi.*?<ul class="nav navbar-nav">(.*?)</ul>')
episodes = scrapertools.find_multiple_matches(season_data, '<a.*?href="(?P<url>[^"]+)"[^>]+>Episodio (?P<episode>[0-9]+)(?::\s*(?P<title2>[^<]+))?')
for url, episode in episodes:
i = item.clone()
i.action = 'findvideos'
i.url = url
i.contentSeason = str(season)
i.contentEpisodeNumber = str(episode)
i.title = str(season) + 'x' + str(episode)
for ep in otherLinks:
if int(ep[0]) == int(season) and int(ep[1].split('-')[-1]) == int(episode):
i.otherLinks = ep[2]
break
retItemlist.append(i)
retItemlist.sort(key=lambda e: (int(e.contentSeason), int(e.contentEpisodeNumber)))
return retItemlist
# debugBlock = True
return locals()
@support.scrape
def category(item):
blacklist = ['Serie TV Altadefinizione', 'HD AltaDefinizione', 'Al Cinema', 'Serie TV', 'Miniserie', 'Programmi Tv', 'Live', 'Trailers', 'Serie TV Aggiornate', 'Aggiornamenti', 'Featured']
blacklist = ['Ultimi Film Aggiornati', 'Anime', 'Serie TV Altadefinizione', 'HD AltaDefinizione', 'Al Cinema', 'Serie TV', 'Miniserie', 'Programmi Tv', 'Live', 'Trailers', 'Serie TV Aggiornate', 'Aggiornamenti', 'Featured']
patron = '<li><a href="(?P<url>[^"]+)"><span></span>(?P<title>[^<]+)</a></li>'
patron_block = '<ul class="table-list">(.*?)</ul>'
action = 'peliculas'
@@ -185,6 +175,9 @@ def findvideos(item):
item.contentType = 'tvshow'
item.data = data
return episodios(item)
else:
item.contentTitle = item.fulltitle
item.contentType = 'movie'
# if 'protectlink' in data:
# urls = scrapertools.find_multiple_matches(data, r'<iframe src="[^=]+=(.*?)"')

View File

@@ -12,9 +12,6 @@ def getmainlist(view="thumb_"):
logger.debug()
itemlist = list()
if config.dev_mode():
itemlist.append(Item(title="Redirect", action="check_channels", thumbnail='',
category=config.get_localized_string(30119), viewmode="thumbnails"))
# Main Menu Channels
if addon.getSetting('enable_news_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist",

View File

@@ -62,11 +62,13 @@ def start(itemlist, item):
# Save the current value of "Action and Player Mode" in preferences
user_config_setting_action = config.get_setting("default_action")
user_config_setting_player = config.get_setting("player_mode")
# user_config_setting_player = config.get_setting("player_mode")
# Enable the "View in high quality" action (if the server returns more than one quality, eg gdrive)
if not user_config_setting_action: config.set_setting("default_action", 2)
# if user_config_setting_player != 0: config.set_setting("player_mode", 0)
# Priorities when ordering itemlist:
# 0: Servers and qualities
# 1: Qualities and servers
@@ -208,8 +210,6 @@ def start(itemlist, item):
videoitem = autoplay_elem['videoitem']
if videoitem.server.lower() not in max_intentos_servers:
max_intentos_servers[videoitem.server.lower()] = max_intentos
if videoitem.server.lower() in ['youtube'] and user_config_setting_player != 0:
config.set_setting("player_mode", 0)
# If the maximum number of attempts of this server have been reached, we jump to the next
if max_intentos_servers[videoitem.server.lower()] == 0:
@@ -269,7 +269,7 @@ def start(itemlist, item):
# Restore if necessary the previous value of "Action and Player Mode" in preferences
if not user_config_setting_action: config.set_setting("default_action", user_config_setting_action)
config.set_setting("player_mode", user_config_setting_player)
# if user_config_setting_player != 0: config.set_setting("player_mode", user_config_setting_player)
return itemlist

View File

@@ -142,9 +142,9 @@ class Downloader(object):
# We stop downloading
self._state = self.states.stopped
for t in self._threads:
if t.isAlive(): t.join()
if t.is_alive(): t.join()
if self._save_thread.isAlive(): self._save_thread.join()
if self._save_thread.is_alive(): self._save_thread.join()
if self._seekable:
# Guardamos la info al final del archivo

View File

@@ -815,36 +815,50 @@ def typo(string, typography=''):
string = string
typography.lower()
if 'capitalize' in typography:
string = string.capitalize()
typography = typography.replace('capitalize', '')
if 'uppercase' in typography:
string = string.upper()
typography = typography.replace('uppercase', '')
if 'lowercase' in typography:
string = string.lower()
typography = typography.replace('lowercase', '')
if '[]' in typography:
string = '[' + string + ']'
typography = typography.replace('[]', '')
if '()' in typography:
string = '(' + string + ')'
typography = typography.replace('()', '')
if 'submenu' in typography:
if VLT: string = "•• " + string
else: string = string
typography = typography.replace('submenu', '')
if 'color kod' in typography:
string = '[COLOR ' + kod_color + ']' + string + '[/COLOR]'
typography = typography.replace('color kod', '')
elif 'color' in typography:
color = scrapertools.find_single_match(typography, 'color ([a-zA-Z0-9]+)')
string = '[COLOR ' + color + ']' + string + '[/COLOR]'
typography = typography.replace('color ' + color, '')
if 'bold' in typography:
string = '[B]' + string + '[/B]'
typography = typography.replace('bold', '')
if 'italic' in typography:
string = '[I]' + string + '[/I]'
typography = typography.replace('italic', '')
if '_' in typography:
string = ' ' + string
typography = typography.replace('_', '')
if '--' in typography:
string = ' - ' + string
typography = typography.replace('--', '')
if 'bullet' in typography:
if VLT: string = '[B]' + "" + '[/B] ' + string
else: string = string
typography = typography.replace('bullet', '')
typography = typography.strip()
if typography: string = string + '{' + typography + '}'
return string

View File

@@ -269,7 +269,7 @@ def wait_for_update_trakt():
t = Thread(update_all)
t.setDaemon(True)
t.start()
t.isAlive()
t.is_alive()
def update_all():
# from core.support import dbg;dbg()

View File

@@ -49,6 +49,8 @@ def read_nfo(path_nfo, item=None):
data = "\n".join(data.splitlines()[1:])
it_nfo = Item().fromjson(data)
if not it_nfo.library_playcounts: # may be corrupted
it_nfo.library_playcounts = {}
if item:
it = item.clone()

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

View File

@@ -1937,7 +1937,7 @@ msgid "FILTER SAVED"
msgstr ""
msgctxt "#60447"
msgid "FAQ:"
msgid "Guide (opens the browser)"
msgstr ""
msgctxt "#60448"

View File

@@ -1936,8 +1936,8 @@ msgid "FILTER SAVED"
msgstr "FILTRO SALVATO"
msgctxt "#60447"
msgid "FAQ:"
msgstr "FAQ:"
msgid "Guide (opens the browser)"
msgstr "Guida alle funzioni di KoD (apre il browser)"
msgctxt "#60448"
msgid " - How do I report an error?"

View File

@@ -148,7 +148,7 @@
<!-- Contextual -->
<setting label="30024" type="lsep"/>
<setting id="quick_menu" type="bool" label="60360" default="true"/>
<setting id="side_menu" type="bool" label="70737" default="false"/>
<!-- <setting id="side_menu" type="bool" label="70737" default="false"/> -->
<setting id="kod_menu" type="bool" label="60026" default="true"/>
<setting id="infoplus" type="bool" label="70151" default="false"/>
<!-- <setting id="infoplus_set" type="bool" label="70128" visible="eq(-1,true)" default="false" subsetting="true"/> -->
@@ -157,13 +157,6 @@
<setting label="30998" type="lsep"/>
<setting id="shortcut_key" type="action" label="30999" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIg0KfQ==)"/>
<setting id="delete_key" type="action" label="31000" action="RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJkZWxldGVfa2V5Igp9==)"/>
<!-- Custom Start -->
<setting label="70715" type="lsep"/>
<setting id="start_page" type="bool" label="70121" default="false"/>
<setting id="custom_start" type="bool" label="70122" default="false" visible="eq(-1,True)" enable="eq(-1,True)+eq(1,False)" subsetting="true"/>
<setting id="news_start" type="bool" label="70123" default="false" visible="eq(-2,True)" enable="eq(-1,False)+eq(-2,True)" subsetting="true"/>
<setting id="category" type="action" label="70124" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiJzZWxlY3QiLA0KICAgICJjaGFubmVsIjoic2hvcnRjdXRzIiwNCgkiaWQiOiJjYXRlZ29yeSIsDQoJInR5cGUiOiJsYWJlbHMiLA0KCSJ2YWx1ZXMiOiI3MDEzN3wzMDEyM3wzMDEyNHw2MDUxMyIsDQoJImxhYmVsIjoiNzAxMjQiDQp9)" visible="eq(-3,True)+eq(-1,True)+eq(-2,False)" enable="eq(-3,True)+eq(-1,True)+eq(-2,False)" subsetting="true"/>
<!-- <setting id="category" type="select" label="70124" lvalues="70137|30123|30124|60513" default="Film" visible="eq(-3,True)+eq(-1,True)+eq(-2,False)" enable="eq(-3,True)+eq(-1,True)+(-2,false)"/> -->
<!-- Others -->
<setting label="70149" type="lsep"/>
<setting id="icon_set" type="select" label="70108" values="default|light|dark|mike" default="default"/>

View File

@@ -1,114 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
<depth>0.52</depth>
<coordinates>
<left>0</left>
<top>0</top>
</coordinates>
<controls>
<!-- CLOSE BUTTON / BACKGROUND -->
<control type="button">
<left>0</left>
<top>0</top>
<width>100%</width>
<height>100%</height>
<texturefocus colordiffuse="80DCDCDC">white.png</texturefocus>
<texturenofocus colordiffuse="80DCDCDC">white.png</texturenofocus>
<animation effect="fade" time="200">WindowOpen</animation>
<animation effect="fade" time="200">WindowClose</animation>
<onclick>Action(close)</onclick>
</control>
<!-- GROUP CONTROLS -->
<control type="group">
<left>100</left>
<top>250</top>
<animation type="WindowOpen" reversible="false">
<effect type="slide" start="0,100" end="0,0" delay="160" time="160" />
<effect type="fade" delay="160" end="100" time="100" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="slide" start="0,0" end="0,100" delay="160" time="160" />
<effect type="fade" delay="160" start="100" end="0" time="100" />
</animation>
<!-- SCROLLBAR -->
<control type="scrollbar" id="61">
<visible allowhiddenfocus="true">Control.HasFocus(61)</visible>
<animation effect="slide" start="0,0" end="0,-9" time="100">Unfocus</animation>
<animation effect="slide" start="0,-9" end="0,0" time="100">Focus</animation>
<left>0</left>
<top>219</top>
<width>1100</width>
<height>10</height>
<texturesliderbackground colordiffuse="FFDCDCDC">white.png</texturesliderbackground>
<texturesliderbar colordiffuse="FF1f1f1f">white.png</texturesliderbar>
<texturesliderbarfocus colordiffuse="FF0082C2">white.png</texturesliderbarfocus>
<showonepage>false</showonepage>
<orientation>horizontal</orientation>
<ondown>32500</ondown>
</control>
<!-- BACKGROUND -->
<control type="image">
<width>1100</width>
<height>218</height>
<texture colordiffuse="FFDCDCDC">white.png</texture>
</control>
<control type="list" id="32500">
<left>-130</left>
<top>-1</top>
<width>1100</width>
<height>220</height>
<onup>32501</onup>
<ondown>61</ondown>
<orientation>horizontal</orientation>
<scrolltime>200</scrolltime>
<pagecontrol>61</pagecontrol>
<animation effect="slide" start="0,0" end="10,0" time="0" condition="true">Conditional</animation>
<animation effect="slide" end="120,0" time="0" condition="!Control.IsVisible(5)">Conditional</animation>
<itemlayout height="220" width="220">
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
</itemlayout>
<focusedlayout height="220" width="220">
<control type="image">
<top>1</top>
<width>220</width>
<height>218</height>
<texture colordiffuse="550082C2">white.png</texture>
</control>
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
<control type="textbox">
<left>0</left>
<top>160</top>
<width>220</width>
<height>74</height>
<font>font13</font>
<textcolor>FF232323</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
<control type="image">
<left>90</left>
<top>0</top>
<width>40</width>
<height>40</height>
<texture colordiffuse="FF232323">$INFO[ListItem.Property(sub)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
</focusedlayout>
</control>
</control> <!-- GROUP CONTROLS END -->
</controls>
</window>

View File

@@ -6,22 +6,29 @@
<top>0</top>
</coordinates>
<controls>
<!-- CLOSE BUTTON / BACKGROUND -->
<control type="button">
<description>Close Button</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>100%</height>
<texturefocus colordiffuse="80232323">white.png</texturefocus>
<texturenofocus colordiffuse="80232323">white.png</texturenofocus>
<texturefocus colordiffuse="77232323">white.png</texturefocus>
<texturenofocus colordiffuse="77232323">white.png</texturenofocus>
<animation effect="fade" time="200">WindowOpen</animation>
<animation effect="fade" time="200">WindowClose</animation>
<onclick>Action(close)</onclick>
<onup>100</onup>
<ondown>100</ondown>
<onleft>100</onleft>
<onright>100</onright>
</control>
<!-- GROUP CONTROLS -->
<control type="group">
<description>Group Controls</description>
<left>100</left>
<top>250</top>
<width>1100</width>
<height>220</height>
<animation type="WindowOpen" reversible="false">
<effect type="slide" start="0,100" end="0,0" delay="160" time="160" />
<effect type="fade" delay="160" end="100" time="100" />
@@ -30,84 +37,157 @@
<effect type="slide" start="0,0" end="0,100" delay="160" time="160" />
<effect type="fade" delay="160" start="100" end="0" time="100" />
</animation>
<!-- SCROLLBAR -->
<control type="scrollbar" id="61">
<visible allowhiddenfocus="true">Control.HasFocus(61)</visible>
<animation effect="slide" start="0,0" end="0,-9" time="100">Unfocus</animation>
<animation effect="slide" start="0,-9" end="0,0" time="100">Focus</animation>
<left>0</left>
<top>219</top>
<width>1100</width>
<height>10</height>
<texturesliderbackground colordiffuse="FF232323">white.png</texturesliderbackground>
<texturesliderbar colordiffuse="FF1f1f1f">white.png</texturesliderbar>
<texturesliderbarfocus colordiffuse="FF0082C2">white.png</texturesliderbarfocus>
<showonepage>false</showonepage>
<orientation>horizontal</orientation>
<ondown>32500</ondown>
</control>
<!-- BACKGROUND -->
<control type="image">
<width>1100</width>
<height>218</height>
<texture colordiffuse="FF232323">white.png</texture>
<description>Background</description>
<top>0</top>
<left>0</left>
<width>100%</width>
<height>100%</height>
<texture colordiffuse="Container(1).ListItem.Property(background)">white.png</texture>
</control>
<control type="list" id="32500">
<left>-130</left>
<top>-1</top>
<width>1100</width>
<control type="grouplist">
<description>Group List</description>
<top>0</top>
<left>0</left>
<width>100%</width>
<height>220</height>
<onup>32501</onup>
<ondown>61</ondown>
<orientation>horizontal</orientation>
<scrolltime>200</scrolltime>
<pagecontrol>61</pagecontrol>
<animation effect="slide" start="0,0" end="10,0" time="0" condition="true">Conditional</animation>
<animation effect="slide" end="120,0" time="0" condition="!Control.IsVisible(5)">Conditional</animation>
<itemlayout height="220" width="220">
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
</itemlayout>
<focusedlayout height="220" width="220">
<control type="image">
<top>1</top>
<width>220</width>
<height>218</height>
<texture colordiffuse="FF0082C2">white.png</texture>
</control>
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
<control type="textbox">
<left>0</left>
<top>160</top>
<width>220</width>
<height>74</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
<control type="image">
<left>90</left>
<top>0</top>
<width>40</width>
<height>40</height>
<texture>$INFO[ListItem.Property(sub)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
</focusedlayout>
<orientation>vertical</orientation>
<control type="list" id="1">
<description>Menu</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>220</height>
<onup>32501</onup>
<ondown>61</ondown>
<orientation>horizontal</orientation>
<scrolltime>200</scrolltime>
<pagecontrol>61</pagecontrol>
<itemlayout height="220" width="220">
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
</itemlayout>
<focusedlayout height="220" width="220">
<control type="image">
<top>1</top>
<width>220</width>
<height>218</height>
<texture colordiffuse="Container(1).ListItem.Property(select)">white.png</texture>
</control>
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
<control type="textbox">
<description>Selected Item</description>
<left>0</left>
<top>180</top>
<width>100%</width>
<height>40</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
</focusedlayout>
</control>
<control type="list" id="2">
<description>Submenu</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>220</height>
<onup>32501</onup>
<ondown>61</ondown>
<orientation>horizontal</orientation>
<scrolltime>200</scrolltime>
<pagecontrol>61</pagecontrol>
<itemlayout height="220" width="220">
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
</itemlayout>
<focusedlayout height="220" width="220">
<control type="image">
<top>1</top>
<width>220</width>
<height>218</height>
<texture colordiffuse="Container(1).ListItem.Property(select)">white.png</texture>
</control>
<control type="image">
<width>220</width>
<height>220</height>
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
<aspectratio>keep</aspectratio>
<align>center</align>
</control>
<control type="textbox">
<description>Selected Item</description>
<left>0</left>
<top>180</top>
<width>100%</width>
<height>40</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
</focusedlayout>
</control>
</control>
<control type="button" id='101'>
<visible>!String.IsEmpty(Container(1).ListItem.Property(sub)) + !Control.HasFocus(2) + !Control.HasFocus(102)</visible>
<animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(101)">Conditional</animation>
<!-- <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,0)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,1)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,2)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,3)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,4)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,5)">Conditional</animation> -->
<left>520</left>
<top>240</top>
<width>60</width>
<height>60</height>
<texturefocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturefocus>
<texturenofocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturenofocus>
<aspectratio>keep</aspectratio>
</control>
<control type="button" id='102'>
<visible>!Control.HasFocus(1) + !Control.HasFocus(101)</visible>
<animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(102)">Conditional</animation>
<!-- <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,0)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,1)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,2)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,3)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,4)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,5)">Conditional</animation> -->
<left>520</left>
<top>-80</top>
<width>60</width>
<height>60</height>
<texturefocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturefocus>
<texturenofocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturenofocus>
<aspectratio>keep</aspectratio>
</control>
</control> <!-- GROUP CONTROLS END -->
</controls>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
<coordinates>
<left>0</left>
<top>0</top>
</coordinates>
<zorder>1</zorder>
<controls>
<control type="image">
<animation type="WindowOpen" reversible="true">
<effect type="slide" start="-200" end="0" time="250"/>
</animation>
<left>0</left>
<top>0</top>
<width>260</width>
<height>725</height>
<texture border="2">side_menu/bg0.png</texture>
</control>
<control type="image">
<left>25</left>
<top>30</top>
<width>200</width>
<height>70</height>
<texture border="2">side_menu/logo.png</texture>
</control>
</controls>
</window>

View File

@@ -13,7 +13,7 @@ from platformcode import logger, config, platformtools
# real_host = 'wstream.video'
errorsStr = ['Sorry this file is not longer available', 'Sorry this video is unavailable', 'Video is processing'
'File was deleted', 'Not Found']
'File was deleted', 'Not Found', 'This server is in maintenance mode. Refresh this page in some minutes.']
def test_video_exists(page_url):

View File

@@ -1,5 +1,5 @@
# s-*- coding: utf-8 -*-
import xbmc, xbmcaddon, sys, re
from core import httptools, scrapertools, filetools
from platformcode import config, logger, platformtools
@@ -21,20 +21,17 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
logger.debug("(page_url='%s')" % page_url)
video_urls = []
if not page_url.startswith("http"):
page_url = "http://www.youtube.com/watch?v=%s" % page_url
logger.debug(" page_url->'%s'" % page_url)
video_id = scrapertools.find_single_match(page_url, '(?:v=|embed/)([A-z0-9_-]{11})')
inputstream = platformtools.install_inputstream()
# from core.support import dbg;dbg()
try:
__settings__ = Addon(name)
if inputstream: __settings__.setSetting('kodion.video.quality.mpd', 'true')
else: __settings__.setSetting('kodion.video.quality.mpd', 'false')
video_urls = [['con YouTube', 'plugin://plugin.video.youtube/play/?video_id=' + video_id ]]
# video_urls = [['con YouTube', 'plugin://plugin.video.youtube/play/?video_id=' + video_id ]]
except:
if filetools.exists(xbmc.translatePath('special://profile/addons/' + name)):
path = xbmc.translatePath('special://home/addons/' + name)
if filetools.exists(path):
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70818)):
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "' + name + '", "enabled": true }}')
else: return [['','']]
@@ -42,7 +39,15 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
xbmc.executebuiltin('InstallAddon(' + name + ')', wait=True)
try: Addon(name)
except: return [['','']]
my_addon = xbmcaddon.Addon('plugin.video.youtube')
addon_dir = xbmc.translatePath( my_addon.getAddonInfo('path') )
sys.path.append(filetools.join( addon_dir, 'resources', 'lib' ) )
from youtube_resolver import resolve
for stream in resolve(page_url):
# title = scrapertools.find_single_match(stream['title'], '(\d+p)')
if scrapertools.find_single_match(stream['title'], r'(\d+p)'):
video_urls.append([re.sub(r'(\[[^\]]+\])', '', stream['title']), stream['url']])
video_urls.sort(key=lambda it: int(it[0].split("p", 1)[0]))
return get_video_url(page_url)
return video_urls

View File

@@ -65,7 +65,7 @@ QUALITYTAG = 505
EPISODESLIST = 200
SERVERLIST = 300
class SearchWindow(xbmcgui.WindowXMLDialog):
class SearchWindow(xbmcgui.WindowXML):
def start(self, item, moduleDict={}, searchActions=[]):
logger.debug()
self.exit = False
@@ -83,6 +83,8 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.searchActions = searchActions
self.thread = None
self.selected = False
self.pos = 0
selfeppos = 0
self.items = []
if not searchActions:
@@ -479,8 +481,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
global close_action
action = action.getId()
focus = self.getFocusId()
if action in [FULLSCREEN]:
self.playmonitor()
if action in [CONTEXT] and focus in [RESULTS, EPISODESLIST, SERVERLIST]:
self.context()
@@ -500,7 +501,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.RESULTS.addItems(items)
self.RESULTS.selectItem(subpos)
elif action in [DOWN] and focus in [BACK, CLOSE, MENU]:
elif (action in [DOWN] and focus in [BACK, CLOSE, MENU]) or focus not in [BACK, CLOSE, MENU, SERVERLIST, EPISODESLIST, RESULTS, CHANNELS]:
if self.SERVERS.isVisible(): self.setFocusId(SERVERLIST)
elif self.EPISODES.isVisible(): self.setFocusId(EPISODESLIST)
elif self.RESULTS.isVisible(): self.setFocusId(RESULTS)
@@ -556,10 +557,10 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.actors()
elif search == 'persons':
item = self.item.clone(mode='person_', discovery=self.persons[pos])
self.close()
# self.close()
Search(item, self.moduleDict, self.searchActions)
if not close_action:
self.doModal()
if close_action:
self.close
else:
item = Item().fromurl(self.RESULTS.getSelectedItem().getProperty('item'))
if self.item.mode == 'movie': item.contentTitle = self.RESULTS.getSelectedItem().getLabel()
@@ -574,10 +575,10 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.RESULTS.setVisible(True)
self.PROGRESS.setVisible(False)
self.close()
# self.close()
Search(item, self.moduleDict, self.searchActions)
if not close_action:
self.doModal()
if close_action:
self.close()
elif control_id in [RESULTS, EPISODESLIST]:
busy(True)
@@ -586,7 +587,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.pos = self.RESULTS.getSelectedPosition()
item = Item().fromurl(self.RESULTS.getSelectedItem().getProperty('item'))
else:
self.pos = self.EPISODESLIST.getSelectedPosition()
self.eppos = self.EPISODESLIST.getSelectedPosition()
item_url = self.EPISODESLIST.getSelectedItem().getProperty('item')
if item_url:
item = Item().fromurl(item_url)
@@ -663,14 +664,12 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
if config.get_setting('autoplay'):
busy(False)
self.playmonitor()
else:
self.episodes = self.itemsResult if self.itemsResult else []
self.itemsResult = []
ep = []
for item in self.episodes:
# if item.action == 'findvideos':
it = xbmcgui.ListItem(item.title)
it.setProperty('item', item.tourl())
ep.append(it)
@@ -688,9 +687,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
elif control_id in [SERVERLIST]:
server = Item().fromurl(self.getControl(control_id).getSelectedItem().getProperty('item'))
return self.playmonitor(server)
# server.globalsearch = True
# return run(server)
return self.play(server)
def Back(self):
self.getControl(QUALITYTAG).setText('')
@@ -701,7 +698,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
else:
self.Focus(SEARCH)
self.setFocusId(RESULTS)
self.RESULTS.selectItem(self.pos)
self.RESULTS.selectItem(self.eppos)
elif self.EPISODES.isVisible():
self.episodes = []
self.Focus(SEARCH)
@@ -740,23 +737,9 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
if index > 0: xbmc.executebuiltin(context_commands[index])
def playmonitor(self, server=None):
if server:
platformtools.prevent_busy(server)
server.window = True
server.globalsearch = True
if server in ['torrent']: Thread(target=run, args=[server]).start()
else: run(server)
try:
while not platformtools.is_playing() or not xbmc.Player().getTime() > 0:
xbmc.sleep(500)
self.close()
xbmc.sleep(500)
while xbmcgui.getCurrentWindowId() in [12005, 12006]:
xbmc.sleep(500)
if platformtools.is_playing():
xbmc.sleep(300)
xbmc.executebuiltin('Action(Fullscreen)')
self.doModal()
except:
return
def play(self, server=None):
platformtools.prevent_busy(server)
server.window = True
server.globalsearch = True
return run(server)

View File

@@ -1,40 +1,9 @@
# -*- coding: utf-8 -*-
import os
from channelselector import get_thumb
from core.item import Item
from platformcode import config, logger, platformtools
if config.is_xbmc():
import xbmcgui
class TextBox(xbmcgui.WindowXMLDialog):
""" Create a skinned textbox window """
def __init__(self, *args, **kwargs):
self.title = kwargs.get('title')
self.text = kwargs.get('text')
self.doModal()
def onInit(self):
try:
self.getControl(5).setText(self.text)
self.getControl(1).setLabel(self.title)
except:
pass
def onClick(self, control_id):
pass
def onFocus(self, control_id):
pass
def onAction(self, action):
# self.close()
if action in [xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]:
self.close()
from platformcode import config, logger
guideUrl = "https://github.com/kodiondemand/addon/wiki/Guida-alle-funzioni-di-Kod"
def mainlist(item):
logger.debug()
@@ -44,119 +13,11 @@ def mainlist(item):
itemlist.append(Item(title=config.get_localized_string(707429), channel="setting", action="report_menu",
thumbnail=get_thumb("error.png"), viewmode="list",folder=True))
itemlist.append(Item(channel=item.channel, action="", title=config.get_localized_string(60447),
thumbnail=get_thumb("help.png"),
itemlist.append(Item(action="open_browser", title=config.get_localized_string(60447),
thumbnail=get_thumb("help.png"), url=guideUrl, plot=guideUrl,
folder=False))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60449),
thumbnail=get_thumb("help.png"),
folder=False, extra="onoff_canales"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60450),
thumbnail=get_thumb("help.png"),
folder=False, extra="trakt_sync"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60451),
thumbnail=get_thumb("help.png"),
folder=False, extra="buscador_juntos"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60452),
thumbnail=get_thumb("help.png"),
folder=False, extra="tiempo_enlaces"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60453),
thumbnail=get_thumb("help.png"),
folder=False, extra="prob_busquedacont"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60454),
thumbnail=get_thumb("help.png"),
folder=False, extra="canal_fallo"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(70280),
thumbnail=get_thumb("help.png"),
folder=False, extra="prob_torrent"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60455),
thumbnail=get_thumb("help.png"),
folder=False, extra="prob_bib"))
itemlist.append(Item(channel=item.channel, action="faq",
title=config.get_localized_string(60456),
thumbnail=get_thumb("help.png"),
folder=False, extra=""))
itemlist.append(Item(channel="setting", action="check_quickfixes", folder=False, thumbnail=get_thumb("update.png"),
title=config.get_localized_string(30001), plot=config.get_addon_version(with_fix=True)))
return itemlist
def faq(item):
if item.extra == "onoff_canales":
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60458))
if respuesta == 1:
from specials import setting
setting.conf_tools(Item(extra='channels_onoff'))
elif item.extra == "trakt_sync":
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60459))
if respuesta == 1:
from specials import videolibrary
videolibrary.channel_config(Item(channel='videolibrary'))
elif item.extra == "tiempo_enlaces":
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60460))
if respuesta == 1:
from specials import videolibrary
videolibrary.channel_config(Item(channel='videolibrary'))
elif item.extra == "prob_busquedacont":
title = config.get_localized_string(60461) % item.title[6:]
text = config.get_localized_string(60462)
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
elif item.extra == "canal_fallo":
title = config.get_localized_string(60461) % item.title[6:]
text = config.get_localized_string(60463)
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
elif item.extra == "prob_bib":
platformtools.dialog_ok(config.get_localized_string(60457), # To check
config.get_localized_string(60464))
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457),
config.get_localized_string(60465))
if respuesta == 1:
itemlist = []
from specials import setting
new_item = Item(channel="setting", action="submenu_tools", folder=True)
itemlist.extend(setting.submenu_tools(new_item))
return itemlist
elif item.extra == "prob_torrent":
title = config.get_localized_string(60461) % item.title[6:]
text = config.get_localized_string(70279)
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
elif item.extra == "buscador_juntos":
respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60466))
if respuesta == 1:
from specials import search
search.settings("")
elif item.extra == "report_error":
import xbmc
if config.get_platform(True)['num_version'] < 14:
log_name = "xbmc.log"
else:
log_name = "kodi.log"
ruta = xbmc.translatePath("special://logpath") + log_name
title = config.get_localized_string(60461) % item.title[6:]
text = config.get_localized_string(60467) % ruta
return TextBox("DialogTextViewer.xml", os.getcwd(), "Default", title=title, text=text)
else:
platformtools.dialog_ok(config.get_localized_string(60457), # To check "Tag telegram"
config.get_localized_string(60468))

View File

@@ -26,7 +26,7 @@ from datetime import datetime
from core.item import Item
from platformcode import config, logger, platformtools
from core import filetools, jsontools
from core import filetools, jsontools, support
def fechahora_actual():
@@ -189,30 +189,24 @@ def mainlist(item):
for i_perfil, perfil in enumerate(alfav.user_favorites):
context = []
context.append({'title': config.get_localized_string(70533), 'channel': item.channel, 'action': 'editar_perfil_titulo',
'i_perfil': i_perfil})
context.append({'title': config.get_localized_string(70534), 'channel': item.channel, 'action': 'eliminar_perfil',
'i_perfil': i_perfil})
context.append({'title': config.get_localized_string(70533), 'channel': item.channel, 'action': 'editar_perfil_titulo', 'i_perfil': i_perfil})
context.append({'title': config.get_localized_string(70534), 'channel': item.channel, 'action': 'eliminar_perfil', 'i_perfil': i_perfil})
if i_perfil > 0:
context.append({'title': config.get_localized_string(70535), 'channel': item.channel, 'action': 'mover_perfil',
'i_perfil': i_perfil, 'direccion': 'top'})
context.append({'title': config.get_localized_string(70536), 'channel': item.channel, 'action': 'mover_perfil',
'i_perfil': i_perfil, 'direccion': 'arriba'})
context.append({'title': config.get_localized_string(70535), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'top'})
context.append({'title': config.get_localized_string(70536), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'arriba'})
if i_perfil < last_i:
context.append({'title': config.get_localized_string(70537), 'channel': item.channel, 'action': 'mover_perfil',
'i_perfil': i_perfil, 'direccion': 'abajo'})
context.append({'title': config.get_localized_string(70538), 'channel': item.channel, 'action': 'mover_perfil',
'i_perfil': i_perfil, 'direccion': 'bottom'})
context.append({'title': config.get_localized_string(70537), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'abajo'})
context.append({'title': config.get_localized_string(70538), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'bottom'})
plot = str(len(perfil['items'])) + " " + config.get_localized_string(70723)
itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context))
itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context, thumbnail=support.thumb('mylink.png')))
itemlist.append(item.clone(action='crear_perfil', title=config.get_localized_string(70542), folder=False))
itemlist.append(item.clone(action='mainlist_listas', title=config.get_localized_string(70603)))
return itemlist
return support.thumb(itemlist)
def mostrar_perfil(item):
@@ -230,13 +224,13 @@ def mostrar_perfil(item):
for i_enlace, enlace in enumerate(alfav.user_favorites[i_perfil]['items']):
it = Item().fromurl(enlace)
it.context = [ {'title': '[COLOR blue]'+config.get_localized_string(70617)+'[/COLOR]', 'channel': item.channel, 'action': 'acciones_enlace',
it.context = [ {'title': config.get_localized_string(70617), 'channel': item.channel, 'action': 'acciones_enlace',
'i_enlace': i_enlace, 'i_perfil': i_perfil} ]
it.plot += '[CR][CR][COLOR blue]' + config.get_localized_string(70724) + ':[/COLOR] ' + it.channel + ' [COLOR blue]' + config.get_localized_string(60266) + ':[/COLOR] ' + it.action
if it.extra != '': it.plot += ' [COLOR blue]Extra:[/COLOR] ' + it.extra
it.plot += '[CR][COLOR blue]Url:[/COLOR] ' + it.url if isinstance(it.url, str) else '...'
if it.date_added != '': it.plot += '[CR][COLOR blue]' + config.get_localized_string(70469) + ':[/COLOR] ' + it.date_added
it.plot += '[CR][CR]' + config.get_localized_string(70724) + ': ' + it.channel + ' ' + config.get_localized_string(60266) + ': ' + it.action
if it.extra != '': it.plot += ' Extra: ' + it.extra
it.plot += '[CR]Url: ' + it.url if isinstance(it.url, str) else '...'
if it.date_added != '': it.plot += '[CR]' + config.get_localized_string(70469) + ': ' + it.date_added
# If it is not a url, nor does it have the system path, convert the path since it will have been copied from another device.
# It would be more optimal if the conversion was done with an import menu, but at the moment it is controlled in run-time.

View File

@@ -246,15 +246,15 @@ def novedades(item):
list_canales, any_active = get_channels_list()
if config.is_xbmc():
from platformcode import side_menu
if mode=='silent' and any_active and len(list_canales[item.extra]) > 0:
side_menu.set_menu_settings(item)
aux_list=[]
for canal in list_canales[item.extra]:
if len(aux_list)<2:
aux_list.append(canal)
list_canales[item.extra]=aux_list
# if config.is_xbmc():
# from platformcode import side_menu
# if mode=='silent' and any_active and len(list_canales[item.extra]) > 0:
# side_menu.set_menu_settings(item)
# aux_list=[]
# for canal in list_canales[item.extra]:
# if len(aux_list)<2:
# aux_list.append(canal)
# list_canales[item.extra]=aux_list
if mode == 'set_cache':
list_canales[item.extra] = list_canales[item.extra][2:]
@@ -290,7 +290,7 @@ def novedades(item):
# Multi Thread mode: wait for all threads to finish
if multithread:
pendent = [a for a in threads if a.isAlive()]
pendent = [a for a in threads if a.is_alive()]
t = float(100) / len(pendent)
while pendent:
index = (len(threads) - len(pendent)) + 1
@@ -308,7 +308,7 @@ def novedades(item):
break
time.sleep(0.5)
pendent = [a for a in threads if a.isAlive()]
pendent = [a for a in threads if a.is_alive()]
if mode == 'normal':
mensaje = config.get_localized_string(60522) % (len(list_newest), time.time() - start_time)
progreso.update(100, mensaje)

View File

@@ -21,7 +21,7 @@ from core.item import Item
from core import tmdb, scrapertools, channeltools, filetools, jsontools, servertools
from channelselector import get_thumb
from platformcode import logger, config, platformtools, unify
from core.support import typo
from core.support import typo, thumb
import xbmcgui
import gc
@@ -697,11 +697,18 @@ def discover_list(item):
year = scrapertools.find_single_match(release, r'(\d{4})')
if not item.cast_ or (item.cast_ and (int(year) <= int(datetime.datetime.today().year))):
new_item = Item(channel='search', title=typo(title, 'bold'), infoLabels=elem,
action='channel_search', text=title,
thumbnail=thumbnail, fanart=fanart,
context='', mode=mode, contentType=mode,
release_date=year)
if config.get_setting('new_search'):
new_item = Item(channel='globalsearch', title=typo(title, 'bold'), infoLabels=elem,
action='Search', text=title,
thumbnail=thumbnail, fanart=fanart,
context='', mode='search', type = mode, contentType=mode,
release_date=year, folder = False)
else:
new_item = Item(channel='search', title=typo(title, 'bold'), infoLabels=elem,
action='channel_search', text=title,
thumbnail=thumbnail, fanart=fanart,
context='', mode=mode, contentType=mode,
release_date=year)
if tvshow:
new_item.contentSerieName = title
@@ -718,14 +725,13 @@ def discover_list(item):
elif len(result) > 19 and item.discovery:
item.discovery['page'] = str(int(item.discovery['page']) + 1)
itemlist.append(Item(channel=item.channel, action='discover_list', title=config.get_localized_string(70065),
list_type=item.list_type, discovery=item.discovery, text_color='gold'))
itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'),
list_type=item.list_type, discovery=item.discovery, thumbnail=thumb()))
elif len(result) > 19:
next_page = str(int(item.page) + 1)
itemlist.append(Item(channel=item.channel, action='discover_list', title=config.get_localized_string(70065),
list_type=item.list_type, search_type=item.search_type, mode=item.mode, page=next_page,
text_color='gold'))
itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'),
list_type=item.list_type, search_type=item.search_type, mode=item.mode, page=next_page, thumbnail=thumb()))
return itemlist

View File

@@ -371,47 +371,6 @@ def settings(item):
config.open_settings()
def submenu_tools(item):
logger.debug()
itemlist = list()
# Custom tools
import os
channel_custom = os.path.join(config.get_runtime_path(), 'channels', 'custom.py')
if not filetools.exists(channel_custom):
user_custom = os.path.join(config.get_data_path(), 'custom.py')
if filetools.exists(user_custom):
filetools.copy(user_custom, channel_custom, silent=True)
if filetools.exists(channel_custom):
itemlist.append(Item(channel='custom', action='mainlist', title='Custom Channel'))
itemlist.append(Item(channel=CHANNELNAME, action="check_quickfixes", folder=False,
title=config.get_localized_string(30001), plot=config.get_addon_version(with_fix=True)))
# itemlist.append(Item(channel=CHANNELNAME, action="update_quasar", folder=False,
# title=config.get_localized_string(70569)))
itemlist.append(Item(channel=CHANNELNAME, action="", title="", folder=False,
thumbnail=get_thumb("setting_0.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60564) + ":", action="", folder=False,
text_bold=True, thumbnail=get_thumb("channels.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60565), action="conf_tools",
folder=True, extra="lib_check_datajson", thumbnail=get_thumb("channels.png")))
if config.get_videolibrary_support():
itemlist.append(Item(channel=CHANNELNAME, action="", title="", folder=False,
thumbnail=get_thumb("setting_0.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60566) + ":", action="", folder=False,
text_bold=True, thumbnail=get_thumb("videolibrary.png")))
itemlist.append(Item(channel=CHANNELNAME, action="restore_tools", folder=False,
thumbnail=get_thumb("videolibrary.png"),
title="- " + config.get_localized_string(60567)))
itemlist.append(Item(channel="videolibrary", action="update_videolibrary", folder=False,
thumbnail=get_thumb("videolibrary.png"),
title="- " + config.get_localized_string(60568)))
return itemlist
def check_quickfixes(item):
logger.debug()

View File

@@ -358,11 +358,11 @@ try:
self.control_list.addItems(self.items)
self.setFocus(self.control_list)
def onClick(self, id):
global window_select, result
# Cancel button y [X]
if id == 7:
window_select[-1].close()
if id == 5:
global window_select, result
self.result = "_no_video"
result = "no_video"
self.close()

View File

@@ -408,9 +408,14 @@ def details(item):
title = item.contentType.replace("movie", config.get_localized_string(70283)).replace("tvshow", "serie")
# Search by titles chosen language and / or original version and Spanish
itemlist.append(item.clone(channel='search', action="new_search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, mode=item.contentType))
if item.infoLabels['originaltitle'] and item.contentTitle != item.infoLabels['originaltitle']:
itemlist.append(item.clone(channel='search', action="search", search_text=item.infoLabels['originaltitle'], title=config.get_localized_string(70070) % item.infoLabels['originaltitle'], mode=item.contentType))
if config.get_setting('new_search'):
itemlist.append(item.clone(channel='globalsearch', action="Search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, mode='search', type=item.contentType))
if item.infoLabels['originaltitle'] and item.contentTitle != item.infoLabels['originaltitle']:
itemlist.append(item.clone(channel='globalsearch', action="Search", search_text=item.infoLabels['originaltitle'], title=config.get_localized_string(70070) % item.infoLabels['originaltitle'], mode='search', type=item.contentType))
else:
itemlist.append(item.clone(channel='search', action="new_search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, mode=item.contentType))
if item.infoLabels['originaltitle'] and item.contentTitle != item.infoLabels['originaltitle']:
itemlist.append(item.clone(channel='search', action="search", search_text=item.infoLabels['originaltitle'], title=config.get_localized_string(70070) % item.infoLabels['originaltitle'], mode=item.contentType))
# if langt != "es" and langt != "en" and item.infoLabels["tmdb_id"]:
# tmdb_lang = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_searching=def_lang)
@@ -2035,7 +2040,7 @@ def top_mal(item):
# data = re.sub(r"\n|\r|\t|&nbsp;", "", data)
# data = re.sub(r"\s{2}", " ", data)
patron = r'<td class="title al va-t word-break"><a.*?href="([^"]+)"[^>]+><img.*?src="([^"]+).*?<div class="di-ib clearfix">.*?href.*?>([^<]+)<.*?<div class="information di-ib mt4">(.*?)<br>.*?(\d{4}|-).*?<span class="text.*?>(.*?)</span>'
patron = r'<td class="title al va-t word-break">\s*<a.*?href="([^"]+)"[^>]+>\s*<img.*?src="([^"]+).*?<div class="di-ib clearfix">.*?href.*?>([^<]+)<.*?<div class="information di-ib mt4">(.*?)<br>.*?(\d{4}|-).*?<span class="text.*?>(.*?)</span>'
matches = match(item, patron=patron)
for url, thumbnail, title, info, year, rating in matches.matches:
new_item = item.clone(action="details_mal", url=url)
@@ -2155,13 +2160,20 @@ def details_mal(item):
if item.infoLabels['fanart']: item.fanart = item.infoLabels['fanart']
if item.infoLabels['thumbnail']: item.thumbnail = item.infoLabels['thumbnail']
if not item.thumbnail: item.thumbnail = match(data, patron=r'/pics">.*?<img src="([^"]+)"').match.replace(".jpg", "l.jpg")
if config.get_setting('new_search'):
itemlist.append(item.clone(action="Search", channel='globalsearch', title=config.get_localized_string(70350) % title_mal, text=title_mal, mode=item.args.replace("tv", "tvshow"), contentType=item.args.replace("tv", "tvshow"), thumbnail=thumb('search')))
if item.infoLabels["title"] and title_mal != item.infoLabels["title"]:
itemlist.append(item.clone(action="Search", channel='globalsearch', search_text=item.infoLabels["title"], title=config.get_localized_string(70351) % item.infoLabels["title"], mode=item.args.replace("tv", "tvshow"), contentType=item.args.replace("tv", "tvshow"), thumbnail=thumb('search')))
itemlist.append(item.clone(action="new_search", channel='search', title=config.get_localized_string(70350) % title_mal, search_text=title_mal, args=item.args.replace("tv", "anime"), thumbnail=thumb('search')))
if item.infoLabels["title"] and title_mal != item.infoLabels["title"]:
itemlist.append(item.clone(action="new_search", channel='search', search_text=item.infoLabels["title"], title=config.get_localized_string(70351) % item.infoLabels["title"], thumbnail=thumb('search')))
if eng_title and item.contentTitle != eng_title and title_mal != eng_title:
itemlist.append(item.clone(action="Search", channel='globalsearch', search_text=eng_title, title=config.get_localized_string(70352) % eng_title, mode=item.args.replace("tv", "tvshow"), contentType=item.args.replace("tv", "tvshow"), thumbnail=thumb('search')))
else:
itemlist.append(item.clone(action="new_search", channel='search', title=config.get_localized_string(70350) % title_mal, search_text=title_mal, args=item.args.replace("tv", "anime"), thumbnail=thumb('search')))
if item.infoLabels["title"] and title_mal != item.infoLabels["title"]:
itemlist.append(item.clone(action="new_search", channel='search', search_text=item.infoLabels["title"], title=config.get_localized_string(70351) % item.infoLabels["title"], thumbnail=thumb('search')))
if eng_title and item.contentTitle != eng_title and title_mal != eng_title:
itemlist.append(item.clone(action="new_search", channel='search', search_text=eng_title, title=config.get_localized_string(70352) % eng_title, thumbnail=thumb('search')))
if eng_title and item.contentTitle != eng_title and title_mal != eng_title:
itemlist.append(item.clone(action="new_search", channel='search', search_text=eng_title, title=config.get_localized_string(70352) % eng_title, thumbnail=thumb('search')))
if item_tmdb.args == "tv" and ob_tmdb.result:
itemlist.append(item.clone(action="info_seasons", title=config.get_localized_string(70067) % item.infoLabels["number_of_seasons"], thumbnail=thumb('info')))

View File

@@ -64,15 +64,17 @@ def list_tvshows(item):
logger.debug()
itemlist = []
lista = []
tvshows_path = []
# tvshows_path = []
# We get all the tvshow.nfo from the SERIES video library recursively
for root, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH):
for f in folders:
tvshows_path += [filetools.join(root, f, "tvshow.nfo")]
# # We get all the tvshow.nfo from the SERIES video library recursively
# for root, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH):
# for f in folders:
# tvshows_path += [filetools.join(root, f, "tvshow.nfo")]
root = videolibrarytools.TVSHOWS_PATH
with futures.ThreadPoolExecutor() as executor:
for tvshow_path in tvshows_path:
for folder in filetools.listdir(root):
tvshow_path = filetools.join(root, folder, "tvshow.nfo")
item_tvshow, value = executor.submit(get_results, tvshow_path, root, 'tvshow').result()
# verify the existence of the channels
if item_tvshow.library_urls and len(item_tvshow.library_urls) > 0:
@@ -394,7 +396,10 @@ def findvideos(item):
logger.debug("Unable to search for videos due to lack of parameters")
return []
content_title = str(item.contentSeason) + 'x' + (str(item.contentEpisodeNumber) if item.contentEpisodeNumber > 9 else '0' + str(item.contentEpisodeNumber))
if item.contentEpisodeNumber:
content_title = str(item.contentSeason) + 'x' + (str(item.contentEpisodeNumber) if item.contentEpisodeNumber > 9 else '0' + str(item.contentEpisodeNumber))
else:
content_title = item.contentTitle.strip().lower()
if item.contentType == 'movie':
item.strm_path = filetools.join(videolibrarytools.MOVIES_PATH, item.strm_path)
path_dir = filetools.dirname(item.strm_path)
@@ -1127,8 +1132,8 @@ def add_download_items(item, itemlist):
thumbnail=thumb('downloads'),
parent=item.tourl())
if item.action == 'findvideos':
if item.contentType == 'episode':
downloadItem.title = typo(config.get_localized_string(60356), "color kod bold")
if item.contentType != 'movie':
downloadItem.title = '{} {}'.format(typo(config.get_localized_string(60356), "color kod bold"), item.title)
else: # film
downloadItem.title = typo(config.get_localized_string(60354), "color kod bold")
downloadItem.downloadItemlist = [i.tourl() for i in itemlist]

View File

@@ -57,7 +57,6 @@
<td class="col-xs-9" colspan="3">
{%- if test_case.stdout %}<p style="white-space: pre-line;">{{ test_case.stdout|e }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.err[0].__name__ }}: {{ test_case.err[1] }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.test_exception_info }}</p>{% endif %}
</td>
</tr>
{%- endif %}

View File

@@ -6,7 +6,7 @@
# export PYTHONPATH=/home/user/.kodi/addons/plugin.video.kod
# export KOD_TST_CH=channel
# python tests/test_generic.py
import html
import os
import sys
import unittest
@@ -141,23 +141,33 @@ chNumRis = {
servers = []
channels = []
channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")]
logger.info(channel_list)
# channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")]
channel_list = [Item(channel='tantifilm', action="mainlist")]
logger.info([c.channel for c in channel_list])
ret = []
logger.record = True
for chItem in channel_list:
try:
ch = chItem.channel
if ch not in chBlackList:
module = __import__('channels.%s' % ch, fromlist=["channels.%s" % ch])
hasChannelConfig = False
mainlist = module.mainlist(Item())
menuItemlist = {}
logMenu = {}
serversFound = {}
ch = chItem.channel
if ch not in chBlackList:
hasChannelConfig = False
mainlist = []
module = None
error = None
menuItemlist = {}
serversFound = {}
logMenu = {}
for it in mainlist:
try:
module = __import__('channels.%s' % ch, fromlist=["channels.%s" % ch])
mainlist = module.mainlist(Item())
except:
import traceback
logger.error(traceback.format_exc())
error = logger.recordedLog
logger.recordedLog = ''
for it in mainlist:
try:
print('preparing ' + ch + ' -> ' + it.title)
if it.action == 'channel_config':
@@ -165,6 +175,8 @@ for chItem in channel_list:
continue
if it.action == 'search': # channel-specific
continue
menuItemlist[it.title] = []
itemlist = getattr(module, it.action)(it)
menuItemlist[it.title] = itemlist
logMenu[it.title] = logger.recordedLog
@@ -180,19 +192,24 @@ for chItem in channel_list:
if serversFound[it.title]:
if hasattr(module, 'play'):
serversFound[it.title] = [getattr(module, 'play')(resIt)[0] for srv in serversFound[it.title]]
tmp = []
for srv in serversFound[it.title]:
itPlay = getattr(module, 'play')(srv)
if itPlay:
tmp.append(itPlay[0])
serversFound[it.title] = tmp
servers.extend(
{'name': srv.server.lower(), 'server': srv} for srv in serversFound[it.title] if srv.server)
break
except:
import traceback
logger.error(traceback.format_exc())
logMenu[it.title] = logger.recordedLog
logger.recordedLog = ''
channels.append(
{'ch': ch, 'hasChannelConfig': hasChannelConfig, 'mainlist': mainlist, 'menuItemlist': menuItemlist,
'serversFound': serversFound, 'module': module, 'logMenu': logMenu})
except:
import traceback
logger.error(traceback.format_exc())
print(logger.recordedLog)
logger.recordedLog = ''
channels.append(
{'ch': ch, 'hasChannelConfig': hasChannelConfig, 'mainlist': mainlist, 'menuItemlist': menuItemlist,
'serversFound': serversFound, 'module': module, 'logMenu': logMenu, 'error': error})
logger.record = False
@@ -211,6 +228,7 @@ for s in servers:
@parameterized.parameterized_class(channels)
class GenericChannelTest(unittest.TestCase):
def test_mainlist(self):
self.assertIsNone(self.error, self.error)
self.assertTrue(self.mainlist, 'channel ' + self.ch + ' has no mainlist')
self.assertTrue(self.hasChannelConfig, 'channel ' + self.ch + ' has no channel config')
@@ -255,25 +273,22 @@ class GenericChannelMenuItemTest(unittest.TestCase):
self.assertEqual(chNumRis[self.ch][content], risNum,
'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results<br>'
+ str(risNum) + ' but should be ' + str(chNumRis[self.ch][content]) + '<br>' +
'<br>'.join([i.title for i in self.itemlist if not i.nextPage]))
'<br>'.join([html.escape(i.title) for i in self.itemlist if not i.nextPage]))
break
for resIt in self.itemlist:
logger.info(resIt.title + ' -> ' + resIt.url)
self.assertLess(len(resIt.fulltitle), 110,
'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong titles<br>' + resIt.fulltitle)
'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong titles:<br>' + html.escape(resIt.fulltitle))
if resIt.url:
self.assertIsInstance(resIt.url, str,
'channel ' + self.ch + ' -> ' + self.title + ' -> ' + resIt.title + ' contain non-string url')
'channel ' + self.ch + ' -> ' + self.title + ' -> ' + html.escape(resIt.title) + ' contain non-string url')
self.assertIsNotNone(re.match(validUrlRegex, resIt.url),
'channel ' + self.ch + ' -> ' + self.title + ' -> ' + resIt.title + ' might contain wrong url<br>' + resIt.url)
'channel ' + self.ch + ' -> ' + self.title + ' -> ' + html.escape(resIt.title) + ' might contain wrong url<br>' + html.escape(resIt.url))
if 'year' in resIt.infoLabels and resIt.infoLabels['year']:
msgYear = 'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong infolabels year<br>' + str(
resIt.infoLabels['year'])
self.assert_(type(resIt.infoLabels['year']) is int or resIt.infoLabels['year'].isdigit(),
msgYear)
self.assert_(int(resIt.infoLabels['year']) > 1900 and int(resIt.infoLabels['year']) < 2100,
msgYear)
msgYear = 'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong infolabels year:<br>' + html.escape(str(resIt.infoLabels['year']))
self.assert_(type(resIt.infoLabels['year']) is int or resIt.infoLabels['year'].isdigit(), msgYear)
self.assert_(1900 < int(resIt.infoLabels['year']) < 2100, msgYear)
if resIt.title == typo(config.get_localized_string(30992), 'color kod bold'): # next page
nextPageItemlist = getattr(self.module, resIt.action)(resIt)
@@ -326,5 +341,7 @@ if __name__ == '__main__':
if 'KOD_TST_CH' not in os.environ:
unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(report_name='report', add_timestamp=False, combine_reports=True,
report_title='KoD Test Suite', template=os.path.join(config.get_runtime_path(), 'tests', 'template.html')), exit=False)
import webbrowser
webbrowser.open(os.path.join(config.get_runtime_path(), 'reports', 'report.html'))
else:
unittest.main()