Merge pull request #806 from croneter/beta-version

Bump master
This commit is contained in:
croneter 2019-03-29 14:30:20 +01:00 committed by GitHub
commit 3208655598
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 34 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.7.9-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip) [![stable version](https://img.shields.io/badge/stable_version-2.7.10-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.7.9-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip) [![beta version](https://img.shields.io/badge/beta_version-2.7.10-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) [![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) [![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq)

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.7.9" provider-name="croneter"> <addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.7.10" provider-name="croneter">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.9.1" /> <import addon="script.module.requests" version="2.9.1" />
@ -77,7 +77,13 @@
<summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary> <summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary>
<description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description> <description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description>
<disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer> <disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer>
<news>version 2.7.9: <news>version 2.7.10:
- Fix duplicate music entries for direct paths (you will need to manually reset the Kodi database
- Fix UnicodeEncodeError for Direct Paths and some PKC video nodes)
- Fix playback sometimes not being reported for direct paths
- Update translations
version 2.7.9:
- Wait for PKC to authorize before loading widgets - Wait for PKC to authorize before loading widgets
- Fix UnicodeDecodeError for libraries with non-ASCII paths - Fix UnicodeDecodeError for libraries with non-ASCII paths
- Fix TypeError on Kodi start - Fix TypeError on Kodi start

View file

@ -1,3 +1,9 @@
version 2.7.10:
- Fix duplicate music entries for direct paths (you will need to manually reset the Kodi database
- Fix UnicodeEncodeError for Direct Paths and some PKC video nodes)
- Fix playback sometimes not being reported for direct paths
- Update translations
version 2.7.9: version 2.7.9:
- Wait for PKC to authorize before loading widgets - Wait for PKC to authorize before loading widgets
- Fix UnicodeDecodeError for libraries with non-ASCII paths - Fix UnicodeDecodeError for libraries with non-ASCII paths

View file

@ -590,7 +590,7 @@ msgstr ""
# PKC Settings - Sync Options # PKC Settings - Sync Options
msgctxt "#30524" msgctxt "#30524"
msgid "Select Plex libraries to sync" msgid "Select Plex libraries to sync"
msgstr "" msgstr "Zvolte knihovny Plexu k synchronizaci"
# PKC Settings - Playback # PKC Settings - Playback
msgctxt "#30527" msgctxt "#30527"
@ -1249,7 +1249,7 @@ msgstr "Shlédnout později"
# e.g. the PMS' name # e.g. the PMS' name
msgctxt "#39213" msgctxt "#39213"
msgid "{0} offline" msgid "{0} offline"
msgstr "" msgstr "{0} je offline"
msgctxt "#39215" msgctxt "#39215"
msgid "Enter your Plex Media Server's IP or URL, Examples are:" msgid "Enter your Plex Media Server's IP or URL, Examples are:"

View file

@ -22,9 +22,14 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
""" """
kodi_id = None kodi_id = None
path = utils.try_decode(path) path = utils.try_decode(path)
path, filename = path_ops.path.split(path)
# Make sure path ends in either '/' or '\' # Make sure path ends in either '/' or '\'
path = path_ops.path.join(path, '') # We CANNOT use path_ops.path.join as this can result in \ where we need /
try:
filename = path.rsplit('/', 1)[1]
path = path.rsplit('/', 1)[0] + '/'
except IndexError:
filename = path.rsplit('\\', 1)[1]
path = path.rsplit('\\', 1)[0] + '\\'
if kodi_type == v.KODI_TYPE_SONG or db_type == 'music': if kodi_type == v.KODI_TYPE_SONG or db_type == 'music':
with KodiMusicDB(lock=False) as kodidb: with KodiMusicDB(lock=False) as kodidb:
try: try:

View file

@ -8,7 +8,7 @@ from . import utils
from . import variables as v from . import variables as v
############################################################################### ###############################################################################
LOG = getLogger('PLEX.music') LOG = getLogger('PLEX.music.py')
############################################################################### ###############################################################################
@ -25,7 +25,7 @@ def excludefromscan_music_folders(sections):
reboot = False reboot = False
api = API(item=None) api = API(item=None)
for section in sections: for section in sections:
if section.plex_type != v.PLEX_TYPE_ARTIST: if section.section_type != v.PLEX_TYPE_ARTIST:
# Only look at music libraries # Only look at music libraries
continue continue
if not section.sync_to_kodi: if not section.sync_to_kodi:

View file

@ -152,9 +152,9 @@ class API(object):
def directory_path(self, section_id=None, plex_type=None, old_key=None, def directory_path(self, section_id=None, plex_type=None, old_key=None,
synched=True): synched=True):
key = self.item.get('fastKey') key = cast(unicode, self.item.get('fastKey'))
if not key: if not key:
key = self.item.get('key') key = cast(unicode, self.item.get('key'))
if old_key: if old_key:
key = '%s/%s' % (old_key, key) key = '%s/%s' % (old_key, key)
elif not key.startswith('/'): elif not key.startswith('/'):
@ -169,10 +169,10 @@ class API(object):
params['synched'] = 'false' params['synched'] = 'false'
if self.item.get('prompt'): if self.item.get('prompt'):
# User input needed, e.g. search for a movie or episode # User input needed, e.g. search for a movie or episode
params['prompt'] = self.item.get('prompt') params['prompt'] = cast(unicode, self.item.get('prompt'))
if section_id: if section_id:
params['id'] = section_id params['id'] = section_id
return 'plugin://%s/?%s' % (v.ADDON_ID, urlencode(params)) return utils.extend_url('plugin://%s/' % v.ADDON_ID, params)
def path_and_plex_id(self): def path_and_plex_id(self):
""" """

View file

@ -9,6 +9,7 @@ from sqlite3 import connect, OperationalError
from datetime import datetime from datetime import datetime
from unicodedata import normalize from unicodedata import normalize
from threading import Lock from threading import Lock
import urllib
# Originally tried faster cElementTree, but does NOT work reliably with Kodi # Originally tried faster cElementTree, but does NOT work reliably with Kodi
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
import defusedxml.ElementTree as defused_etree # etree parse unsafe import defusedxml.ElementTree as defused_etree # etree parse unsafe
@ -269,26 +270,59 @@ def cast(func, value):
func (func): Calback function to used cast to type (int, bool, float). func (func): Calback function to used cast to type (int, bool, float).
value (any): value to be cast and returned. value (any): value to be cast and returned.
""" """
if value is not None: if value is None:
if func == bool: return value
return bool(int(value)) elif func == bool:
elif func == unicode: return bool(int(value))
if isinstance(value, (int, long, float)): elif func == unicode:
return unicode(value) if isinstance(value, (int, long, float)):
else: return unicode(value)
return value.decode('utf-8') elif isinstance(value, unicode):
elif func == str: return value
if isinstance(value, (int, long, float)): else:
return str(value) return value.decode('utf-8')
else: elif func == str:
return value.encode('utf-8') if isinstance(value, (int, long, float)):
elif func in (int, float): return str(value)
try: elif isinstance(value, str):
return func(value) return value
except ValueError: else:
return float('nan') return value.encode('utf-8')
return func(value) elif func in (int, float):
return value try:
return func(value)
except ValueError:
return float('nan')
return func(value)
def extend_url(url, params):
"""
Pass in an url [unicode] and params [dict]. Returns the extended url
'<url><? or &><urllib.urlencode(params)>'
in unicode
"""
params = encode_dict(params) if params else {}
params = urllib.urlencode(params).decode('utf-8')
if '?' in url:
return '%s&%s' % (url, params)
else:
return '%s?%s' % (url, params)
def encode_dict(dictionary):
"""
Pass in a dict. Will return the same dict with all keys and values encoded
in utf-8 - as long as they are unicode. Ignores all non-unicode entries
Useful for urllib.urlencode or urllib.(un)quote
"""
for key, value in dictionary.iteritems():
if isinstance(key, unicode):
dictionary[key.encode('utf-8')] = dictionary.pop(key)
if isinstance(value, unicode):
dictionary[key] = value.encode('utf-8')
return dictionary
def try_encode(input_str, encoding='utf-8'): def try_encode(input_str, encoding='utf-8'):