refactor to plugin.video.emby

This commit is contained in:
Marcel van der Veldt 2015-03-25 18:37:21 +01:00
parent b0ef58458e
commit 7d49a33b21
19 changed files with 104 additions and 104 deletions

View File

@ -1,2 +1,2 @@
# plugin.video.mb3sync
# plugin.video.emby
MediaBrowser Syncer

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.mb3sync"
<addon id="plugin.video.emby"
name="Emby"
version="0.0.1"
provider-name="Emby.media">

View File

@ -7,7 +7,7 @@ import threading
import json
import urllib
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
cwd = addonSettings.getAddonInfo('path')
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
sys.path.append(BASE_RESOURCE_PATH)
@ -27,5 +27,5 @@ if mode == "play":
PlaybackUtils().PLAY(id)
else:
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.mb3sync)')
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')

View File

@ -261,7 +261,7 @@ class API():
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")
getSeriesData = False
userData = data.get("UserData")
@ -348,7 +348,7 @@ class API():
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")
port = addonSettings.getSetting('port')
host = addonSettings.getSetting('ipaddress')

View File

@ -46,7 +46,7 @@ class ClientInformation():
def getAddonId(self):
# To use when declaring xbmcaddon.Addon(id=addonId)
addonId = "plugin.video.mb3sync"
addonId = "plugin.video.emby"
return addonId
def getAddonName(self):

View File

@ -20,7 +20,7 @@ logLevel = 1
class ConnectionManager():
addonSettings = None
__addon__ = xbmcaddon.Addon(id='plugin.video.mb3sync')
__addon__ = xbmcaddon.Addon(id='plugin.video.emby')
__addondir__ = xbmc.translatePath( __addon__.getAddonInfo('profile') )
__language__ = __addon__.getLocalizedString
@ -28,44 +28,44 @@ class ConnectionManager():
if(logLevel >= level):
if(logLevel == 2):
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:
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:
try:
xbmc.log("mb3sync " + str(level) + " -> " + str(msg))
xbmc.log("emby " + str(level) + " -> " + str(msg))
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):
WINDOW = xbmcgui.Window( 10000 )
WINDOW.setProperty("Server_Checked", "True")
self.printDebug ("mb3sync Connection Manager Called")
self.addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
self.printDebug ("emby Connection Manager Called")
self.addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
port = self.addonSettings.getSetting('port')
host = self.addonSettings.getSetting('ipaddress')
if(len(host) != 0 and host != "<none>"):
self.printDebug ("mb3sync server already set")
self.printDebug ("emby server already set")
return
serverInfo = self.getServerDetails()
if(serverInfo == None):
self.printDebug ("mb3sync getServerDetails failed")
self.printDebug ("emby getServerDetails failed")
return
index = serverInfo.find(":")
if(index <= 0):
self.printDebug ("mb3sync getServerDetails data not correct : " + serverInfo)
self.printDebug ("emby getServerDetails data not correct : " + serverInfo)
return
server_address = serverInfo[:index]
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)

View File

@ -27,7 +27,7 @@ import Utils as utils
from ReadEmbyDB import ReadEmbyDB
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
dataPath = os.path.join(addondir,"library")
movieLibrary = os.path.join(dataPath,'movies')
@ -59,7 +59,7 @@ class CreateFiles():
xbmcvfs.mkdir(itemPath)
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.close()
@ -231,7 +231,7 @@ class CreateFiles():
if(jsonData != ""):
trailerItem = json.loads(jsonData)
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
#add streamdetails

View File

@ -41,10 +41,10 @@ class DownloadUtils():
def logMsg(self, msg, level = 1):
if(self.logLevel >= level):
try:
xbmc.log("mb3sync DownloadUtils -> " + str(msg))
xbmc.log("emby DownloadUtils -> " + str(msg))
except UnicodeEncodeError:
try:
xbmc.log("mb3sync DownloadUtils -> " + str(msg.encode('utf-8')))
xbmc.log("emby DownloadUtils -> " + str(msg.encode('utf-8')))
except: pass
def getServer(self, prefix=True):
@ -76,7 +76,7 @@ class DownloadUtils():
def getUserId(self, suppress=True):
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')
host = self.addonSettings.getSetting('ipaddress')
userName = self.addonSettings.getSetting('username')
@ -149,7 +149,7 @@ class DownloadUtils():
def authenticate(self, retreive=True):
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')
token = WINDOW.getProperty("AccessToken" + username)

