Merge conflicts

This commit is contained in:
tomkat83 2016-03-01 10:40:30 +01:00
parent 4704d8e983
commit 4360b6b7de
4 changed files with 37 additions and 23 deletions

View file

@ -60,7 +60,7 @@ class ClientInfo():
else: else:
return "Unknown" return "Unknown"
def getDeviceId(self): def getDeviceId(self, reset=False):
""" """
Returns a unique Plex client id "X-Plex-Client-Identifier" from Kodi Returns a unique Plex client id "X-Plex-Client-Identifier" from Kodi
settings file. settings file.
@ -68,6 +68,11 @@ class ClientInfo():
If id does not exist, create one and save in Kodi settings file. If id does not exist, create one and save in Kodi settings file.
""" """
if reset:
utils.window('plex_client_Id', clear=True)
utils.settings('plex_client_Id', value="")
clientId = utils.window('plex_client_Id') clientId = utils.window('plex_client_Id')
if clientId: if clientId:
return clientId return clientId

View file

@ -215,15 +215,17 @@ def resetDeviceId():
utils.window('emby_deviceId', clear=True) utils.window('emby_deviceId', clear=True)
deviceId = clientinfo.ClientInfo().getDeviceId(reset=True) deviceId = clientinfo.ClientInfo().getDeviceId(reset=True)
except Exception as e: except Exception as e:
utils.logMsg("EMBY", "Failed to generate a new device Id: %s" % e, 1) utils.logMsg(addonName,
"Failed to generate a new device Id: %s" % e, 1)
dialog.ok( dialog.ok(
heading="Emby for Kodi", heading=addonName,
line1=language(33032)) line1=language(33032))
else: else:
utils.logMsg("EMBY", "Successfully removed old deviceId: %s New deviceId: %s" utils.logMsg(addonName,
"Successfully removed old deviceId: %s New deviceId: %s"
% (deviceId_old, deviceId), 1) % (deviceId_old, deviceId), 1)
dialog.ok( dialog.ok(
heading="Emby for Kodi", heading=addonName,
line1=language(33033)) line1=language(33033))
xbmc.executebuiltin('RestartApp') xbmc.executebuiltin('RestartApp')

View file

@ -521,6 +521,29 @@ class LibrarySync(Thread):
vnodes.clearProperties() vnodes.clearProperties()
totalnodes = 0 totalnodes = 0
with embydb.GetEmbyDB() as emby_db:
with kodidb.GetKodiDB('video') as kodi_db:
for folderItem in result:
self.processView(folderItem, kodi_db, emby_db, totalnodes)
else:
# Add video nodes listings
vnodes.singleNode(totalnodes,
"Favorite movies",
"movies",
"favourites")
totalnodes += 1
vnodes.singleNode(totalnodes,
"Favorite tvshows",
"tvshows",
"favourites")
totalnodes += 1
vnodes.singleNode(totalnodes,
"channels",
"movies",
"channels")
totalnodes += 1
# Save total
utils.window('Emby.nodes.total', str(totalnodes))
# update views for all: # update views for all:
self.views = emby_db.getAllViewInfo() self.views = emby_db.getAllViewInfo()
@ -534,8 +557,6 @@ class LibrarySync(Thread):
'itemtype': 'artist' 'itemtype': 'artist'
} }
self.views.append(entry) self.views.append(entry)
nodes = [] # Prevent duplicate for nodes of the same type
playlists = [] # Prevent duplicate for playlists of the same type
self.logMsg("views saved: %s" % self.views, 1) self.logMsg("views saved: %s" % self.views, 1)
@ -623,17 +644,6 @@ class LibrarySync(Thread):
itemNumber = len(self.updatelist) itemNumber = len(self.updatelist)
if itemNumber == 0: if itemNumber == 0:
return True return True
# Validate the playlist exists or recreate it
if (foldername not in playlists and
mediatype in ('movies', 'tvshows', 'musicvideos')):
utils.playlistXSP(mediatype, foldername, folderid, viewtype)
playlists.append(foldername)
if foldername not in nodes and mediatype != "musicvideos":
vnodes.viewNode(sorted_views.index(foldername), foldername,
mediatype, viewtype, folderid)
if viewtype == "mixed": # Change the value
sorted_views[sorted_views.index(foldername)] = "%ss" % foldername
nodes.append(foldername)
# Run through self.updatelist, get XML metadata per item # Run through self.updatelist, get XML metadata per item
# Initiate threads # Initiate threads
@ -682,10 +692,6 @@ class LibrarySync(Thread):
thread.start() thread.start()
threads.append(thread) threads.append(thread)
self.logMsg("Kodi Infobox thread spawned", 1) self.logMsg("Kodi Infobox thread spawned", 1)
# Remove any old referenced views
log("Removing views: %s" % current_views, 1)
for view in current_views:
emby_db.removeView(view)
# Wait until finished # Wait until finished
getMetadataQueue.join() getMetadataQueue.join()

View file

@ -11,6 +11,7 @@ import unicodedata
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from functools import wraps from functools import wraps
from calendar import timegm from calendar import timegm
import os
import xbmc import xbmc
import xbmcaddon import xbmcaddon