Merge branch 'beta-version' into plex_for_kodi
This commit is contained in:
commit
c26e1283db
6 changed files with 71 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
||||||
[![stable version](https://img.shields.io/badge/stable_version-2.4.3-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.4.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.4.4-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.4.5-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)
|
||||||
|
|
|
@ -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.4.4" provider-name="croneter">
|
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.4.5" 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" />
|
||||||
|
@ -74,7 +74,12 @@
|
||||||
<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.4.4 (beta only):
|
<news>version 2.4.5 (beta only):
|
||||||
|
- Fix playback not starting up at all
|
||||||
|
- Rewire Kodi library refreshs
|
||||||
|
- Wipe Kodi database on first PKC run to more reliably install PKC
|
||||||
|
|
||||||
|
version 2.4.4 (beta only):
|
||||||
- Fix rare case when playback would not start-up
|
- Fix rare case when playback would not start-up
|
||||||
- Increase logging
|
- Increase logging
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
version 2.4.5 (beta only):
|
||||||
|
- Fix playback not starting up at all
|
||||||
|
- Rewire Kodi library refreshs
|
||||||
|
- Wipe Kodi database on first PKC run to more reliably install PKC
|
||||||
|
|
||||||
version 2.4.4 (beta only):
|
version 2.4.4 (beta only):
|
||||||
- Fix rare case when playback would not start-up
|
- Fix rare case when playback would not start-up
|
||||||
- Increase logging
|
- Increase logging
|
||||||
|
|
|
@ -637,6 +637,10 @@ class InitialSetup(object):
|
||||||
# dialog.ok(heading=utils.lang(29999), line1=utils.lang(39717))
|
# dialog.ok(heading=utils.lang(29999), line1=utils.lang(39717))
|
||||||
# Make sure that we only ask these questions upon first installation
|
# Make sure that we only ask these questions upon first installation
|
||||||
utils.settings('InstallQuestionsAnswered', value='true')
|
utils.settings('InstallQuestionsAnswered', value='true')
|
||||||
|
|
||||||
|
# New installation - make sure we start with a clean slate
|
||||||
|
from . import kodidb_functions
|
||||||
|
kodidb_functions.wipe_kodi_dbs()
|
||||||
|
|
||||||
if goto_settings is False:
|
if goto_settings is False:
|
||||||
# Open Settings page now? You will need to restart!
|
# Open Settings page now? You will need to restart!
|
||||||
|
|
|
@ -1253,3 +1253,30 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
LOG.debug('No kodi video db element found for path %s', path)
|
LOG.debug('No kodi video db element found for path %s', path)
|
||||||
return kodi_id, kodi_type
|
return kodi_id, kodi_type
|
||||||
|
|
||||||
|
|
||||||
|
def wipe_kodi_dbs():
|
||||||
|
"""
|
||||||
|
Completely resets the Kodi databases 'video', 'texture' and 'music' (if
|
||||||
|
music sync is enabled)
|
||||||
|
"""
|
||||||
|
LOG.warn('Wiping Kodi databases!')
|
||||||
|
query = "SELECT name FROM sqlite_master WHERE type = 'table'"
|
||||||
|
kinds = ['video', 'texture']
|
||||||
|
if state.ENABLE_MUSIC:
|
||||||
|
LOG.info('Also deleting music database')
|
||||||
|
kinds.append('music')
|
||||||
|
for db in kinds:
|
||||||
|
with GetKodiDB(db) as kodi_db:
|
||||||
|
kodi_db.cursor.execute(query)
|
||||||
|
tables = kodi_db.cursor.fetchall()
|
||||||
|
tables = [i[0] for i in tables]
|
||||||
|
if 'version' in tables:
|
||||||
|
tables.remove('version')
|
||||||
|
for table in tables:
|
||||||
|
delete_query = 'DELETE FROM %s' % table
|
||||||
|
kodi_db.cursor.execute(delete_query)
|
||||||
|
import xbmc
|
||||||
|
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||||
|
if state.ENABLE_MUSIC:
|
||||||
|
xbmc.executebuiltin('UpdateLibrary(music)')
|
||||||
|
|
|
@ -39,6 +39,25 @@ LOG = getLogger('PLEX.librarysync')
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
def update_library(video=True, music=True):
|
||||||
|
"""
|
||||||
|
Updates the Kodi library and thus refreshes the Kodi views and widgets
|
||||||
|
"""
|
||||||
|
if xbmc.getCondVisibility('Container.Content(musicvideos)') or \
|
||||||
|
xbmc.getCondVisibility('Window.IsMedia'):
|
||||||
|
# Prevent cursor from moving
|
||||||
|
LOG.debug("Refreshing container")
|
||||||
|
xbmc.executebuiltin('Container.Refresh')
|
||||||
|
else:
|
||||||
|
# Update widgets
|
||||||
|
if video:
|
||||||
|
LOG.debug("Doing Kodi Video Lib update")
|
||||||
|
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||||
|
if music:
|
||||||
|
LOG.debug("Doing Kodi Music Lib update")
|
||||||
|
xbmc.executebuiltin('UpdateLibrary(music)')
|
||||||
|
|
||||||
|
|
||||||
@utils.thread_methods(add_suspends=['SUSPEND_LIBRARY_THREAD', 'STOP_SYNC'])
|
@utils.thread_methods(add_suspends=['SUSPEND_LIBRARY_THREAD', 'STOP_SYNC'])
|
||||||
class LibrarySync(Thread):
|
class LibrarySync(Thread):
|
||||||
"""
|
"""
|
||||||
|
@ -58,8 +77,8 @@ class LibrarySync(Thread):
|
||||||
# Need to be set accordingly later
|
# Need to be set accordingly later
|
||||||
self.compare = None
|
self.compare = None
|
||||||
self.new_items_only = None
|
self.new_items_only = None
|
||||||
self.update_kodi_video_library = None
|
self.update_kodi_video_library = False
|
||||||
self.update_kodi_music_library = None
|
self.update_kodi_music_library = False
|
||||||
self.nodes = {}
|
self.nodes = {}
|
||||||
self.playlists = {}
|
self.playlists = {}
|
||||||
self.sorted_views = []
|
self.sorted_views = []
|
||||||
|
@ -288,9 +307,7 @@ class LibrarySync(Thread):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Let kodi update the views in any case, since we're doing a full sync
|
# Let kodi update the views in any case, since we're doing a full sync
|
||||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
update_library(video=True, music=state.ENABLE_MUSIC)
|
||||||
if state.ENABLE_MUSIC:
|
|
||||||
xbmc.executebuiltin('UpdateLibrary(music)')
|
|
||||||
|
|
||||||
if utils.window('plex_scancrashed') == 'true':
|
if utils.window('plex_scancrashed') == 'true':
|
||||||
# Show warning if itemtypes.py crashed at some point
|
# Show warning if itemtypes.py crashed at some point
|
||||||
|
@ -1081,8 +1098,6 @@ class LibrarySync(Thread):
|
||||||
6: 'analyzing',
|
6: 'analyzing',
|
||||||
9: 'deleted'
|
9: 'deleted'
|
||||||
"""
|
"""
|
||||||
self.update_kodi_video_library = False
|
|
||||||
self.update_kodi_music_library = False
|
|
||||||
now = utils.unix_timestamp()
|
now = utils.unix_timestamp()
|
||||||
delete_list = []
|
delete_list = []
|
||||||
for i, item in enumerate(self.items_to_process):
|
for i, item in enumerate(self.items_to_process):
|
||||||
|
@ -1119,12 +1134,11 @@ class LibrarySync(Thread):
|
||||||
self.items_to_process = self.multi_delete(self.items_to_process,
|
self.items_to_process = self.multi_delete(self.items_to_process,
|
||||||
delete_list)
|
delete_list)
|
||||||
# Let Kodi know of the change
|
# Let Kodi know of the change
|
||||||
if self.update_kodi_video_library is True:
|
if self.update_kodi_video_library or self.update_kodi_music_library:
|
||||||
LOG.info("Doing Kodi Video Lib update")
|
update_library(video=self.update_kodi_video_library,
|
||||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
music=self.update_kodi_music_library)
|
||||||
if self.update_kodi_music_library is True:
|
self.update_kodi_video_library = False
|
||||||
LOG.info("Doing Kodi Music Lib update")
|
self.update_kodi_music_library = False
|
||||||
xbmc.executebuiltin('UpdateLibrary(music)')
|
|
||||||
|
|
||||||
def process_newitems(self, item):
|
def process_newitems(self, item):
|
||||||
xml = PF.GetPlexMetadata(item['ratingKey'])
|
xml = PF.GetPlexMetadata(item['ratingKey'])
|
||||||
|
|
Loading…
Reference in a new issue