Skip to content

Commit

Permalink
Add "Go to program" context to Favorites (#437)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dagwieers authored Aug 13, 2019
1 parent bc799c8 commit 5eaed10
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions resources/lib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 5eaed10

Please sign in to comment.