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:
return "Unknown"
def getDeviceId(self):
def getDeviceId(self, reset=False):
"""
Returns a unique Plex client id "X-Plex-Client-Identifier" from Kodi
settings file.
@ -68,6 +68,11 @@ class ClientInfo():
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')
if clientId:
return clientId

View file

@ -215,15 +215,17 @@ def resetDeviceId():
utils.window('emby_deviceId', clear=True)
deviceId = clientinfo.ClientInfo().getDeviceId(reset=True)
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(
heading="Emby for Kodi",
heading=addonName,
line1=language(33032))
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)
dialog.ok(
heading="Emby for Kodi",
heading=addonName,
line1=language(33033))
xbmc.executebuiltin('RestartApp')

View file

@ -521,6 +521,29 @@ class LibrarySync(Thread):
vnodes.clearProperties()
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:
self.views = emby_db.getAllViewInfo()
@ -534,8 +557,6 @@ class LibrarySync(Thread):
'itemtype': 'artist'
}
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)
@ -623,17 +644,6 @@ class LibrarySync(Thread):
itemNumber = len(self.updatelist)
if itemNumber == 0:
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
# Initiate threads
@ -682,10 +692,6 @@ class LibrarySync(Thread):
thread.start()
threads.append(thread)
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
getMetadataQueue.join()

View file

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