From 892d3167ef3537bfbd3ddacdb0c36f8e682b87d2 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Wed, 8 Mar 2017 21:02:10 +1100 Subject: [PATCH] string replace MBCon with EmbyCon --- resources/language/English/strings.xml | 2 +- resources/lib/DataManager.py | 4 +-- resources/lib/DownloadUtils.py | 10 +++--- resources/lib/Functions.py | 50 +++++++++++++------------- resources/lib/Utils.py | 8 ++--- resources/lib/WebSocketClient.py | 4 +-- resources/settings.xml | 2 +- service.py | 26 +++++++------- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 0cb244f..94b878c 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -36,7 +36,7 @@ Play Error This item is not playable Error - MBCon service is not running + EmbyCon service is not running Please restart XBMC Skin does not support setting views diff --git a/resources/lib/DataManager.py b/resources/lib/DataManager.py index 429c1a8..5db0149 100644 --- a/resources/lib/DataManager.py +++ b/resources/lib/DataManager.py @@ -28,7 +28,7 @@ class DataManager(): def logMsg(self, msg, level = 1): if(self.logLevel >= level): - xbmc.log("MBCon DataManager -> " + msg) + xbmc.log("EmbyCon DataManager -> " + msg) def getCacheValidatorFromData(self, result): result = result.get("Items") @@ -152,7 +152,7 @@ class CacheManagerThread(threading.Thread): def logMsg(self, msg, level = 1): if(self.logLevel >= level): - xbmc.log("MBCon CacheManagerThread -> " + msg) + xbmc.log("EmbyCon CacheManagerThread -> " + msg) def setCacheData(self, data): self.dataManager = data diff --git a/resources/lib/DownloadUtils.py b/resources/lib/DownloadUtils.py index 9431b3a..4e2a758 100644 --- a/resources/lib/DownloadUtils.py +++ b/resources/lib/DownloadUtils.py @@ -31,7 +31,7 @@ class DownloadUtils(): def logMsg(self, msg, level = 1): if(self.logLevel >= level): - xbmc.log("MBCon DownloadUtils -> " + msg) + xbmc.log("EmbyCon DownloadUtils -> " + msg) def getArtwork(self, data, type, index = "0", width = 10000, height = 10000): @@ -114,7 +114,7 @@ class DownloadUtils(): userid = WINDOW.getProperty("userid") if(userid != None and userid != ""): - self.logMsg("MBCon DownloadUtils -> Returning saved UserID : " + userid) + self.logMsg("EmbyCon DownloadUtils -> Returning saved UserID : " + userid) return userid port = self.addonSettings.getSetting('port') @@ -175,7 +175,7 @@ class DownloadUtils(): token = WINDOW.getProperty("AccessToken") if(token != None and token != ""): - self.logMsg("MBCon DownloadUtils -> Returning saved AccessToken : " + token) + self.logMsg("EmbyCon DownloadUtils -> Returning saved AccessToken : " + token) return token port = self.addonSettings.getSetting("port") @@ -237,7 +237,7 @@ class DownloadUtils(): if(authToken != ""): headers["X-MediaBrowser-Token"] = authToken - self.logMsg("MBCon Authentication Header : " + str(headers)) + self.logMsg("EmbyCon Authentication Header : " + str(headers)) return headers def downloadUrl(self, url, suppress=False, postBody=None, type="GET", popup=0, authenticate=True): @@ -321,7 +321,7 @@ class DownloadUtils(): xbmc.log(error) if suppress is False: if popup == 0: - xbmc.executebuiltin("XBMC.Notification(\"MBCon\": URL error: Unable to connect to server,)") + xbmc.executebuiltin("XBMC.Notification(\"EmbyCon\": URL error: Unable to connect to server,)") else: xbmcgui.Dialog().ok("",self.getString(30204)) raise diff --git a/resources/lib/Functions.py b/resources/lib/Functions.py index 9ab6757..9728fef 100644 --- a/resources/lib/Functions.py +++ b/resources/lib/Functions.py @@ -68,14 +68,14 @@ try: except: pass -#xbmc.log("MBCon -> LogLevel: " + str(logLevel)) +#xbmc.log("EmbyCon -> LogLevel: " + str(logLevel)) downloadUtils = DownloadUtils() dataManager = DataManager() def mainEntryPoint(): - printDebug("===== MBCon START =====") + printDebug("===== EmbyCon START =====") ProfileCode = __settings__.getSetting('profile') == "true" @@ -85,17 +85,17 @@ def mainEntryPoint(): pr.enable() ADDON_VERSION = ClientInformation().getVersion() - printDebug("MBCon -> running Python: " + str(sys.version_info)) - printDebug("MBCon -> running MBCon: " + str(ADDON_VERSION)) + printDebug("EmbyCon -> running Python: " + str(sys.version_info)) + printDebug("EmbyCon -> running EmbyCon: " + str(ADDON_VERSION)) printDebug(xbmc.getInfoLabel( "System.BuildVersion" )) - printDebug( "MBCon -> Script argument date " + str(sys.argv)) + printDebug( "EmbyCon -> Script argument date " + str(sys.argv)) try: params = get_params(sys.argv[2]) except: params = {} - printDebug("MBCon -> Script params is " + str(params)) + printDebug("EmbyCon -> Script params is " + str(params)) param_url = params.get('url', None) @@ -153,8 +153,8 @@ def mainEntryPoint(): WINDOW = xbmcgui.Window( 10000 ) WINDOW.clearProperty("heading") - printDebug("MBCon -> Mode: " + str(mode)) - printDebug("MBCon -> URL: " + str(param_url)) + printDebug("EmbyCon -> Mode: " + str(mode)) + printDebug("EmbyCon -> URL: " + str(param_url)) #Run a function based on the mode variable that was passed in the URL #if ( mode == None or param_url == None or len(param_url) < 1 ): @@ -188,7 +188,7 @@ def mainEntryPoint(): f.write(str(ncalls) + "\t" + "{0}".format(total_time) + "\t" + "{0}".format(cumulative_time) + "\t" + func_name + "\t" + filename + "\r\n") f.close() - printDebug("===== MBCon FINISHED =====") + printDebug("===== EmbyCon FINISHED =====") def printDebug( msg, level = 1): if(logLevel >= level): @@ -197,9 +197,9 @@ def printDebug( msg, level = 1): stack = inspect.stack() for frame in stack: stackline = stackline + "." + frame[3] - xbmc.log("MBCon " + str(level) + " -> (" + stackline + ") : " + str(msg)) + xbmc.log("EmbyCon " + str(level) + " -> (" + stackline + ") : " + str(msg)) else: - xbmc.log("MBCon " + str(level) + " -> " + str(msg)) + xbmc.log("EmbyCon " + str(level) + " -> " + str(msg)) def getServerDetails(): @@ -724,7 +724,7 @@ def get_params( paramstring ): param[splitparams[0]]=splitparams[1] elif (len(splitparams))==3: param[splitparams[0]]=splitparams[1]+"="+splitparams[2] - printDebug("MBCon -> Detected parameters: " + str(param), level=2) + printDebug("EmbyCon -> Detected parameters: " + str(param), level=2) return param def getContent(url, pluginhandle): @@ -741,7 +741,7 @@ def getContent(url, pluginhandle): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE) WINDOW = xbmcgui.Window(10000) - WINDOW.setProperty("MBConContent", "true") + WINDOW.setProperty("EmbyConContent", "true") # show a progress indicator if needed progress = None @@ -1131,7 +1131,7 @@ def getXbmcVersion(): def getCastList(pluginName, handle, params): - printDebug ("MBCon Returning Cast List") + printDebug ("EmbyCon Returning Cast List") port = __settings__.getSetting('port') host = __settings__.getSetting('ipaddress') @@ -1385,50 +1385,50 @@ def showParentContent(pluginName, handle, params): def checkService(): - timeStamp = xbmcgui.Window(10000).getProperty("mbcon_Service_Timestamp") + timeStamp = xbmcgui.Window(10000).getProperty("EmbyCon_Service_Timestamp") loops = 0 while(timeStamp == ""): - timeStamp = xbmcgui.Window(10000).getProperty("mbcon_Service_Timestamp") + timeStamp = xbmcgui.Window(10000).getProperty("EmbyCon_Service_Timestamp") loops = loops + 1 if(loops == 40): - printDebug("MBCon Service Not Running, no time stamp, exiting", 0) + printDebug("EmbyCon Service Not Running, no time stamp, exiting", 0) xbmcgui.Dialog().ok(__language__(30135), __language__(30136), __language__(30137)) sys.exit() xbmc.sleep(200) - printDebug ("MBCon Service Timestamp: " + timeStamp) - printDebug ("MBCon Current Timestamp: " + str(int(time.time()))) + printDebug ("EmbyCon Service Timestamp: " + timeStamp) + printDebug ("EmbyCon Current Timestamp: " + str(int(time.time()))) if((int(timeStamp) + 240) < int(time.time())): - printDebug("MBCon Service Not Running, time stamp to old, exiting", 0) + printDebug("EmbyCon Service Not Running, time stamp to old, exiting", 0) xbmcgui.Dialog().ok(__language__(30135), __language__(30136), __language__(30137)) sys.exit() def checkServer(force=0): - printDebug ("MBCon checkServer Called") + printDebug ("EmbyCon checkServer Called") port = __settings__.getSetting('port') host = __settings__.getSetting('ipaddress') if(force == 0 and len(host) != 0 and host != ""): - printDebug ("MBCon server already set") + printDebug ("EmbyCon server already set") return serverInfo = getServerDetails() if(len(serverInfo) == 0): - printDebug ("MBCon getServerDetails failed") + printDebug ("EmbyCon getServerDetails failed") return index = serverInfo.find(":") if(index <= 0): - printDebug ("MBCon getServerDetails data not correct : " + serverInfo) + printDebug ("EmbyCon getServerDetails data not correct : " + serverInfo) return server_address = serverInfo[:index] server_port = serverInfo[index+1:] - printDebug ("MBCon detected server info " + server_address + " : " + server_port) + printDebug ("EmbyCon detected server info " + server_address + " : " + server_port) xbmcgui.Dialog().ok(__language__(30167), __language__(30168), __language__(30169) + server_address, __language__(30030) + server_port) diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 5c3e2ab..a6175a6 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -23,7 +23,7 @@ class PlayUtils(): addonSettings = xbmcaddon.Addon(id='plugin.video.embycon') # if the path is local and depending on the video quality play we can direct play it do so- - xbmc.log("MBCon getPlayUrl") + xbmc.log("EmbyCon getPlayUrl") playurl = result.get("Path") if playurl != None: @@ -71,14 +71,14 @@ class PlayUtils(): if(mediaSources != None): if mediaSources[0].get('Bitrate') != None: if settingsVideoBitRate < int(mediaSources[0].get('Bitrate')): - xbmc.log("MBCon isNetworkQualitySufficient -> FALSE bit rate - settingsVideoBitRate: " + str(settingsVideoBitRate) + " mediasource bitrate: " + str(mediaSources[0].get('Bitrate'))) + xbmc.log("EmbyCon isNetworkQualitySufficient -> FALSE bit rate - settingsVideoBitRate: " + str(settingsVideoBitRate) + " mediasource bitrate: " + str(mediaSources[0].get('Bitrate'))) return False else: - xbmc.log("MBCon isNetworkQualitySufficient -> TRUE bit rate") + xbmc.log("EmbyCon isNetworkQualitySufficient -> TRUE bit rate") return True # Any thing else is ok - xbmc.log("MBCon isNetworkQualitySufficient -> TRUE default") + xbmc.log("EmbyCon isNetworkQualitySufficient -> TRUE default") return True diff --git a/resources/lib/WebSocketClient.py b/resources/lib/WebSocketClient.py index 814d264..e19e5fe 100644 --- a/resources/lib/WebSocketClient.py +++ b/resources/lib/WebSocketClient.py @@ -27,13 +27,13 @@ class WebSocketThread(threading.Thread): if(level != None): self.logLevel = int(level) - xbmc.log("MBCon WebSocketThread -> Log Level:" + str(self.logLevel)) + xbmc.log("EmbyCon WebSocketThread -> Log Level:" + str(self.logLevel)) threading.Thread.__init__(self, *args) def logMsg(self, msg, level = 1): if(self.logLevel >= level): - xbmc.log("MBCon WebSocketThread -> " + msg) + xbmc.log("EmbyCon WebSocketThread -> " + msg) def playbackStarted(self, itemId): if(self.client != None): diff --git a/resources/settings.xml b/resources/settings.xml index 41ecf5a..d520491 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -7,7 +7,7 @@ - + diff --git a/service.py b/service.py index ee55fd7..6bf53a0 100644 --- a/service.py +++ b/service.py @@ -55,19 +55,19 @@ def stopAll(played_information): return addonSettings = xbmcaddon.Addon(id='plugin.video.embycon') - xbmc.log ("MBCon Service -> played_information : " + str(played_information)) + xbmc.log ("EmbyCon Service -> played_information : " + str(played_information)) for item_url in played_information: data = played_information.get(item_url) if(data != None): - xbmc.log ("MBCon Service -> item_url : " + item_url) - xbmc.log ("MBCon Service -> item_data : " + str(data)) + xbmc.log ("EmbyCon Service -> item_url : " + item_url) + xbmc.log ("EmbyCon Service -> item_data : " + str(data)) currentPossition = data.get("currentPossition") item_id = data.get("item_id") if(hasData(item_id)): - xbmc.log("MBCon Service -> Playback Stopped at :" + str(int(currentPossition * 10000000))) + xbmc.log("EmbyCon Service -> Playback Stopped at :" + str(int(currentPossition * 10000000))) newWebSocketThread.playbackStopped(item_id, str(int(currentPossition * 10000000))) played_information.clear() @@ -78,7 +78,7 @@ class Service( xbmc.Player ): played_information = {} def __init__( self, *args ): - xbmc.log("MBCon Service -> starting monitor service") + xbmc.log("EmbyCon Service -> starting monitor service") self.played_information = {} pass @@ -87,7 +87,7 @@ class Service( xbmc.Player ): stopAll(self.played_information) currentFile = xbmc.Player().getPlayingFile() - xbmc.log("MBCon Service -> onPlayBackStarted" + currentFile) + xbmc.log("EmbyCon Service -> onPlayBackStarted" + currentFile) WINDOW = xbmcgui.Window( 10000 ) item_id = WINDOW.getProperty("item_id") @@ -104,17 +104,17 @@ class Service( xbmc.Player ): data["item_id"] = item_id self.played_information[currentFile] = data - xbmc.log("MBCon Service -> ADDING_FILE : " + currentFile) - xbmc.log("MBCon Service -> ADDING_FILE : " + str(self.played_information)) + xbmc.log("EmbyCon Service -> ADDING_FILE : " + currentFile) + xbmc.log("EmbyCon Service -> ADDING_FILE : " + str(self.played_information)) def onPlayBackEnded( self ): # Will be called when xbmc stops playing a file - xbmc.log("MBCon Service -> onPlayBackEnded") + xbmc.log("EmbyCon Service -> onPlayBackEnded") stopAll(self.played_information) def onPlayBackStopped( self ): # Will be called when user stops xbmc playing a file - xbmc.log("MBCon Service -> onPlayBackStopped") + xbmc.log("EmbyCon Service -> onPlayBackStopped") stopAll(self.played_information) monitor = Service() @@ -140,13 +140,13 @@ while not xbmc.abortRequested: lastProgressUpdate = datetime.today() except Exception, e: - xbmc.log("MBCon Service -> Exception in Playback Monitor : " + str(e)) + xbmc.log("EmbyCon Service -> Exception in Playback Monitor : " + str(e)) pass xbmc.sleep(1000) - xbmcgui.Window(10000).setProperty("mbcon_Service_Timestamp", str(int(time.time()))) + xbmcgui.Window(10000).setProperty("EmbyCon_Service_Timestamp", str(int(time.time()))) # stop the WebSocket client newWebSocketThread.stopClient() -xbmc.log("MBCon Service -> Service shutting down") +xbmc.log("EmbyCon Service -> Service shutting down")