From 362d0e0c342f9e17734dab8b4d102d55677ec412 Mon Sep 17 00:00:00 2001 From: Shaun Date: Sat, 25 Nov 2017 15:04:26 +1100 Subject: [plugin.video.embycon] 1.3.47 --- plugin.video.embycon/addon.xml | 2 +- .../language/resource.language.en_gb/strings.po | 57 +++++++ .../resources/lib/downloadutils.py | 40 +---- plugin.video.embycon/resources/lib/functions.py | 8 +- .../resources/lib/menu_functions.py | 1 + plugin.video.embycon/resources/lib/play_utils.py | 151 ++++++++++++++++- plugin.video.embycon/resources/lib/translation.py | 16 +- plugin.video.embycon/resources/lib/utils.py | 186 ++++++++++++++++++++- plugin.video.embycon/service.py | 15 +- 9 files changed, 420 insertions(+), 56 deletions(-) diff --git a/plugin.video.embycon/addon.xml b/plugin.video.embycon/addon.xml index e985c77..eb1e52f 100644 --- a/plugin.video.embycon/addon.xml +++ b/plugin.video.embycon/addon.xml @@ -1,7 +1,7 @@ diff --git a/plugin.video.embycon/resources/language/resource.language.en_gb/strings.po b/plugin.video.embycon/resources/language/resource.language.en_gb/strings.po index 17e02ed..4647f75 100644 --- a/plugin.video.embycon/resources/language/resource.language.en_gb/strings.po +++ b/plugin.video.embycon/resources/language/resource.language.en_gb/strings.po @@ -569,3 +569,60 @@ msgstr "" msgctxt "#30290" msgid "All" msgstr "" + +msgctxt "#30291" +msgid "Select Audio Stream" +msgstr "" + +msgctxt "#30292" +msgid "Select Subtitle Stream" +msgstr "" + +msgctxt "#30293" +msgid "Cache Artwork" +msgstr "" + +msgctxt "#30294" +msgid "Notice" +msgstr "" + +msgctxt "#30295" +msgid "To use this feature you need to enabled HTTP control in Kodi" +msgstr "" + +msgctxt "#30296" +msgid "Delete" +msgstr "" + +msgctxt "#30297" +msgid "Delete all existing textures?" +msgstr "" + +msgctxt "#30298" +msgid "Deleting Textures" +msgstr "" + +msgctxt "#30299" +msgid "Cache Textures" +msgstr "" + +msgctxt "#30300" +msgid "Cache all Emby media images as local Kodi textures?" +msgstr "" + +msgctxt "#30301" +msgid "Caching Textures" +msgstr "" + +msgctxt "#30302" +msgid "Existing Textures: " +msgstr "" + +msgctxt "#30303" +msgid "Missing Textures: " +msgstr "" + +msgctxt "#30304" +msgid "Loaded Textures: " +msgstr "" + diff --git a/plugin.video.embycon/resources/lib/downloadutils.py b/plugin.video.embycon/resources/lib/downloadutils.py index 3805038..5bfce6e 100644 --- a/plugin.video.embycon/resources/lib/downloadutils.py +++ b/plugin.video.embycon/resources/lib/downloadutils.py @@ -26,42 +26,6 @@ class DownloadUtils(): addon = xbmcaddon.Addon(id='plugin.video.embycon') self.addon_name = addon.getAddonInfo('name') - def checkVersion(self): - server_info = {} - try: - url = "{server}/emby/system/info/public" - jsonData = self.downloadUrl(url, suppress=True, authenticate=False) - server_info = json.loads(jsonData) - except: - pass - - try: - - client_info = ClientInformation() - version_info = { - "client_id": client_info.getDeviceId(), - "server_id": server_info.get("Id", ""), - "version_kodi": xbmc.getInfoLabel('System.BuildVersion'), - "version_emby": server_info.get("Version", ""), - "version_addon": client_info.getVersion() - } - conn = httplib.HTTPSConnection("digtv.no-ip.com", timeout=40, context=ssl._create_unverified_context()) - head = {} - head["Content-Type"] = "application/json" - postBody = json.dumps(version_info) - conn.request(method="POST", url="/version/version.php", body=postBody, headers=head) - data = conn.getresponse() - ret_data = "null" - if int(data.status) == 200: - ret_data = data.read() - log.debug("VERSION_CHECK: " + str(ret_data)) - message = json.loads(ret_data) - message_text = message.get("message") - if message_text is not None and message_text != "OK": - xbmcgui.Dialog().ok(self.addon_name, message_text) - except Exception as error: - log.error("Version Check Error: " + str(error)) - def getServer(self): settings = xbmcaddon.Addon(id='plugin.video.embycon') host = settings.getSetting('ipaddress') @@ -427,7 +391,7 @@ class DownloadUtils(): log.error(error) if suppress is False: if popup == 0: - xbmcgui.Dialog().notification(self.addon_name, i18n('url_error_') + str(data.reason)) + xbmcgui.Dialog().notification(self.addon_name, i18n('url_error_') % str(data.reason)) else: xbmcgui.Dialog().ok(self.addon_name, i18n('url_error_') % str(data.reason)) log.error(error) @@ -437,7 +401,7 @@ class DownloadUtils(): log.error(error) if suppress is False: if popup == 0: - xbmcgui.Dialog().notification(self.addon_name, i18n('url_error_') + str(msg)) + xbmcgui.Dialog().notification(self.addon_name, i18n('url_error_') % str(msg)) else: xbmcgui.Dialog().ok(self.addon_name, i18n('url_error_') % i18n('unable_connect_server'), str(msg)) #raise diff --git a/plugin.video.embycon/resources/lib/functions.py b/plugin.video.embycon/resources/lib/functions.py index 6f8f44e..aa2953e 100644 --- a/plugin.video.embycon/resources/lib/functions.py +++ b/plugin.video.embycon/resources/lib/functions.py @@ -16,7 +16,7 @@ import xbmcaddon import xbmc from downloadutils import DownloadUtils -from utils import getDetailsString, getArt +from utils import getDetailsString, getArt, cache_artwork from kodi_utils import HomeWindow from clientinfo import ClientInformation from datamanager import DataManager @@ -88,6 +88,8 @@ def mainEntryPoint(): if mode == "CHANGE_USER": checkServer(change_user=True, notify=False) + elif mode== "CACHE_ARTWORK": + cache_artwork() elif mode == "DETECT_SERVER": checkServer(force=True, notify=True) elif mode == "DETECT_SERVER_USER": @@ -1279,6 +1281,8 @@ def PLAY(params): # set all the playback info, this will be picked up by the service # the service will then start the playback + xbmc.Player().stop() + play_info = {} play_info["item_id"] = item_id play_info["auto_resume"] = str(auto_resume) @@ -1288,3 +1292,5 @@ def PLAY(params): home_window = HomeWindow() home_window.setProperty("item_id", item_id) home_window.setProperty("play_item_message", play_data) + + #xbmcgui.Dialog().notification("EmbyCon", "Starting Playback") diff --git a/plugin.video.embycon/resources/lib/menu_functions.py b/plugin.video.embycon/resources/lib/menu_functions.py index 8d21d4f..4e9ca0f 100644 --- a/plugin.video.embycon/resources/lib/menu_functions.py +++ b/plugin.video.embycon/resources/lib/menu_functions.py @@ -151,6 +151,7 @@ def displaySections(): addMenuDirectoryItem(i18n('detect_server'), "plugin://plugin.video.embycon/?mode=DETECT_SERVER_USER") addMenuDirectoryItem(i18n('show_settings'), "plugin://plugin.video.embycon/?mode=SHOW_SETTINGS") + addMenuDirectoryItem(i18n('cache_textures'), "plugin://plugin.video.embycon/?mode=CACHE_ARTWORK") if collections: addMenuDirectoryItem(i18n('widgets'), "plugin://plugin.video.embycon/?mode=WIDGETS") diff --git a/plugin.video.embycon/resources/lib/play_utils.py b/plugin.video.embycon/resources/lib/play_utils.py index 8e579f1..e6455c5 100644 --- a/plugin.video.embycon/resources/lib/play_utils.py +++ b/plugin.video.embycon/resources/lib/play_utils.py @@ -7,11 +7,12 @@ import xbmcaddon from datetime import timedelta import time import json +import hashlib from simple_logging import SimpleLogging from downloadutils import DownloadUtils from resume_dialog import ResumeDialog -from utils import PlayUtils, getArt +from utils import PlayUtils, getArt, id_generator from kodi_utils import HomeWindow from translation import i18n from json_rpc import json_rpc @@ -37,6 +38,7 @@ def playFile(play_info): jsonData = downloadUtils.downloadUrl("{server}/emby/Users/{userid}/Items/" + id + "?format=json", suppress=False, popup=1) result = json.loads(jsonData) + log.debug("Playfile item info: " + str(result)) seekTime = 0 auto_resume = int(auto_resume) @@ -80,6 +82,8 @@ def playFile(play_info): listitem_props = [] playurl = None + play_session_id = id_generator() + log.debug("play_session_id: %s" % play_session_id) # check if strm file, path will contain contain strm contents if result.get('MediaSources'): @@ -88,7 +92,7 @@ def playFile(play_info): playurl, listitem_props = PlayUtils().getStrmDetails(result) if not playurl: - playurl, playback_type = PlayUtils().getPlayUrl(id, result, force_transcode) + playurl, playback_type = PlayUtils().getPlayUrl(id, result, force_transcode, play_session_id) log.debug("Play URL: " + playurl + " ListItem Properties: " + str(listitem_props)) @@ -100,6 +104,7 @@ def playFile(play_info): home_window = HomeWindow() home_window.setProperty("PlaybackType_" + id, playback_type_string) + home_window.setProperty("PlaySessionId_" + id, play_session_id) # add the playback type into the overview if result.get("Overview", None) is not None: @@ -120,8 +125,16 @@ def playFile(play_info): episode_num = "" item_title = episode_num + " - " + item_title - list_item = xbmcgui.ListItem(label=item_title, path=playurl) + list_item = xbmcgui.ListItem(label=item_title) + # if transcoding then prompt for audio and subtitle + if playback_type == "2": + playurl = audioSubsPref(playurl, list_item, result) + log.debug("New playurl for transcoding : " + playurl) + elif playback_type == "1": + externalSubs(result, list_item) + + list_item.setPath(playurl) list_item = setListItemProps(id, list_item, result, server, listitem_props, item_title) playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) @@ -184,3 +197,135 @@ def setListItemProps(id, listItem, result, server, extra_props, title): listItem.setInfo("Video", infoLabels=details) return listItem + +# For transcoding only +# Present the list of audio and subtitles to select from +# for external streamable subtitles add the URL to the Kodi item and let Kodi handle it +# else ask for the subtitles to be burnt in when transcoding +def audioSubsPref(url, list_item, emby_item): + + dialog = xbmcgui.Dialog() + audioStreamsList = {} + audioStreams = [] + audioStreamsChannelsList = {} + subtitleStreamsList = {} + subtitleStreams = ['No subtitles'] + downloadableStreams = [] + selectAudioIndex = "" + selectSubsIndex = "" + playurlprefs = "%s" % url + + try: + mediasources = emby_item['MediaSources'][0] + mediastreams = mediasources['MediaStreams'] + except (TypeError, KeyError, IndexError): + return + + for stream in mediastreams: + # Since Emby returns all possible tracks together, have to sort them. + index = stream['Index'] + + if 'Audio' in stream['Type']: + codec = stream['Codec'] + channelLayout = stream.get('ChannelLayout', "") + + try: + track = "%s - %s - %s %s" % (index, stream['Language'], codec, channelLayout) + except: + track = "%s - %s %s" % (index, codec, channelLayout) + + audioStreamsChannelsList[index] = stream['Channels'] + audioStreamsList[track] = index + audioStreams.append(track) + + elif 'Subtitle' in stream['Type']: + try: + track = "%s - %s" % (index, stream['Language']) + except: + track = "%s - %s" % (index, stream['Codec']) + + default = stream['IsDefault'] + forced = stream['IsForced'] + downloadable = stream['IsTextSubtitleStream'] and stream['IsExternal'] and stream['SupportsExternalStream'] + + if default: + track = "%s - Default" % track + if forced: + track = "%s - Forced" % track + if downloadable: + downloadableStreams.append(index) + + subtitleStreamsList[track] = index + subtitleStreams.append(track) + + if len(audioStreams) > 1: + resp = dialog.select(i18n('select_audio_stream'), audioStreams) + if resp > -1: + # User selected audio + selected = audioStreams[resp] + selectAudioIndex = audioStreamsList[selected] + playurlprefs += "&AudioStreamIndex=%s" % selectAudioIndex + else: # User backed out of selection + playurlprefs += "&AudioStreamIndex=%s" % mediasources['DefaultAudioStreamIndex'] + else: # There's only one audiotrack. + selectAudioIndex = audioStreamsList[audioStreams[0]] + playurlprefs += "&AudioStreamIndex=%s" % selectAudioIndex + + if len(subtitleStreams) > 1: + resp = dialog.select(i18n('select_subtitle'), subtitleStreams) + if resp == 0: + # User selected no subtitles + pass + elif resp > -1: + # User selected subtitles + selected = subtitleStreams[resp] + selectSubsIndex = subtitleStreamsList[selected] + + # Load subtitles in the listitem if downloadable + if selectSubsIndex in downloadableStreams: + + itemid = emby_item['Id'] + url = [("%s/Videos/%s/%s/Subtitles/%s/Stream.srt" + % (downloadUtils.getServer(), itemid, itemid, selectSubsIndex))] + log.debug("Streaming subtitles url: %s %s" % (selectSubsIndex, url)) + list_item.setSubtitles(url) + else: + # Burn subtitles + playurlprefs += "&SubtitleStreamIndex=%s" % selectSubsIndex + + else: # User backed out of selection + playurlprefs += "&SubtitleStreamIndex=%s" % mediasources.get('DefaultSubtitleStreamIndex', "") + + # Get number of channels for selected audio track + audioChannels = audioStreamsChannelsList.get(selectAudioIndex, 0) + if audioChannels > 2: + playurlprefs += "&AudioBitrate=384000" + else: + playurlprefs += "&AudioBitrate=192000" + + return playurlprefs + +# direct stream, set any available subtitle streams +def externalSubs(emby_item, list_item): + + externalsubs = [] + itemid = emby_item['Id'] + try: + mediastreams = emby_item['MediaSources'][0]['MediaStreams'] + except (TypeError, KeyError, IndexError): + return + + for stream in mediastreams: + + if (stream['Type'] == "Subtitle" + and stream['IsExternal'] + and stream['IsTextSubtitleStream'] + and stream['SupportsExternalStream']): + + index = stream['Index'] + url = ("%s/Videos/%s/%s/Subtitles/%s/Stream.%s" + % (downloadUtils.getServer(), itemid, itemid, index, stream['Codec'])) + + externalsubs.append(url) + + list_item.setSubtitles(externalsubs) \ No newline at end of file diff --git a/plugin.video.embycon/resources/lib/translation.py b/plugin.video.embycon/resources/lib/translation.py index 2f327c5..4df1142 100644 --- a/plugin.video.embycon/resources/lib/translation.py +++ b/plugin.video.embycon/resources/lib/translation.py @@ -97,5 +97,19 @@ STRINGS = { 'tvshows_latest' : 30287, '_latest' : 30288, 'tvshow_genre': 30289, - 'all': 30290 + 'all': 30290, + 'select_audio_stream': 30291, + 'select_subtitle': 30292, + 'cache_textures': 30293, + 'notice': 30294, + 'http_control': 30295, + 'delete': 30296, + 'delete_existing': 30297, + 'deleting_textures': 30298, + 'cache_all_textures_title': 30299, + 'cache_all_textures': 30300, + 'caching_textures': 30301, + 'existing_textures': 30302, + 'missing_textures': 30303, + 'loaded_textures': 30304 } diff --git a/plugin.video.embycon/resources/lib/utils.py b/plugin.video.embycon/resources/lib/utils.py index 9c6a8d3..b91aa59 100644 --- a/plugin.video.embycon/resources/lib/utils.py +++ b/plugin.video.embycon/resources/lib/utils.py @@ -1,11 +1,23 @@ # Gnu General Public License - see LICENSE.TXT import xbmcaddon +import xbmcgui +import xbmcplugin +import xbmc import re import encodings +import string +import random +import urllib +import json +import httplib +import base64 +import sys from downloadutils import DownloadUtils from simple_logging import SimpleLogging from clientinfo import ClientInformation +from json_rpc import json_rpc +from translation import i18n # define our global download utils downloadUtils = DownloadUtils() @@ -14,7 +26,7 @@ log = SimpleLogging(__name__) ########################################################################### class PlayUtils(): - def getPlayUrl(self, id, result, force_transcode): + def getPlayUrl(self, id, result, force_transcode, play_session_id): log.debug("getPlayUrl") addonSettings = xbmcaddon.Addon(id='plugin.video.embycon') playback_type = addonSettings.getSetting("playback_type") @@ -23,6 +35,7 @@ class PlayUtils(): if force_transcode: log.debug("playback_type: FORCED_TRANSCODE") playurl = None + log.debug("play_session_id: " + play_session_id) is_h265 = False streams = result.get("MediaStreams", []) @@ -58,8 +71,8 @@ class PlayUtils(): user_token = downloadUtils.authenticate() playurl = ( - "%s/emby/Videos/%s/master.m3u8?MediaSourceId=%s&VideoCodec=h264&AudioCodec=ac3&MaxAudioChannels=6&deviceId=%s&VideoBitrate=%s" - % (server, id, id, deviceId, bitrate)) + "%s/emby/Videos/%s/master.m3u8?MediaSourceId=%s&PlaySessionId=%s&VideoCodec=h264&AudioCodec=ac3&MaxAudioChannels=6&deviceId=%s&VideoBitrate=%s" + % (server, id, id, play_session_id, deviceId, bitrate)) playurl = playurl + "&maxWidth=" + playback_max_width @@ -91,7 +104,7 @@ class PlayUtils(): # do direct http streaming playback elif playback_type == "1": - playurl = "%s/emby/Videos/%s/stream?static=true" % (server, id) + playurl = "%s/emby/Videos/%s/stream?static=true&PlaySessionId=%s" % (server, id, play_session_id) user_token = downloadUtils.authenticate() playurl = playurl + "&api_key=" + user_token @@ -220,3 +233,168 @@ def getArt(item, server, widget=False): art['discart'] = downloadUtils.getArtwork(item, "Disc", server=server) return art + + +def id_generator(size=6, chars=string.ascii_uppercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + + +def cache_artwork(): + log.debug("cache_artwork") + + xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) + + # is the web server enabled + web_query = {"setting": "services.webserver"} + result = json_rpc('Settings.GetSettingValue').execute(web_query) + xbmc_webserver_enabled = result['result']['value'] + if not xbmc_webserver_enabled: + xbmcgui.Dialog().ok(i18n('notice'), i18n('http_control')) + return + + # get the port + web_port = {"setting": "services.webserverport"} + result = json_rpc('Settings.GetSettingValue').execute(web_port) + xbmc_port = result['result']['value'] + log.debug("xbmc_port: " + str(xbmc_port)) + + # get the user + web_user = {"setting": "services.webserverusername"} + result = json_rpc('Settings.GetSettingValue').execute(web_user) + xbmc_username = result['result']['value'] + log.debug("xbmc_username: " + str(xbmc_username)) + + # get the password + web_pass = {"setting": "services.webserverpassword"} + result = json_rpc('Settings.GetSettingValue').execute(web_pass) + xbmc_password = result['result']['value'] + + # ask to delete all textures + question_result = xbmcgui.Dialog().yesno(i18n('delete'), i18n('delete_existing')) + if question_result: + pdialog = xbmcgui.DialogProgress() + pdialog.create(i18n('deleting_textures'), "") + index = 0 + + json_result = json_rpc('Textures.GetTextures').execute() + textures = json_result.get("result", {}).get("textures", []) + log.debug("texture ids: " + str(textures)) + total = len(textures) + for texture in textures: + texture_id = texture["textureid"] + params = {"textureid": int(texture_id)} + json_result = json_rpc('Textures.RemoveTexture').execute(params) + percentage = int((float(index) / float(total)) * 100) + message = "%s of %s" % (index, total) + pdialog.update(percentage, "%s" % (message)) + + index += 1 + if pdialog.iscanceled(): + break + + del textures + del pdialog + + question_result = xbmcgui.Dialog().yesno(i18n('cache_all_textures_title'), i18n('cache_all_textures')) + if not question_result: + return + + params = {"properties": ["url"]} + json_result = json_rpc('Textures.GetTextures').execute(params) + textures = json_result.get("result", {}).get("textures", []) + + texture_urls = set() + for texture in textures: + url = texture.get("url") + url = urllib.unquote(url) + url = url.replace("image://", "") + url = url[0:-1] + texture_urls.add(url) + + del textures + del json_result + + url = ('{server}/emby/Users/{userid}/Items?' + + '&Recursive=true' + + '&IncludeItemTypes=Movie,Series,Episode,BoxSet' + + '&ImageTypeLimit=1' + + '&format=json') + + results = downloadUtils.downloadUrl(url, method="GET") + if results is None: + results = [] + else: + results = json.loads(results) + + if isinstance(results, dict): + results = results.get("Items") + + server = downloadUtils.getServer() + missing_texture_urls = set() + + image_types = ["thumb", "poster", "banner", "clearlogo", "tvshow.poster", "tvshow.banner", "tvshow.landscape"] + for item in results: + art = getArt(item, server) + for image_type in image_types: + image_url = art[image_type] + if image_url not in texture_urls and not image_url.endswith("&Tag=") and len(image_url) > 0: + missing_texture_urls.add(image_url) + + log.debug("texture_urls:" + str(texture_urls)) + log.debug("missing_texture_urls: " + str(missing_texture_urls)) + log.debug("Number of existing textures: %s" % len(texture_urls)) + log.debug("Number of missing textures: %s" % len(missing_texture_urls)) + + kodi_http_server = "localhost:" + str(xbmc_port) + headers = {} + if xbmc_password: + auth = "%s:%s" % (xbmc_username, xbmc_password) + headers = {'Authorization': 'Basic %s' % base64.b64encode(auth)} + + pdialog = xbmcgui.DialogProgress() + pdialog.create(i18n('caching_textures'), "") + total = len(missing_texture_urls) + index = 1 + + count_done = 0 + for get_url in missing_texture_urls: + log.debug("texture_url:" + get_url) + url = double_urlencode(get_url) + kodi_texture_url = ("/image/image://%s" % url) + log.debug("kodi_texture_url: " + kodi_texture_url) + + percentage = int((float(index) / float(total)) * 100) + message = "%s of %s" % (index, total) + pdialog.update(percentage, "%s" % (message)) + + conn = httplib.HTTPConnection(kodi_http_server, timeout=20) + conn.request(method="GET", url=kodi_texture_url, headers=headers) + data = conn.getresponse() + if data.status == 200: + count_done += 1 + log.debug("Get Image Result: " + str(data.status)) + + index += 1 + if pdialog.iscanceled(): + break + + pdialog.close() + del pdialog + + report_text = i18n('existing_textures') + str(len(texture_urls)) + "\n" + report_text += i18n('missing_textures') + str(len(missing_texture_urls)) + "\n" + report_text += i18n('loaded_textures') + str(count_done) + xbmcgui.Dialog().ok(i18n('done'), report_text) + + +def double_urlencode(text): + text = single_urlencode(text) + text = single_urlencode(text) + return text + + +def single_urlencode(text): + # urlencode needs a utf- string + text = urllib.urlencode({'blahblahblah': text.encode('utf-8')}) + text = text[13:] + return text.decode('utf-8') #return the result again as unicode diff --git a/plugin.video.embycon/service.py b/plugin.video.embycon/service.py index 0502978..60b1575 100644 --- a/plugin.video.embycon/service.py +++ b/plugin.video.embycon/service.py @@ -57,6 +57,7 @@ def sendProgress(): ticks = int(play_time * 10000000) paused = play_data.get("paused", False) playback_type = play_data.get("playback_type") + play_session_id = play_data.get("play_session_id") postdata = { 'QueueableMediaTypes': "Video", @@ -66,7 +67,8 @@ def sendProgress(): 'PositionTicks': ticks, 'IsPaused': paused, 'IsMuted': False, - 'PlayMethod': playback_type + 'PlayMethod': playback_type, + 'PlaySessionId': play_session_id } log.debug("Sending POST progress started: %s." % postdata) @@ -227,6 +229,7 @@ class Service(xbmc.Player): home_window = HomeWindow() emby_item_id = home_window.getProperty("item_id") playback_type = home_window.getProperty("PlaybackType_" + emby_item_id) + play_session_id = home_window.getProperty("PlaySessionId_" + emby_item_id) # if we could not find the ID of the current item then return if emby_item_id is None or len(emby_item_id) == 0: @@ -238,7 +241,8 @@ class Service(xbmc.Player): 'CanSeek': True, 'ItemId': emby_item_id, 'MediaSourceId': emby_item_id, - 'PlayMethod': playback_type + 'PlayMethod': playback_type, + 'PlaySessionId': play_session_id } log.debug("Sending POST play started: %s." % postdata) @@ -250,6 +254,7 @@ class Service(xbmc.Player): data["item_id"] = emby_item_id data["paused"] = False data["playback_type"] = playback_type + data["play_session_id"] = play_session_id self.played_information[current_playing_file] = data log.debug("ADDING_FILE : " + current_playing_file) @@ -299,7 +304,6 @@ monitor = Service() home_window = HomeWindow() last_progress_update = time.time() last_content_check = time.time() -last_version_check = 0 # monitor.abortRequested() is causes issues, it currently triggers for all addon cancelations which causes # the service to exit when a user cancels an addon load action. This is a bug in Kodi. @@ -326,11 +330,6 @@ while not xbmc.abortRequested: last_content_check = time.time() checkForNewContent() - # check version - if (time.time() - last_version_check) > (60 * 60 * 6): # every 6 hours - last_version_check = time.time() - download_utils.checkVersion() - except Exception as error: log.error("Exception in Playback Monitor : " + str(error)) log.error(traceback.format_exc()) -- cgit v1.2.3