Merge branch 'master' into alpha

This commit is contained in:
Alhaziel01
2021-06-10 16:01:03 +02:00
68 changed files with 12011 additions and 261 deletions

View File

@@ -0,0 +1,5 @@
[
"platformcode.contextmenu.search",
"platformcode.contextmenu.update_tv_show",
"platformcode.contextmenu.trailer"
]

View File

@@ -0,0 +1,127 @@
import xbmc, sys, os
from platformcode import config, logger
import re
# incliuding folder libraries
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
sys.path.insert(0, librerias)
from core import tmdb
from core.item import Item
addon_id = config.get_addon_core().getAddonInfo('id')
global item_is_coming_from_kod
def check_condition():
global item_is_coming_from_kod
logger.debug('check item condition')
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
folderPath = xbmc.getInfoLabel('Container.FolderPath')
filePath = xbmc.getInfoLabel('ListItem.Path')
fileNameAndPath = xbmc.getInfoLabel('ListItem.FileNameAndPath')
logger.debug('Container:',folderPath )
logger.debug('listitem mediatype:',mediatype )
logger.debug('filenamepath:', fileNameAndPath )
logger.info('filepath:', filePath )
item_is_coming_from_kod = addon_id in filePath
if not item_is_coming_from_kod:
videolibpath = config.get_setting("videolibrarypath")
if filePath.startswith(videolibpath):
pattern = re.compile("\[.*\][\\\/]?$")
item_is_coming_from_kod = pattern.search(filePath)
if item_is_coming_from_kod:
logger.debug("item IS already managed by KOD")
return mediatype
def get_menu_items():
logger.debug('get menu item')
if check_condition():
return [(config.get_localized_string(90003 if item_is_coming_from_kod else 90005), execute)]
else:
return []
def execute():
"""
Gather the selected ListItem's attributes in order to compute the `Item` parameters
and perform the KOD's globalsearch.
Globalsearch will be executed specifing the content-type of the selected ListItem
NOTE: this method needs the DBTYPE and TMDB_ID specified as ListItem's properties
"""
# These following lines are commented and keep in the code just as reminder.
# In future, they could be used to filter the search outcome
# ADDON: maybe can we know if the current windows is related to a specific addon?
# we could skip the ContextMenu if we already are in KOD's window
tmdbid = xbmc.getInfoLabel('ListItem.Property(tmdb_id)')
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
title = xbmc.getInfoLabel('ListItem.Title')
year = xbmc.getInfoLabel('ListItem.Year')
imdb = xbmc.getInfoLabel('ListItem.IMDBNumber')
if mediatype in ('episode', 'season'):
mediatype = 'tvshow'
title = xbmc.getInfoLabel('ListItem.TVShowTitle')
logstr = "Selected ListItem is: 'IMDB: {}' - TMDB: {}' - 'Title: {}' - 'Year: {}'' - 'Type: {}'".format(imdb, tmdbid, title, year, mediatype)
logger.info(logstr)
if not tmdbid and imdb:
logger.info('No TMDBid found. Try to get by IMDB')
it = Item(contentType= mediatype, infoLabels={'imdb_id' : imdb})
try:
tmdb.set_infoLabels(it)
tmdbid = it.infoLabels.get('tmdb_id', '')
except:
logger.info("Cannot find TMDB via imdb")
if not tmdbid:
logger.info('No TMDBid found. Try to get by Title/Year')
it = Item(contentTitle= title, contentType= mediatype, infoLabels={'year' : year})
try:
tmdb.set_infoLabels(it)
tmdbid = it.infoLabels.get('tmdb_id', '')
except:
logger.info("Cannot find TMDB via title/year")
if not tmdbid:
# We can continue searching by 'title (year)'
logger.info( "No TMDB found, proceed with title/year:", title , "(" , year, ")" )
# User wants to search on other channels
logger.info("Search on other channels")
item = Item(
action="from_context",
channel="search",
contentType= mediatype,
mode="search",
contextual= True,
text=title,
type= mediatype,
infoLabels= {
'tmdb_id': tmdbid,
'year': year,
'mediatype': mediatype
},
folder= False
)
logger.info("Invoking Item: ", item.tostring() )
itemurl = item.tourl()
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + itemurl + ")")

