From 3d58b931071ad12d858646da1914e60874e27649 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 10 Aug 2017 19:34:23 +0200 Subject: [PATCH 1/4] Revert "Fix playback not starting in some cirrcumstances" This reverts commit f9037dcbd836d23f38f26846904ed666ef246adb. --- resources/lib/PlexAPI.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index b58ff222..65db0967 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2395,11 +2395,9 @@ class API(): log.error('Could not temporarily download subtitle %s' % url) return else: - log.debug('Writing temp subtitle to %s' % path) r.encoding = 'utf-8' with open(path, 'wb') as f: - # r.content does not always seem to be encoded! - f.write(tryEncode(r.content)) + f.write(r.content) return path def GetKodiPremierDate(self): From 73d6bfde890fc3033bcf5dad28f5f2d44adb82b7 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 10 Aug 2017 21:05:46 +0200 Subject: [PATCH 2/4] Fix playback not starting in some circumstances - Fixes #330 --- resources/lib/PlexAPI.py | 13 +++++++++---- resources/lib/utils.py | 10 ++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 65db0967..f03b0d80 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -49,7 +49,7 @@ from xbmcvfs import exists import clientinfo as client from downloadutils import DownloadUtils from utils import window, settings, language as lang, tryDecode, tryEncode, \ - DateToKodi, exists_dir + DateToKodi, exists_dir, slugify from PlexFunctions import PMSHttpsEnabled import plexdb_functions as plexdb import variables as v @@ -2395,9 +2395,14 @@ class API(): log.error('Could not temporarily download subtitle %s' % url) return else: - r.encoding = 'utf-8' - with open(path, 'wb') as f: - f.write(r.content) + log.debug('Writing temp subtitle to %s' % path) + try: + with open(path, 'wb') as f: + f.write(r.content) + except UnicodeEncodeError: + log.debug('Need to slugify the filename %s' % path) + with open(slugify(path), 'wb') as f: + f.write(r.content) return path def GetKodiPremierDate(self): diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 27354384..ee1631d1 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -221,6 +221,16 @@ def tryDecode(string, encoding='utf-8'): return string +def slugify(text): + """ + Normalizes text (in unicode or string) to e.g. enable safe filenames. + Returns unicode + """ + if not isinstance(text, unicode): + text = unicode(text) + return unicode(normalize('NFKD', text).encode('ascii', 'ignore')) + + def escape_html(string): """ Escapes the following: From 9e275b23d4cfcc105f324394a86f0d1d4f0d3477 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 10 Aug 2017 21:08:37 +0200 Subject: [PATCH 3/4] Deactivate some annoying popups on install --- resources/lib/initialsetup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index f29afa72..730517e9 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -496,10 +496,10 @@ class InitialSetup(): # If you use several Plex libraries of one kind, e.g. "Kids Movies" and # "Parents Movies", be sure to check https://goo.gl/JFtQV9 - dialog.ok(heading=lang(29999), line1=lang(39076)) + # dialog.ok(heading=lang(29999), line1=lang(39076)) # Need to tell about our image source for collections: themoviedb.org - dialog.ok(heading=lang(29999), line1=lang(39717)) + # dialog.ok(heading=lang(29999), line1=lang(39717)) # Make sure that we only ask these questions upon first installation settings('InstallQuestionsAnswered', value='true') From e4ca63b42c81b89826bc6c971404205b018b93ea Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 10 Aug 2017 21:10:19 +0200 Subject: [PATCH 4/4] Version bump --- README.md | 4 ++-- addon.xml | 8 ++++++-- changelog.txt | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1b98a04d..7a88e755 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![stable version](https://img.shields.io/badge/stable_version-1.8.8-blue.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect/bin/repository.plexkodiconnect/repository.plexkodiconnect-1.0.0.zip) -[![beta version](https://img.shields.io/badge/beta_version-1.8.8-red.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect_BETA/bin-BETA/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.0.zip) +[![stable version](https://img.shields.io/badge/stable_version-1.8.9-blue.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect/bin/repository.plexkodiconnect/repository.plexkodiconnect-1.0.0.zip) +[![beta version](https://img.shields.io/badge/beta_version-1.8.9-red.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect_BETA/bin-BETA/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.0.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) diff --git a/addon.xml b/addon.xml index 0f6064ec..83707bb9 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -59,7 +59,11 @@ Indbygget Integration af Plex i Kodi Tilslut Kodi til din Plex Media Server. Dette plugin forudsætter, at du administrere alle dine videoer med Plex (og ikke med Kodi). Du kan miste data som allerede er gemt i Kodi video og musik-databaser (dette plugin ændrer direkte i dem). Brug på eget ansvar! Brug på eget ansvar - version 1.8.8 + version 1.8.9 +- Fix playback not starting in some circumstances +- Deactivate some annoying popups on install + +version 1.8.8 - Fix playback not starting in some circumstances - Fix first artist "missing" tag (Reset your DB!) - Update Czech translation diff --git a/changelog.txt b/changelog.txt index e3c5f2df..65d57151 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +version 1.8.9 +- Fix playback not starting in some circumstances +- Deactivate some annoying popups on install + version 1.8.8 - Fix playback not starting in some circumstances - Fix first artist "missing" tag (Reset your DB!)