diff --git a/addon.xml b/addon.xml index 2a58f2a7..fcc045ab 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/changelog.txt b/changelog.txt index f1cc627c..34f9cb56 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +version 1.1.72 +- Fix to extrafanart +- Fix for artists deletion +- Fix for views + 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. diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 496b31fc..f21b27bc 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -112,7 +112,7 @@ class Items(object): musicconn = None - if itemtype in ('MusicAlbum', 'MusicArtist', 'Audio'): + if itemtype in ('MusicAlbum', 'MusicArtist', 'AlbumArtist', 'Audio'): if music_enabled: musicconn = utils.kodiSQL('music') musiccursor = musicconn.cursor() @@ -1871,7 +1871,6 @@ class Music(Items): def __init__(self, embycursor, musiccursor): Items.__init__(self, embycursor, musiccursor) - self.musiccursor = musiccursor self.directstream = utils.settings('streamMusic') == "true" self.userid = utils.window('emby_currUser') @@ -1928,7 +1927,7 @@ class Music(Items): def add_updateArtist(self, item, artisttype="MusicArtist"): # Process a single artist kodiversion = self.kodiversion - kodicursor = self.musiccursor + kodicursor = self.kodicursor emby_db = self.emby_db kodi_db = self.kodi_db artwork = self.artwork @@ -2011,7 +2010,7 @@ class Music(Items): # Process a single artist emby = self.emby kodiversion = self.kodiversion - kodicursor = self.musiccursor + kodicursor = self.kodicursor emby_db = self.emby_db kodi_db = self.kodi_db artwork = self.artwork @@ -2169,7 +2168,7 @@ class Music(Items): def add_updateSong(self, item): # Process single song kodiversion = self.kodiversion - kodicursor = self.musiccursor + kodicursor = self.kodicursor emby_db = self.emby_db kodi_db = self.kodi_db artwork = self.artwork @@ -2418,7 +2417,7 @@ class Music(Items): def updateUserdata(self, item): # This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks # Poster with progress bar - kodicursor = self.musiccursor + kodicursor = self.kodicursor emby_db = self.emby_db kodi_db = self.kodi_db API = api.API(item) @@ -2457,7 +2456,7 @@ class Music(Items): def remove(self, itemid): # Remove kodiid, fileid, pathid, emby reference emby_db = self.emby_db - kodicursor = self.musiccursor + kodicursor = self.kodicursor artwork = self.artwork emby_dbitem = emby_db.getItem_byId(itemid) @@ -2522,7 +2521,7 @@ class Music(Items): def removeSong(self, kodiid): - kodicursor = self.musiccursor + kodicursor = self.kodicursor artwork = self.artwork artwork.deleteArtwork(kodiid, "song", kodicursor) @@ -2530,7 +2529,7 @@ class Music(Items): def removeAlbum(self, kodiid): - kodicursor = self.musiccursor + kodicursor = self.kodicursor artwork = self.artwork artwork.deleteArtwork(kodiid, "album", kodicursor) @@ -2538,7 +2537,7 @@ class Music(Items): def removeArtist(self, kodiid): - kodicursor = self.musiccursor + kodicursor = self.kodicursor artwork = self.artwork artwork.deleteArtwork(kodiid, "artist", kodicursor) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 687c485e..47713e25 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -852,26 +852,52 @@ class Kodidb_Functions(): if self.kodiversion in (15, 16): # Kodi Isengard, Jarvis - query = ' '.join(( + try: + query = ' '.join(( - "UPDATE tag_link", - "SET tag_id = ?", - "WHERE media_id = ?", - "AND media_type = ?", - "AND tag_id = ?" - )) - cursor.execute(query, (newtag, kodiid, mediatype, oldtag,)) + "UPDATE tag_link", + "SET tag_id = ?", + "WHERE media_id = ?", + "AND media_type = ?", + "AND tag_id = ?" + )) + cursor.execute(query, (newtag, kodiid, mediatype, oldtag,)) + except Exception as e: + # The new tag we are going to apply already exists for this item + # delete current tag instead + self.logMsg("Exception: %s" % e, 1) + query = ' '.join(( + + "DELETE FROM tag_link", + "WHERE media_id = ?", + "AND media_type = ?", + "AND tag_id = ?" + )) + cursor.execute(query, (kodiid, mediatype, oldtag,)) else: # Kodi Helix - query = ' '.join(( + try: + query = ' '.join(( - "UPDATE taglinks", - "SET idTag = ?", - "WHERE idMedia = ?", - "AND media_type = ?", - "AND idTag = ?" - )) - cursor.execute(query, (newtag, kodiid, mediatype, oldtag,)) + "UPDATE taglinks", + "SET idTag = ?", + "WHERE idMedia = ?", + "AND media_type = ?", + "AND idTag = ?" + )) + cursor.execute(query, (newtag, kodiid, mediatype, oldtag,)) + except Exception as e: + # The new tag we are going to apply already exists for this item + # delete current tag instead + self.logMsg("Exception: %s" % e, 1) + query = ' '.join(( + + "DELETE FROM taglinks", + "WHERE idMedia = ?", + "AND media_type = ?", + "AND idTag = ?" + )) + cursor.execute(query, (kodiid, mediatype, oldtag,)) def removeTag(self, kodiid, tagname, mediatype): diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index fe22a270..80e664f6 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -43,6 +43,28 @@ class KodiMonitor(xbmc.Monitor): if library == "video": utils.window('emby_kodiScan', clear=True) + def onSettingsChanged(self): + # Monitor emby settings + currentPath = utils.settings('useDirectPaths') + if utils.window('emby_pluginpath') != currentPath: + # Plugin path value changed. Offer to reset + self.logMsg("Changed to playback mode detected", 1) + utils.window('emby_pluginpath', value=currentPath) + resp = xbmcgui.Dialog().yesno( + heading="Playback mode change detected", + line1=( + "Detected the playback mode has changed. The database " + "needs to be recreated for the change to be applied. " + "Proceed?")) + if resp: + utils.reset() + + currentLog = utils.settings('logLevel') + if utils.window('emby_logLevel') != currentLog: + # The log level changed, set new prop + self.logMsg("New log level: %s" % currentLog, 1) + utils.window('emby_logLevel', value=currentLog) + def onNotification(self, sender, method, data): doUtils = self.doUtils diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 01f3ab6e..2ef11909 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -486,7 +486,7 @@ class LibrarySync(threading.Thread): # This is only reserved for the detection of grouped views if (grouped_view['Type'] == "UserView" and grouped_view.get('CollectionType') == mediatype and - grouped_view['Id'] not in grouped_view['Path']): + grouped_view['Id'] not in grouped_view.get('Path', "")): # Take the name of the userview foldername = grouped_view['Name'] break diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index a755f5e1..8b947c6c 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -44,11 +44,11 @@ class PlayUtils(): self.API.setPartNumber(partIndex) playurl = None - # if item['MediaSources'][0]['Protocol'] == "Http": - # # Only play as http - # self.logMsg("File protocol is http.", 1) - # playurl = self.httpPlay() - # utils.window('emby_%s.playmethod' % playurl, value="DirectStream") + if item.get('MediaSources') and item['MediaSources'][0]['Protocol'] == "Http": + # Only play as http + self.logMsg("File protocol is http.", 1) + playurl = self.httpPlay() + utils.window('emby_%s.playmethod' % playurl, value="DirectStream") if self.isDirectPlay(): self.logMsg("File is direct playing.", 1) @@ -85,7 +85,7 @@ class PlayUtils(): itemid = item['Id'] mediatype = item['MediaType'] - if type == "Audio": + if mediatype == "Audio": playurl = "%s/emby/Audio/%s/stream" % (server, itemid) else: playurl = "%s/emby/Videos/%s/stream?static=true" % (server, itemid) diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py index eb46c336..6865330b 100644 --- a/resources/lib/userclient.py +++ b/resources/lib/userclient.py @@ -46,7 +46,6 @@ class UserClient(threading.Thread): self.addonName = clientinfo.ClientInfo().getAddonName() self.doUtils = downloadutils.DownloadUtils() - self.logLevel = int(utils.settings('logLevel')) threading.Thread.__init__(self) @@ -365,15 +364,6 @@ class UserClient(threading.Thread): while not monitor.abortRequested(): - # Verify the log level - currLogLevel = self.getLogLevel() - if self.logLevel != currLogLevel: - # Set new log level - self.logLevel = currLogLevel - utils.window('emby_logLevel', value=str(currLogLevel)) - self.logMsg("New Log Level: %s" % currLogLevel, 0) - - status = utils.window('emby_serverStatus') if status: # Verify the connection status to server diff --git a/service.py b/service.py index 3579fe88..d74eeffc 100644 --- a/service.py +++ b/service.py @@ -57,6 +57,7 @@ class Service(): utils.window('emby_logLevel', value=str(logLevel)) utils.window('emby_kodiProfile', value=xbmc.translatePath("special://profile")) + utils.window('emby_pluginpath', value=utils.settings('useDirectPaths')) # Initial logging self.logMsg("======== START %s ========" % self.addonName, 0)