commit
3208655598
8 changed files with 85 additions and 34 deletions
|
@ -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)
|
||||
[![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)
|
||||
[![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.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)
|
||||
[![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq)
|
||||
|
|
10
addon.xml
10
addon.xml
|
@ -1,5 +1,5 @@
|
|||
<?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>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.requests" version="2.9.1" />
|
||||
|
@ -77,7 +77,13 @@
|
|||
<summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary>
|
||||
<description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description>
|
||||
<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
|
||||
- Fix UnicodeDecodeError for libraries with non-ASCII paths
|
||||
- Fix TypeError on Kodi start
|
||||
|
|
|
@ -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:
|
||||
- Wait for PKC to authorize before loading widgets
|
||||
- Fix UnicodeDecodeError for libraries with non-ASCII paths
|
||||
|
|
|
@ -590,7 +590,7 @@ msgstr ""
|
|||
# PKC Settings - Sync Options
|
||||
msgctxt "#30524"
|
||||
msgid "Select Plex libraries to sync"
|
||||
msgstr ""
|
||||
msgstr "Zvolte knihovny Plexu k synchronizaci"
|
||||
|
||||
# PKC Settings - Playback
|
||||
msgctxt "#30527"
|
||||
|
@ -1249,7 +1249,7 @@ msgstr "Shlédnout později"
|
|||
# e.g. the PMS' name
|
||||
msgctxt "#39213"
|
||||
msgid "{0} offline"
|
||||
msgstr ""
|
||||
msgstr "{0} je offline"
|
||||
|
||||
msgctxt "#39215"
|
||||
msgid "Enter your Plex Media Server's IP or URL, Examples are:"
|
||||
|
|
|
@ -22,9 +22,14 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
|
|||
"""
|
||||
kodi_id = None
|
||||
path = utils.try_decode(path)
|
||||
path, filename = path_ops.path.split(path)
|
||||
# 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':
|
||||
with KodiMusicDB(lock=False) as kodidb:
|
||||
try:
|
||||
|
|
|
@ -8,7 +8,7 @@ from . import utils
|
|||
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
|
||||
api = API(item=None)
|
||||
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
|
||||
continue
|
||||
if not section.sync_to_kodi:
|
||||
|
|
|
@ -152,9 +152,9 @@ class API(object):
|
|||
|
||||
def directory_path(self, section_id=None, plex_type=None, old_key=None,
|
||||
synched=True):
|
||||
key = self.item.get('fastKey')
|
||||
key = cast(unicode, self.item.get('fastKey'))
|
||||
if not key:
|
||||
key = self.item.get('key')
|
||||
key = cast(unicode, self.item.get('key'))
|
||||
if old_key:
|
||||
key = '%s/%s' % (old_key, key)
|
||||
elif not key.startswith('/'):
|
||||
|
@ -169,10 +169,10 @@ class API(object):
|
|||
params['synched'] = 'false'
|
||||
if self.item.get('prompt'):
|
||||
# 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:
|
||||
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):
|
||||
"""
|
||||
|
|
|
@ -9,6 +9,7 @@ from sqlite3 import connect, OperationalError
|
|||
from datetime import datetime
|
||||
from unicodedata import normalize
|
||||
from threading import Lock
|
||||
import urllib
|
||||
# Originally tried faster cElementTree, but does NOT work reliably with Kodi
|
||||
import xml.etree.ElementTree as etree
|
||||
import defusedxml.ElementTree as defused_etree # etree parse unsafe
|
||||
|
@ -269,17 +270,22 @@ def cast(func, value):
|
|||
func (func): Calback function to used cast to type (int, bool, float).
|
||||
value (any): value to be cast and returned.
|
||||
"""
|
||||
if value is not None:
|
||||
if func == bool:
|
||||
if value is None:
|
||||
return value
|
||||
elif func == bool:
|
||||
return bool(int(value))
|
||||
elif func == unicode:
|
||||
if isinstance(value, (int, long, float)):
|
||||
return unicode(value)
|
||||
elif isinstance(value, unicode):
|
||||
return value
|
||||
else:
|
||||
return value.decode('utf-8')
|
||||
elif func == str:
|
||||
if isinstance(value, (int, long, float)):
|
||||
return str(value)
|
||||
elif isinstance(value, str):
|
||||
return value
|
||||
else:
|
||||
return value.encode('utf-8')
|
||||
elif func in (int, float):
|
||||
|
@ -288,7 +294,35 @@ def cast(func, value):
|
|||
except ValueError:
|
||||
return float('nan')
|
||||
return func(value)
|
||||
return 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'):
|
||||
|
|
Loading…
Reference in a new issue