View File

@ -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
#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):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port

View File

@ -23,7 +23,7 @@ from ReadKodiDB import ReadKodiDB
from WriteKodiDB import WriteKodiDB
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")
movieLibrary = os.path.join(dataPath,'movies')
tvLibrary = os.path.join(dataPath,'tvshows')
@ -32,7 +32,7 @@ class LibrarySync():
def syncDatabase(self):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
@ -80,7 +80,7 @@ class LibrarySync():
startedSync = datetime.today()
try:
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
dbSyncIndication = addon.getSetting("dbSyncIndication")
dbSyncFirstRun = addon.getSetting("SyncFirstMovieRunDone")
@ -227,7 +227,7 @@ class LibrarySync():
self.doKodiLibraryUpdate(True, pDialog)
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")
# display notification if set up
@ -260,7 +260,7 @@ class LibrarySync():
def TvShowsSync(self, fullsync=True):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
startedSync = datetime.today()
@ -589,7 +589,7 @@ class LibrarySync():
self.doKodiLibraryUpdate(True, pDialog)
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")
# display notification if set up
@ -622,7 +622,7 @@ class LibrarySync():
def MusicVideosSync(self, fullsync=True):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
@ -747,7 +747,7 @@ class LibrarySync():
self.doKodiLibraryUpdate(True, pDialog)
if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addon.setSetting("SyncFirstMusicVideoRunDone", "true")
finally:
@ -771,7 +771,7 @@ class LibrarySync():
def updatePlayCounts(self):
#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 )
pDialog = None
startedSync = datetime.today()
@ -914,7 +914,7 @@ class LibrarySync():
showCurrent += 1
if(playCountSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addon.setSetting("SyncFirstCountsRunDone", "true")
# display notification if set up
@ -946,7 +946,7 @@ class LibrarySync():
def updatePlayCount(self,itemID,type):
#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 )
#process movie
if type=='Movie':

View File

@ -24,7 +24,7 @@ class PlayUtils():
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 self.isDirectPlay(result) == True:
playurl = result.get("Path")
@ -90,20 +90,20 @@ class PlayUtils():
if(mediaSources != None):
if mediaSources[0].get('Bitrate') != None:
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
else:
#xbmc.log("mb3sync isNetworkQualitySufficient -> TRUE bit rate")
#xbmc.log("emby isNetworkQualitySufficient -> TRUE bit rate")
return True
# Any thing else is ok
#xbmc.log("mb3sync isNetworkQualitySufficient -> TRUE default")
#xbmc.log("emby isNetworkQualitySufficient -> TRUE default")
return True
# get the addon video quality
def getVideoBitRate(self):
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
videoQuality = addonSettings.getSetting('videoBitRate')
if (videoQuality == "0"):
return '664'

View File

@ -19,7 +19,7 @@ import Utils as utils
import os
import xbmcvfs
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
language = addon.getLocalizedString

View File

@ -26,13 +26,13 @@ class Player( xbmc.Player ):
def __init__( self, *args ):
self.settings = xbmcaddon.Addon(id='plugin.video.mb3sync')
self.settings = xbmcaddon.Addon(id='plugin.video.emby')
self.downloadUtils = DownloadUtils()
try:
self.logLevel = int(self.settings.getSetting('logLevel'))
except:
pass
self.printDebug("mb3sync Service -> starting playback monitor service",1)
self.printDebug("emby Service -> starting playback monitor service",1)
self.played_information = {}
pass
@ -40,14 +40,14 @@ class Player( xbmc.Player ):
if(self.logLevel >= level):
if(self.logLevel == 2):
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:
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:
try:
xbmc.log("mb3sync " + str(level) + " -> " + str(msg))
xbmc.log("emby " + str(level) + " -> " + str(msg))
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):
if(data == None or len(data) == 0 or data == "None"):
@ -60,15 +60,15 @@ class Player( xbmc.Player ):
if(len(self.played_information) == 0):
return
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
self.printDebug("mb3sync Service -> played_information : " + str(self.played_information))
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
self.printDebug("emby Service -> played_information : " + str(self.played_information))
for item_url in self.played_information:
data = self.played_information.get(item_url)
if(data != None):
self.printDebug("mb3sync Service -> item_url : " + item_url)
self.printDebug("mb3sync Service -> item_data : " + str(data))
self.printDebug("emby Service -> item_url : " + item_url)
self.printDebug("emby Service -> item_data : " + str(data))
runtime = data.get("runtime")
currentPosition = data.get("currentPosition")
@ -79,11 +79,11 @@ class Player( xbmc.Player ):
if(currentPosition != None and self.hasData(runtime)):
runtimeTicks = int(runtime)
self.printDebug("mb3sync Service -> runtimeticks:" + str(runtimeTicks))
self.printDebug("emby Service -> runtimeticks:" + str(runtimeTicks))
percentComplete = (currentPosition * 10000000) / runtimeTicks
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)
if(refresh_id != None):
@ -101,7 +101,7 @@ class Player( xbmc.Player ):
def stopPlayback(self, data):
self.printDebug("stopPlayback called")
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
item_id = data.get("item_id")
audioindex = data.get("AudioStreamIndex")
@ -138,9 +138,9 @@ class Player( xbmc.Player ):
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):
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
item_id = data.get("item_id")
audioindex = data.get("AudioStreamIndex")
@ -193,12 +193,12 @@ class Player( xbmc.Player ):
# Will be called when xbmc starts playing a file
WINDOW = xbmcgui.Window( 10000 )
self.stopAll()
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
xbmcplayer = xbmc.Player()
if xbmcplayer.isPlaying():
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
# 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
self.played_information[currentFile] = data
self.printDebug("mb3sync Service -> ADDING_FILE : " + currentFile)
self.printDebug("mb3sync Service -> ADDING_FILE : " + str(self.played_information))
self.printDebug("emby Service -> ADDING_FILE : " + currentFile)
self.printDebug("emby Service -> ADDING_FILE : " + str(self.played_information))
# log some playback stats
if(itemType != None):
@ -271,7 +271,7 @@ class Player( xbmc.Player ):
def onPlayBackEnded( self ):
# 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
#TODO --> mark watched when 95% is played of the file
@ -280,7 +280,7 @@ class Player( xbmc.Player ):
try:
id = WINDOW.getProperty("virtualstrm")
type = WINDOW.getProperty("virtualstrmtype")
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -295,7 +295,7 @@ class Player( xbmc.Player ):
def onPlayBackStopped( self ):
# Will be called when user stops xbmc playing a file
self.printDebug("mb3sync Service -> onPlayBackStopped")
self.printDebug("emby Service -> onPlayBackStopped")
self.stopAll()
def seekToPosition(self, seekTo):

