refactor to plugin.video.emby
This commit is contained in:
parent
b0ef58458e
commit
7d49a33b21
19 changed files with 104 additions and 104 deletions
|
@ -1,2 +1,2 @@
|
||||||
# plugin.video.mb3sync
|
# plugin.video.emby
|
||||||
MediaBrowser Syncer
|
MediaBrowser Syncer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.mb3sync"
|
<addon id="plugin.video.emby"
|
||||||
name="Emby"
|
name="Emby"
|
||||||
version="0.0.1"
|
version="0.0.1"
|
||||||
provider-name="Emby.media">
|
provider-name="Emby.media">
|
||||||
|
|
|
@ -7,7 +7,7 @@ import threading
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
cwd = addonSettings.getAddonInfo('path')
|
cwd = addonSettings.getAddonInfo('path')
|
||||||
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
||||||
sys.path.append(BASE_RESOURCE_PATH)
|
sys.path.append(BASE_RESOURCE_PATH)
|
||||||
|
@ -27,5 +27,5 @@ if mode == "play":
|
||||||
PlaybackUtils().PLAY(id)
|
PlaybackUtils().PLAY(id)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.mb3sync)')
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ class API():
|
||||||
|
|
||||||
def getArtwork(self, data, type, index = "0", userParentInfo = False):
|
def getArtwork(self, data, type, index = "0", userParentInfo = False):
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
id = data.get("Id")
|
id = data.get("Id")
|
||||||
getSeriesData = False
|
getSeriesData = False
|
||||||
userData = data.get("UserData")
|
userData = data.get("UserData")
|
||||||
|
@ -348,7 +348,7 @@ class API():
|
||||||
|
|
||||||
def getUserArtwork(self, data, type, index = "0"):
|
def getUserArtwork(self, data, type, index = "0"):
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
id = data.get("Id")
|
id = data.get("Id")
|
||||||
port = addonSettings.getSetting('port')
|
port = addonSettings.getSetting('port')
|
||||||
host = addonSettings.getSetting('ipaddress')
|
host = addonSettings.getSetting('ipaddress')
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ClientInformation():
|
||||||
|
|
||||||
def getAddonId(self):
|
def getAddonId(self):
|
||||||
# To use when declaring xbmcaddon.Addon(id=addonId)
|
# To use when declaring xbmcaddon.Addon(id=addonId)
|
||||||
addonId = "plugin.video.mb3sync"
|
addonId = "plugin.video.emby"
|
||||||
return addonId
|
return addonId
|
||||||
|
|
||||||
def getAddonName(self):
|
def getAddonName(self):
|
||||||
|
|
|
@ -20,7 +20,7 @@ logLevel = 1
|
||||||
class ConnectionManager():
|
class ConnectionManager():
|
||||||
|
|
||||||
addonSettings = None
|
addonSettings = None
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
__addon__ = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
__addondir__ = xbmc.translatePath( __addon__.getAddonInfo('profile') )
|
__addondir__ = xbmc.translatePath( __addon__.getAddonInfo('profile') )
|
||||||
__language__ = __addon__.getLocalizedString
|
__language__ = __addon__.getLocalizedString
|
||||||
|
|
||||||
|
@ -28,44 +28,44 @@ class ConnectionManager():
|
||||||
if(logLevel >= level):
|
if(logLevel >= level):
|
||||||
if(logLevel == 2):
|
if(logLevel == 2):
|
||||||
try:
|
try:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg))
|
xbmc.log("emby " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg))
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg.encode('utf-8')))
|
xbmc.log("emby " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg.encode('utf-8')))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + str(msg))
|
xbmc.log("emby " + str(level) + " -> " + str(msg))
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + str(msg.encode('utf-8')))
|
xbmc.log("emby " + str(level) + " -> " + str(msg.encode('utf-8')))
|
||||||
|
|
||||||
def checkServer(self):
|
def checkServer(self):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
WINDOW.setProperty("Server_Checked", "True")
|
WINDOW.setProperty("Server_Checked", "True")
|
||||||
|
|
||||||
self.printDebug ("mb3sync Connection Manager Called")
|
self.printDebug ("emby Connection Manager Called")
|
||||||
self.addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
self.addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = self.addonSettings.getSetting('port')
|
port = self.addonSettings.getSetting('port')
|
||||||
host = self.addonSettings.getSetting('ipaddress')
|
host = self.addonSettings.getSetting('ipaddress')
|
||||||
|
|
||||||
if(len(host) != 0 and host != "<none>"):
|
if(len(host) != 0 and host != "<none>"):
|
||||||
self.printDebug ("mb3sync server already set")
|
self.printDebug ("emby server already set")
|
||||||
return
|
return
|
||||||
|
|
||||||
serverInfo = self.getServerDetails()
|
serverInfo = self.getServerDetails()
|
||||||
|
|
||||||
if(serverInfo == None):
|
if(serverInfo == None):
|
||||||
self.printDebug ("mb3sync getServerDetails failed")
|
self.printDebug ("emby getServerDetails failed")
|
||||||
return
|
return
|
||||||
|
|
||||||
index = serverInfo.find(":")
|
index = serverInfo.find(":")
|
||||||
|
|
||||||
if(index <= 0):
|
if(index <= 0):
|
||||||
self.printDebug ("mb3sync getServerDetails data not correct : " + serverInfo)
|
self.printDebug ("emby getServerDetails data not correct : " + serverInfo)
|
||||||
return
|
return
|
||||||
|
|
||||||
server_address = serverInfo[:index]
|
server_address = serverInfo[:index]
|
||||||
server_port = serverInfo[index+1:]
|
server_port = serverInfo[index+1:]
|
||||||
self.printDebug ("mb3sync detected server info " + server_address + " : " + server_port)
|
self.printDebug ("emby detected server info " + server_address + " : " + server_port)
|
||||||
|
|
||||||
xbmcgui.Dialog().ok(self.__language__(30167), self.__language__(30168), self.__language__(30169) + server_address, self.__language__(30030) + server_port)
|
xbmcgui.Dialog().ok(self.__language__(30167), self.__language__(30168), self.__language__(30169) + server_address, self.__language__(30030) + server_port)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import Utils as utils
|
||||||
from ReadEmbyDB import ReadEmbyDB
|
from ReadEmbyDB import ReadEmbyDB
|
||||||
|
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
||||||
dataPath = os.path.join(addondir,"library")
|
dataPath = os.path.join(addondir,"library")
|
||||||
movieLibrary = os.path.join(dataPath,'movies')
|
movieLibrary = os.path.join(dataPath,'movies')
|
||||||
|
@ -59,7 +59,7 @@ class CreateFiles():
|
||||||
xbmcvfs.mkdir(itemPath)
|
xbmcvfs.mkdir(itemPath)
|
||||||
text_file = open(strmFile, "w")
|
text_file = open(strmFile, "w")
|
||||||
|
|
||||||
playUrl = "plugin://plugin.video.mb3sync/?id=" + item["Id"] + '&mode=play'
|
playUrl = "plugin://plugin.video.emby/?id=" + item["Id"] + '&mode=play'
|
||||||
|
|
||||||
text_file.writelines(playUrl)
|
text_file.writelines(playUrl)
|
||||||
text_file.close()
|
text_file.close()
|
||||||
|
@ -231,7 +231,7 @@ class CreateFiles():
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
trailerItem = json.loads(jsonData)
|
trailerItem = json.loads(jsonData)
|
||||||
if trailerItem[0].get("LocationType") == "FileSystem":
|
if trailerItem[0].get("LocationType") == "FileSystem":
|
||||||
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
trailerUrl = "plugin://plugin.video.emby/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
||||||
SubElement(root, "trailer").text = trailerUrl
|
SubElement(root, "trailer").text = trailerUrl
|
||||||
|
|
||||||
#add streamdetails
|
#add streamdetails
|
||||||
|
|
|
@ -41,10 +41,10 @@ class DownloadUtils():
|
||||||
def logMsg(self, msg, level = 1):
|
def logMsg(self, msg, level = 1):
|
||||||
if(self.logLevel >= level):
|
if(self.logLevel >= level):
|
||||||
try:
|
try:
|
||||||
xbmc.log("mb3sync DownloadUtils -> " + str(msg))
|
xbmc.log("emby DownloadUtils -> " + str(msg))
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
try:
|
try:
|
||||||
xbmc.log("mb3sync DownloadUtils -> " + str(msg.encode('utf-8')))
|
xbmc.log("emby DownloadUtils -> " + str(msg.encode('utf-8')))
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
def getServer(self, prefix=True):
|
def getServer(self, prefix=True):
|
||||||
|
@ -76,7 +76,7 @@ class DownloadUtils():
|
||||||
def getUserId(self, suppress=True):
|
def getUserId(self, suppress=True):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
self.addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
self.addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = self.addonSettings.getSetting('port')
|
port = self.addonSettings.getSetting('port')
|
||||||
host = self.addonSettings.getSetting('ipaddress')
|
host = self.addonSettings.getSetting('ipaddress')
|
||||||
userName = self.addonSettings.getSetting('username')
|
userName = self.addonSettings.getSetting('username')
|
||||||
|
@ -149,7 +149,7 @@ class DownloadUtils():
|
||||||
def authenticate(self, retreive=True):
|
def authenticate(self, retreive=True):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = xbmcgui.Window(10000)
|
||||||
self.addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
self.addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
username = self.addonSettings.getSetting('username')
|
username = self.addonSettings.getSetting('username')
|
||||||
|
|
||||||
token = WINDOW.getProperty("AccessToken" + username)
|
token = WINDOW.getProperty("AccessToken" + username)
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Kodi_Monitor(xbmc.Monitor):
|
||||||
#this library monitor is used to detect a watchedstate change by the user through the library
|
#this library monitor is used to detect a watchedstate change by the user through the library
|
||||||
#as well as detect when a library item has been deleted to pass the delete to the Emby server
|
#as well as detect when a library item has been deleted to pass the delete to the Emby server
|
||||||
def onNotification (self,sender,method,data):
|
def onNotification (self,sender,method,data):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
|
|
@ -23,7 +23,7 @@ from ReadKodiDB import ReadKodiDB
|
||||||
from WriteKodiDB import WriteKodiDB
|
from WriteKodiDB import WriteKodiDB
|
||||||
from CreateFiles import CreateFiles
|
from CreateFiles import CreateFiles
|
||||||
|
|
||||||
addondir = xbmc.translatePath(xbmcaddon.Addon(id='plugin.video.mb3sync').getAddonInfo('profile'))
|
addondir = xbmc.translatePath(xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('profile'))
|
||||||
dataPath = os.path.join(addondir,"library")
|
dataPath = os.path.join(addondir,"library")
|
||||||
movieLibrary = os.path.join(dataPath,'movies')
|
movieLibrary = os.path.join(dataPath,'movies')
|
||||||
tvLibrary = os.path.join(dataPath,'tvshows')
|
tvLibrary = os.path.join(dataPath,'tvshows')
|
||||||
|
@ -32,7 +32,7 @@ class LibrarySync():
|
||||||
|
|
||||||
def syncDatabase(self):
|
def syncDatabase(self):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
pDialog = None
|
pDialog = None
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class LibrarySync():
|
||||||
startedSync = datetime.today()
|
startedSync = datetime.today()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
dbSyncIndication = addon.getSetting("dbSyncIndication")
|
dbSyncIndication = addon.getSetting("dbSyncIndication")
|
||||||
dbSyncFirstRun = addon.getSetting("SyncFirstMovieRunDone")
|
dbSyncFirstRun = addon.getSetting("SyncFirstMovieRunDone")
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ class LibrarySync():
|
||||||
self.doKodiLibraryUpdate(True, pDialog)
|
self.doKodiLibraryUpdate(True, pDialog)
|
||||||
|
|
||||||
if(dbSyncFirstRun != "true"):
|
if(dbSyncFirstRun != "true"):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') #force a new instance of the addon
|
addon = xbmcaddon.Addon(id='plugin.video.emby') #force a new instance of the addon
|
||||||
addon.setSetting("SyncFirstMovieRunDone", "true")
|
addon.setSetting("SyncFirstMovieRunDone", "true")
|
||||||
|
|
||||||
# display notification if set up
|
# display notification if set up
|
||||||
|
@ -260,7 +260,7 @@ class LibrarySync():
|
||||||
|
|
||||||
def TvShowsSync(self, fullsync=True):
|
def TvShowsSync(self, fullsync=True):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
pDialog = None
|
pDialog = None
|
||||||
startedSync = datetime.today()
|
startedSync = datetime.today()
|
||||||
|
@ -589,7 +589,7 @@ class LibrarySync():
|
||||||
self.doKodiLibraryUpdate(True, pDialog)
|
self.doKodiLibraryUpdate(True, pDialog)
|
||||||
|
|
||||||
if(dbSyncFirstRun != "true"):
|
if(dbSyncFirstRun != "true"):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') #force a new instance of the addon
|
addon = xbmcaddon.Addon(id='plugin.video.emby') #force a new instance of the addon
|
||||||
addon.setSetting("SyncFirstTVRunDone", "true")
|
addon.setSetting("SyncFirstTVRunDone", "true")
|
||||||
|
|
||||||
# display notification if set up
|
# display notification if set up
|
||||||
|
@ -622,7 +622,7 @@ class LibrarySync():
|
||||||
|
|
||||||
def MusicVideosSync(self, fullsync=True):
|
def MusicVideosSync(self, fullsync=True):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
pDialog = None
|
pDialog = None
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ class LibrarySync():
|
||||||
self.doKodiLibraryUpdate(True, pDialog)
|
self.doKodiLibraryUpdate(True, pDialog)
|
||||||
|
|
||||||
if(dbSyncFirstRun != "true"):
|
if(dbSyncFirstRun != "true"):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addon.setSetting("SyncFirstMusicVideoRunDone", "true")
|
addon.setSetting("SyncFirstMusicVideoRunDone", "true")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
@ -771,7 +771,7 @@ class LibrarySync():
|
||||||
def updatePlayCounts(self):
|
def updatePlayCounts(self):
|
||||||
#update all playcounts from MB3 to Kodi library
|
#update all playcounts from MB3 to Kodi library
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
pDialog = None
|
pDialog = None
|
||||||
startedSync = datetime.today()
|
startedSync = datetime.today()
|
||||||
|
@ -914,7 +914,7 @@ class LibrarySync():
|
||||||
showCurrent += 1
|
showCurrent += 1
|
||||||
|
|
||||||
if(playCountSyncFirstRun != "true"):
|
if(playCountSyncFirstRun != "true"):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addon.setSetting("SyncFirstCountsRunDone", "true")
|
addon.setSetting("SyncFirstCountsRunDone", "true")
|
||||||
|
|
||||||
# display notification if set up
|
# display notification if set up
|
||||||
|
@ -946,7 +946,7 @@ class LibrarySync():
|
||||||
def updatePlayCount(self,itemID,type):
|
def updatePlayCount(self,itemID,type):
|
||||||
#update playcount of the itemID from MB3 to Kodi library
|
#update playcount of the itemID from MB3 to Kodi library
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
#process movie
|
#process movie
|
||||||
if type=='Movie':
|
if type=='Movie':
|
||||||
|
|
|
@ -24,7 +24,7 @@ class PlayUtils():
|
||||||
|
|
||||||
def getPlayUrl(self, server, id, result):
|
def getPlayUrl(self, server, id, result):
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
# if the path is local and depending on the video quality play we can direct play it do so-
|
# if the path is local and depending on the video quality play we can direct play it do so-
|
||||||
if self.isDirectPlay(result) == True:
|
if self.isDirectPlay(result) == True:
|
||||||
playurl = result.get("Path")
|
playurl = result.get("Path")
|
||||||
|
@ -90,20 +90,20 @@ class PlayUtils():
|
||||||
if(mediaSources != None):
|
if(mediaSources != None):
|
||||||
if mediaSources[0].get('Bitrate') != None:
|
if mediaSources[0].get('Bitrate') != None:
|
||||||
if settingsVideoBitRate < int(mediaSources[0].get('Bitrate')):
|
if settingsVideoBitRate < int(mediaSources[0].get('Bitrate')):
|
||||||
#xbmc.log("mb3sync isNetworkQualitySufficient -> FALSE bit rate - settingsVideoBitRate: " + str(settingsVideoBitRate) + " mediasource bitrate: " + str(mediaSources[0].get('Bitrate')))
|
#xbmc.log("emby isNetworkQualitySufficient -> FALSE bit rate - settingsVideoBitRate: " + str(settingsVideoBitRate) + " mediasource bitrate: " + str(mediaSources[0].get('Bitrate')))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
#xbmc.log("mb3sync isNetworkQualitySufficient -> TRUE bit rate")
|
#xbmc.log("emby isNetworkQualitySufficient -> TRUE bit rate")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Any thing else is ok
|
# Any thing else is ok
|
||||||
#xbmc.log("mb3sync isNetworkQualitySufficient -> TRUE default")
|
#xbmc.log("emby isNetworkQualitySufficient -> TRUE default")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# get the addon video quality
|
# get the addon video quality
|
||||||
def getVideoBitRate(self):
|
def getVideoBitRate(self):
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
videoQuality = addonSettings.getSetting('videoBitRate')
|
videoQuality = addonSettings.getSetting('videoBitRate')
|
||||||
if (videoQuality == "0"):
|
if (videoQuality == "0"):
|
||||||
return '664'
|
return '664'
|
||||||
|
|
|
@ -19,7 +19,7 @@ import Utils as utils
|
||||||
import os
|
import os
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
||||||
language = addon.getLocalizedString
|
language = addon.getLocalizedString
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,13 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
def __init__( self, *args ):
|
def __init__( self, *args ):
|
||||||
|
|
||||||
self.settings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
self.settings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
self.downloadUtils = DownloadUtils()
|
self.downloadUtils = DownloadUtils()
|
||||||
try:
|
try:
|
||||||
self.logLevel = int(self.settings.getSetting('logLevel'))
|
self.logLevel = int(self.settings.getSetting('logLevel'))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.printDebug("mb3sync Service -> starting playback monitor service",1)
|
self.printDebug("emby Service -> starting playback monitor service",1)
|
||||||
self.played_information = {}
|
self.played_information = {}
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -40,14 +40,14 @@ class Player( xbmc.Player ):
|
||||||
if(self.logLevel >= level):
|
if(self.logLevel >= level):
|
||||||
if(self.logLevel == 2):
|
if(self.logLevel == 2):
|
||||||
try:
|
try:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg))
|
xbmc.log("emby " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg))
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg.encode('utf-8')))
|
xbmc.log("emby " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg.encode('utf-8')))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + str(msg))
|
xbmc.log("emby " + str(level) + " -> " + str(msg))
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
xbmc.log("mb3sync " + str(level) + " -> " + str(msg.encode('utf-8')))
|
xbmc.log("emby " + str(level) + " -> " + str(msg.encode('utf-8')))
|
||||||
|
|
||||||
def hasData(self, data):
|
def hasData(self, data):
|
||||||
if(data == None or len(data) == 0 or data == "None"):
|
if(data == None or len(data) == 0 or data == "None"):
|
||||||
|
@ -60,15 +60,15 @@ class Player( xbmc.Player ):
|
||||||
if(len(self.played_information) == 0):
|
if(len(self.played_information) == 0):
|
||||||
return
|
return
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
self.printDebug("mb3sync Service -> played_information : " + str(self.played_information))
|
self.printDebug("emby Service -> played_information : " + str(self.played_information))
|
||||||
|
|
||||||
for item_url in self.played_information:
|
for item_url in self.played_information:
|
||||||
data = self.played_information.get(item_url)
|
data = self.played_information.get(item_url)
|
||||||
|
|
||||||
if(data != None):
|
if(data != None):
|
||||||
self.printDebug("mb3sync Service -> item_url : " + item_url)
|
self.printDebug("emby Service -> item_url : " + item_url)
|
||||||
self.printDebug("mb3sync Service -> item_data : " + str(data))
|
self.printDebug("emby Service -> item_data : " + str(data))
|
||||||
|
|
||||||
runtime = data.get("runtime")
|
runtime = data.get("runtime")
|
||||||
currentPosition = data.get("currentPosition")
|
currentPosition = data.get("currentPosition")
|
||||||
|
@ -79,11 +79,11 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
if(currentPosition != None and self.hasData(runtime)):
|
if(currentPosition != None and self.hasData(runtime)):
|
||||||
runtimeTicks = int(runtime)
|
runtimeTicks = int(runtime)
|
||||||
self.printDebug("mb3sync Service -> runtimeticks:" + str(runtimeTicks))
|
self.printDebug("emby Service -> runtimeticks:" + str(runtimeTicks))
|
||||||
percentComplete = (currentPosition * 10000000) / runtimeTicks
|
percentComplete = (currentPosition * 10000000) / runtimeTicks
|
||||||
markPlayedAt = float(90) / 100
|
markPlayedAt = float(90) / 100
|
||||||
|
|
||||||
self.printDebug("mb3sync Service -> Percent Complete:" + str(percentComplete) + " Mark Played At:" + str(markPlayedAt))
|
self.printDebug("emby Service -> Percent Complete:" + str(percentComplete) + " Mark Played At:" + str(markPlayedAt))
|
||||||
self.stopPlayback(data)
|
self.stopPlayback(data)
|
||||||
|
|
||||||
if(refresh_id != None):
|
if(refresh_id != None):
|
||||||
|
@ -101,7 +101,7 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
def stopPlayback(self, data):
|
def stopPlayback(self, data):
|
||||||
self.printDebug("stopPlayback called")
|
self.printDebug("stopPlayback called")
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
|
||||||
item_id = data.get("item_id")
|
item_id = data.get("item_id")
|
||||||
audioindex = data.get("AudioStreamIndex")
|
audioindex = data.get("AudioStreamIndex")
|
||||||
|
@ -138,9 +138,9 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
data = self.played_information.get(currentFile)
|
data = self.played_information.get(currentFile)
|
||||||
|
|
||||||
# only report playback if mb3sync has initiated the playback (item_id has value)
|
# only report playback if emby has initiated the playback (item_id has value)
|
||||||
if(data != None and data.get("item_id") != None):
|
if(data != None and data.get("item_id") != None):
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
|
||||||
item_id = data.get("item_id")
|
item_id = data.get("item_id")
|
||||||
audioindex = data.get("AudioStreamIndex")
|
audioindex = data.get("AudioStreamIndex")
|
||||||
|
@ -193,12 +193,12 @@ class Player( xbmc.Player ):
|
||||||
# Will be called when xbmc starts playing a file
|
# Will be called when xbmc starts playing a file
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
self.stopAll()
|
self.stopAll()
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
xbmcplayer = xbmc.Player()
|
xbmcplayer = xbmc.Player()
|
||||||
|
|
||||||
if xbmcplayer.isPlaying():
|
if xbmcplayer.isPlaying():
|
||||||
currentFile = xbmcplayer.getPlayingFile()
|
currentFile = xbmcplayer.getPlayingFile()
|
||||||
self.printDebug("mb3sync Service -> onPlayBackStarted" + currentFile,2)
|
self.printDebug("emby Service -> onPlayBackStarted" + currentFile,2)
|
||||||
|
|
||||||
# grab all the info about this item from the stored windows props
|
# grab all the info about this item from the stored windows props
|
||||||
# only ever use the win props here, use the data map in all other places
|
# only ever use the win props here, use the data map in all other places
|
||||||
|
@ -245,8 +245,8 @@ class Player( xbmc.Player ):
|
||||||
data["Type"] = itemType
|
data["Type"] = itemType
|
||||||
self.played_information[currentFile] = data
|
self.played_information[currentFile] = data
|
||||||
|
|
||||||
self.printDebug("mb3sync Service -> ADDING_FILE : " + currentFile)
|
self.printDebug("emby Service -> ADDING_FILE : " + currentFile)
|
||||||
self.printDebug("mb3sync Service -> ADDING_FILE : " + str(self.played_information))
|
self.printDebug("emby Service -> ADDING_FILE : " + str(self.played_information))
|
||||||
|
|
||||||
# log some playback stats
|
# log some playback stats
|
||||||
if(itemType != None):
|
if(itemType != None):
|
||||||
|
@ -271,7 +271,7 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
def onPlayBackEnded( self ):
|
def onPlayBackEnded( self ):
|
||||||
# Will be called when xbmc stops playing a file
|
# Will be called when xbmc stops playing a file
|
||||||
self.printDebug("mb3sync Service -> onPlayBackEnded")
|
self.printDebug("emby Service -> onPlayBackEnded")
|
||||||
|
|
||||||
#workaround when strm files are launched through the addon - mark watched when finished playing
|
#workaround when strm files are launched through the addon - mark watched when finished playing
|
||||||
#TODO --> mark watched when 95% is played of the file
|
#TODO --> mark watched when 95% is played of the file
|
||||||
|
@ -280,7 +280,7 @@ class Player( xbmc.Player ):
|
||||||
try:
|
try:
|
||||||
id = WINDOW.getProperty("virtualstrm")
|
id = WINDOW.getProperty("virtualstrm")
|
||||||
type = WINDOW.getProperty("virtualstrmtype")
|
type = WINDOW.getProperty("virtualstrmtype")
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -295,7 +295,7 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
def onPlayBackStopped( self ):
|
def onPlayBackStopped( self ):
|
||||||
# Will be called when user stops xbmc playing a file
|
# Will be called when user stops xbmc playing a file
|
||||||
self.printDebug("mb3sync Service -> onPlayBackStopped")
|
self.printDebug("emby Service -> onPlayBackStopped")
|
||||||
self.stopAll()
|
self.stopAll()
|
||||||
|
|
||||||
def seekToPosition(self, seekTo):
|
def seekToPosition(self, seekTo):
|
||||||
|
|
|
@ -9,13 +9,13 @@ import json
|
||||||
|
|
||||||
from DownloadUtils import DownloadUtils
|
from DownloadUtils import DownloadUtils
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
|
||||||
class ReadEmbyDB():
|
class ReadEmbyDB():
|
||||||
def getMovies(self, id, fullinfo = False, fullSync = True):
|
def getMovies(self, id, fullinfo = False, fullSync = True):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -44,7 +44,7 @@ class ReadEmbyDB():
|
||||||
def getMusicVideos(self, fullinfo = False, fullSync = True):
|
def getMusicVideos(self, fullinfo = False, fullSync = True):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -73,7 +73,7 @@ class ReadEmbyDB():
|
||||||
def getItem(self, id):
|
def getItem(self, id):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -90,7 +90,7 @@ class ReadEmbyDB():
|
||||||
def getFullItem(self, id):
|
def getFullItem(self, id):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -107,7 +107,7 @@ class ReadEmbyDB():
|
||||||
def getTVShows(self, fullinfo = False, fullSync = False):
|
def getTVShows(self, fullinfo = False, fullSync = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -137,7 +137,7 @@ class ReadEmbyDB():
|
||||||
def getTVShowSeasons(self, tvShowId):
|
def getTVShowSeasons(self, tvShowId):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -158,7 +158,7 @@ class ReadEmbyDB():
|
||||||
def getEpisodes(self, showId, fullinfo = False):
|
def getEpisodes(self, showId, fullinfo = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -182,7 +182,7 @@ class ReadEmbyDB():
|
||||||
def getLatestEpisodes(self,fullinfo = False):
|
def getLatestEpisodes(self,fullinfo = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -206,7 +206,7 @@ class ReadEmbyDB():
|
||||||
def getCollections(self, type):
|
def getCollections(self, type):
|
||||||
#Build a list of the user views
|
#Build a list of the user views
|
||||||
userid = DownloadUtils().getUserId()
|
userid = DownloadUtils().getUserId()
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -253,7 +253,7 @@ class ReadEmbyDB():
|
||||||
def getViewCollections(self, type):
|
def getViewCollections(self, type):
|
||||||
#Build a list of the user views
|
#Build a list of the user views
|
||||||
userid = DownloadUtils().getUserId()
|
userid = DownloadUtils().getUserId()
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -293,7 +293,7 @@ class ReadEmbyDB():
|
||||||
def getBoxSets(self):
|
def getBoxSets(self):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -314,7 +314,7 @@ class ReadEmbyDB():
|
||||||
def getMoviesInBoxSet(self,boxsetId):
|
def getMoviesInBoxSet(self,boxsetId):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
|
|
@ -9,7 +9,7 @@ import xbmcaddon
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
||||||
dataPath = os.path.join(addondir,"library")
|
dataPath = os.path.join(addondir,"library")
|
||||||
movieLibrary = os.path.join(dataPath,'movies')
|
movieLibrary = os.path.join(dataPath,'movies')
|
||||||
|
@ -39,9 +39,9 @@ class ReadKodiDB():
|
||||||
#returns all movies in Kodi db inserted by MB
|
#returns all movies in Kodi db inserted by MB
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "lastplayed", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"] }, "id": "libMovies"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.emby"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "lastplayed", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"] }, "id": "libMovies"}')
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties" : ["resume", "playcount", "lastplayed", "file"] }, "id": "libMovies"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.emby"}, "properties" : ["resume", "playcount", "lastplayed", "file"] }, "id": "libMovies"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
movies = None
|
movies = None
|
||||||
|
|
||||||
|
@ -99,9 +99,9 @@ class ReadKodiDB():
|
||||||
#returns all tvshows in Kodi db inserted by MB
|
#returns all tvshows in Kodi db inserted by MB
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "premiered", "rating", "thumbnail", "playcount", "lastplayed", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.emby"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "premiered", "rating", "thumbnail", "playcount", "lastplayed", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties": ["sorttitle", "title", "playcount", "lastplayed", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.emby"}, "properties": ["sorttitle", "title", "playcount", "lastplayed", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
tvshows = None
|
tvshows = None
|
||||||
|
|
||||||
|
@ -206,9 +206,9 @@ class ReadKodiDB():
|
||||||
#returns all musicvideos in Kodi db inserted by MB
|
#returns all musicvideos in Kodi db inserted by MB
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties" : ["art", "thumbnail", "resume", "runtime", "year", "genre", "studio", "artist", "album", "track", "lastplayed", "plot", "director", "playcount", "tag", "file"] }, "id": "libMusicVideos"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.emby"}, "properties" : ["art", "thumbnail", "resume", "runtime", "year", "genre", "studio", "artist", "album", "track", "lastplayed", "plot", "director", "playcount", "tag", "file"] }, "id": "libMusicVideos"}')
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.mb3sync"}, "properties" : ["resume", "playcount", "lastplayed", "file"] }, "id": "libMusicVideos"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "filter": {"operator": "contains", "field": "path", "value": "plugin.video.emby"}, "properties" : ["resume", "playcount", "lastplayed", "file"] }, "id": "libMusicVideos"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
musicvideos = None
|
musicvideos = None
|
||||||
if(jsonobject.has_key('result')):
|
if(jsonobject.has_key('result')):
|
||||||
|
|
|
@ -22,7 +22,7 @@ from API import API
|
||||||
from PlayUtils import PlayUtils
|
from PlayUtils import PlayUtils
|
||||||
from DownloadUtils import DownloadUtils
|
from DownloadUtils import DownloadUtils
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
language = addonSettings.getLocalizedString
|
language = addonSettings.getLocalizedString
|
||||||
DATABASE_VERSION_HELIX = "90"
|
DATABASE_VERSION_HELIX = "90"
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ def convertEncoding(data):
|
||||||
|
|
||||||
|
|
||||||
def checkKodiSources():
|
def checkKodiSources():
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addondir = xbmc.translatePath( addon.getAddonInfo('profile') )
|
addondir = xbmc.translatePath( addon.getAddonInfo('profile') )
|
||||||
dataPath = os.path.join(addondir,"library")
|
dataPath = os.path.join(addondir,"library")
|
||||||
movieLibrary = os.path.join(dataPath,'movies')
|
movieLibrary = os.path.join(dataPath,'movies')
|
||||||
|
@ -210,7 +210,7 @@ def stopProfiling(pr, profileName):
|
||||||
pr.disable()
|
pr.disable()
|
||||||
ps = pstats.Stats(pr)
|
ps = pstats.Stats(pr)
|
||||||
|
|
||||||
addondir = xbmc.translatePath(xbmcaddon.Addon(id='plugin.video.mb3sync').getAddonInfo('profile'))
|
addondir = xbmc.translatePath(xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('profile'))
|
||||||
|
|
||||||
fileTimeStamp = time.strftime("%Y-%m-%d %H-%M-%S")
|
fileTimeStamp = time.strftime("%Y-%m-%d %H-%M-%S")
|
||||||
tabFileNamepath = os.path.join(addondir, "profiles")
|
tabFileNamepath = os.path.join(addondir, "profiles")
|
||||||
|
|
|
@ -24,23 +24,23 @@ class WebSocketThread(threading.Thread):
|
||||||
keepRunning = True
|
keepRunning = True
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
level = addonSettings.getSetting('logLevel')
|
level = addonSettings.getSetting('logLevel')
|
||||||
self.logLevel = 0
|
self.logLevel = 0
|
||||||
if(level != None):
|
if(level != None):
|
||||||
self.logLevel = int(level)
|
self.logLevel = int(level)
|
||||||
|
|
||||||
xbmc.log("MB3SYNC WebSocketThread -> Log Level:" + str(self.logLevel))
|
xbmc.log("emby WebSocketThread -> Log Level:" + str(self.logLevel))
|
||||||
|
|
||||||
threading.Thread.__init__(self, *args)
|
threading.Thread.__init__(self, *args)
|
||||||
|
|
||||||
def logMsg(self, msg, level = 1):
|
def logMsg(self, msg, level = 1):
|
||||||
if(self.logLevel >= level):
|
if(self.logLevel >= level):
|
||||||
try:
|
try:
|
||||||
xbmc.log("MB3SYNC WebSocketThread -> " + str(msg))
|
xbmc.log("emby WebSocketThread -> " + str(msg))
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
try:
|
try:
|
||||||
xbmc.log("MB3SYNC WebSocketThread -> " + str(msg.encode('utf-8')))
|
xbmc.log("emby WebSocketThread -> " + str(msg.encode('utf-8')))
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -191,7 +191,7 @@ class WebSocketThread(threading.Thread):
|
||||||
messageData = {}
|
messageData = {}
|
||||||
messageData["MessageType"] = "Identity"
|
messageData["MessageType"] = "Identity"
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
deviceName = addonSettings.getSetting('deviceName')
|
deviceName = addonSettings.getSetting('deviceName')
|
||||||
deviceName = deviceName.replace("\"", "_")
|
deviceName = deviceName.replace("\"", "_")
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ class WebSocketThread(threading.Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
mb3Host = addonSettings.getSetting('ipaddress')
|
mb3Host = addonSettings.getSetting('ipaddress')
|
||||||
mb3Port = addonSettings.getSetting('port')
|
mb3Port = addonSettings.getSetting('port')
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from ReadEmbyDB import ReadEmbyDB
|
||||||
from API import API
|
from API import API
|
||||||
import Utils as utils
|
import Utils as utils
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
|
||||||
dataPath = os.path.join(addondir,"library")
|
dataPath = os.path.join(addondir,"library")
|
||||||
movieLibrary = os.path.join(dataPath,'movies')
|
movieLibrary = os.path.join(dataPath,'movies')
|
||||||
|
@ -61,7 +61,7 @@ class WriteKodiDB():
|
||||||
mb3Id = filename[-38:-6]
|
mb3Id = filename[-38:-6]
|
||||||
|
|
||||||
if(mb3Id != None):
|
if(mb3Id != None):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -76,7 +76,7 @@ class WriteKodiDB():
|
||||||
downloadUtils.downloadUrl(watchedurl, type="DELETE")
|
downloadUtils.downloadUrl(watchedurl, type="DELETE")
|
||||||
|
|
||||||
def updateMovieToKodiLibrary_Batched(self, MBitem, KodiItem):
|
def updateMovieToKodiLibrary_Batched(self, MBitem, KodiItem):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -140,7 +140,7 @@ class WriteKodiDB():
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
trailerItem = json.loads(jsonData)
|
trailerItem = json.loads(jsonData)
|
||||||
if trailerItem[0].get("LocationType") == "FileSystem":
|
if trailerItem[0].get("LocationType") == "FileSystem":
|
||||||
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
trailerUrl = "plugin://plugin.video.emby/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
||||||
self.getPropertyParam_Batched(KodiItem, "trailer", trailerUrl, params)
|
self.getPropertyParam_Batched(KodiItem, "trailer", trailerUrl, params)
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class WriteKodiDB():
|
||||||
return changes
|
return changes
|
||||||
|
|
||||||
def updateMusicVideoToKodiLibrary_Batched(self, MBitem, KodiItem):
|
def updateMusicVideoToKodiLibrary_Batched(self, MBitem, KodiItem):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -243,7 +243,7 @@ class WriteKodiDB():
|
||||||
|
|
||||||
def updateMovieToKodiLibrary(self, MBitem, KodiItem):
|
def updateMovieToKodiLibrary(self, MBitem, KodiItem):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -306,7 +306,7 @@ class WriteKodiDB():
|
||||||
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
trailerItem = json.loads(jsonData)
|
trailerItem = json.loads(jsonData)
|
||||||
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
trailerUrl = "plugin://plugin.video.emby/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
||||||
changes |= self.updateProperty(KodiItem,"trailer",trailerUrl,"movie")
|
changes |= self.updateProperty(KodiItem,"trailer",trailerUrl,"movie")
|
||||||
|
|
||||||
#add actors
|
#add actors
|
||||||
|
@ -328,7 +328,7 @@ class WriteKodiDB():
|
||||||
|
|
||||||
def updateTVShowToKodiLibrary( self, MBitem, KodiItem ):
|
def updateTVShowToKodiLibrary( self, MBitem, KodiItem ):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
@ -399,7 +399,7 @@ class WriteKodiDB():
|
||||||
|
|
||||||
def updateEpisodeToKodiLibrary( self, MBitem, KodiItem ):
|
def updateEpisodeToKodiLibrary( self, MBitem, KodiItem ):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
|
|
@ -6,7 +6,7 @@ import threading
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
cwd = xbmcaddon.Addon(id='plugin.video.mb3sync').getAddonInfo('path')
|
cwd = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path')
|
||||||
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
||||||
sys.path.append(BASE_RESOURCE_PATH)
|
sys.path.append(BASE_RESOURCE_PATH)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue