Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -3,19 +3,9 @@
|
||||
# XBMC Launcher (xbmc / kodi)
|
||||
# ------------------------------------------------------------
|
||||
|
||||
#from future import standard_library
|
||||
#standard_library.install_aliases()
|
||||
#from builtins import str
|
||||
import sys
|
||||
import sys, os
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
# if PY3:
|
||||
# import urllib.error as urllib2 # It is very slow in PY2. In PY3 it is native
|
||||
# else:
|
||||
# import urllib2 # We use the native of PY2 which is faster
|
||||
|
||||
import os
|
||||
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
from core.item import Item
|
||||
from platformcode import config, logger, platformtools
|
||||
@@ -65,11 +55,7 @@ def run(item=None):
|
||||
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(70014): 'castellano',
|
||||
config.get_localized_string(59976): 'latino',
|
||||
config.get_localized_string(70171): 'torrent',
|
||||
}
|
||||
if not config.get_setting("category") in dictCategory.keys():
|
||||
@@ -155,18 +141,10 @@ def run(item=None):
|
||||
import urllib.request as urllib
|
||||
except ImportError:
|
||||
import urllib
|
||||
short = urllib.urlopen(
|
||||
'https://u.nu/api.php?action=shorturl&format=simple&url=' + item.url).read().decode('utf-8')
|
||||
platformtools.dialog_ok(config.get_localized_string(20000),
|
||||
config.get_localized_string(70740) % short)
|
||||
short = urllib.urlopen('https://u.nu/api.php?action=shorturl&format=simple&url=' + item.url).read().decode('utf-8')
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % short)
|
||||
# Action in certain channel specified in "action" and "channel" parameters
|
||||
else:
|
||||
# # Actualiza el canal individual
|
||||
# if (item.action == "mainlist" and item.channel != "channelselector" and
|
||||
# config.get_setting("check_for_channel_updates") == True):
|
||||
# from core import updater
|
||||
# updater.update_channel(item.channel)
|
||||
|
||||
# Checks if channel exists
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
CHANNELS = 'channels'
|
||||
@@ -181,8 +159,7 @@ def run(item=None):
|
||||
|
||||
if os.path.exists(channel_file):
|
||||
try:
|
||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None,
|
||||
None, ['%s.%s' % (CHANNELS, item.channel)])
|
||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None, None, ['%s.%s' % (CHANNELS, item.channel)])
|
||||
except ImportError:
|
||||
exec("import " + CHANNELS + "." + item.channel + " as channel")
|
||||
|
||||
@@ -211,7 +188,7 @@ def run(item=None):
|
||||
item.isFavourite = True
|
||||
platformtools.play_video(item)
|
||||
|
||||
# Permitir varias calidades desde play en el canal
|
||||
# Permitir varias calidades desde play en el Channel
|
||||
elif len(itemlist) > 0 and isinstance(itemlist[0], list):
|
||||
item.video_urls = itemlist
|
||||
platformtools.play_video(item)
|
||||
@@ -310,21 +287,7 @@ def run(item=None):
|
||||
|
||||
platformtools.render_items(itemlist, item)
|
||||
|
||||
# except urllib2.URLError as e:
|
||||
# import traceback
|
||||
# logger.error(traceback.format_exc())
|
||||
#
|
||||
# # Grab inner and third party errors
|
||||
# if hasattr(e, 'reason'):
|
||||
# logger.error("Reason for the error, code: %s | Reason: %s" % (str(e.reason[0]), str(e.reason[1])))
|
||||
# texto = config.get_localized_string(30050) # "No se puede conectar con el sitio web"
|
||||
# platformtools.dialog_ok(config.get_localized_string(20000), texto)
|
||||
#
|
||||
# # Grab server response errors
|
||||
# elif hasattr(e, 'code'):
|
||||
# logger.error("HTTP error code: %d" % e.code)
|
||||
# # "El sitio web no funciona correctamente (error http %d)"
|
||||
# platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(30051) % e.code)
|
||||
|
||||
except WebErrorException as e:
|
||||
import traceback
|
||||
from core import scrapertools
|
||||
@@ -332,10 +295,10 @@ def run(item=None):
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + '([^.]+)\.py"'
|
||||
canal = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
|
||||
platformtools.dialog_ok(
|
||||
config.get_localized_string(59985) + canal,
|
||||
config.get_localized_string(59985) + Channel,
|
||||
config.get_localized_string(60013) %(e))
|
||||
except:
|
||||
import traceback
|
||||
@@ -344,7 +307,7 @@ def run(item=None):
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + '([^.]+)\.py"'
|
||||
canal = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
|
||||
try:
|
||||
import xbmc
|
||||
@@ -356,15 +319,12 @@ def run(item=None):
|
||||
except:
|
||||
log_message = ""
|
||||
|
||||
if canal:
|
||||
if Channel:
|
||||
if item.url:
|
||||
if platformtools.dialog_yesno(config.get_localized_string(60087) % canal, config.get_localized_string(60014),
|
||||
log_message, nolabel='ok', yeslabel=config.get_localized_string(70739)):
|
||||
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), log_message, nolabel='ok', yeslabel=config.get_localized_string(70739)):
|
||||
run(Item(action="open_browser", url=item.url))
|
||||
else:
|
||||
platformtools.dialog_ok(config.get_localized_string(60087) % canal,
|
||||
config.get_localized_string(60014),
|
||||
log_message)
|
||||
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), log_message)
|
||||
else:
|
||||
platformtools.dialog_ok(
|
||||
config.get_localized_string(60038),
|
||||
@@ -384,8 +344,7 @@ def reorder_itemlist(itemlist):
|
||||
modified = 0
|
||||
not_modified = 0
|
||||
|
||||
to_change = [[config.get_localized_string(60335), '[V]'],
|
||||
[config.get_localized_string(60336), '[D]']]
|
||||
to_change = [[config.get_localized_string(60335), '[V]'], [config.get_localized_string(60336), '[D]']]
|
||||
|
||||
for item in itemlist:
|
||||
if not PY3:
|
||||
@@ -441,7 +400,7 @@ def limit_itemlist(itemlist):
|
||||
|
||||
|
||||
def play_from_library(item):
|
||||
itemlist=[]
|
||||
# from core.support import dbg;dbg()
|
||||
"""
|
||||
The .strm files when played from kodi, this expects it to be a "playable" file so it cannot contain
|
||||
more items, at most a selection dialog can be placed.
|
||||
@@ -452,28 +411,49 @@ def play_from_library(item):
|
||||
@type item: item
|
||||
@param item: item with information
|
||||
"""
|
||||
item.fromLibrary = True
|
||||
logger.info()
|
||||
# logger.debug("item: \n" + item.tostring('\n'))
|
||||
|
||||
import xbmcgui
|
||||
import xbmcplugin
|
||||
import xbmc
|
||||
import xbmcgui, xbmcplugin, xbmc
|
||||
from time import sleep, time
|
||||
from specials import nextep
|
||||
|
||||
def show_server(item, itemlist, p_dialog):
|
||||
if item.show_server:
|
||||
# The number of links to show is limited
|
||||
if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
|
||||
# The list of links is slightly "cleaned"
|
||||
if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
|
||||
|
||||
p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
|
||||
|
||||
if len(itemlist) > 0:
|
||||
while not xbmc.Monitor().abortRequested():
|
||||
# The user chooses the mirror
|
||||
options = []
|
||||
for item in itemlist: options.append(item.title)
|
||||
# The selection window opens
|
||||
if (item.contentSerieName and item.contentSeason and item.contentEpisodeNumber): head = ("%s - %sx%s | %s" % (item.contentSerieName, item.contentSeason, item.contentEpisodeNumber, config.get_localized_string(30163)))
|
||||
else: head = config.get_localized_string(30163)
|
||||
selection = platformtools.dialog_select(head, options)
|
||||
if selection == -1:
|
||||
return
|
||||
else:
|
||||
item = videolibrary.play(itemlist[selection])[0]
|
||||
item.play_from = 'window'
|
||||
platformtools.play_video(item)
|
||||
if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break
|
||||
|
||||
itemlist=[]
|
||||
item.fromLibrary = True
|
||||
logger.info()
|
||||
logger.debug("item: \n" + item.tostring('\n'))
|
||||
|
||||
# We try to reproduce an image (this does nothing and also does not give an error)
|
||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||
|
||||
# Just in case the image did (in future versions) we give stop to stop the reproduction
|
||||
# sleep(0.5) ### If you don't put this on you crash Kodi
|
||||
xbmc.Player().stop()
|
||||
|
||||
# we modify the action (currently the video library needs "findvideos" since this is where the sources are searched
|
||||
item.action = "findvideos"
|
||||
check_next_ep = nextep.check(item)
|
||||
|
||||
|
||||
window_type = config.get_setting("window_type", "videolibrary")
|
||||
|
||||
# and we launch kodi again
|
||||
@@ -482,7 +462,6 @@ def play_from_library(item):
|
||||
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
||||
|
||||
else:
|
||||
|
||||
# Pop-up window
|
||||
item.show_server = True
|
||||
|
||||
@@ -492,75 +471,23 @@ def play_from_library(item):
|
||||
|
||||
itemlist = videolibrary.findvideos(item)
|
||||
|
||||
if not config.get_setting('autoplay'): show_server(item, itemlist, p_dialog)
|
||||
|
||||
if check_next_ep:
|
||||
p_dialog.update(100, '')
|
||||
sleep(0.5)
|
||||
p_dialog.close()
|
||||
item = nextep.return_item(item)
|
||||
if item.next_ep:
|
||||
return play_from_library(item)
|
||||
|
||||
if item.next_ep: return play_from_library(item)
|
||||
else:
|
||||
while platformtools.is_playing():
|
||||
# Conventional window
|
||||
sleep(5)
|
||||
while platformtools.is_playing(): # Conventional window
|
||||
sleep(5)
|
||||
p_dialog.update(50, '')
|
||||
|
||||
it = item
|
||||
if item.show_server or not check_next_ep:
|
||||
if item.show_server: show_server(item, itemlist, p_dialog)
|
||||
|
||||
# The links are filtered according to the blacklist
|
||||
# if config.get_setting('filter_servers', "servers"):
|
||||
# itemlist = servertools.filter_servers(itemlist)
|
||||
|
||||
# The number of links to show is limited
|
||||
if config.get_setting("max_links", "videolibrary") != 0:
|
||||
itemlist = limit_itemlist(itemlist)
|
||||
|
||||
# The list of links is slightly "cleaned"
|
||||
if config.get_setting("replace_VD", "videolibrary") == 1:
|
||||
itemlist = reorder_itemlist(itemlist)
|
||||
|
||||
|
||||
p_dialog.update(100, '')
|
||||
sleep(0.5)
|
||||
p_dialog.close()
|
||||
|
||||
|
||||
if len(itemlist) > 0:
|
||||
while not xbmc.Monitor().abortRequested():
|
||||
# The user chooses the mirror
|
||||
opciones = []
|
||||
for item in itemlist:
|
||||
opciones.append(item.title)
|
||||
|
||||
# The selection window opens
|
||||
if (item.contentSerieName != "" and
|
||||
item.contentSeason != "" and
|
||||
item.contentEpisodeNumber != ""):
|
||||
cabecera = ("%s - %sx%s -- %s" %
|
||||
(item.contentSerieName,
|
||||
item.contentSeason,
|
||||
item.contentEpisodeNumber,
|
||||
config.get_localized_string(30163)))
|
||||
else:
|
||||
cabecera = config.get_localized_string(30163)
|
||||
|
||||
|
||||
seleccion = platformtools.dialog_select(cabecera, opciones)
|
||||
|
||||
if seleccion == -1:
|
||||
return
|
||||
else:
|
||||
item = videolibrary.play(itemlist[seleccion])[0]
|
||||
item.play_from = 'window'
|
||||
platformtools.play_video(item)
|
||||
|
||||
if (platformtools.is_playing() and item.action) or item.server == 'torrent' or autoplay.is_active(item.contentChannel):
|
||||
break
|
||||
|
||||
if it.show_server and check_next_ep:
|
||||
nextep.run(it)
|
||||
if item.show_server and check_next_ep:
|
||||
nextep.run(item)
|
||||
sleep(0.5)
|
||||
p_dialog.close()
|
||||
|
||||
|
||||
@@ -6,24 +6,18 @@
|
||||
# version 2.0
|
||||
# ------------------------------------------------------------
|
||||
|
||||
from __future__ import division
|
||||
from __future__ import absolute_import
|
||||
from past.utils import old_div
|
||||
import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
if PY3:
|
||||
if sys.version_info[0] >= 3:
|
||||
import urllib.parse as urllib
|
||||
else:
|
||||
import urllib
|
||||
|
||||
import os, xbmc, xbmcgui, xbmcplugin
|
||||
|
||||
from past.utils import old_div
|
||||
from channelselector import get_thumb
|
||||
from core import channeltools, trakt_tools, scrapertools
|
||||
from core import trakt_tools, scrapertools
|
||||
from core.item import Item
|
||||
from platformcode import logger, config, unify
|
||||
from platformcode import logger, config
|
||||
|
||||
addon = config.__settings__
|
||||
addon_icon = os.path.join( addon.getAddonInfo( "path" ), "logo.png" )
|
||||
@@ -293,255 +287,6 @@ def set_view_mode(item, parent_item):
|
||||
logger.info('TYPE: ' + Type + ' - ' + 'CONTENT: ' + content)
|
||||
|
||||
|
||||
# def render_items_old(itemlist, parent_item):
|
||||
# """
|
||||
# Function responsible for displaying the itemlist in kodi, the itemlist and the item it comes from are passed as parameters
|
||||
# @type itemlist: list
|
||||
# @param itemlist: list of elements to show
|
||||
|
||||
# @type parent_item: item
|
||||
# @param parent_item: parent element
|
||||
# """
|
||||
# logger.info('START render_items')
|
||||
# from core import httptools
|
||||
|
||||
# # If the itemlist is not a list we leave
|
||||
# if not isinstance(itemlist, list):
|
||||
# return
|
||||
|
||||
# if parent_item.start:
|
||||
# menu_icon = get_thumb('menu.png')
|
||||
# menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon, title='Menu')
|
||||
# itemlist.insert(0, menu)
|
||||
|
||||
# # If there is no item, we show a notice
|
||||
# if not len(itemlist):
|
||||
# itemlist.append(Item(title=config.get_localized_string(60347), thumbnail=get_thumb('nofolder.png')))
|
||||
|
||||
# genre = False
|
||||
# if 'nero' in parent_item.title:
|
||||
# genre = True
|
||||
# anime = False
|
||||
# if 'anime' in channeltools.get_channel_parameters(parent_item.channel)['categories']:
|
||||
# anime = True
|
||||
# # try:
|
||||
# # force_unify = channeltools.get_channel_parameters(parent_item.channel)['force_unify']
|
||||
# # except:
|
||||
# force_unify = False
|
||||
|
||||
# unify_enabled = False
|
||||
|
||||
# has_extendedinfo = xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)')
|
||||
|
||||
# # Add SuperFavourites to context menu (1.0.53 or higher required)
|
||||
# sf_file_path = xbmc.translatePath("special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py")
|
||||
# check_sf = os.path.exists(sf_file_path)
|
||||
# superfavourites = check_sf and xbmc.getCondVisibility('System.HasAddon("plugin.program.super.favourites")')
|
||||
# # try:
|
||||
# # if channeltools.get_channel_parameters(parent_item.channel)['adult']:
|
||||
# # unify_enabled = False
|
||||
# # except:
|
||||
# # pass
|
||||
# # logger.debug('unify_enabled: %s' % unify_enabled)
|
||||
|
||||
# # We go through the itemlist
|
||||
# for item in itemlist:
|
||||
# # logger.debug(item)
|
||||
# # If the item does not contain a category, we will add the parent item
|
||||
# item_url = item.tourl()
|
||||
# if item.category == "":
|
||||
# item.category = parent_item.category
|
||||
|
||||
# # If title does not exist, we start it as str, to avoid "NoType" mistakes
|
||||
# if not item.title:
|
||||
# item.title = ''
|
||||
|
||||
# # If there is no action or it is findvideos / play, folder = False because no listing will be returned
|
||||
# if item.action in ['play', '']:
|
||||
# item.folder = False
|
||||
|
||||
# # If the item does not contain fanart, we put the one of the parent item
|
||||
# if item.fanart == "":
|
||||
# item.fanart = parent_item.fanart
|
||||
|
||||
# if genre:
|
||||
# valid_genre = True
|
||||
# thumb = get_thumb(item.title, auto=True)
|
||||
# if thumb != '':
|
||||
# item.thumbnail = thumb
|
||||
# valid_genre = True
|
||||
# elif anime:
|
||||
# valid_genre = True
|
||||
# elif (('siguiente' in item.title.lower() and '>' in item.title) or ('pagina:' in item.title.lower())):
|
||||
# item.thumbnail = get_thumb("next.png")
|
||||
# elif 'add' in item.action:
|
||||
# if 'pelicula' in item.action:
|
||||
# item.thumbnail = get_thumb("add_to_videolibrary.png")
|
||||
# elif 'serie' in item.action:
|
||||
# item.thumbnail = get_thumb("add_to_videolibrary.png")
|
||||
|
||||
# if (unify_enabled or force_unify) and parent_item.channel not in ['kodfavourites']:
|
||||
# # Format title with unify
|
||||
# item = unify.title_format(item)
|
||||
# else:
|
||||
# # Format title method old school
|
||||
# if item.text_color:
|
||||
# item.title = '[COLOR %s]%s[/COLOR]' % (item.text_color, item.title)
|
||||
# if item.text_bold:
|
||||
# item.title = '[B]%s[/B]' % item.title
|
||||
# if item.text_italic:
|
||||
# item.title = '[I]%s[/I]' % item.title
|
||||
|
||||
# # Add headers to images if they are on a server with cloudflare
|
||||
# if item.action == 'play':
|
||||
# item.thumbnail = unify.thumbnail_type(item)
|
||||
# else:
|
||||
# item.thumbnail = httptools.get_url_headers(item.thumbnail)
|
||||
# item.fanart = httptools.get_url_headers(item.fanart)
|
||||
|
||||
# # Icon Image for folder and video
|
||||
# if item.folder:
|
||||
# icon_image = "DefaultFolder.png"
|
||||
# else:
|
||||
# icon_image = "DefaultVideo.png"
|
||||
|
||||
# # fanart
|
||||
# if item.fanart:
|
||||
# fanart = item.fanart
|
||||
# else:
|
||||
# fanart = config.get_fanart()
|
||||
|
||||
# # Create listitem
|
||||
# listitem = xbmcgui.ListItem(item.title)
|
||||
|
||||
# # values icon, thumb or poster are skin dependent.. so we set all to avoid problems
|
||||
# # if not exists thumb it's used icon value
|
||||
# if config.get_platform(True)['num_version'] >= 16.0:
|
||||
# listitem.setArt({'icon': icon_image, 'thumb': item.thumbnail, 'poster': item.thumbnail,
|
||||
# 'fanart': fanart})
|
||||
# else:
|
||||
# listitem.setIconImage(icon_image)
|
||||
# listitem.setThumbnailImage(item.thumbnail)
|
||||
# listitem.setProperty('fanart_image', fanart)
|
||||
|
||||
# # No need it, use fanart instead
|
||||
# # xbmcplugin.setPluginFanart(int(sys.argv[1]), os.path.join(config.get_runtime_path(), "fanart.jpg"))
|
||||
|
||||
# # This option is to be able to use the xbmcplugin.setResolvedUrl()
|
||||
# # if item.isPlayable == True or (config.get_setting("player_mode") == 1 and item.action == "play"):
|
||||
# if config.get_setting("player_mode") == 1 and item.action == "play":
|
||||
# listitem.setProperty('IsPlayable', 'true')
|
||||
|
||||
# # Add infoLabels
|
||||
# set_infolabels(listitem, item)
|
||||
|
||||
# # Do not drag plot if it is not a movie / series / season / episode
|
||||
# if item.plot and item.contentType not in ['movie', 'tvshow', 'season', 'episode']:
|
||||
# item.__dict__['infoLabels'].pop('plot')
|
||||
|
||||
# # Mount context menu
|
||||
# if parent_item.channel != 'special':
|
||||
# context_commands = set_context_commands(item, item_url, parent_item, has_extendedinfo=has_extendedinfo, superfavourites=superfavourites)
|
||||
# else:
|
||||
# context_commands = []
|
||||
# # Add context menu
|
||||
# if config.get_platform(True)['num_version'] >= 17.0 and parent_item.list_type == '':
|
||||
# listitem.addContextMenuItems(context_commands)
|
||||
# elif parent_item.list_type == '':
|
||||
# listitem.addContextMenuItems(context_commands, replaceItems=True)
|
||||
|
||||
# from specials import shortcuts
|
||||
# context_commands += shortcuts.context()
|
||||
|
||||
# if not item.totalItems:
|
||||
# item.totalItems = 0
|
||||
# xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url='%s?%s' % (sys.argv[0], item_url),
|
||||
# listitem=listitem, isFolder=item.folder,
|
||||
# totalItems=item.totalItems)
|
||||
|
||||
# # Set types of views ...
|
||||
# if config.get_setting("forceview"): # ...force according to the viewcontent
|
||||
# xbmcplugin.setContent(int(sys.argv[1]), parent_item.viewcontent)
|
||||
|
||||
# elif parent_item.channel not in ["channelselector", "", "kodfavourites"]: # ... or according to the channel
|
||||
# xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
|
||||
# elif parent_item.channel == "kodfavourites" and parent_item.action == 'mostrar_perfil':
|
||||
# xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
|
||||
# # set "breadcrumb"
|
||||
# if parent_item.list_type == '':
|
||||
# breadcrumb = parent_item.category.capitalize()
|
||||
# else:
|
||||
# if 'similar' in parent_item.list_type:
|
||||
# if parent_item.contentTitle != '':
|
||||
# breadcrumb = config.get_localized_string(70693) + parent_item.contentTitle
|
||||
# else:
|
||||
# breadcrumb = config.get_localized_string(70693) + parent_item.contentSerieName
|
||||
# else:
|
||||
# breadcrumb = config.get_localized_string(70693)
|
||||
|
||||
# xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=breadcrumb)
|
||||
|
||||
# # Do not sort items
|
||||
# xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE)
|
||||
|
||||
# # We close the directory
|
||||
# xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||
|
||||
# # Fix the view
|
||||
# # if config.get_setting("forceview"):
|
||||
# # viewmode_id = get_viewmode_id(parent_item)
|
||||
# # xbmc.executebuiltin("Container.SetViewMode(%s)" % viewmode_id)
|
||||
# # if parent_item.mode in ['silent', 'get_cached', 'set_cache', 'finish']:
|
||||
# # xbmc.executebuiltin("Container.SetViewMode(500)")
|
||||
|
||||
# logger.info('END render_items')
|
||||
|
||||
|
||||
# def get_viewmode_id(parent_item):
|
||||
# # viewmode_json would have to save it in a file and create a method for the user to set their preferences in:
|
||||
# # user_files, user_movies, user_tvshows, user_season and user_episodes.
|
||||
# viewmode_json = {'skin.confluence': {'default_files': 50,
|
||||
# 'default_movies': 515,
|
||||
# 'default_tvshows': 508,
|
||||
# 'default_seasons': 503,
|
||||
# 'default_episodes': 504,
|
||||
# 'view_list': 50,
|
||||
# 'view_thumbnails': 500,
|
||||
# 'view_movie_with_plot': 503},
|
||||
# 'skin.estuary': {'default_files': 50,
|
||||
# 'default_movies': 54,
|
||||
# 'default_tvshows': 502,
|
||||
# 'default_seasons': 500,
|
||||
# 'default_episodes': 53,
|
||||
# 'view_list': 50,
|
||||
# 'view_thumbnails': 500,
|
||||
# 'view_movie_with_plot': 54}}
|
||||
|
||||
# # If the parent_item had a viewmode set we use that view ...
|
||||
# if parent_item.viewmode == 'movie':
|
||||
# # We replace the old viewmode 'movie' with 'thumbnails'
|
||||
# parent_item.viewmode = 'thumbnails'
|
||||
|
||||
# if parent_item.viewmode in ["list", "movie_with_plot", "thumbnails"]:
|
||||
# view_name = "view_" + parent_item.viewmode
|
||||
|
||||
# '''elif isinstance(parent_item.viewmode, int):
|
||||
# # only for debug
|
||||
# viewName = parent_item.viewmode'''
|
||||
|
||||
# # ...otherwise we put the default view according to the viewcontent
|
||||
# else:
|
||||
# view_name = "default_" + parent_item.viewcontent
|
||||
|
||||
# skin_name = xbmc.getSkinDir()
|
||||
# if skin_name not in viewmode_json:
|
||||
# skin_name = 'skin.confluence'
|
||||
# view_skin = viewmode_json[skin_name]
|
||||
# return view_skin.get(view_name, 50)
|
||||
|
||||
|
||||
def set_infolabels(listitem, item, player=False):
|
||||
"""
|
||||
Method to pass the information to the listitem (see tmdb.set_InfoLabels())
|
||||
@@ -582,32 +327,6 @@ def set_infolabels(listitem, item, player=False):
|
||||
listitem.setInfo("video", item.infoLabels)
|
||||
# logger.error(item.infoLabels)
|
||||
|
||||
# if item.infoLabels:
|
||||
# if 'mediatype' not in item.infoLabels:
|
||||
# item.infoLabels['mediatype'] = item.contentType
|
||||
#
|
||||
# try:
|
||||
# for label_tag, label_value in list(item.infoLabels.items()):
|
||||
# try:
|
||||
# # logger.debug(str(label_tag) + ': ' + str(infoLabels_dict[label_tag]))
|
||||
# if infoLabels_dict[label_tag] != 'None':
|
||||
# infoLabels_kodi.update({infoLabels_dict[label_tag]: item.infoLabels[label_tag]})
|
||||
# except:
|
||||
# continue
|
||||
#
|
||||
# listitem.setInfo("video", infoLabels_kodi)
|
||||
#
|
||||
# except:
|
||||
# listitem.setInfo("video", item.infoLabels)
|
||||
# logger.error(item.infoLabels)
|
||||
# logger.error(infoLabels_kodi)
|
||||
#
|
||||
# if player and not item.contentTitle:
|
||||
# listitem.setInfo("video", {"Title": item.title})
|
||||
#
|
||||
# elif not player:
|
||||
# listitem.setInfo("video", {"Title": item.title})
|
||||
|
||||
|
||||
def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
"""
|
||||
@@ -686,17 +405,12 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
# ExtendedInfo: If the addon is installed and a series of conditions are met
|
||||
if kwargs.get('has_extendedinfo') \
|
||||
and config.get_setting("extended_info") == True:
|
||||
if item.contentType == "episode" and item.contentEpisodeNumber and item.contentSeason \
|
||||
and (item.infoLabels['tmdb_id'] or item.contentSerieName):
|
||||
param = "tvshow_id =%s, tvshow=%s, season=%s, episode=%s" \
|
||||
% (item.infoLabels['tmdb_id'], item.contentSerieName, item.contentSeason,
|
||||
item.contentEpisodeNumber)
|
||||
if item.contentType == "episode" and item.contentEpisodeNumber and item.contentSeason and (item.infoLabels['tmdb_id'] or item.contentSerieName):
|
||||
param = "tvshow_id =%s, tvshow=%s, season=%s, episode=%s" % (item.infoLabels['tmdb_id'], item.contentSerieName, item.contentSeason, item.contentEpisodeNumber)
|
||||
context_commands.append(("ExtendedInfo", "XBMC.RunScript(script.extendedinfo,info=extendedepisodeinfo,%s)" % param))
|
||||
|
||||
elif item.contentType == "season" and item.contentSeason \
|
||||
and (item.infoLabels['tmdb_id'] or item.contentSerieName):
|
||||
param = "tvshow_id =%s,tvshow=%s, season=%s" \
|
||||
% (item.infoLabels['tmdb_id'], item.contentSerieName, item.contentSeason)
|
||||
elif item.contentType == "season" and item.contentSeason and (item.infoLabels['tmdb_id'] or item.contentSerieName):
|
||||
param = "tvshow_id =%s,tvshow=%s, season=%s" % (item.infoLabels['tmdb_id'], item.contentSerieName, item.contentSeason)
|
||||
context_commands.append(("ExtendedInfo", "XBMC.RunScript(script.extendedinfo,info=seasoninfo,%s)" % param))
|
||||
|
||||
elif item.contentType == "tvshow" and (item.infoLabels['tmdb_id'] or item.infoLabels['tvdb_id'] or item.infoLabels['imdb_id'] or item.contentSerieName):
|
||||
@@ -705,15 +419,14 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
|
||||
elif item.contentType == "movie" and (item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.contentTitle):
|
||||
param = "id =%s,imdb_id=%s,name=%s" % (item.infoLabels['tmdb_id'], item.infoLabels['imdb_id'], item.contentTitle)
|
||||
|
||||
context_commands.append(("ExtendedInfo", "XBMC.RunScript(script.extendedinfo,info=extendedinfo,%s)" % param))
|
||||
# InfoPlus
|
||||
|
||||
# InfoPlus
|
||||
if config.get_setting("infoplus"):
|
||||
#if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id'] or \
|
||||
# (item.contentTitle and item.infoLabels["year"]) or item.contentSerieName:
|
||||
if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id']:
|
||||
context_commands.append(("InfoPlus", "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url,
|
||||
'channel=infoplus&action=start&from_channel=' + item.channel)))
|
||||
context_commands.append(("InfoPlus", "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=infoplus&action=start&from_channel=' + item.channel)))
|
||||
|
||||
# Go to the Main Menu (channel.mainlist)
|
||||
if parent_item.channel not in ["news", "channelselector", "downloads"] and item.action != "mainlist":
|
||||
@@ -721,13 +434,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
context_commands.insert(0, (config.get_localized_string(60349), "XBMC.Container.Refresh (%s?%s)" % (sys.argv[0], Item(channel=item.channel, action="mainlist").tourl())))
|
||||
context_commands.insert(1, (config.get_localized_string(70739), "XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="open_browser", url=item.url).tourl())))
|
||||
|
||||
# Add to Favorites
|
||||
# if num_version_xbmc < 17.0 and \
|
||||
# ((item.channel not in ["favorites", "videolibrary", "help", ""]
|
||||
# or item.action in ["update_videolibrary"]) and parent_item.channel != "favorites"):
|
||||
# context_commands.append((config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s&%s)" %
|
||||
# (sys.argv[0], item_url, 'channel=favorites&action=addFavourite&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
|
||||
# Add to kodfavoritos (My links)
|
||||
if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites":
|
||||
context_commands.append( (config.get_localized_string(70557), "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': "kodfavorites", 'action': "addFavourite", 'from_channel': item.channel, 'from_action': item.action}))))
|
||||
@@ -748,6 +454,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
context_commands.append((config.get_localized_string(60350), "XBMC.Container.Update (%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': 'search', 'action': "from_context", 'from_channel': item.channel, 'contextual': True, 'text': item.wanted}))))
|
||||
|
||||
context_commands.append( (config.get_localized_string(70561), "XBMC.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']:
|
||||
@@ -780,11 +487,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
elif item.contentType == "season":
|
||||
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
|
||||
# # Open settings
|
||||
# if parent_item.channel not in ["setting", "news", "search"] and item.action == "play":
|
||||
# context_commands.append((config.get_localized_string(60358), "XBMC.Container.Update(%s?%s)" %
|
||||
# (sys.argv[0], Item(channel="setting", action="mainlist").tourl())))
|
||||
|
||||
# Open settings...
|
||||
if item.action in ["findvideos", 'episodios', 'check', 'new_search'] or "buscar_trailer" in context:
|
||||
context_commands.append((config.get_localized_string(60359), "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], urllib.urlencode({ 'channel': "trailertools", 'action': "buscartrailer", 'search_title': item.contentTitle if item.contentTitle else item.fulltitle, 'contextual': True}))))
|
||||
@@ -792,14 +494,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
if kwargs.get('superfavourites'):
|
||||
context_commands.append((config.get_localized_string(60361), "XBMC.RunScript(special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py)"))
|
||||
|
||||
# context_commands = sorted(context_commands, key=lambda comand: comand[0])
|
||||
|
||||
# Quick Menu
|
||||
# context_commands.insert(0, (config.get_localized_string(60360),
|
||||
# "XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(channel='side_menu',
|
||||
# action="open_menu",
|
||||
# parent=parent_item.tourl()).tourl(
|
||||
# ))))
|
||||
if config.dev_mode():
|
||||
context_commands.insert(0, ("item info", "XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl())))
|
||||
return context_commands
|
||||
@@ -824,7 +518,6 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
|
||||
set_infolabels(xlistitem, item, True)
|
||||
set_player(item, xlistitem, item.url, True, None) # Fix Play From Download Section
|
||||
# xbmc_player.play(item.url, xlistitem)
|
||||
return
|
||||
|
||||
default_action = config.get_setting("default_action")
|
||||
|
||||
@@ -25,7 +25,7 @@ def mark_auto_as_watched(item):
|
||||
vl = xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_movies")))
|
||||
path = '%s [%s]' % (item.contentTitle, item.infoLabels['IMDBNumber'])
|
||||
item.nfo = filetools.join(vl, path, path + '.nfo')
|
||||
item.strm_path = filetools.join(path, item.contentTitle + '.strm')
|
||||
if not item.strm_path: item.strm_path = filetools.join(path, item.contentTitle + '.strm')
|
||||
else:
|
||||
vl = xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_tvshows")))
|
||||
path = '%s [%s]' % (item.contentSerieName, item.infoLabels['IMDBNumber'])
|
||||
@@ -35,7 +35,7 @@ def mark_auto_as_watched(item):
|
||||
else:
|
||||
season, episode = scrapertools.find_single_match(item.title, r'(\d+)x(\d+)')
|
||||
title = season + 'x' + episode.zfill(2)
|
||||
item.strm_path = filetools.join(path, title + '.strm')
|
||||
if not item.strm_path: item.strm_path = filetools.join(path, title + '.strm')
|
||||
condicion = config.get_setting("watched_setting", "videolibrary")
|
||||
|
||||
time_limit = time.time() + 30
|
||||
|
||||
@@ -51,15 +51,16 @@ def start(itemlist, item):
|
||||
autoplay_b = []
|
||||
favorite_quality = []
|
||||
|
||||
file_settings = filetools.join(config.get_data_path(), "settings_servers", "servers_data.json")
|
||||
if not filetools.exists(file_settings):
|
||||
blacklisted_servers = config.get_setting('black_list', server='servers')
|
||||
if not blacklisted_servers:
|
||||
config.set_setting('black_list', [], server='servers')
|
||||
config.set_setting('favorites_servers_list', [], server='servers')
|
||||
blacklisted_servers = []
|
||||
favorite_servers = config.get_setting('favorites_servers_list', server='servers')
|
||||
if not favorite_servers:
|
||||
config.set_setting('favorites_servers_list', [], server='servers')
|
||||
favorite_servers = []
|
||||
else:
|
||||
blacklisted_servers = config.get_setting('black_list', server='servers')
|
||||
favorite_servers = list(set(config.get_setting('favorites_servers_list', server='servers')) - set(blacklisted_servers))
|
||||
favorite_servers = list(set(favorite_servers) - set(blacklisted_servers))
|
||||
|
||||
# Save the current value of "Action and Player Mode" in preferences
|
||||
user_config_setting_action = config.get_setting("default_action")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import xbmc, xbmcgui
|
||||
import xbmc, xbmcgui, os
|
||||
from platformcode import config, platformtools
|
||||
from time import time, sleep
|
||||
from core import jsontools, filetools
|
||||
from core.support import log
|
||||
from core.support import log, dbg
|
||||
from core.item import Item
|
||||
from platformcode.launcher import play_from_library
|
||||
|
||||
@@ -50,6 +50,7 @@ def videolibrary(item):
|
||||
|
||||
def next_ep(item):
|
||||
log()
|
||||
|
||||
condition = config.get_setting('next_ep')
|
||||
item.next_ep = False
|
||||
item.show_server = True
|
||||
@@ -79,7 +80,6 @@ def next_ep(item):
|
||||
if condition == 1: # hide server afther x second
|
||||
item.show_server = False
|
||||
elif condition == 2: # play next file if exist
|
||||
|
||||
# check if next file exist
|
||||
current_filename = filetools.basename(item.strm_path)
|
||||
base_path = filetools.basename(filetools.dirname(item.strm_path))
|
||||
@@ -112,7 +112,7 @@ def next_ep(item):
|
||||
contentTitle= next_ep,
|
||||
contentType= 'episode',
|
||||
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_ep},
|
||||
strm_path= filetools.join(base_path, next_file))
|
||||
strm_path= os.sep + filetools.join(base_path, next_file))
|
||||
|
||||
global INFO
|
||||
INFO = filetools.join(path, next_file.replace("strm", "nfo"))
|
||||
|
||||
@@ -375,7 +375,7 @@ def servers_favorites(item):
|
||||
orden = config.get_setting("favorites_servers_list", server=server)
|
||||
|
||||
if orden > 0:
|
||||
dict_values[orden] = len(server_names) - 2
|
||||
dict_values[orden] = len(server_names) - 1
|
||||
|
||||
for x in range(2, 12):
|
||||
control = {'id': x,
|
||||
@@ -399,7 +399,7 @@ def cb_servers_favorites(server_names, dict_values):
|
||||
for i, v in list(dict_values.items()):
|
||||
if i == "favorites_servers":
|
||||
config.set_setting("favorites_servers", v)
|
||||
if i == "quality_priority":
|
||||
elif i == "quality_priority":
|
||||
config.set_setting("quality_priority", v)
|
||||
elif int(v) > 0:
|
||||
dict_name[server_names[v]] = int(i)
|
||||
@@ -416,7 +416,7 @@ def cb_servers_favorites(server_names, dict_values):
|
||||
progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % server_parameters['name'])
|
||||
i += 1
|
||||
|
||||
c = 1
|
||||
c = 2
|
||||
favorites_servers_list = []
|
||||
while c in dict_favorites:
|
||||
favorites_servers_list.append(dict_favorites[c])
|
||||
|
||||
Reference in New Issue
Block a user