Merge pull request #747 from croneter/beta-version

Bump master
This commit is contained in:
croneter 2019-02-24 11:27:52 +01:00 committed by GitHub
commit 652b23bd8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 87 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.7.2-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.3-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.2-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.3-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.2" provider-name="croneter"> <addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.7.3" 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,11 @@
<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.2: <news>version 2.7.3:
- Fix PKC trying to initialize playqueues over and over again
- Fix PKC not starting due to a higher version Kodi database
version 2.7.2:
- Fix Kodi profile switch not working correctly and PKC not exiting cleanly - Fix Kodi profile switch not working correctly and PKC not exiting cleanly
version 2.7.1: version 2.7.1:

View file

@ -1,3 +1,7 @@
version 2.7.3:
- Fix PKC trying to initialize playqueues over and over again
- Fix PKC not starting due to a higher version Kodi database
version 2.7.2: version 2.7.2:
- Fix Kodi profile switch not working correctly and PKC not exiting cleanly - Fix Kodi profile switch not working correctly and PKC not exiting cleanly

View file

@ -5,6 +5,8 @@ Monitors the Kodi playqueue and adjusts the Plex playqueue accordingly
""" """
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import copy
import xbmc import xbmc
from .plex_api import API from .plex_api import API
@ -97,11 +99,14 @@ class PlayqueueMonitor(backgroundthread.KillableThread):
(playlist) are swapped. This is what this monitor is for. Don't replace (playlist) are swapped. This is what this monitor is for. Don't replace
this mechanism till Kodi's implementation of playlists has improved this mechanism till Kodi's implementation of playlists has improved
""" """
def _compare_playqueues(self, playqueue, new): def _compare_playqueues(self, playqueue, new_kodi_playqueue):
""" """
Used to poll the Kodi playqueue and update the Plex playqueue if needed Used to poll the Kodi playqueue and update the Plex playqueue if needed
""" """
old = list(playqueue.items) old = list(playqueue.items)
# We might append to new_kodi_playqueue but will need the original
# still back in the main loop
new = copy.deepcopy(new_kodi_playqueue)
index = list(range(0, len(old))) index = list(range(0, len(old)))
LOG.debug('Comparing new Kodi playqueue %s with our play queue %s', LOG.debug('Comparing new Kodi playqueue %s with our play queue %s',
new, old) new, old)

View file