View File

@ -9,13 +9,13 @@ import json
from DownloadUtils import DownloadUtils
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
class ReadEmbyDB():
def getMovies(self, id, fullinfo = False, fullSync = True):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -44,7 +44,7 @@ class ReadEmbyDB():
def getMusicVideos(self, fullinfo = False, fullSync = True):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -73,7 +73,7 @@ class ReadEmbyDB():
def getItem(self, id):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -90,7 +90,7 @@ class ReadEmbyDB():
def getFullItem(self, id):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -107,7 +107,7 @@ class ReadEmbyDB():
def getTVShows(self, fullinfo = False, fullSync = False):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -137,7 +137,7 @@ class ReadEmbyDB():
def getTVShowSeasons(self, tvShowId):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -158,7 +158,7 @@ class ReadEmbyDB():
def getEpisodes(self, showId, fullinfo = False):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -182,7 +182,7 @@ class ReadEmbyDB():
def getLatestEpisodes(self,fullinfo = False):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -206,7 +206,7 @@ class ReadEmbyDB():
def getCollections(self, type):
#Build a list of the user views
userid = DownloadUtils().getUserId()
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -253,7 +253,7 @@ class ReadEmbyDB():
def getViewCollections(self, type):
#Build a list of the user views
userid = DownloadUtils().getUserId()
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -293,7 +293,7 @@ class ReadEmbyDB():
def getBoxSets(self):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -314,7 +314,7 @@ class ReadEmbyDB():
def getMoviesInBoxSet(self,boxsetId):
result = None
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port

