Skip to content

Commit

Permalink
Update favorites (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister authored Oct 4, 2024
1 parent 4761108 commit 3fb4ba2
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 156 deletions.
28 changes: 0 additions & 28 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,6 @@ msgctxt "#30413"
msgid "Refresh menu"
msgstr ""

msgctxt "#30415"
msgid "No followed programs found"
msgstr ""

msgctxt "#30416"
msgid "We could not find any programs that are followed.\n\nEither right-click on a program or episode to follow a program, or follow a program on the VRT MAX website."
msgstr ""

msgctxt "#30417"
msgid "Go to program"
msgstr ""
Expand Down Expand Up @@ -561,10 +553,6 @@ msgctxt "#30744"
msgid "When enabled, the user can follow their favorite programs and list these separately. In this case the VRT MAX add-on will download and update a list of your followed programs on the VRT MAX website."
msgstr ""

msgctxt "#30745"
msgid "Manage My favorites…"
msgstr ""

msgctxt "#30747"
msgid "Enable watching activity"
msgstr ""
Expand Down Expand Up @@ -845,14 +833,6 @@ msgctxt "#30915"
msgid "Clear VRT tokens"
msgstr ""

msgctxt "#30917"
msgid "Refresh favorites"
msgstr ""

msgctxt "#30919"
msgid "Refresh watching activity"
msgstr ""

msgctxt "#30921"
msgid "Use menu caching"
msgstr ""
Expand Down Expand Up @@ -1011,14 +991,6 @@ msgctxt "#30981"
msgid "Successfully invalidated caches."
msgstr ""

msgctxt "#30982"
msgid "Successfully refreshed favorites."
msgstr ""

msgctxt "#30983"
msgid "Successfully refreshed watching activity."
msgstr ""

msgctxt "#30985"
msgid "Successfully cleared VRT tokens."
msgstr ""
Expand Down
20 changes: 0 additions & 20 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,6 @@ msgctxt "#30413"
msgid "Refresh menu"
msgstr "Vernieuw menu"

msgctxt "#30415"
msgid "No followed programs found"
msgstr "Geen programma's worden gevolgd"

msgctxt "#30416"
msgid "We could not find any programs that are followed.\n\nEither right-click on a program or episode to follow a program, or follow a program on the VRT MAX website."
msgstr "We konden geen programma's vinden die je volgt.\n\nKlik met de rechtermuisknop op een programma of aflevering om een programma te volgen of volg een programma op de VRT MAX-website."

msgctxt "#30417"
msgid "Go to program"
msgstr "Ga naar programma"
Expand Down Expand Up @@ -561,10 +553,6 @@ msgctxt "#30744"
msgid "When enabled, the user can follow their favorite programs and list these separately. In this case the VRT MAX add-on will download and update a list of your followed programs on the VRT MAX website."
msgstr "Indien actief kan de gebruiker zijn favoriete programma's volgen en apart aanroepen. Dit zorgt er wel voor dat de VRT MAX add-on een lijst van favoriete programma's download en aanpast op de VRT MAX website."

msgctxt "#30745"
msgid "Manage My favorites…"
msgstr "Beheer Mijn favorieten…"

msgctxt "#30747"
msgid "Enable watching activity"
msgstr "Toon kijkactiviteit"
Expand Down Expand Up @@ -845,14 +833,6 @@ msgctxt "#30915"
msgid "Clear VRT tokens"
msgstr "Verwijder VRT-tokens"

msgctxt "#30917"
msgid "Refresh favorites"
msgstr "Ververs favoriete programma's"

msgctxt "#30919"
msgid "Refresh watching activity"
msgstr "Ververs kijkactiviteit"

msgctxt "#30921"
msgid "Use menu caching"
msgstr "Gebruik menu caching"
Expand Down
44 changes: 16 additions & 28 deletions resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
except ImportError: # Python 2
from urllib import unquote_plus

from kodiutils import end_of_directory, execute_builtin, get_global_setting, localize, log_access, notification, ok_dialog, refresh_caches
from kodiutils import container_refresh, end_of_directory, execute_builtin, get_global_setting, localize, log_access, notification, ok_dialog, refresh_caches
from utils import from_unicode, to_unicode

plugin = Plugin() # pylint: disable=invalid-name
Expand Down Expand Up @@ -43,21 +43,22 @@ def delete_tokens():
TokenResolver().delete_tokens()


@plugin.route('/follow/<program_name>/<title>')
@plugin.route('/follow/<program_name>/<program_id>/<title>')
def follow(program_name, title, program_id=None):
@plugin.route('/follow/<program_id>/<program_title>')
def follow(program_id, program_title):
"""The API interface to follow a program used by the context menu"""
from favorites import Favorites
Favorites().follow(program_name=program_name, title=to_unicode(unquote_plus(from_unicode(title))), program_id=program_id)
from api import set_favorite
set_favorite(program_id=program_id, program_title=to_unicode(unquote_plus(from_unicode(program_title))))
notification(message=localize(30411, title=program_title))
container_refresh()


@plugin.route('/unfollow/<program_name>/<title>')
@plugin.route('/unfollow/<program_name>/<program_id>/<title>')
def unfollow(program_name, title, program_id=None):
@plugin.route('/unfollow/<program_id>/<program_title>')
def unfollow(program_id, program_title):
"""The API interface to unfollow a program used by the context menu"""
move_down = bool(plugin.args.get('move_down'))
from favorites import Favorites
Favorites().unfollow(program_name=program_name, title=to_unicode(unquote_plus(from_unicode(title))), program_id=program_id, move_down=move_down)
from api import set_favorite
set_favorite(program_id=program_id, program_title=to_unicode(unquote_plus(from_unicode(program_title))), is_favorite=False)
notification(message=localize(30412, title=program_title))
container_refresh()


@plugin.route('/favorites')
Expand All @@ -72,7 +73,7 @@ def favorites_menu():
def favorites_programs(end_cursor=''):
"""The favorites 'My programs' listing"""
from vrtplayer import VRTPlayer
VRTPlayer().show_tvshow_menu(end_cursor=end_cursor, use_favorites=True)
VRTPlayer().show_favorites_tvshow_menu(end_cursor=end_cursor)


@plugin.route('/favorites/recent')
Expand All @@ -92,21 +93,6 @@ def favorites_offline(end_cursor=''):
VRTPlayer().show_offline_menu(end_cursor=end_cursor, use_favorites=True)


@plugin.route('/favorites/refresh')
def favorites_refresh():
"""The API interface to refresh the favorites cache"""
from favorites import Favorites
Favorites().refresh(ttl=0)
notification(message=localize(30982))


@plugin.route('/favorites/manage')
def favorites_manage():
"""The API interface to manage your favorites"""
from favorites import Favorites
Favorites().manage()


@plugin.route('/resumepoints/continue')
@plugin.route('/resumepoints/continue/<end_cursor>')
def resumepoints_continue(end_cursor=''):
Expand All @@ -120,13 +106,15 @@ def resumepoints_continue_delete(episode_id):
"""The API interface to delete episodes from continue watching listing"""
from api import delete_continue
delete_continue(episode_id)
container_refresh()


@plugin.route('/resumepoints/continue/finish/<episode_id>')
def resumepoints_continue_finish(episode_id):
"""The API interface to finish episodes from continue watching listing"""
from api import finish_continue
finish_continue(episode_id)
container_refresh()


@plugin.route('/programs/<program_name>')
Expand Down
Loading

0 comments on commit 3fb4ba2

Please sign in to comment.