string replace MBCon with EmbyCon
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<string id="30128">Play Error</string>
|
||||
<string id="30129">This item is not playable</string>
|
||||
<string id="30135">Error</string>
|
||||
<string id="30136">MBCon service is not running</string>
|
||||
<string id="30136">EmbyCon service is not running</string>
|
||||
<string id="30137">Please restart XBMC</string>
|
||||
|
||||
<string id="30150">Skin does not support setting views</string>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 != "<none>"):
|
||||
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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<setting type="sep" />
|
||||
<setting id="username" type="text" label="30024" />
|
||||
<setting id="password" type="text" option="hidden" label="30025" />
|
||||
<setting id="deviceName" type="text" label="30016" default="MBCon" visible="true" enable="true" />
|
||||
<setting id="deviceName" type="text" label="30016" default="EmbyCon" visible="true" enable="true" />
|
||||
<setting type="sep" />
|
||||
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
|
||||
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
|
||||
|
||||
26
service.py
26
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")
|
||||
|
||||
Reference in New Issue
Block a user