diff --git a/addon.xml b/addon.xml index 40abcca0a..7aafa5f66 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index bd9a94be7..c27c7e293 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +## v7.0.8+beta.4 +### Fixed +- Poll for http server restart when required for playback #746 #808 +- Fix unsubscribe from My Subscriptions #809 + ## v7.0.8+beta.3 ### Fixed - Additional fixes for redacting IP addresses in debug logs #801 diff --git a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py index ebf350601..b6ce38c7f 100644 --- a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py +++ b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py @@ -775,5 +775,15 @@ def tear_down(self): except AttributeError: pass - def wakeup(self): - self.send_notification(WAKEUP) + def wakeup(self, target): + self.send_notification(WAKEUP, target) + if not target: + return + pop_property = self.get_ui().pop_property + while 1: + awake = pop_property(WAKEUP) + if awake: + if awake != target: + self.log_error('Incorrect wakeup target') + break + wait(0.5) diff --git a/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py b/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py index 968ba3f78..cf4a377a5 100644 --- a/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py +++ b/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py @@ -87,30 +87,27 @@ def onNotification(self, sender, method, data): if event == CHECK_SETTINGS: if not isinstance(data, dict): data = json.loads(data) - log_debug('onNotification: |check_settings| -> |{data}|' - .format(data=data)) - if data == 'defer': self._settings_state = data - return - if data == 'process': + elif data == 'process': self._settings_state = data self.onSettingsChanged() self._settings_state = None - return elif event == WAKEUP: - self.interrupt = True + if not isinstance(data, dict): + data = json.loads(data) + if data: + self.set_property(WAKEUP, data) + if data == 'plugin': + self.interrupt = True + elif data == 'server': + if not self.httpd and self.httpd_required(): + self.start_httpd() elif event == REFRESH_CONTAINER: self.refresh_container() elif event == RELOAD_ACCESS_MANAGER: self._context.reload_access_manager() self.refresh_container() - elif event == PLAYBACK_INIT: - if not self.httpd and self.httpd_required(): - self.start_httpd() - else: - log_debug('onNotification: |unhandled method| -> |{method}|' - .format(method=method)) def onSettingsChanged(self): self._settings_changes += 1 diff --git a/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py b/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py index 257c3c7b3..08d33fcab 100644 --- a/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py +++ b/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py @@ -131,7 +131,7 @@ def run(self, provider, context, focused=None): ui.clear_property(PLAYLIST_POSITION) if ui.get_property(SLEEPING): - context.wakeup() + context.wakeup('plugin') if ui.get_property(REFRESH_CONTAINER): focused = False diff --git a/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py b/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py index 9164ea059..3145cf044 100644 --- a/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py +++ b/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py @@ -145,6 +145,15 @@ def get_property(property_id): property_id = '-'.join((ADDON_ID, property_id)) return xbmcgui.Window(10000).getProperty(property_id) + @staticmethod + def pop_property(property_id): + property_id = '-'.join((ADDON_ID, property_id)) + window = xbmcgui.Window(10000) + value = window.getProperty(property_id) + if value: + window.clearProperty(property_id) + return value + @staticmethod def clear_property(property_id): property_id = '-'.join((ADDON_ID, property_id)) diff --git a/resources/lib/youtube_plugin/youtube/helper/utils.py b/resources/lib/youtube_plugin/youtube/helper/utils.py index bcbb31960..5a3b1d442 100644 --- a/resources/lib/youtube_plugin/youtube/helper/utils.py +++ b/resources/lib/youtube_plugin/youtube/helper/utils.py @@ -643,7 +643,7 @@ def update_video_infos(provider, context, video_id_dict, # update channel mapping channel_id = snippet.get('channelId', '') - video_item.set_subscription_id(channel_id) + video_item.set_channel_id(channel_id) if channel_id and channel_items_dict is not None: if channel_id not in channel_items_dict: channel_items_dict[channel_id] = [] diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_play.py b/resources/lib/youtube_plugin/youtube/helper/yt_play.py index 48a5a5e09..ddd1a2f2e 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_play.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_play.py @@ -154,6 +154,7 @@ def play_video(provider, context): 'refresh_only': screensaver } + context.wakeup('server') ui.set_property(PLAYER_DATA, json.dumps(playback_data, ensure_ascii=False)) context.send_notification(PLAYBACK_INIT, playback_data) return video_item