From 54f0f37d7ee9a1be1e9354a62f281dfd2ecacc77 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Tue, 8 Nov 2016 07:10:21 -0600 Subject: [PATCH 01/12] Fix typo --- resources/lib/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/database.py b/resources/lib/database.py index a300a465..a4746836 100644 --- a/resources/lib/database.py +++ b/resources/lib/database.py @@ -98,7 +98,7 @@ class DatabaseConn(object): log.info("opened: %s - %s", self.path, id(self.conn)) self.cursor = self.conn.cursor() - return self.conn.cursor() + return self.cursor def _SQL(self, media_type): From a8452d2e81a1226a12ddcd729018b27eb77f7517 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Tue, 8 Nov 2016 08:14:39 -0600 Subject: [PATCH 02/12] Fix typo --- resources/lib/objects/tvshows.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/objects/tvshows.py b/resources/lib/objects/tvshows.py index fab1dbb7..9d192ccc 100644 --- a/resources/lib/objects/tvshows.py +++ b/resources/lib/objects/tvshows.py @@ -401,7 +401,7 @@ class TVShows(Items): # We needed to recreate the show entry. Re-add episodes now. log.info("Repairing episodes for showid: %s %s", showid, title) all_episodes = emby.getEpisodesbyShow(itemid) - self.add_episode(all_episodes['Items'], None) + self.add_episodes(all_episodes['Items'], None) return True From 774700bdc867989fb22704f7dc137927cbf4cfdd Mon Sep 17 00:00:00 2001 From: sfaulds Date: Wed, 9 Nov 2016 10:16:28 +1100 Subject: [PATCH 03/12] add OS and Python version logging --- resources/lib/service_entry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index 273dce45..87cd8197 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -7,6 +7,7 @@ import sys import time import _strptime # Workaround for threads using datetime: _striptime is locked from datetime import datetime +import platform import xbmc @@ -164,6 +165,8 @@ class Service(object): ga = GoogleAnalytics() ga.sendEventData("Application", "Startup", serverId) + ga.sendEventData("Version", "OS", platform.platform()) + ga.sendEventData("Version", "Python", platform.python_version()) # Start up events self.warn_auth = True From 26a4d0724612eb306b42a958d29d9273c4fd7817 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Thu, 10 Nov 2016 11:49:38 +1100 Subject: [PATCH 04/12] only set progress if we could get the position --- resources/lib/player.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/lib/player.py b/resources/lib/player.py index 9f196e66..a61f1b6a 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -385,10 +385,15 @@ class Player(xbmc.Player): log.debug("PLAYBACK_SEEK: %s" % currentFile) if self.played_info.get(currentFile): - position = self.xbmcplayer.getTime() - self.played_info[currentFile]['currentPosition'] = position + position = None + try: + position = self.xbmcplayer.getTime() + except: + pass - self.reportPlayback() + if position is not None: + self.played_info[currentFile]['currentPosition'] = position + self.reportPlayback() @log_error() def onPlayBackStopped(self): From 294ed1d99596d7e38928d6cb67e5aa7ba7a5c279 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Wed, 9 Nov 2016 19:15:17 -0600 Subject: [PATCH 05/12] Try to have offline items returned To prevent Kodi database from being wiped if server marks content as offline. --- resources/lib/read_embyserver.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index 550dc7d9..a596cc44 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -174,7 +174,6 @@ class Read_EmbyServer(): 'IncludeItemTypes': itemtype, 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, - 'IsMissing': False, 'Recursive': True, 'Limit': 1 } @@ -201,7 +200,6 @@ class Read_EmbyServer(): 'IncludeItemTypes': itemtype, 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, - 'IsMissing': False, 'Recursive': True, 'StartIndex': index, 'Limit': jump, @@ -340,7 +338,6 @@ class Read_EmbyServer(): 'ParentId': parentid, 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, - 'IsMissing': False, 'Recursive': True, 'Ids': itemid } @@ -446,7 +443,6 @@ class Read_EmbyServer(): 'ParentId': parent_id, 'Recursive': True, 'IsVirtualUnaired': False, - 'IsMissing': False, 'StartIndex': index, 'Limit': jump, 'SortBy': "SortName", From 8669f41a2d40f1248309e9c874579d2c6e3fe7f6 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Thu, 10 Nov 2016 13:24:53 +1100 Subject: [PATCH 06/12] bump ver --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 40396110..6fc37717 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ From 5cc3847e473ae85075851aa01b87e073d7abe247 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Thu, 10 Nov 2016 16:09:23 +1100 Subject: [PATCH 07/12] looks like platform is throwing an exception on some systems so catch it --- addon.xml | 2 +- resources/lib/service_entry.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 6fc37717..e565c1e4 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index 87cd8197..443c9248 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -165,8 +165,11 @@ class Service(object): ga = GoogleAnalytics() ga.sendEventData("Application", "Startup", serverId) - ga.sendEventData("Version", "OS", platform.platform()) - ga.sendEventData("Version", "Python", platform.python_version()) + try: + ga.sendEventData("Version", "OS", platform.platform()) + ga.sendEventData("Version", "Python", platform.python_version()) + except Exception: + pass # Start up events self.warn_auth = True From 237ee0d810ee76e8afafc14c33fc9bd4fe3d7410 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 10 Nov 2016 14:36:04 -0600 Subject: [PATCH 08/12] Fix virtual episodes and return offline --- resources/lib/read_embyserver.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index a596cc44..7a01afbb 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -172,8 +172,10 @@ class Read_EmbyServer(): 'ParentId': parentid, 'ArtistIds': artist_id, 'IncludeItemTypes': itemtype, + 'IncludeLocationType': "Offline,FileSystem", 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, + 'IsMissing': False, 'Recursive': True, 'Limit': 1 } @@ -199,7 +201,9 @@ class Read_EmbyServer(): 'ArtistIds': artist_id, 'IncludeItemTypes': itemtype, 'CollapseBoxSetItems': False, + 'IncludeLocationType': "Offline,FileSystem", 'IsVirtualUnaired': False, + 'IsMissing': False, 'Recursive': True, 'StartIndex': index, 'Limit': jump, @@ -337,7 +341,9 @@ class Read_EmbyServer(): 'ParentId': parentid, 'CollapseBoxSetItems': False, + 'IncludeLocationType': "Offline,FileSystem", 'IsVirtualUnaired': False, + 'IsMissing': False, 'Recursive': True, 'Ids': itemid } @@ -421,6 +427,7 @@ class Read_EmbyServer(): params = { 'ParentId': parent_id, + 'IncludeLocationType': "Offline,FileSystem", 'Recursive': True, 'Limit': 1 } @@ -443,6 +450,7 @@ class Read_EmbyServer(): 'ParentId': parent_id, 'Recursive': True, 'IsVirtualUnaired': False, + 'IncludeLocationType': "Offline,FileSystem", 'StartIndex': index, 'Limit': jump, 'SortBy': "SortName", From ea3d2a925f3e3fbeb9ae15f0681aeb5a19a14886 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 10 Nov 2016 14:39:35 -0600 Subject: [PATCH 09/12] Version bump 2.3.12 --- addon.xml | 2 +- changelog.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index e565c1e4..dba50b95 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/changelog.txt b/changelog.txt index af01a20b..82b94dbd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +version 2.3.12 +- Fix virtual episodes being processed +- Return offline items so they don't get removed in kodi +- other minor fixes + version 2.3.8 - Fix database connection - other minor fixes From 9cd28f94ab681ba997198cc5929cd720991cbaaa Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 10 Nov 2016 15:16:51 -0600 Subject: [PATCH 10/12] Revert offline fix Apparently offline is being returned regardless, so something else must be causing the kodi database being wiped. Probably the server is sending remove event? --- resources/lib/read_embyserver.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index 7a01afbb..cbcbac58 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -172,7 +172,6 @@ class Read_EmbyServer(): 'ParentId': parentid, 'ArtistIds': artist_id, 'IncludeItemTypes': itemtype, - 'IncludeLocationType': "Offline,FileSystem", 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, 'IsMissing': False, @@ -201,7 +200,6 @@ class Read_EmbyServer(): 'ArtistIds': artist_id, 'IncludeItemTypes': itemtype, 'CollapseBoxSetItems': False, - 'IncludeLocationType': "Offline,FileSystem", 'IsVirtualUnaired': False, 'IsMissing': False, 'Recursive': True, @@ -341,7 +339,6 @@ class Read_EmbyServer(): 'ParentId': parentid, 'CollapseBoxSetItems': False, - 'IncludeLocationType': "Offline,FileSystem", 'IsVirtualUnaired': False, 'IsMissing': False, 'Recursive': True, @@ -427,7 +424,6 @@ class Read_EmbyServer(): params = { 'ParentId': parent_id, - 'IncludeLocationType': "Offline,FileSystem", 'Recursive': True, 'Limit': 1 } @@ -450,7 +446,6 @@ class Read_EmbyServer(): 'ParentId': parent_id, 'Recursive': True, 'IsVirtualUnaired': False, - 'IncludeLocationType': "Offline,FileSystem", 'StartIndex': index, 'Limit': jump, 'SortBy': "SortName", From 4575191093082880fe3aed36bdbc8731286b1386 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Fri, 11 Nov 2016 13:33:06 +1100 Subject: [PATCH 11/12] add LocationTypes to API call --- resources/lib/read_embyserver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index cbcbac58..96a345d0 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -172,6 +172,7 @@ class Read_EmbyServer(): 'ParentId': parentid, 'ArtistIds': artist_id, 'IncludeItemTypes': itemtype, + 'LocationTypes': "FileSystem,Remote,Offline", 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, 'IsMissing': False, @@ -201,6 +202,7 @@ class Read_EmbyServer(): 'IncludeItemTypes': itemtype, 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, + 'LocationTypes': "FileSystem,Remote,Offline", 'IsMissing': False, 'Recursive': True, 'StartIndex': index, @@ -340,6 +342,7 @@ class Read_EmbyServer(): 'ParentId': parentid, 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, + 'LocationTypes': "FileSystem,Remote,Offline", 'IsMissing': False, 'Recursive': True, 'Ids': itemid @@ -446,6 +449,8 @@ class Read_EmbyServer(): 'ParentId': parent_id, 'Recursive': True, 'IsVirtualUnaired': False, + 'LocationTypes': "FileSystem,Remote,Offline", + 'IsMissing': False, 'StartIndex': index, 'Limit': jump, 'SortBy': "SortName", From 27f998560146f9a0b2c56fea9c8d3577081530d6 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Fri, 11 Nov 2016 14:44:48 +1100 Subject: [PATCH 12/12] move the verify emby DB to the service entry --- addon.xml | 2 +- resources/lib/librarysync.py | 3 --- resources/lib/service_entry.py | 2 ++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index dba50b95..82dc9651 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index fe795b15..bc89af22 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -651,9 +651,6 @@ class LibrarySync(threading.Thread): log.warn("---===### Starting LibrarySync ###===---") - # Verify database structure, otherwise create it. - self._verify_emby_database() - while not self.monitor.abortRequested(): # In the event the server goes offline diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index 443c9248..5ed15c5c 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -100,6 +100,8 @@ class Service(object): self.websocket_thread = wsc.WebSocketClient() self.library_thread = librarysync.LibrarySync() + # Verify database structure, otherwise create it. + self.library_thread._verify_emby_database() while not self.monitor.abortRequested():