From 7a19f010dcb6fd92c26ef94ec4c5fe16adeae166 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 31 Dec 2015 17:16:16 -0600 Subject: [PATCH 1/5] Correct reversed settings --- resources/lib/kodimonitor.py | 2 +- resources/lib/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index de5808c6..fe22a270 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -63,7 +63,7 @@ class KodiMonitor(xbmc.Monitor): self.logMsg("Properties already set for item.", 1) else: if ((utils.settings('useDirectPaths') == "1" and not type == "song") or - (type == "song" and utils.settings('disableMusic') == "false")): + (type == "song" and utils.settings('enableMusic') == "true")): # Set up properties for player embyconn = utils.kodiSQL('emby') embycursor = embyconn.cursor() diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 01adfb72..26ff601b 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -158,7 +158,7 @@ def reset(): connection.commit() cursor.close() - if settings('disableMusic') != "true": + if settings('enableMusic') == "true": logMsg("EMBY", "Resetting the Kodi music database.") connection = kodiSQL('music') cursor = connection.cursor() From 227bb3eb423a5ed17fa2ee1339b8dc225dc23a64 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 31 Dec 2015 22:19:36 -0600 Subject: [PATCH 2/5] Add fix for missing key --- resources/lib/itemtypes.py | 8 ++++++-- resources/lib/librarysync.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index cab6fe3c..23f99e52 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -2280,10 +2280,14 @@ class Music(Items): # Add path pathid = kodi_db.addPath(path) - # Get the album - emby_dbalbum = emby_db.getItem_byId(item['AlbumId']) try: + # Get the album + emby_dbalbum = emby_db.getItem_byId(item['AlbumId']) albumid = emby_dbalbum[0] + except KeyError: + # No album Id associated to the song. + self.logMsg("Song itemid: %s has no albumId." % itemid, 1) + return except TypeError: # No album found, create a single's album kodicursor.execute("select coalesce(max(idAlbum),0) from album") diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index e5cacfab..7f9f4efe 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -358,7 +358,7 @@ class LibrarySync(threading.Thread): # Media folders are grouped into userview for grouped_view in grouped_views: if (grouped_view['Type'] == "UserView" and - grouped_view['CollectionType'] == mediatype): + grouped_view.get('CollectionType') == mediatype): # Take the name of the userview foldername = grouped_view['Name'] break From 77de12bec8dda23e6cd46299ee7dae9527d274c5 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 1 Jan 2016 23:24:28 -0600 Subject: [PATCH 3/5] Fix albums with same name --- resources/lib/kodidb_functions.py | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index a5f6a5d0..687c485e 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -1050,29 +1050,17 @@ class Kodidb_Functions(): try: albumid = cursor.fetchone()[0] except TypeError: - # Verify by name - query = ' '.join(( + # Create the album + cursor.execute("select coalesce(max(idAlbum),0) from album") + albumid = cursor.fetchone()[0] + 1 + query = ( + ''' + INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID) - "SELECT idAlbum", - "FROM album", - "WHERE strAlbum = ?", - "COLLATE NOCASE" - )) - cursor.execute(query, (name,)) - try: - albumid = cursor.fetchone()[0] - except TypeError: - # Create the album - cursor.execute("select coalesce(max(idAlbum),0) from album") - albumid = cursor.fetchone()[0] + 1 - query = ( - ''' - INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID) - - VALUES (?, ?, ?) - ''' - ) - cursor.execute(query, (albumid, name, musicbrainz)) + VALUES (?, ?, ?) + ''' + ) + cursor.execute(query, (albumid, name, musicbrainz)) return albumid From 84532ce3f8cf585f267911be5c7daa4fac2f3e9a Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 1 Jan 2016 23:38:26 -0600 Subject: [PATCH 4/5] Remove "!" from prompts --- resources/lib/entrypoint.py | 6 +++--- resources/lib/librarysync.py | 2 +- resources/lib/utils.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index ab753d08..cc00eada 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -387,7 +387,7 @@ def refreshPlaylist(): lib.refreshViews() dialog.notification( heading="Emby for Kodi", - message="Emby playlist refreshed!", + message="Emby playlist refreshed", icon="special://home/addons/plugin.video.emby/icon.png", time=1000, sound=False) @@ -395,8 +395,8 @@ def refreshPlaylist(): utils.logMsg("EMBY", "Refresh playlist failed: %s" % e, 1) dialog.notification( heading="Emby for Kodi", - message="Emby playlist refresh failed!", - icon="special://home/addons/plugin.video.emby/icon.png", + message="Emby playlist refresh failed", + icon=xbmcgui.NOTIFICATION_ERROR, time=1000, sound=False) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 7f9f4efe..35eb26b3 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -296,7 +296,7 @@ class LibrarySync(threading.Thread): utils.window('emby_dbScan', clear=True) xbmcgui.Dialog().notification( heading="Emby for Kodi", - message="%s completed in: %s!" % + message="%s completed in: %s" % (message, str(elapsedtotal).split('.')[0]), icon="special://home/addons/plugin.video.emby/icon.png", sound=False) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 26ff601b..3c2df45a 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -376,7 +376,7 @@ def passwordsXML(): settings('networkCreds', value="") xbmcgui.Dialog().notification( heading="Emby for Kodi", - message="%s removed from passwords.xml!" % credentials, + message="%s removed from passwords.xml" % credentials, icon="special://home/addons/plugin.video.emby/icon.png", time=1000, sound=False) @@ -435,7 +435,7 @@ def passwordsXML(): dialog.notification( heading="Emby for Kodi", - message="%s added to passwords.xml!" % server, + message="%s added to passwords.xml" % server, icon="special://home/addons/plugin.video.emby/icon.png", time=1000, sound=False) From 0a2ef0c339c15e5580875fe2ec09efe452f5b9cc Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 1 Jan 2016 23:40:20 -0600 Subject: [PATCH 5/5] Version bump 1.1.70 --- addon.xml | 2 +- changelog.txt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 515da519..b97f17cf 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/changelog.txt b/changelog.txt index ae3a8912..f1cc627c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +version 1.1.70 +- Include AirsAfterSeason for special episodes ordering +- Cover art settings - label adjusted. A reset or repair will be required if you change the settings value. +- Fix duplicate views being created (reset will be required) +- Fix albums merge when they had the same name (reset will be required) +- Minor fix to songs + version 1.1.69 - Fix unicode error for video nodes - Fix special episode ordering (repair sync can be run)