Skip to content

Commit

Permalink
Show notifications for My List (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister authored Oct 21, 2024
1 parent 7016816 commit f7668e7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
8 changes: 8 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ msgctxt "#30723"
msgid "The Widevine device file must have a '.wvd' extension."
msgstr ""

msgctxt "#30724"
msgid "{title} added to My List"
msgstr ""

msgctxt "#30725"
msgid "{title} removed from My List"
msgstr ""


### SETTINGS
msgctxt "#30800"
Expand Down
8 changes: 8 additions & 0 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ msgctxt "#30723"
msgid "The Widevine device file must have a '.wvd' extension."
msgstr "Het Widevine-apparaatbestand moet een '.wvd' extensie hebben."

msgctxt "#30724"
msgid "{title} added to My List"
msgstr "{title} toegevoegd aan Mijn Lijst"

msgctxt "#30725"
msgid "{title} removed from My List"
msgstr "{title} verwijderd uit Mijn Lijst"


### SETTINGS
msgctxt "#30800"
Expand Down
12 changes: 6 additions & 6 deletions resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ def show_mylist():
Catalog().show_mylist()


@routing.route('/mylist/add/<uuid>')
def mylist_add(uuid):
@routing.route('/mylist/add/<uuid>/<title>')
def mylist_add(uuid, title):
""" Add a program to My List """
from resources.lib.modules.catalog import Catalog
Catalog().mylist_add(uuid)
Catalog().mylist_add(uuid, title)


@routing.route('/mylist/del/<uuid>')
def mylist_del(uuid):
@routing.route('/mylist/del/<uuid>/<title>')
def mylist_del(uuid, title):
""" Remove a program from My List """
from resources.lib.modules.catalog import Catalog
Catalog().mylist_del(uuid)
Catalog().mylist_del(uuid, title)


@routing.route('/continue')
Expand Down
7 changes: 5 additions & 2 deletions resources/lib/modules/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import absolute_import, division, unicode_literals

import logging
from urllib.parse import unquote_plus

from resources.lib import kodiutils
from resources.lib.goplay.auth import AuthApi
Expand Down Expand Up @@ -180,24 +181,26 @@ def show_mylist(self):
# Used for A-Z listing or when movies and episodes are mixed.
kodiutils.show_listing(listing, 30011, content='tvshows', sort='title')

def mylist_add(self, uuid):
def mylist_add(self, uuid, title):
""" Add a program to My List """
if not uuid:
kodiutils.end_of_directory()
return

self._api.mylist_add(uuid)

kodiutils.notification(message=kodiutils.localize(30724, title=unquote_plus(title))) # We need to ensure forward slashes are quoted
kodiutils.end_of_directory()

def mylist_del(self, uuid):
def mylist_del(self, uuid, title):
""" Remove a program from My List """
if not uuid:
kodiutils.end_of_directory()
return

self._api.mylist_del(uuid)

kodiutils.notification(message=kodiutils.localize(30725, title=unquote_plus(title))) # We need to ensure forward slashes are quoted
kodiutils.end_of_directory()

def continue_watching(self, index=0):
Expand Down
10 changes: 3 additions & 7 deletions resources/lib/modules/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
from __future__ import absolute_import, division, unicode_literals

import logging
from urllib.parse import quote, quote_plus

from resources.lib import kodiutils
from resources.lib.goplay import STREAM_DICT
from resources.lib.goplay.content import Episode, Program
from resources.lib.kodiutils import TitleItem

try: # Python 3
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote

_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -147,13 +143,13 @@ def generate_titleitem(item):
context_menu.append((
kodiutils.localize(30101), # Remove from My List
'Container.Update(%s)' %
kodiutils.url_for('mylist_del', uuid=item.uuid)
kodiutils.url_for('mylist_del', uuid=item.uuid, title=quote_plus(item.title))
))
else:
context_menu.append((
kodiutils.localize(30100), # Add to My List
'Container.Update(%s)' %
kodiutils.url_for('mylist_add', uuid=item.uuid)
kodiutils.url_for('mylist_add', uuid=item.uuid, title=quote_plus(item.title))
))

context_menu.append((
Expand Down

0 comments on commit f7668e7

Please sign in to comment.