View File

@ -9,7 +9,7 @@ import xbmcaddon
import json
import os
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
dataPath = os.path.join(addondir,"library")
movieLibrary = os.path.join(dataPath,'movies')
@ -39,9 +39,9 @@ class ReadKodiDB():
#returns all movies in Kodi db inserted by MB
xbmc.sleep(sleepVal)
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:
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'))
movies = None
@ -99,9 +99,9 @@ class ReadKodiDB():
#returns all tvshows in Kodi db inserted by MB
xbmc.sleep(sleepVal)
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:
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'))
tvshows = None
@ -206,9 +206,9 @@ class ReadKodiDB():
#returns all musicvideos in Kodi db inserted by MB
xbmc.sleep(sleepVal)
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:
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'))
musicvideos = None
if(jsonobject.has_key('result')):

View File

@ -22,7 +22,7 @@ from API import API
from PlayUtils import PlayUtils
from DownloadUtils import DownloadUtils
downloadUtils = DownloadUtils()
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
language = addonSettings.getLocalizedString
DATABASE_VERSION_HELIX = "90"
@ -49,7 +49,7 @@ def convertEncoding(data):
def checkKodiSources():
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath( addon.getAddonInfo('profile') )
dataPath = os.path.join(addondir,"library")
movieLibrary = os.path.join(dataPath,'movies')
@ -210,7 +210,7 @@ def stopProfiling(pr, profileName):
pr.disable()
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")
tabFileNamepath = os.path.join(addondir, "profiles")

View File

@ -24,23 +24,23 @@ class WebSocketThread(threading.Thread):
keepRunning = True
def __init__(self, *args):
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
level = addonSettings.getSetting('logLevel')
self.logLevel = 0
if(level != None):
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)
def logMsg(self, msg, level = 1):
if(self.logLevel >= level):
try:
xbmc.log("MB3SYNC WebSocketThread -> " + str(msg))
xbmc.log("emby WebSocketThread -> " + str(msg))
except UnicodeEncodeError:
try:
xbmc.log("MB3SYNC WebSocketThread -> " + str(msg.encode('utf-8')))
xbmc.log("emby WebSocketThread -> " + str(msg.encode('utf-8')))
except: pass
'''
@ -191,7 +191,7 @@ class WebSocketThread(threading.Thread):
messageData = {}
messageData["MessageType"] = "Identity"
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
deviceName = addonSettings.getSetting('deviceName')
deviceName = deviceName.replace("\"", "_")
@ -225,7 +225,7 @@ class WebSocketThread(threading.Thread):
def run(self):
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
mb3Host = addonSettings.getSetting('ipaddress')
mb3Port = addonSettings.getSetting('port')

View File

@ -19,7 +19,7 @@ from ReadEmbyDB import ReadEmbyDB
from API import API
import Utils as utils
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
dataPath = os.path.join(addondir,"library")
movieLibrary = os.path.join(dataPath,'movies')
@ -61,7 +61,7 @@ class WriteKodiDB():
mb3Id = filename[-38:-6]
if(mb3Id != None):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -76,7 +76,7 @@ class WriteKodiDB():
downloadUtils.downloadUrl(watchedurl, type="DELETE")
def updateMovieToKodiLibrary_Batched(self, MBitem, KodiItem):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -140,7 +140,7 @@ class WriteKodiDB():
if(jsonData != ""):
trailerItem = json.loads(jsonData)
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)
@ -182,7 +182,7 @@ class WriteKodiDB():
return changes
def updateMusicVideoToKodiLibrary_Batched(self, MBitem, KodiItem):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -243,7 +243,7 @@ class WriteKodiDB():
def updateMovieToKodiLibrary(self, MBitem, KodiItem):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -306,7 +306,7 @@ class WriteKodiDB():
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
if(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")
#add actors
@ -328,7 +328,7 @@ class WriteKodiDB():
def updateTVShowToKodiLibrary( self, MBitem, KodiItem ):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
@ -399,7 +399,7 @@ class WriteKodiDB():
def updateEpisodeToKodiLibrary( self, MBitem, KodiItem ):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port

View File

@ -6,7 +6,7 @@ import threading
import json
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' ) )
sys.path.append(BASE_RESOURCE_PATH)