Cleaning up logs

This commit is contained in:
tomkat83 2016-01-11 08:10:36 +01:00
parent de3a058463
commit 5645e451cc
3 changed files with 13 additions and 14 deletions

View file

@ -27,7 +27,7 @@ import PlexAPI
class Items(object): class Items(object):
""" """
Items to be called with "with Items as xxx:" to ensure that __enter__ Items to be called with "with Items as xxx:" to ensure that __enter__
method is called! method is called (opens db connections)
""" """
def __init__(self): def __init__(self):

View file

@ -118,7 +118,6 @@ class ThreadedProcessMetadata(threading.Thread):
viewId = updateItem['viewId'] viewId = updateItem['viewId']
title = updateItem['title'] title = updateItem['title']
itemSubFkt = getattr(item, method) itemSubFkt = getattr(item, method)
with self.lock: with self.lock:
itemSubFkt( itemSubFkt(
plexitem, plexitem,
@ -185,10 +184,10 @@ class ThreadedShowSyncInfo(threading.Thread):
percentage = 0 percentage = 0
self.dialog.update( self.dialog.update(
percentage, percentage,
message="Downloaded: %s, Processed: %s: %s" % message="Downloaded: %s, Processed: %s: %s" % (
(getMetadataProgress, processMetadataProgress, viewName) getMetadataProgress, processMetadataProgress, viewName)
) )
time.sleep(1) time.sleep(0.5)
self.dialog.close() self.dialog.close()
def stopThread(self): def stopThread(self):
@ -775,8 +774,7 @@ class LibrarySync(threading.Thread):
for kodimovie in self.allKodiElementsId: for kodimovie in self.allKodiElementsId:
if kodimovie not in self.allPlexElementsId: if kodimovie not in self.allPlexElementsId:
Movie.remove(kodimovie) Movie.remove(kodimovie)
else: self.logMsg("%s sync is finished." % itemType, 1)
self.logMsg("%s compare finished." % itemType, 1)
return True return True
def musicvideos(self, embycursor, kodicursor, pdialog, compare=False): def musicvideos(self, embycursor, kodicursor, pdialog, compare=False):
@ -974,7 +972,7 @@ class LibrarySync(threading.Thread):
itemType = 'TVShows' itemType = 'TVShows'
views = plx.GetPlexCollections('show') views = plx.GetPlexCollections('show')
self.logMsg("Media folders: %s" % views, 1) self.logMsg("Media folders for %s: %s" % (itemType, views), 1)
self.allKodiElementsId = {} self.allKodiElementsId = {}
if self.compare: if self.compare:
@ -1011,7 +1009,7 @@ class LibrarySync(threading.Thread):
'add_update', 'add_update',
viewName, viewName,
viewId) viewId)
self.logMsg("Processed view %s with ID %s" % (viewName, viewId), 1) self.logMsg("Analyzed view %s with ID %s" % (viewName, viewId), 1)
# COPY for later use # COPY for later use
allPlexTvShowsId = self.allPlexElementsId.copy() allPlexTvShowsId = self.allPlexElementsId.copy()
@ -1029,7 +1027,7 @@ class LibrarySync(threading.Thread):
'add_updateSeason', 'add_updateSeason',
None, None,
tvShowId) # send showId instead of viewid tvShowId) # send showId instead of viewid
self.logMsg("Processed all seasons of TV show with Plex Id %s" % tvShowId, 1) self.logMsg("Analyzed all seasons of TV show with Plex Id %s" % tvShowId, 1)
##### PROCESS TV Episodes ##### ##### PROCESS TV Episodes #####
# Cycle through tv shows # Cycle through tv shows
@ -1044,16 +1042,18 @@ class LibrarySync(threading.Thread):
'add_updateEpisode', 'add_updateEpisode',
None, None,
None) None)
self.logMsg("Processed all episodes of TV show with Plex Id %s" % tvShowId, 1) self.logMsg("Analyzed all episodes of TV show with Plex Id %s" % tvShowId, 1)
# Process self.updatelist # Process self.updatelist
self.GetAndProcessXMLs(itemType) self.GetAndProcessXMLs(itemType)
self.logMsg("GetAndProcessXMLs completed", 1)
# Refresh season info # Refresh season info
# Cycle through tv shows # Cycle through tv shows
with itemtypes.TVShows() as TVshow: with itemtypes.TVShows() as TVshow:
for tvShowId in allPlexTvShowsId: for tvShowId in allPlexTvShowsId:
XMLtvshow = plx.GetPlexMetadata(tvShowId) XMLtvshow = plx.GetPlexMetadata(tvShowId)
TVshow.refreshSeasonEntry(XMLtvshow, tvShowId) TVshow.refreshSeasonEntry(XMLtvshow, tvShowId)
self.logMsg("Season info refreshed", 1)
##### PROCESS DELETES ##### ##### PROCESS DELETES #####
if self.compare: if self.compare:
@ -1062,8 +1062,7 @@ class LibrarySync(threading.Thread):
for kodiTvElement in self.allKodiElementsId: for kodiTvElement in self.allKodiElementsId:
if kodiTvElement not in self.allPlexElementsId: if kodiTvElement not in self.allPlexElementsId:
TVShow.remove(kodiTvElement) TVShow.remove(kodiTvElement)
else: self.logMsg("%s sync is finished." % itemType, 1)
self.logMsg("TV Shows compare finished.", 1)
return True return True
def tvshows(self, embycursor, kodicursor, pdialog, compare=False): def tvshows(self, embycursor, kodicursor, pdialog, compare=False):

View file

@ -68,6 +68,6 @@
<setting id="restartMsg" type="bool" label="Enable server message when it's restarting" default="false" /> <setting id="restartMsg" type="bool" label="Enable server message when it's restarting" default="false" />
<setting id="newContent" type="bool" label="Enable new content notification" default="false" /> <setting id="newContent" type="bool" label="Enable new content notification" default="false" />
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=reset)" option="close" /> <setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=reset)" option="close" />
<setting id="syncThreadNumber" type="number" label="Number of parallel threads while syncing" default="20" option="int"/> <setting id="syncThreadNumber" type="number" label="Number of parallel threads while syncing" default="10" option="int"/>
</category> </category>
</settings> </settings>