@ -3,7 +3,6 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
import os import os
import sys import sys
import re
import platform import platform
import xbmc import xbmc
@ -99,50 +98,30 @@ PKC_MACHINE_IDENTIFIER = None
# Minimal PKC version needed for the Kodi database - otherwise need to recreate # Minimal PKC version needed for the Kodi database - otherwise need to recreate
MIN_DB_VERSION = '2.6.8' MIN_DB_VERSION = '2.6.8'
# Supported databases # Supported databases - version numbers in tuples should decrease
SUPPORTED_VIDEO_DB = { SUPPORTED_VIDEO_DB = {
# Kodi 17 Krypton: # Kodi 17 Krypton:
17: { 17: (107, ),
107: 107,
},
# Kodi 18 Leia: # Kodi 18 Leia:
18: { 18: (116, 113),
113: 113,
116: 116
},
# Kodi 19 - EXTREMLY EXPERIMENTAL! # Kodi 19 - EXTREMLY EXPERIMENTAL!
19: { 19: (116, 113)
113: 113,
116: 116
}
} }
SUPPORTED_MUSIC_DB = { SUPPORTED_MUSIC_DB = {
# Kodi 17 Krypton: # Kodi 17 Krypton:
17: { 17: (60, ),
60: 60,
},
# Kodi 18 Leia: # Kodi 18 Leia:
18: { 18: (72, ),
72: 72,
},
# Kodi 19 - EXTREMLY EXPERIMENTAL! # Kodi 19 - EXTREMLY EXPERIMENTAL!
19: { 19: (72, )
72: 72,
}
} }
SUPPORTED_TEXTURE_DB = { SUPPORTED_TEXTURE_DB = {
# Kodi 17 Krypton: # Kodi 17 Krypton:
17: { 17: (13, ),
13: 13,
},
# Kodi 18 Leia: # Kodi 18 Leia:
18: { 18: (13, ),
13: 13,
},
# Kodi 19 - EXTREMLY EXPERIMENTAL! # Kodi 19 - EXTREMLY EXPERIMENTAL!
19: { 19: (13, )
13: 13,
}
} }
DB_VIDEO_VERSION = None DB_VIDEO_VERSION = None
DB_VIDEO_PATH = None DB_VIDEO_PATH = None
@ -590,57 +569,6 @@ PLEX_STREAM_TYPE_FROM_STREAM_TYPE = {
'subtitle': '3' 'subtitle': '3'
} }
def database_paths():
'''
Set the Kodi database paths. Will raise a RuntimeError if the DBs are
not found or of a wrong, unsupported version
'''
global DB_VIDEO_VERSION, DB_VIDEO_PATH
global DB_MUSIC_VERSION, DB_MUSIC_PATH
global DB_TEXTURE_VERSION, DB_TEXTURE_PATH
database_path = try_decode(xbmc.translatePath('special://database'))
video_versions = []
music_versions = []
texture_versions = []
types = (
(re.compile(r'''MyVideos(\d+).db'''), video_versions),
(re.compile(r'''MyMusic(\d+).db'''), music_versions),
(re.compile(r'''Textures(\d+).db'''), texture_versions)
)
for root, _, files in path_ops.walk(database_path):
for file in files:
for typus in types:
match = typus[0].search(path_ops.path.join(root, file))
if not match:
continue
typus[1].append(int(match.group(1)))
try:
DB_VIDEO_VERSION = max(video_versions)
SUPPORTED_VIDEO_DB[KODIVERSION][DB_VIDEO_VERSION]
DB_VIDEO_PATH = path_ops.path.join(database_path,
'MyVideos%s.db' % DB_VIDEO_VERSION)
except (ValueError, KeyError):
raise RuntimeError('Video DB %s not supported'
% DB_VIDEO_VERSION)
try:
DB_MUSIC_VERSION = max(music_versions)
SUPPORTED_MUSIC_DB[KODIVERSION][DB_MUSIC_VERSION]
DB_MUSIC_PATH = path_ops.path.join(database_path,
'MyMusic%s.db' % DB_MUSIC_VERSION)
except (ValueError, KeyError):
raise RuntimeError('Music DB %s not supported'
% DB_MUSIC_VERSION)
try:
DB_TEXTURE_VERSION = max(texture_versions)
SUPPORTED_TEXTURE_DB[KODIVERSION][DB_TEXTURE_VERSION]
DB_TEXTURE_PATH = path_ops.path.join(database_path,
'Textures%s.db' % DB_TEXTURE_VERSION)
except (ValueError, KeyError):
raise RuntimeError('Texture DB %s not supported'
% DB_TEXTURE_VERSION)
# Encoding to be used for our m3u playlist files # Encoding to be used for our m3u playlist files
# m3u files do not have encoding specified by definition, unfortunately. # m3u files do not have encoding specified by definition, unfortunately.
if DEVICE == 'Windows': if DEVICE == 'Windows':
@ -651,3 +579,36 @@ else:
M3U_ENCODING == 'ascii' or M3U_ENCODING == 'ascii' or
M3U_ENCODING == 'ANSI_X3.4-1968'): M3U_ENCODING == 'ANSI_X3.4-1968'):
M3U_ENCODING = 'utf-8' M3U_ENCODING = 'utf-8'
def database_paths():
'''
Set the Kodi database paths - PKC will choose the HIGHEST available and
supported database version for the current Kodi version.
Will raise a RuntimeError if the DBs are not found or of a wrong,
unsupported version
'''
# Check Kodi version first
if KODIVERSION not in (17, 18, 19):
raise RuntimeError('Kodiversion %s not supported by PKC' % KODIVERSION)
database_path = try_decode(xbmc.translatePath('special://database'))
thismodule = sys.modules[__name__]
types = (('MyVideos%s.db', SUPPORTED_VIDEO_DB,
'DB_VIDEO_VERSION', 'DB_VIDEO_PATH'),
('MyMusic%s.db', SUPPORTED_MUSIC_DB,
'DB_MUSIC_VERSION', 'DB_MUSIC_PATH'),
('Textures%s.db', SUPPORTED_TEXTURE_DB,
'DB_TEXTURE_VERSION', 'DB_TEXTURE_PATH'))
for string, versions, actual_version, actual_path in types:
for version in versions[KODIVERSION]:
file = string % version
path = path_ops.path.join(database_path, file)
if path_ops.exists(path):
setattr(thismodule, actual_version, version)
setattr(thismodule, actual_path, path)
if (DB_VIDEO_VERSION is None or
DB_MUSIC_VERSION is None or
DB_TEXTURE_VERSION is None):
raise RuntimeError('Kodi database versions not supported by PKC')