Merge pull request #675 from croneter/beta-version

Bump stable
This commit is contained in:
croneter 2019-02-02 13:47:11 +01:00 committed by GitHub
commit ee68703da9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 90 additions and 50 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.6.1-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.6.1-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.6.2-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.6.2-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.6.1" provider-name="croneter">
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.6.2" provider-name="croneter">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.9.1" />
@ -77,7 +77,15 @@
<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.6.1:
<news>version 2.6.2:
- Fix playlist sync: sequence item 0: expected string or unicode
- Fix PKC not deleting all the items it should
- Fix keyError 'sessionKey' for weird PMS messages
- Fix artwork caching AttributeError: 'ImageCachingThread' object has no attribute 'cancel'
- Improve pop-up "Searching for PMS"
- Fix FutureWarning
version 2.6.1:
- WARNING: You will need to reset the Kodi database!
- Fix TV sections not being deleted e.g. after user switch
- Don't show a library sync error pop-up when full sync is interrupted

View file

@ -1,3 +1,11 @@
version 2.6.2:
- Fix playlist sync: sequence item 0: expected string or unicode
- Fix PKC not deleting all the items it should
- Fix keyError 'sessionKey' for weird PMS messages
- Fix artwork caching AttributeError: 'ImageCachingThread' object has no attribute 'cancel'
- Improve pop-up "Searching for PMS"
- Fix FutureWarning
version 2.6.1:
- WARNING: You will need to reset the Kodi database!
- Fix TV sections not being deleted e.g. after user switch

View file

@ -220,7 +220,7 @@ class InitialSetup(object):
verifySSL=verifySSL)
return chk
def pick_pms(self, showDialog=False):
def pick_pms(self, showDialog=False, inform_of_search=False):
"""
Searches for PMS in local Lan and optionally (if self.plex_token set)
also on plex.tv
@ -260,10 +260,10 @@ class InitialSetup(object):
if showDialog is True:
server = self._user_pick_pms()
else:
server = self._auto_pick_pms()
server = self._auto_pick_pms(show_dialog=inform_of_search)
return server
def _auto_pick_pms(self):
def _auto_pick_pms(self, show_dialog=False):
"""
Will try to pick PMS based on machineIdentifier saved in file settings
but only once
@ -272,35 +272,47 @@ class InitialSetup(object):
"""
https_updated = False
server = None
while True:
if https_updated is False:
serverlist = PF.discover_pms(self.plex_token)
for item in serverlist:
if item.get('machineIdentifier') == app.CONN.machine_identifier:
server = item
if server is None:
name = utils.settings('plex_servername')
LOG.warn('The PMS you have used before with a unique '
'machineIdentifier of %s and name %s is '
'offline', app.CONN.machine_identifier, name)
if show_dialog:
# Searching for PMS
utils.dialog('notification',
heading='{plex}',
message=utils.lang(30001),
icon='{plex}',
time=60000)
try:
while True:
if https_updated is False:
serverlist = PF.discover_pms(self.plex_token)
for item in serverlist:
if item.get('machineIdentifier') == app.CONN.machine_identifier:
server = item
if server is None:
name = utils.settings('plex_servername')
LOG.warn('The PMS you have used before with a unique '
'machineIdentifier of %s and name %s is '
'offline', app.CONN.machine_identifier, name)
return
chk = self._check_pms_connectivity(server)
if chk == 504 and https_updated is False:
# switch HTTPS to HTTP or vice-versa
if server['scheme'] == 'https':
server['scheme'] = 'http'
else:
server['scheme'] = 'https'
https_updated = True
continue
# Problems connecting
elif chk >= 400 or chk is False:
LOG.warn('Problems connecting to server %s. chk is %s',
server['name'], chk)
return
chk = self._check_pms_connectivity(server)
if chk == 504 and https_updated is False:
# switch HTTPS to HTTP or vice-versa
if server['scheme'] == 'https':
server['scheme'] = 'http'
else:
server['scheme'] = 'https'
https_updated = True
continue
# Problems connecting
elif chk >= 400 or chk is False:
LOG.warn('Problems connecting to server %s. chk is %s',
server['name'], chk)
return
LOG.info('We found a server to automatically connect to: %s',
server['name'])
return server
LOG.info('We found a server to automatically connect to: %s',
server['name'])
return server
finally:
if show_dialog:
executebuiltin("Dialog.Close(all, true)")
def _user_pick_pms(self):
"""
@ -314,7 +326,7 @@ class InitialSetup(object):
heading='{plex}',
message=utils.lang(30001),
icon='{plex}',
time=5000)
time=60000)
while True:
if https_updated is False:
serverlist = PF.discover_pms(self.plex_token)
@ -343,6 +355,8 @@ class InitialSetup(object):
dialoglist.append('%s (%s)'
% (server['name'], msg))
# Let user pick server from a list
# Close the PKC info "Searching for PMS"
executebuiltin("Dialog.Close(all, true)")
resp = utils.dialog('select', utils.lang(39012), dialoglist)
if resp == -1:
# User cancelled
@ -551,7 +565,7 @@ class InitialSetup(object):
if not self.plex_token and app.ACCOUNT.myplexlogin:
self.plex_tv_sign_in()
server = self.pick_pms()
server = self.pick_pms(inform_of_search=True)
if server is not None:
# Write our chosen server to Kodi settings file
self.save_pms_settings(server['baseURL'], server['token'])

