From f32a8c534f868b9fcf90f15ea4a95d05b2d74546 Mon Sep 17 00:00:00 2001 From: croneter Date: Tue, 25 Jun 2019 18:12:46 +0200 Subject: [PATCH 1/5] Fix FutureWarning --- resources/lib/entrypoint.py | 2 +- resources/lib/plex_api/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 162d1c38..3225515f 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -483,7 +483,7 @@ def extras(plex_id): xbmcplugin.endOfDirectory(int(sys.argv[1])) return extras = API(xml[0]).extras() - if not extras: + if extras is None: return for child in xml: xml.remove(child) diff --git a/resources/lib/plex_api/base.py b/resources/lib/plex_api/base.py index f6c61b73..5228accb 100644 --- a/resources/lib/plex_api/base.py +++ b/resources/lib/plex_api/base.py @@ -561,7 +561,7 @@ class Base(object): Returns None if no extras are found """ extras = self.xml.find('Extras') - if not extras: + if extras is None: return return (x for x in extras) From fb76f49fbd7895671c1e4e88cde1f9f30561758c Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 28 Jun 2019 15:20:22 +0200 Subject: [PATCH 2/5] Fix PKC creating thousands of playlists if there are 2 identical Kodi playlists --- resources/lib/plex_db/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/plex_db/common.py b/resources/lib/plex_db/common.py index 65f5ca6d..70361feb 100644 --- a/resources/lib/plex_db/common.py +++ b/resources/lib/plex_db/common.py @@ -305,7 +305,7 @@ def initialize(): 'CREATE INDEX IF NOT EXISTS ix_track_1 ON track (last_sync)', 'CREATE UNIQUE INDEX IF NOT EXISTS ix_track_2 ON track (kodi_id)', 'CREATE UNIQUE INDEX IF NOT EXISTS ix_playlists_2 ON playlists (kodi_path)', - 'CREATE UNIQUE INDEX IF NOT EXISTS ix_playlists_3 ON playlists (kodi_hash)', + 'CREATE INDEX IF NOT EXISTS ix_playlists_3 ON playlists (kodi_hash)', ) for cmd in commands: plexdb.cursor.execute(cmd) From 58ba03b94bfcbbf52f741a43c459804680fc252e Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 28 Jun 2019 15:27:02 +0200 Subject: [PATCH 3/5] Ensure faulty index on Plex DB is correctly recreated on PKC update --- resources/lib/migration.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/lib/migration.py b/resources/lib/migration.py index 854679d2..70caabc2 100644 --- a/resources/lib/migration.py +++ b/resources/lib/migration.py @@ -42,4 +42,13 @@ def check_migration(): sections.clear_window_vars() sections.delete_videonode_files() + if not utils.compare_version(last_migration, '2.8.7'): + LOG.info('Migrating to version 2.8.6') + # Need to delete the UNIQUE index that prevents creating several + # playlist entries with the same kodi_hash + from .plex_db import PlexDB + with PlexDB() as plexdb: + plexdb.cursor.execute('DROP INDEX IF EXISTS ix_playlists_3') + # Index will be automatically recreated on next PKC startup + utils.settings('last_migrated_PKC_version', value=v.ADDON_VERSION) From eb3e655213c23022fdac22ef685aa2142cedbe5b Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 28 Jun 2019 15:54:55 +0200 Subject: [PATCH 4/5] Cleanup due to wrong assumption that kodi playlist hash was unique --- resources/lib/playlists/db.py | 8 +++----- resources/lib/plex_db/playlists.py | 11 ++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/resources/lib/playlists/db.py b/resources/lib/playlists/db.py index 51cde690..265fddee 100644 --- a/resources/lib/playlists/db.py +++ b/resources/lib/playlists/db.py @@ -47,15 +47,13 @@ def update_playlist(playlist, delete=False): plexdb.add_playlist(playlist) -def get_playlist(path=None, kodi_hash=None, plex_id=None): +def get_playlist(path=None, plex_id=None): """ - Returns the playlist as a Playlist for either the plex_id, path or - kodi_hash. kodi_hash will be more reliable as it includes path and file - content. + Returns the playlist as a Playlist for either the plex_id or path """ playlist = Playlist() with PlexDB() as plexdb: - playlist = plexdb.playlist(playlist, plex_id, path, kodi_hash) + playlist = plexdb.playlist(playlist, plex_id, path) return playlist diff --git a/resources/lib/plex_db/playlists.py b/resources/lib/plex_db/playlists.py index 3c14f259..586e745a 100644 --- a/resources/lib/plex_db/playlists.py +++ b/resources/lib/plex_db/playlists.py @@ -57,20 +57,17 @@ class Playlists(object): playlist.kodi_type, playlist.kodi_hash)) - def playlist(self, playlist, plex_id=None, path=None, kodi_hash=None): + def playlist(self, playlist, plex_id=None, path=None): """ - Returns a complete Playlist (empty one passed in via playlist) - for the entry with plex_id OR kodi_hash OR kodi_path. + Returns a complete Playlist (empty one passed in via playlist) for the + entry with plex_id OR kodi_path. Returns None if not found """ query = 'SELECT * FROM playlists WHERE %s = ? LIMIT 1' if plex_id: query = query % 'plex_id' var = plex_id - elif kodi_hash: - query = query % 'kodi_hash' - var = kodi_hash - else: + elif path: query = query % 'kodi_path' var = path self.cursor.execute(query, (var, )) From f5e8569584fd0cfd92c153234f2118eb4c0e176f Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 28 Jun 2019 16:40:45 +0200 Subject: [PATCH 5/5] Stable and beta version bump 2.8.6 --- README.md | 6 +++--- addon.xml | 8 ++++++-- changelog.txt | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d2f4ee55..ccfcd73d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -[![stable version](https://img.shields.io/badge/stable_version-2.8.5-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip) -[![beta version](https://img.shields.io/badge/beta_version-2.8.5-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip) +[![stable version](https://img.shields.io/badge/stable_version-2.8.6-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip) +[![beta version](https://img.shields.io/badge/beta_version-2.8.6-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip) [![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation) [![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq) [![Forum](https://img.shields.io/badge/forum-plex-orange.svg?maxAge=60&style=flat)](https://forums.plex.tv/discussion/210023/plexkodiconnect-let-kodi-talk-to-your-plex) [![Donate](https://img.shields.io/badge/donate-kofi-blue.svg)](https://ko-fi.com/A8182EB) -[![GitHub issues](https://img.shields.io/github/issues/croneter/PlexKodiConnect.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/croneter/PlexKodiConnect.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/pulls) [![HitCount](http://hits.dwyl.io/croneter/PlexKodiConnect.svg)](http://hits.dwyl.io/croneter/PlexKodiConnect) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a66870f19ced4fb98f94d9fd56e34e87)](https://www.codacy.com/app/croneter/PlexKodiConnect?utm_source=github.com&utm_medium=referral&utm_content=croneter/PlexKodiConnect&utm_campaign=Badge_Grade) +[![GitHub issues](https://img.shields.io/github/issues/croneter/PlexKodiConnect.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/croneter/PlexKodiConnect.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/pulls) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a66870f19ced4fb98f94d9fd56e34e87)](https://www.codacy.com/app/croneter/PlexKodiConnect?utm_source=github.com&utm_medium=referral&utm_content=croneter/PlexKodiConnect&utm_campaign=Badge_Grade) # PlexKodiConnect (PKC) diff --git a/addon.xml b/addon.xml index ab833ee5..dea1d785 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -77,7 +77,11 @@ Нативна інтеграція Plex в Kodi Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик! Використовуйте на свій ризик - version 2.8.5: + version 2.8.6: +- Fix PKC creating thousands of playlists if a single Kodi playlist wasn't unique +- Fix FutureWarning + +version 2.8.5: - Fix Trakt add-on not recognizing id of tv shows (you will need to manually reset the Kodi database in the PKC settings under Advanced) - Update translations diff --git a/changelog.txt b/changelog.txt index 3c133484..e7a3ac3b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +version 2.8.6: +- Fix PKC creating thousands of playlists if a single Kodi playlist wasn't unique +- Fix FutureWarning + version 2.8.5: - Fix Trakt add-on not recognizing id of tv shows (you will need to manually reset the Kodi database in the PKC settings under Advanced) - Update translations