Merge branch 'beta-version'

This commit is contained in:
croneter 2018-07-15 19:22:56 +02:00
commit 27c3e2761e
6 changed files with 28 additions and 7 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.1.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.2.13-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.2.14-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)

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.2.13" provider-name="croneter">
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.2.14" provider-name="croneter">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.9.1" />
@ -73,7 +73,10 @@
<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.2.13 (beta only):
<news>version 2.2.14 (beta only):
- Hopefully fix playlist sync loops
version 2.2.13 (beta only):
- Fix library sync crash
- Fix switching to __future__ module
- Fix "Prefer Kodi Artwork" toggle doing the exact opposite

View file

@ -1,3 +1,6 @@
version 2.2.14 (beta only):
- Hopefully fix playlist sync loops
version 2.2.13 (beta only):
- Fix library sync crash
- Fix switching to __future__ module

View file

@ -40,6 +40,8 @@ SUPPORTED_FILETYPES = (
# 'pls',
# 'cue',
)
# Avoid endless loops
IGNORE_KODI_PLAYLIST_CHANGE = list()
###############################################################################
@ -70,9 +72,10 @@ def websocket(plex_id, status):
if sync_plex_playlist(playlist=playlist):
LOG.debug('Plex deletion of playlist detected: %s', playlist)
try:
IGNORE_KODI_PLAYLIST_CHANGE.append(plex_id)
kodi_pl.delete(playlist)
except PlaylistError:
pass
IGNORE_KODI_PLAYLIST_CHANGE.remove(plex_id)
return
xml = pms.metadata(plex_id)
if xml is None:
@ -90,6 +93,7 @@ def websocket(plex_id, status):
else:
LOG.debug('Change of Plex playlist detected: %s',
playlist)
IGNORE_KODI_PLAYLIST_CHANGE.append(plex_id)
kodi_pl.delete(playlist)
create = True
elif not playlist and not status == 9:
@ -98,9 +102,10 @@ def websocket(plex_id, status):
create = True
# To the actual work
if create:
IGNORE_KODI_PLAYLIST_CHANGE.append(plex_id)
kodi_pl.create(plex_id)
except PlaylistError:
pass
IGNORE_KODI_PLAYLIST_CHANGE.remove(plex_id)
def full_sync():
@ -140,22 +145,28 @@ def _full_sync():
if not playlist:
LOG.debug('New Plex playlist %s discovered: %s',
api.plex_id(), api.title())
IGNORE_KODI_PLAYLIST_CHANGE.append(api.plex_id())
kodi_pl.create(api.plex_id())
elif playlist.plex_updatedat != api.updated_at():
LOG.debug('Detected changed Plex playlist %s: %s',
api.plex_id(), api.title())
IGNORE_KODI_PLAYLIST_CHANGE.append(api.plex_id())
kodi_pl.delete(playlist)
IGNORE_KODI_PLAYLIST_CHANGE.append(api.plex_id())
kodi_pl.create(api.plex_id())
except PlaylistError:
LOG.info('Skipping playlist %s: %s', api.plex_id(), api.title())
IGNORE_KODI_PLAYLIST_CHANGE.remove(api.plex_id())
# Get rid of old Plex playlists that were deleted on the Plex side
for plex_id in old_plex_ids:
playlist = db.get_playlist(plex_id=plex_id)
LOG.debug('Removing outdated Plex playlist: %s', playlist)
try:
IGNORE_KODI_PLAYLIST_CHANGE.append(playlist.plex_id)
kodi_pl.delete(playlist)
except PlaylistError:
LOG.debug('Skipping deletion of playlist: %s', playlist)
IGNORE_KODI_PLAYLIST_CHANGE.remove(playlist.plex_id)
# Look at all supported Kodi playlists. Check whether they are in the DB.
old_kodi_paths = db.kodi_playlist_paths()
for root, _, files in path_ops.walk(v.PLAYLIST_PATH):
@ -275,6 +286,11 @@ class PlaylistEventhandler(events.FileSystemEventHandler):
else event.src_path
if not sync_kodi_playlist(path):
return
playlist = db.get_playlist(path=path)
if playlist and playlist.plex_id in IGNORE_KODI_PLAYLIST_CHANGE:
LOG.debug('Ignoring event %s for playlist %s', event, playlist)
IGNORE_KODI_PLAYLIST_CHANGE.remove(playlist.plex_id)
return
_method_map = {
events.EVENT_TYPE_MODIFIED: self.on_modified,
events.EVENT_TYPE_MOVED: self.on_moved,

View file

@ -65,8 +65,6 @@ class Playlist(object):
self.kodi_hash = None
def __repr__(self):
for attr in self.__dict__:
LOG.debug('attr %s: %s', attr, type(attr))
return ("{{"
"'plex_id': {self.plex_id}, "
"'plex_name': '{self.plex_name}', "

View file

@ -77,6 +77,7 @@ def delete(playlist):
if path_ops.exists(playlist.kodi_path):
try:
path_ops.remove(playlist.kodi_path)
LOG.debug('Deleted Kodi playlist: %s', playlist)
except (OSError, IOError) as err:
LOG.error('Could not delete Kodi playlist file %s. Error:\n%s: %s',
playlist, err.errno, err.strerror)