From 5eaed10e36179a3e8384732b63191e6c4018627c Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 14 Aug 2019 01:00:28 +0200 Subject: [PATCH] Add "Go to program" context to Favorites (#437) This PR includes: - Add the "Go to program" context menu to My recent items and My soon offline - Move "Follow program" and "Go to program" together --- resources/lib/metadata.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/lib/metadata.py b/resources/lib/metadata.py index ed493ed2..2aaf4aee 100644 --- a/resources/lib/metadata.py +++ b/resources/lib/metadata.py @@ -77,20 +77,21 @@ def get_context_menu(self, api_data, program, cache_file): if follow_enabled: program_title = quote_plus(statichelper.from_unicode(program_title)) # We need to ensure forward slashes are quoted if self._favorites.is_favorite(program): + # Unfollow context menu context_menu.append(( - self._kodi.localize(30412) + follow_suffix, # Unfollow + self._kodi.localize(30412) + follow_suffix, 'RunPlugin(%s)' % self._kodi.url_for('unfollow', program=program, title=program_title) )) favorite_marker = '[COLOR yellow]ᵛ[/COLOR]' else: + # Follow context menu context_menu.append(( - self._kodi.localize(30411) + follow_suffix, # Follow + self._kodi.localize(30411) + follow_suffix, 'RunPlugin(%s)' % self._kodi.url_for('follow', program=program, title=program_title) )) - context_menu.append((self._kodi.localize(30413), 'RunPlugin(%s)' % self._kodi.url_for('delete_cache', cache_file=cache_file))) # Go to program context menu - if cache_file and cache_file.startswith(('offline', 'recent')): + if cache_file and cache_file.startswith(('my-offline', 'my-recent', 'offline', 'recent')): season = self.get_season(api_data) if season: plugin_url = self._kodi.url_for('programs', program=program, season=season) @@ -99,6 +100,9 @@ def get_context_menu(self, api_data, program, cache_file): # NOTE: ActivateWindow doesn't handle urls without trailing slash right context_menu.append((self._kodi.localize(30417), 'ActivateWindow(Videos,%s,return)' % plugin_url)) + # Refresh context menu + context_menu.append((self._kodi.localize(30413), 'RunPlugin(%s)' % self._kodi.url_for('delete_cache', cache_file=cache_file))) + return context_menu, favorite_marker def get_tvshowtitle(self, api_data):