View File

@@ -0,0 +1,23 @@
import xbmc
from core.item import Item
from platformcode import config
def get_menu_items():
return [(config.get_localized_string(60359), execute)]
def execute():
tmdbid = xbmc.getInfoLabel('ListItem.Property(tmdb_id)')
year = xbmc.getInfoLabel('ListItem.Year')
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
title = xbmc.getInfoLabel('ListItem.Title')
if mediatype in ('episode', 'season'):
mediatype = 'tvshow'
title = xbmc.getInfoLabel('ListItem.TVShowTitle')
item = Item(channel="trailertools", action="buscartrailer", search_title=title, contentType=mediatype,
year=year, contentTitle=title, contextual=True)
item.infoLabels['tmdb_id'] = tmdbid
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")

View File

@@ -0,0 +1,203 @@
# -*- coding: utf-8 -*-
import xbmc, sys, xbmcgui, os, xbmcvfs, traceback
from platformcode import config, logger
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
sys.path.insert(0, librerias)
from core.item import Item
from lib.sambatools import libsmb as samba
from core import scrapertools, support
path = ''
mediatype = ''
def exists(path, silent=False, vfs=True):
path = xbmc.translatePath(path)
try:
if vfs:
result = bool(xbmcvfs.exists(path))
if not result and not path.endswith('/') and not path.endswith('\\'):
result = bool(xbmcvfs.exists(join(path, ' ').rstrip()))
return result
elif path.lower().startswith("smb://"):
return samba.exists(path)
else:
return os.path.exists(path)
except:
logger.error("ERROR when checking the path: %s" % path)
if not silent:
logger.error(traceback.format_exc())
return False
def join(*paths):
list_path = []
if paths[0].startswith("/"):
list_path.append("")
for path in paths:
if path:
list_path += path.replace("\\", "/").strip("/").split("/")
if scrapertools.find_single_match(paths[0], r'(^\w+:\/\/)'):
return str("/".join(list_path))
else:
return str(os.sep.join(list_path))
def search_paths(Id):
records = execute_sql('SELECT idPath FROM tvshowlinkpath WHERE idShow LIKE "%s"' % Id)
if len(records) >= 1:
for record in records:
path_records = execute_sql('SELECT strPath FROM path WHERE idPath LIKE "%s"' % record[0])
for path in path_records:
if config.get_setting('videolibrarypath') in path[0] and exists(join(path[0], 'tvshow.nfo')):
return path[0]
return ''
def execute_sql(sql):
logger.debug()
file_db = ""
records = None
# We look for the archive of the video database according to the version of kodi
video_db = config.get_platform(True)['video_db']
if video_db:
file_db = os.path.join(xbmc.translatePath("special://userdata/Database"), video_db)
# alternative method to locate the database
if not file_db or not os.path.exists(file_db):
file_db = ""
for f in os.path.listdir(xbmc.translatePath("special://userdata/Database")):
path_f = os.path.join(xbmc.translatePath("special://userdata/Database"), f)
if os.path.pathoos.pathols.isfile(path_f) and f.lower().startswith('myvideos') and f.lower().endswith('.db'):
file_db = path_f
break
if file_db:
logger.debug("DB file: %s" % file_db)
conn = None
try:
import sqlite3
conn = sqlite3.connect(file_db)
cursor = conn.cursor()
logger.debug("Running sql: %s" % sql)
cursor.execute(sql)
conn.commit()
records = cursor.fetchall()
if sql.lower().startswith("select"):
if len(records) == 1 and records[0][0] is None:
records = []
conn.close()
logger.debug("Query executed. Records: %s" % len(records))
except:
logger.error("Error executing sql query")
if conn:
conn.close()
else:
logger.debug("Database not found")
return records
def get_id():
global mediatype
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
if mediatype == 'tvshow':
dbid = xbmc.getInfoLabel('ListItem.DBID')
elif mediatype in ('season', 'episode'):
dbid = xbmc.getInfoLabel('ListItem.TvShowDBID')
else:
dbid = ''
return dbid
def check_condition():
# support.dbg()
global path
path = search_paths(get_id())
return path
def get_menu_items():
logger.debug('get menu item')
if check_condition():
items = [(config.get_localized_string(70269), update)]
from core import videolibrarytools
nfo = path + 'tvshow.nfo'
item = videolibrarytools.read_nfo(nfo)[1]
if item:
item.nfo = nfo
item_url = item.tourl()
# Context menu: Automatically search for new episodes or not
if item.active and int(item.active) > 0:
update_text = config.get_localized_string(60022)
value = 0
else:
update_text = config.get_localized_string(60023)
value = 1
items.append((update_text,
lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&title={}&action=mark_tvshow_as_updatable&channel=videolibrary&active={})".format(item_url, update_text, str(value)))))
if item.local_episodes_path == "":
items.append((config.get_localized_string(80048), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=add_local_episodes&channel=videolibrary&path={})".format(item_url, path))))
# if config.get_setting('downloadenabled'):
# from core import videolibrarytools
# from core import filetools
# if xbmc.getInfoLabel('ListItem.FilenameAndPath'):
# item = Item().fromurl(filetools.read(xbmc.getInfoLabel('ListItem.FilenameAndPath')))
# else:
# item = videolibrarytools.read_nfo(path + 'tvshow.nfo')[1]
# if item:
# item_url = item.tourl()
#
# Download movie
# if mediatype == "movie":
# items.append((config.get_localized_string(60354), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (item_url,
# 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))))
#
# elif item.contentSerieName:
# Download series
# if mediatype == "tvshow" and item.action not in ['findvideos']:
# if item.channel == 'videolibrary':
# items.append((config.get_localized_string(60003), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
# item_url,
# 'channel=downloads&action=save_download&unseen=true&from_channel=' + item.channel + '&from_action=' + item.action))))
# items.append((config.get_localized_string(60355), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
# item_url,
# 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))))
# items.append((config.get_localized_string(60357), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
# item_url,
# 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action))))
# Download episode
# elif mediatype == "episode" and item.action in ['findvideos']:
# items.append((config.get_localized_string(60356), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
# item_url,
# 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))))
# Download season
# elif mediatype == "season":
# items.append((config.get_localized_string(60357), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
# item_url,
# 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action))))
return items
else:
return []
def update():
dbid = get_id()
path = search_paths(dbid)
if path:
item = Item(action="update_tvshow", channel="videolibrary", path=path)
# Why? I think it is not necessary, just commented
# item.tourl()
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")

View File

@@ -69,9 +69,18 @@ def dialog_multiselect(heading, _list, autoclose=0, preselect=[], useDetails=Fal
def dialog_progress(heading, message):
dialog = xbmcgui.DialogProgress()
dialog.create(heading, message)
return dialog
if get_window() in ('WINDOW_HOME', 'WINDOW_SETTINGS_MENU', 'WINDOW_SETTINGS_INTERFACE', 'WINDOW_SKIN_SETTINGS', 'SKIN'):
# in widget, hide any progress
class Dummy(object):
def __getattr__(self, name):
def _missing(*args, **kwargs):
pass
return _missing
return Dummy()
else:
dialog = xbmcgui.DialogProgress()
dialog.create(heading, message)
return dialog
def dialog_progress_bg(heading, message=""):
@@ -179,6 +188,7 @@ def dialog_register(heading, user=False, email=False, password=False, user_defau
dialog = Register('Register.xml', config.get_runtime_path()).Start(heading, user, email, password, user_default, email_default, password_default, captcha_img)
return dialog
def dialog_info(item, scraper):
class TitleOrIDWindow(xbmcgui.WindowXMLDialog):
def Start(self, item, scraper):
@@ -233,6 +243,7 @@ def dialog_info(item, scraper):
dialog = TitleOrIDWindow('TitleOrIDWindow.xml', config.get_runtime_path()).Start(item, scraper)
return dialog
def dialog_select_group(heading, _list, preselect=0):
class SelectGroup(xbmcgui.WindowXMLDialog):
def start(self, heading, _list, preselect):
@@ -688,7 +699,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
context_commands.append((config.get_localized_string(60354), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
elif item.contentSerieName:
# Descargar series
# Download series
if item.contentType == "tvshow" and item.action not in ['findvideos']:
if item.channel == 'videolibrary':
context_commands.append((config.get_localized_string(60003), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&unseen=true&from_channel=' + item.channel + '&from_action=' + item.action)))
@@ -714,6 +725,265 @@ def is_playing():
return xbmc_player.isPlaying()
def get_window():
"""
Return if addon is used as widget
For doing so, it check current window ID (https://kodi.wiki/view/Window_IDs)
"""
winId = xbmcgui.getCurrentWindowId()
if winId == 9999:
return 'WINDOW_INVALID'
elif winId == 10000:
return 'WINDOW_HOME'
elif winId == 10001:
return 'WINDOW_PROGRAMS'
elif winId == 10002:
return 'WINDOW_PICTURES'
elif winId == 10003:
return 'WINDOW_FILES'
elif winId == 10004:
return 'WINDOW_SETTINGS_MENU'
elif winId == 10007:
return 'WINDOW_SYSTEM_INFORMATION'
elif winId == 10011:
return 'WINDOW_SCREEN_CALIBRATION'
elif winId == 10016:
return 'WINDOW_SETTINGS_START'
elif winId == 10016:
return 'WINDOW_SETTINGS_SYSTEM'
elif winId == 10018:
return 'WINDOW_SETTINGS_SERVICE'
elif winId == 10021:
return 'WINDOW_SETTINGS_MYPVR'
elif winId == 10022:
return 'WINDOW_SETTINGS_MYGAMES'
elif winId == 10025:
return 'WINDOW_VIDEO_NAV'
elif winId == 10028:
return 'WINDOW_VIDEO_PLAYLIST'
elif winId == 10029:
return 'WINDOW_LOGIN_SCREEN'
elif winId == 10030:
return 'WINDOW_SETTINGS_PLAYER'
elif winId == 10031:
return 'WINDOW_SETTINGS_MEDIA'
elif winId == 10032:
return 'WINDOW_SETTINGS_INTERFACE'
elif winId == 10034:
return 'WINDOW_SETTINGS_PROFILES'
elif winId == 10035:
return 'WINDOW_SKIN_SETTINGS'
elif winId == 10040:
return 'WINDOW_ADDON_BROWSER'
elif winId == 10050:
return 'WINDOW_EVENT_LOG'
elif winId == 97:
return 'WINDOW_SCREENSAVER_DIM'
elif winId == 98:
return 'WINDOW_DEBUG_INFO'
elif winId == 10099:
return 'WINDOW_DIALOG_POINTER'
elif winId == 10100:
return 'WINDOW_DIALOG_YES_NO'
elif winId == 10101:
return 'WINDOW_DIALOG_PROGRESS'
elif winId == 10103:
return 'WINDOW_DIALOG_KEYBOARD'
elif winId == 10104:
return 'WINDOW_DIALOG_VOLUME_BAR'
elif winId == 10105:
return 'WINDOW_DIALOG_SUB_MENU'
elif winId == 10106:
return 'WINDOW_DIALOG_CONTEXT_MENU'
elif winId == 10107:
return 'WINDOW_DIALOG_KAI_TOAST'
elif winId == 10109:
return 'WINDOW_DIALOG_NUMERIC'
elif winId == 10110:
return 'WINDOW_DIALOG_GAMEPAD'
elif winId == 10111:
return 'WINDOW_DIALOG_BUTTON_MENU'
elif winId == 10114:
return 'WINDOW_DIALOG_PLAYER_CONTROLS'
elif winId == 10115:
return 'WINDOW_DIALOG_SEEK_BAR'
elif winId == 10116:
return 'WINDOW_DIALOG_PLAYER_PROCESS_INFO'
elif winId == 10120:
return 'WINDOW_DIALOG_MUSIC_OSD'
elif winId == 10121:
return 'WINDOW_DIALOG_VIS_SETTINGS'
elif winId == 10122:
return 'WINDOW_DIALOG_VIS_PRESET_LIST'
elif winId == 10123:
return 'WINDOW_DIALOG_VIDEO_OSD_SETTINGS'
elif winId == 10124:
return 'WINDOW_DIALOG_AUDIO_OSD_SETTINGS'
elif winId == 10125:
return 'WINDOW_DIALOG_VIDEO_BOOKMARKS'
elif winId == 10126:
return 'WINDOW_DIALOG_FILE_BROWSER'
elif winId == 10128:
return 'WINDOW_DIALOG_NETWORK_SETUP'
elif winId == 10129:
return 'WINDOW_DIALOG_MEDIA_SOURCE'
elif winId == 10130:
return 'WINDOW_DIALOG_PROFILE_SETTINGS'
elif winId == 10131:
return 'WINDOW_DIALOG_LOCK_SETTINGS'
elif winId == 10132:
return 'WINDOW_DIALOG_CONTENT_SETTINGS'
elif winId == 10133:
return 'WINDOW_DIALOG_LIBEXPORT_SETTINGS'
elif winId == 10134:
return 'WINDOW_DIALOG_FAVOURITES'
elif winId == 10135:
return 'WINDOW_DIALOG_SONG_INFO'
elif winId == 10136:
return 'WINDOW_DIALOG_SMART_PLAYLIST_EDITOR'
elif winId == 10137:
return 'WINDOW_DIALOG_SMART_PLAYLIST_RULE'
elif winId == 10138:
return 'WINDOW_DIALOG_BUSY'
elif winId == 10139:
return 'WINDOW_DIALOG_PICTURE_INFO'
elif winId == 10140:
return 'WINDOW_DIALOG_ADDON_SETTINGS'
elif winId == 10142:
return 'WINDOW_DIALOG_FULLSCREEN_INFO'
elif winId == 10145:
return 'WINDOW_DIALOG_SLIDER'
elif winId == 10146:
return 'WINDOW_DIALOG_ADDON_INFO'
elif winId == 10147:
return 'WINDOW_DIALOG_TEXT_VIEWER'
elif winId == 10148:
return 'WINDOW_DIALOG_PLAY_EJECT'
elif winId == 10149:
return 'WINDOW_DIALOG_PERIPHERALS'
elif winId == 10150:
return 'WINDOW_DIALOG_PERIPHERAL_SETTINGS'
elif winId == 10151:
return 'WINDOW_DIALOG_EXT_PROGRESS'
elif winId == 10152:
return 'WINDOW_DIALOG_MEDIA_FILTER'
elif winId == 10153:
return 'WINDOW_DIALOG_SUBTITLES'
elif winId == 10156:
return 'WINDOW_DIALOG_KEYBOARD_TOUCH'
elif winId == 10157:
return 'WINDOW_DIALOG_CMS_OSD_SETTINGS'
elif winId == 10158:
return 'WINDOW_DIALOG_INFOPROVIDER_SETTINGS'
elif winId == 10159:
return 'WINDOW_DIALOG_SUBTITLE_OSD_SETTINGS'
elif winId == 10160:
return 'WINDOW_DIALOG_BUSY_NOCANCEL'
elif winId == 10500:
return 'WINDOW_MUSIC_PLAYLIST'
elif winId == 10502:
return 'WINDOW_MUSIC_NAV'
elif winId == 10503:
return 'WINDOW_MUSIC_PLAYLIST_EDITOR'
elif winId == 10550:
return 'WINDOW_DIALOG_OSD_TELETEXT'
# PVR related Window and Dialog ID's
elif 10600 < winId < 10613:
return 'WINDOW_DIALOG_PVR'
elif 10700 < winId < 10711:
return 'WINDOW_PVR_ID'
# virtual windows for PVR specific keymap bindings in fullscreen playback
elif winId == 10800:
return 'WINDOW_FULLSCREEN_LIVETV'
elif winId == 10801:
return 'WINDOW_FULLSCREEN_RADIO'
elif winId == 10802:
return 'WINDOW_FULLSCREEN_LIVETV_PREVIEW'
elif winId == 10803:
return 'WINDOW_FULLSCREEN_RADIO_PREVIEW'
elif winId == 10804:
return 'WINDOW_FULLSCREEN_LIVETV_INPUT'
elif winId == 10805:
return 'WINDOW_FULLSCREEN_RADIO_INPUT'
elif winId == 10820:
return 'WINDOW_DIALOG_GAME_CONTROLLERS'
elif winId == 10821:
return 'WINDOW_GAMES'
elif winId == 10822:
return 'WINDOW_DIALOG_GAME_OSD'
elif winId == 10823:
return 'WINDOW_DIALOG_GAME_VIDEO_FILTER'
elif winId == 10824:
return 'WINDOW_DIALOG_GAME_STRETCH_MODE'
elif winId == 10825:
return 'WINDOW_DIALOG_GAME_VOLUME'
elif winId == 10826:
return 'WINDOW_DIALOG_GAME_ADVANCED_SETTINGS'
elif winId == 10827:
return 'WINDOW_DIALOG_GAME_VIDEO_ROTATION'
elif 11100 < winId < 11199:
return 'SKIN' # WINDOW_ID's from 11100 to 11199 reserved for Skins
elif winId == 12000:
return 'WINDOW_DIALOG_SELECT'
elif winId == 12001:
return 'WINDOW_DIALOG_MUSIC_INFO'
elif winId == 12002:
return 'WINDOW_DIALOG_OK'
elif winId == 12003:
return 'WINDOW_DIALOG_VIDEO_INFO'
elif winId == 12005:
return 'WINDOW_FULLSCREEN_VIDEO'
elif winId == 12006:
return 'WINDOW_VISUALISATION'
elif winId == 12007:
return 'WINDOW_SLIDESHOW'
elif winId == 12600:
return 'WINDOW_WEATHER'
elif winId == 12900:
return 'WINDOW_SCREENSAVER'
elif winId == 12901:
return 'WINDOW_DIALOG_VIDEO_OSD'
elif winId == 12902:
return 'WINDOW_VIDEO_MENU'
elif winId == 12905:
return 'WINDOW_VIDEO_TIME_SEEK' # virtual window for time seeking during fullscreen video
elif winId == 12906:
return 'WINDOW_FULLSCREEN_GAME'
elif winId == 12997:
return 'WINDOW_SPLASH' # splash window
elif winId == 12998:
return 'WINDOW_START' # first window to load
elif winId == 12999:
return 'WINDOW_STARTUP_ANIM' # for startup animations
elif 13000 < winId < 13099:
return 'PYTHON' # WINDOW_ID's from 13000 to 13099 reserved for Python
elif 14000 < winId < 14099:
return 'ADDON' # WINDOW_ID's from 14000 to 14099 reserved for Addons
def play_video(item, strm=False, force_direct=False, autoplay=False):
logger.debug()
logger.debug(item.tostring('\n'))
@@ -762,12 +1032,6 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
# if it is a video in mpd format, the listitem is configured to play it ith the inpustreamaddon addon implemented in Kodi 17
# from core.support import dbg;dbg()
if item.manifest == 'hls':
if not install_inputstream():
return
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls')
xlistitem.setMimeType('application/x-mpegURL')
if mpd or item.manifest =='mpd':
if not install_inputstream():
return
@@ -778,6 +1042,12 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
xlistitem.setProperty("inputstream.adaptive.license_type", item.drm)
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
xlistitem.setMimeType('application/dash+xml')
elif item.manifest == 'hls' or mediaurl.split('|')[0].endswith('m3u8'):
if not install_inputstream():
return
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls')
xlistitem.setMimeType('application/x-mpegURL')
if force_direct: item.window = True