diff --git a/README.md b/README.md index efd5e0bb..7390c4c5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![stable version](https://img.shields.io/badge/stable_version-1.8.18-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.0.20-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.0.22-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) @@ -55,6 +55,7 @@ Some people argue that PKC is 'hacky' because of the way it directly accesses th - Support of Kodi 18 Leia (and Kodi 17 Krypton) - [Amazon Alexa voice recognition](https://www.plex.tv/apps/streaming-devices/amazon-alexa) +- [Cinema Trailers & Extras](https://support.plex.tv/articles/202934883-cinema-trailers-extras/) - [Plex Watch Later / Plex It!](https://support.plex.tv/hc/en-us/sections/200211783-Plex-It-) - [Plex Companion](https://support.plex.tv/hc/en-us/sections/200276908-Plex-Companion): fling Plex media (or anything else) from other Plex devices to PlexKodiConnect - [Plex Transcoding](https://support.plex.tv/hc/en-us/articles/200250377-Transcoding-Media) diff --git a/addon.xml b/addon.xml index d1b93556..a13db1b9 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -67,7 +67,18 @@ Нативная интеграция сервера Plex в Kodi Подключите Kodi к своему серверу Plex. Плагин предполагает что вы управляете своими видео с помощью Plex (а не в Kodi). Вы можете потерять текущие базы данных музыки и видео в Kodi (так как плагин напрямую их изменяет). Используйте на свой страх и риск Используйте на свой страх и риск - version 2.0.20 (beta only): + version 2.0.22 (beta only): +- Fix Recently Added for tv shows not working +- Fix PKC crashing on startup + +version 2.0.21 (beta only): +- Fix TV show artwork Kodi native library (reset Kodi DB!) +- Cache missing posters and backgrounds/fanart on Kodi startup +- Add toggle to deactivate image caching during playback +- Increase timeout between syncing images +- Fix music database if new music is added in the background + +version 2.0.20 (beta only): - Fix missing episode poster in certain views. You will have to manually reset your Kodi database to benefit - Fix episode artwork sometimes not being complete - Fix IndexError for certain Plex channels diff --git a/changelog.txt b/changelog.txt index 3e401c76..6d5b8e35 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,14 @@ +version 2.0.22 (beta only): +- Fix Recently Added for tv shows not working +- Fix PKC crashing on startup + +version 2.0.21 (beta only): +- Fix TV show artwork Kodi native library (reset Kodi DB!) +- Cache missing posters and backgrounds/fanart on Kodi startup +- Add toggle to deactivate image caching during playback +- Increase timeout between syncing images +- Fix music database if new music is added in the background + version 2.0.20 (beta only): - Fix missing episode poster in certain views. You will have to manually reset your Kodi database to benefit - Fix episode artwork sometimes not being complete diff --git a/default.py b/default.py index 79b07fb3..1aaee286 100644 --- a/default.py +++ b/default.py @@ -99,6 +99,9 @@ class Main(): elif mode == 'channels': entrypoint.channels() + elif mode == 'extras': + entrypoint.extras(plex_id=params.get('plex_id')) + elif mode == 'settings': executebuiltin('Addon.OpenSettings(%s)' % v.ADDON_ID) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index e62c76dc..f52d8dad 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -43,12 +43,12 @@ msgstr "" # Sync notification displayed if there is still artwork to be cached to Kodi msgctxt "#30006" -msgid "Caching %s images" +msgid "Caching %s Plex images" msgstr "" # Sync notification displayed if syncing of major artwork is done msgctxt "#30007" -msgid "Major image caching done" +msgid "Plex image caching done" msgstr "" # PKC settings artwork: Enable notifications for artwork image sync @@ -61,6 +61,16 @@ msgctxt "#30009" msgid "Enable image caching during Kodi playback (restart Kodi!)" msgstr "" +# PKC settings - Artwork +msgctxt "#30010" +msgid "Approximate progress" +msgstr "" + +# PKC settings - Artwork +msgctxt "#30011" +msgid "Plex artwork (posters and backgrounds) left to cache:" +msgstr "" + # Button text msgctxt "#30012" msgid "OK" @@ -75,6 +85,11 @@ msgctxt "#30014" msgid "Connection" msgstr "" +# PKC settings - Artwork +msgctxt "#30015" +msgid "Movie and show FanartTV lookups left to do:" +msgstr "" + msgctxt "#30016" msgid "Device Name" msgstr "" @@ -84,6 +99,16 @@ msgctxt "#30017" msgid "Unauthorized for PMS" msgstr "" +# Sync notification displayed for the number of fanart.tv lookups left +msgctxt "#30018" +msgid "Checking FanartTV for %s items" +msgstr "" + +# Sync notification displayed when FanartTV lookup is completed +msgctxt "#30019" +msgid "FanartTV lookup completed" +msgstr "" + # PKC settings category msgctxt "#30022" msgid "Advanced" @@ -407,7 +432,7 @@ msgstr "" # PKC Settings - Artwork msgctxt "#30512" -msgid "Force artwork caching" +msgid "Cache all artwork for a smooth Kodi experience" msgstr "" # PKC Settings - Artwork @@ -487,7 +512,7 @@ msgstr "" # PKC Settings - Advanced msgctxt "#30535" -msgid "[COLOR yellow]Generate a new unique device Id (e.g. when cloning Kodi)[/COLOR]" +msgid "Generate a new unique Plex device Id (e.g. to clone Kodi)" msgstr "" # PKC Settings - Connection @@ -502,7 +527,7 @@ msgstr "" # PKC Settings warning msgctxt "#30538" -msgid "Complete Re-Sync necessary" +msgid "Manual complete reset of Kodi database necessary, see \"Advanced\"" msgstr "" # PKC Settings - Artwork @@ -610,7 +635,7 @@ msgstr "" # PKC Settings - Sync msgctxt "#39003" -msgid "Limit download sync threads (rec. for rpi: 1)" +msgid "Number of simultaneous download threads" msgstr "" # PKC Settings - Plex @@ -675,12 +700,12 @@ msgstr "" # PKC Settings - Advanced msgctxt "#39018" -msgid "[COLOR yellow]Repair local database (force update all content)[/COLOR]" +msgid "Repair the Kodi database (force update all content)" msgstr "" # PKC Settings - Advanced msgctxt "#39019" -msgid "[COLOR red]Partial or full reset of Database and PKC[/COLOR]" +msgid "Reset the Kodi database and optionally reset PlexKodiConnect" msgstr "" # PKC Settings - Artwork diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 03b9767e..6b0a36fa 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -99,6 +99,35 @@ class API(object): """ return self.item.get('ratingKey') + def path(self, force_first_media=True): + """ + Returns a "fully qualified path": add-on paths or direct paths + depending on the current settings. Will NOT valide the playurl + Returns unicode or None if something went wrong. + """ + filename = self.file_path(force_first_media=force_first_media) + if not state.DIRECT_PATHS or self.plex_type() == v.PLEX_TYPE_CLIP: + if filename and '/' in filename: + filename = filename.rsplit('/', 1) + elif filename: + filename = filename.rsplit('\\', 1) + try: + filename = filename[1] + except (TypeError, IndexError): + filename = None + # Set plugin path and media flags using real filename + path = ('plugin://%s/?plex_id=%s&plex_type=%s&mode=play&filename=%s' + % (v.ADDON_TYPE[self.plex_type()], + self.plex_id(), + self.plex_type(), + filename)) + else: + # Direct paths is set the Kodi way + path = self.validate_playurl(filename, + self.plex_type(), + omit_check=True) + return path + def path_and_plex_id(self): """ Returns the Plex key such as '/library/metadata/246922' or None @@ -655,6 +684,16 @@ class API(object): answ['bitDepth'] = None return answ + def extras(self): + """ + Returns a list of XML etree elements for each extra, e.g. a trailer. + """ + answ = [] + for extras in self.item.iterfind('Extras'): + for extra in extras: + answ.append(extra) + return answ + def trailer_id(self): """ Returns the ratingKey (plex_id) of the trailer or None diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 84d7b612..d50c726e 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -12,8 +12,8 @@ import requests from xbmc import sleep, translatePath from xbmcvfs import exists -from utils import window, settings, language as lang, kodi_sql, try_encode, \ - thread_methods, dialog, exists_dir, try_decode +from utils import settings, language as lang, kodi_sql, try_encode, try_decode,\ + thread_methods, dialog, exists_dir import state ############################################################################### @@ -69,7 +69,15 @@ class Image_Cache_Thread(Thread): sleep(1000) continue if isinstance(url, ArtworkSyncMessage): - if state.IMAGE_SYNC_NOTIFICATIONS: + if url.artwork_counter is not None: + if url.artwork_counter == 0: + # Done caching, show this in the PKC settings, too + settings('caching_major_artwork', value=lang(30069)) + LOG.info('Done caching major images!') + else: + settings('caching_major_artwork', + value=str(url.artwork_counter)) + if url.message and state.IMAGE_SYNC_NOTIFICATIONS: dialog('notification', heading=lang(29999), message=url.message, @@ -107,12 +115,12 @@ class Image_Cache_Thread(Thread): 'over-loaded. Sleep %s seconds before trying ' 'again to download %s', 2**sleeptime, double_urldecode(url)) - sleep((2**sleeptime)*1000) + sleep((2**sleeptime) * 1000) sleeptime += 1 continue - except Exception as e: + except Exception as err: LOG.error('Unknown exception for url %s: %s'. - double_urldecode(url), e) + double_urldecode(url), err) import traceback LOG.error("Traceback:\n%s", traceback.format_exc()) break @@ -159,13 +167,25 @@ class Artwork(): connection.close() if not artworks_to_cache: LOG.info('Caching of major images to Kodi texture cache done') + # Set to "None" + settings('caching_major_artwork', value=lang(30069)) return + length = len(artworks_to_cache) LOG.info('Caching has not been completed - caching %s major images', - len(artworks_to_cache)) - self.queue.put(ArtworkSyncMessage(lang(30006) % len(artworks_to_cache))) - for url in artworks_to_cache: + length) + settings('caching_major_artwork', value=str(length)) + # Caching %s Plex images + self.queue.put(ArtworkSyncMessage(message=lang(30006) % length, + artwork_counter=length)) + for i, url in enumerate(artworks_to_cache): self.queue.put(url[0]) - self.queue.put(ArtworkSyncMessage(lang(30007))) + if (length - i) % 10 == 0: + # Update the PKC settings for artwork caching progress + msg = ArtworkSyncMessage(artwork_counter=length - i) + self.queue.put(msg) + # Plex image caching done + self.queue.put(ArtworkSyncMessage(message=lang(30007), + artwork_counter=0)) def fullTextureCacheSync(self): """ @@ -323,5 +343,6 @@ class ArtworkSyncMessage(object): """ Put in artwork queue to display the message as a Kodi notification """ - def __init__(self, message): + def __init__(self, message=None, artwork_counter=None): self.message = message + self.artwork_counter = artwork_counter diff --git a/resources/lib/context_entry.py b/resources/lib/context_entry.py index 56d2f2b1..fa5fd414 100644 --- a/resources/lib/context_entry.py +++ b/resources/lib/context_entry.py @@ -2,13 +2,16 @@ ############################################################################### from logging import getLogger -from xbmc import getInfoLabel, sleep, executebuiltin from xbmcaddon import Addon +import xbmc +import xbmcplugin +import xbmcgui import plexdb_functions as plexdb from utils import window, settings, dialog, language as lang from dialogs import context -from PlexFunctions import delete_item_from_pms +import PlexFunctions as PF +from PlexAPI import API import playqueue as PQ import variables as v import state @@ -25,7 +28,8 @@ OPTIONS = { # 'RemoveFav': lang(30406), # 'RateSong': lang(30407), 'Transcode': lang(30412), - 'PMS_Play': lang(30415) # Use PMS to start playback + 'PMS_Play': lang(30415), # Use PMS to start playback + 'Extras': lang(30235) } ############################################################################### @@ -53,17 +57,24 @@ class ContextMenu(object): self.plex_id, self.plex_type) if not self.plex_id: return + xml = PF.GetPlexMetadata(self.plex_id) + try: + xml[0].attrib + except (TypeError, IndexError, KeyError): + self.api = None + else: + self.api = API(xml[0]) if self._select_menu(): self._action_menu() if self._selected_option in (OPTIONS['Delete'], OPTIONS['Refresh']): LOG.info("refreshing container") - sleep(500) - executebuiltin('Container.Refresh') + xbmc.sleep(500) + xbmc.executebuiltin('Container.Refresh') @staticmethod def _get_plex_id(kodi_id, kodi_type): - plex_id = getInfoLabel('ListItem.Property(plexid)') or None + plex_id = xbmc.getInfoLabel('ListItem.Property(plexid)') or None if not plex_id and kodi_id and kodi_type: with plexdb.Get_Plex_DB() as plexcursor: item = plexcursor.getItem_byKodiId(kodi_id, kodi_type) @@ -79,6 +90,8 @@ class ContextMenu(object): """ options = [] # if user uses direct paths, give option to initiate playback via PMS + if self.api and self.api.extras(): + options.append(OPTIONS['Extras']) if state.DIRECT_PATHS and self.kodi_type in v.KODI_VIDEOTYPES: options.append(OPTIONS['PMS_Play']) if self.kodi_type in v.KODI_VIDEOTYPES: @@ -122,6 +135,8 @@ class ContextMenu(object): self._PMS_play() elif selected == OPTIONS['PMS_Play']: self._PMS_play() + elif selected == OPTIONS['Extras']: + self._extras() # elif selected == OPTIONS['Refresh']: # self.emby.refreshItem(self.item_id) # elif selected == OPTIONS['AddFav']: @@ -131,7 +146,8 @@ class ContextMenu(object): # elif selected == OPTIONS['RateSong']: # self._rate_song() elif selected == OPTIONS['Addon']: - executebuiltin('Addon.OpenSettings(plugin.video.plexkodiconnect)') + xbmc.executebuiltin( + 'Addon.OpenSettings(plugin.video.plexkodiconnect)') elif selected == OPTIONS['Delete']: self._delete_item() @@ -146,7 +162,7 @@ class ContextMenu(object): delete = False if delete: LOG.info("Deleting Plex item with id %s", self.plex_id) - if delete_item_from_pms(self.plex_id) is False: + if PF.delete_item_from_pms(self.plex_id) is False: dialog("ok", heading="{plex}", line1=lang(30414)) def _PMS_play(self): @@ -161,4 +177,16 @@ class ContextMenu(object): % (v.ADDON_TYPE[self.plex_type], self.plex_id, self.plex_type)) - executebuiltin('RunPlugin(%s)' % handle) + xbmc.executebuiltin('RunPlugin(%s)' % handle) + + def _extras(self): + """ + Displays a list of elements for all the extras of the Plex element + """ + handle = ('plugin://plugin.video.plexkodiconnect?mode=extras&plex_id=%s' + % self.plex_id) + if xbmcgui.getCurrentWindowId() == 10025: + # Video Window + xbmc.executebuiltin('Container.Update(\"%s\")' % handle) + else: + xbmc.executebuiltin('ActivateWindow(videos, \"%s\")' % handle) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 7ec66d72..1f47c87b 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -369,7 +369,7 @@ def getRecentEpisodes(viewid, mediatype, tagname, limit): append_show_title = settings('RecentTvAppendShow') == 'true' append_sxxexx = settings('RecentTvAppendSeason') == 'true' # First we get a list of all the TV shows - filtered by tag - allshowsIds = list() + allshowsIds = set() params = { 'sort': {'order': "descending", 'method': "dateadded"}, 'filter': {'operator': "is", 'field': "tag", 'value': "%s" % tagname}, @@ -841,6 +841,26 @@ def __build_item(xml_element): listitem=listitem) +def extras(plex_id): + """ + Lists all extras for plex_id + """ + xbmcplugin.setContent(HANDLE, 'movies') + xml = GetPlexMetadata(plex_id) + try: + xml[0].attrib + except (TypeError, IndexError, KeyError): + xbmcplugin.endOfDirectory(HANDLE) + return + for item in API(xml[0]).extras(): + api = API(item) + listitem = api.create_listitem() + xbmcplugin.addDirectoryItem(handle=HANDLE, + url=api.path(), + listitem=listitem) + xbmcplugin.endOfDirectory(HANDLE) + + def enterPMS(): """ Opens dialogs for the user the plug in the PMS details diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index d753af5c..36a65970 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -852,7 +852,7 @@ class TVShows(Items): # Set plugin path - do NOT use "intermediate" paths for the show # as with direct paths! filename = api.file_name(force_first_media=True) - path = 'plugin://%s.tvshows/' % v.ADDON_ID + path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id) filename = ('%s?plex_id=%s&plex_type=%s&mode=play&filename=%s' % (path, itemid, v.PLEX_TYPE_EPISODE, filename)) playurl = filename diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 36edad66..c45df6e4 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -303,7 +303,11 @@ class KodiDBMethods(object): # Add all new entries that haven't already been added query = 'INSERT INTO %s VALUES (?, ?, ?)' % link_table for entry_id in entry_ids: - self.cursor.execute(query, (entry_id, kodi_id, kodi_type)) + try: + self.cursor.execute(query, (entry_id, kodi_id, kodi_type)) + except IntegrityError: + LOG.info('IntegrityError: skipping entry %s for table %s', + entry_id, link_table) # Delete all outdated references in the link table. Also check whether # we need to delete orphaned entries in the master table query = ''' diff --git a/resources/lib/library_sync/fanart.py b/resources/lib/library_sync/fanart.py index 13c1e3f2..780db325 100644 --- a/resources/lib/library_sync/fanart.py +++ b/resources/lib/library_sync/fanart.py @@ -5,10 +5,12 @@ from Queue import Empty from xbmc import sleep -from utils import thread_methods +from utils import thread_methods, settings, language as lang, dialog import plexdb_functions as plexdb import itemtypes +from artwork import ArtworkSyncMessage import variables as v +import state ############################################################################### @@ -63,6 +65,24 @@ class ThreadedProcessFanart(Thread): sleep(200) continue + if isinstance(item, ArtworkSyncMessage): + if item.artwork_counter is not None: + if item.artwork_counter == 0: + # Done caching, show this in the PKC settings, too + settings('fanarttv_lookups', value=lang(30069)) + LOG.info('Done caching major images!') + else: + settings('fanarttv_lookups', + value=str(item.artwork_counter)) + if item.message and state.IMAGE_SYNC_NOTIFICATIONS: + dialog('notification', + heading=lang(29999), + message=item.message, + icon='{plex}', + sound=False) + queue.task_done() + continue + LOG.debug('Get additional fanart for Plex id %s', item['plex_id']) with getattr(itemtypes, v.ITEMTYPE_FROM_PLEXTYPE[item['plex_type']])() as item_type: diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index c15aac44..c6cfa10d 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -640,7 +640,6 @@ class LibrarySync(Thread): self.updatelist """ # Some logging, just in case. - LOG.debug("self.updatelist: %s", self.updatelist) item_number = len(self.updatelist) if item_number == 0: return @@ -1376,6 +1375,8 @@ class LibrarySync(Thread): missing_only=True False will start look-up for EVERY item refresh=False True will force refresh all external fanart """ + if settings('FanartTV') == 'false': + return with plexdb.Get_Plex_DB() as plex_db: if missing_only: with plexdb.Get_Plex_DB() as plex_db: @@ -1387,14 +1388,26 @@ class LibrarySync(Thread): items.extend(plex_db.itemsByType(plex_type)) LOG.info('Trying to get ALL additional fanart for %s items', len(items)) + if not items: + return # Shuffle the list to not always start out identically shuffle(items) - for item in items: + # Checking FanartTV for %s items + self.fanartqueue.put(artwork.ArtworkSyncMessage( + message=lang(30018) % len(items), artwork_counter=len(items))) + for i, item in enumerate(items): self.fanartqueue.put({ 'plex_id': item['plex_id'], 'plex_type': item['plex_type'], 'refresh': refresh }) + if (len(items) - i) % 10 == 0: + # Update the PKC settings for fanart.tv lookup + msg = artwork.ArtworkSyncMessage(artwork_counter=len(items) - i) + self.fanartqueue.put(msg) + # FanartTV lookup completed + self.fanartqueue.put(artwork.ArtworkSyncMessage(message=lang(30019), + artwork_counter=0)) def triage_lib_scans(self): """ @@ -1542,14 +1555,13 @@ class LibrarySync(Thread): initial_sync_done = True kodi_db_version_checked = True last_sync = utils.unix_timestamp() + self.sync_fanart() self.fanartthread.start() else: LOG.error('Initial start-up full sync unsuccessful') xbmc.executebuiltin('InhibitIdleShutdown(false)') window('plex_dbScan', clear=True) state.DB_SCAN = False - if settings('FanartTV') == 'true': - self.sync_fanart() elif not kodi_db_version_checked: # Install sync was already done, don't force-show dialogs @@ -1583,10 +1595,9 @@ class LibrarySync(Thread): if self.full_sync(): initial_sync_done = True last_sync = utils.unix_timestamp() - if settings('FanartTV') == 'true': - self.sync_fanart() LOG.info('Done initial sync on Kodi startup') artwork.Artwork().cache_major_artwork() + self.sync_fanart() self.fanartthread.start() else: LOG.info('Startup sync has not yet been successful') diff --git a/resources/lib/playback_starter.py b/resources/lib/playback_starter.py index f3723b46..86433bcd 100644 --- a/resources/lib/playback_starter.py +++ b/resources/lib/playback_starter.py @@ -24,7 +24,13 @@ class PlaybackStarter(Thread): """ @staticmethod def _triage(item): - _, params = item.split('?', 1) + try: + _, params = item.split('?', 1) + except ValueError: + # E.g. other add-ons scanning for Extras folder + LOG.debug('Detected 3rd party add-on call - ignoring') + pickle_me(Playback_Successful()) + return params = dict(parse_qsl(params)) mode = params.get('mode') resolve = False if params.get('handle') == '-1' else True diff --git a/resources/lib/plexbmchelper/subscribers.py b/resources/lib/plexbmchelper/subscribers.py index 17d8019a..aa8d2b19 100644 --- a/resources/lib/plexbmchelper/subscribers.py +++ b/resources/lib/plexbmchelper/subscribers.py @@ -119,7 +119,7 @@ class SubscriptionMgr(object): self.server = "" self.protocol = "http" self.port = "" - self.isplaying = False + self.location = 'navigation' # In order to be able to signal a stop at the end self.last_params = {} self.lastplayers = {} @@ -144,7 +144,7 @@ class SubscriptionMgr(object): Returns a timeline xml as str (xml containing video, audio, photo player state) """ - self.isplaying = False + self.location = 'navigation' answ = str(XML) timelines = { v.PLEX_PLAYLIST_TYPE_VIDEO: None, @@ -163,8 +163,8 @@ class SubscriptionMgr(object): v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]], typus) timelines[typus] = self._dict_to_xml(timeline) - location = 'fullScreenVideo' if self.isplaying else 'navigation' - timelines.update({'command_id': '{command_id}', 'location': location}) + timelines.update({'command_id': '{command_id}', + 'location': self.location}) return answ.format(**timelines) @staticmethod @@ -191,7 +191,8 @@ class SubscriptionMgr(object): 'type': ptype, 'state': 'stopped' } - self.isplaying = True + if ptype in (v.PLEX_PLAYLIST_TYPE_VIDEO, v.PLEX_PLAYLIST_TYPE_PHOTO): + self.location = 'fullScreenVideo' self.stop_sent_to_web = False pbmc_server = window('pms_server') if pbmc_server: @@ -202,7 +203,6 @@ class SubscriptionMgr(object): shuffle = '1' if info['shuffled'] else '0' mute = '1' if info['muted'] is True else '0' answ = { - 'location': 'fullScreenVideo', 'controllable': CONTROLLABLE[ptype], 'protocol': self.protocol, 'address': self.server, diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 6cadf80f..b993e909 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -435,7 +435,9 @@ def wipe_database(): cursor.execute("DELETE FROM %s" % table_name) connection.commit() cursor.close() - + # Reset the artwork sync status in the PKC settings + settings('caching_major_artwork', value=language(39310)) + settings('fanarttv_lookups', value=language(39310)) # reset the install run flag settings('SyncInstallRunDone', value="false") diff --git a/resources/settings.xml b/resources/settings.xml index d8e46400..9267b144 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -29,17 +29,16 @@ - + - + + - - @@ -57,26 +56,27 @@ - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + @@ -94,40 +94,45 @@ - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + - + + + + + - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + +