Fixes regarding video node sync

This commit is contained in:
tomkat83 2016-01-11 14:38:01 +01:00
parent c854ee621e
commit a959ee118c
2 changed files with 19 additions and 13 deletions

View file

@ -6,6 +6,8 @@
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.3.0" />
<import addon="plugin.video.plexkodiconnect.movies" version="0.01" />
<import addon="plugin.video.plexkodiconnect.tvshows" version="0.01" />
</requires>
<extension point="xbmc.python.pluginsource"
library="default.py">

View file

@ -506,10 +506,10 @@ class LibrarySync(threading.Thread):
# Delete video node
if mediatype != "musicvideos":
vnodes.viewNode(
indexnumber=totalnodes,
tagname=current_viewname,
mediatype=mediatype,
viewtype=current_viewtype,
totalnodes,
current_viewname,
mediatype,
current_viewtype,
delete=True)
# Added new playlist
utils.playlistXSP(mediatype, foldername, viewtype)
@ -702,25 +702,28 @@ class LibrarySync(threading.Thread):
# Initialize
plx = PlexAPI.PlexAPI()
self.allPlexElementsId = {}
embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
itemType = 'Movies'
views = plx.GetPlexCollections('movie')
views = emby_db.getView_byType('movie')
self.logMsg("Processing Plex %s. Libraries: %s" % (itemType, views), 1)
if self.compare:
# Get movies from Plex server
embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
# Pull the list of movies and boxsets in Kodi
try:
self.allKodiElementsId = dict(emby_db.getChecksum('Movie'))
except ValueError:
self.allKodiElementsId = {}
embyconn.close()
else:
# Getting all metadata, hence set Kodi elements to {}
self.allKodiElementsId = {}
embyconn.close()
##### PROCESS MOVIES #####
self.updatelist = []
@ -942,16 +945,17 @@ class LibrarySync(threading.Thread):
plx = PlexAPI.PlexAPI()
self.allPlexElementsId = {}
itemType = 'TVShows'
# Open DB connections
embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
views = plx.GetPlexCollections('show')
views = emby_db.getView_byType('show')
self.logMsg("Media folders for %s: %s" % (itemType, views), 1)
self.allKodiElementsId = {}
if self.compare:
# Get movies from Plex server
embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
# Pull the list of TV shows already in Kodi
try:
all_koditvshows = dict(emby_db.getChecksum('Series'))
@ -964,7 +968,7 @@ class LibrarySync(threading.Thread):
self.allKodiElementsId.update(all_kodiepisodes)
except ValueError:
pass
embyconn.close()
embyconn.close()
##### PROCESS TV Shows #####
self.updatelist = []