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)
|
||||
[![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)
|
||||
[![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"?>
|
||||
<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>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.requests" version="2.9.1" />
|
||||
|
@ -74,7 +74,12 @@
|
|||
<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.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
|
||||
- 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):
|
||||
- Fix rare case when playback would not start-up
|
||||
- Increase logging
|
||||
|
|
|
@ -638,6 +638,10 @@ class InitialSetup(object):
|
|||
# Make sure that we only ask these questions upon first installation
|
||||
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:
|
||||
# Open Settings page now? You will need to restart!
|
||||
goto_settings = utils.yesno_dialog(utils.lang(29999),
|
||||
|
|
|
@ -1253,3 +1253,30 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
|
|||
except TypeError:
|
||||
LOG.debug('No kodi video db element found for path %s', path)
|
||||
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'])
|
||||
class LibrarySync(Thread):
|
||||
"""
|
||||
|
@ -58,8 +77,8 @@ class LibrarySync(Thread):
|
|||
# Need to be set accordingly later
|
||||
self.compare = None
|
||||
self.new_items_only = None
|
||||
self.update_kodi_video_library = None
|
||||
self.update_kodi_music_library = None
|
||||
self.update_kodi_video_library = False
|
||||
self.update_kodi_music_library = False
|
||||
self.nodes = {}
|
||||
self.playlists = {}
|
||||
self.sorted_views = []
|
||||
|
@ -288,9 +307,7 @@ class LibrarySync(Thread):
|
|||
return False
|
||||
|
||||
# Let kodi update the views in any case, since we're doing a full sync
|
||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||
if state.ENABLE_MUSIC:
|
||||
xbmc.executebuiltin('UpdateLibrary(music)')
|
||||
update_library(video=True, music=state.ENABLE_MUSIC)
|
||||
|
||||
if utils.window('plex_scancrashed') == 'true':
|
||||
# Show warning if itemtypes.py crashed at some point
|
||||
|
@ -1081,8 +1098,6 @@ class LibrarySync(Thread):
|
|||
6: 'analyzing',
|
||||
9: 'deleted'
|
||||
"""
|
||||
self.update_kodi_video_library = False
|
||||
self.update_kodi_music_library = False
|
||||
now = utils.unix_timestamp()
|
||||
delete_list = []
|
||||
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,
|
||||
delete_list)
|
||||
# Let Kodi know of the change
|
||||
if self.update_kodi_video_library is True:
|
||||
LOG.info("Doing Kodi Video Lib update")
|
||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||
if self.update_kodi_music_library is True:
|
||||
LOG.info("Doing Kodi Music Lib update")
|
||||
xbmc.executebuiltin('UpdateLibrary(music)')
|
||||
if self.update_kodi_video_library or self.update_kodi_music_library:
|
||||
update_library(video=self.update_kodi_video_library,
|
||||
music=self.update_kodi_music_library)
|
||||
self.update_kodi_video_library = False
|
||||
self.update_kodi_music_library = False
|
||||
|
||||
def process_newitems(self, item):
|
||||
xml = PF.GetPlexMetadata(item['ratingKey'])
|
||||
|
|
Loading…
Reference in a new issue