View file

@ -372,12 +372,17 @@ class FullSync(common.fullsync_mixin):
])
for plex_type, context in kinds:
# Delete movies that are not on Plex anymore
with context(self.current_sync) as ctx:
for plex_id in ctx.plexdb.plex_id_by_last_sync(plex_type,
self.current_sync):
if self.isCanceled():
return False
ctx.remove(plex_id, plex_type)
while True:
with context(self.current_sync) as ctx:
plex_ids = list(ctx.plexdb.plex_id_by_last_sync(plex_type,
self.current_sync,
BATCH_SIZE))
for plex_id in plex_ids:
if self.isCanceled():
return False
ctx.remove(plex_id, plex_type)
if len(plex_ids) < BATCH_SIZE:
break
LOG.debug('Done deleting')
return True

View file

@ -256,6 +256,9 @@ def process_playing(data):
skip = True
if skip:
continue
if 'sessionKey' not in message:
LOG.warn('Received malformed message from the PMS: %s', message)
continue
session_key = message['sessionKey']
# Do we already have a sessionKey stored?
if session_key not in PLAYSTATE_SESSIONS:

View file

@ -108,7 +108,8 @@ def add_items(playlist, plex_ids):
'title': playlist.plex_name,
'smart': 0,
'uri': ('server://%s/com.plexapp.plugins.library/library/metadata/%s'
% (app.CONN.machine_identifier, ','.join(plex_ids)))
% (app.CONN.machine_identifier,
','.join(unicode(x) for x in plex_ids)))
}
xml = DU().downloadUrl(url='{server}/playlists/',
action_type='POST',

View file

@ -100,13 +100,14 @@ class PlexDBBase(object):
method = getattr(self, 'entry_to_%s' % v.PLEX_TYPE_FROM_KODI_TYPE[kodi_type])
return method(self.cursor.fetchone())
def plex_id_by_last_sync(self, plex_type, last_sync):
def plex_id_by_last_sync(self, plex_type, last_sync, limit):
"""
Returns an iterator for all items where the last_sync is NOT identical
"""
return (x[0] for x in
self.cursor.execute('SELECT plex_id FROM %s WHERE last_sync <> ?' % plex_type,
(last_sync, )))
query = '''
SELECT plex_id FROM %s WHERE last_sync <> ? LIMIT %s
''' % (plex_type, limit)
return (x[0] for x in self.cursor.execute(query, (last_sync, )))
def checksum(self, plex_id, plex_type):
"""

View file

@ -264,7 +264,7 @@ def _sign_in_with_pin():
return
app.APP.monitor.waitForAbort(0.1)
if not pinlogin.expired:
if pinlogin.xml:
if pinlogin.xml is not None:
pin_login_window.setLinking()
return pinlogin.xml
finally:

View file

@ -135,7 +135,7 @@ class Sync(backgroundthread.KillableThread):
LOG.info('Not synching Plex artwork - not caching')
return
if self.image_cache_thread and self.image_cache_thread.is_alive():
self.image_cache_thread.cancel()
self.image_cache_thread.abort()
self.image_cache_thread.join()
self.image_cache_thread = artwork.ImageCachingThread()
self.image_cache_thread.start()