diff --git a/resources/lib/constants.py b/resources/lib/constants.py index 300f1c9..5adec31 100644 --- a/resources/lib/constants.py +++ b/resources/lib/constants.py @@ -14,5 +14,7 @@ SEASONS='seasons', EPISODES='episodes', WATCHLATER='watchlater', - PLAYER='player' + PLAYER='player', + LOGOUT='logout', + PROFILE='profile' ) diff --git a/resources/lib/helpers/Render.py b/resources/lib/helpers/Render.py index 86017ae..a7800b2 100644 --- a/resources/lib/helpers/Render.py +++ b/resources/lib/helpers/Render.py @@ -17,7 +17,7 @@ def static(items: list)-> list: info = { "title": item["title"] } - url = '{0}?menu={1}'.format(_URL, item["id"]) + url = '{0}?route={1}'.format(_URL, item["id"]) list_item.setInfo('video', info) listing.append((url, list_item, True)) @@ -30,23 +30,23 @@ def videos(items: list)-> list: """ listing = [] for item in items: - url = '{0}?menu=player&id={1}'.format(_URL, item["id"]) + url = '{0}?route=player&id={1}'.format(_URL, item["id"]) list_item = ListItemExtra.video(url, item) listing.append((url, list_item, False)) return listing @staticmethod - def folders(items: list, menu: str = '')-> list: + def folders(items: list, route: str = '')-> list: """ Render folders fetched from Filmin API """ listing = [] for item in items: - if not menu: + if not route: if item['type'] == Types.folders[0]: - menu = 'seasons' - url = '{0}?menu={1}&id={2}'.format(_URL, menu, item["id"]) - if menu == 'episodes': + route = 'seasons' + url = '{0}?route={1}&id={2}'.format(_URL, route, item["id"]) + if route == 'episodes': # Add show id to URL url += '&item_id={0}'.format(_PARAMS['id']) list_item = ListItemExtra.folder(url, item) diff --git a/resources/lib/routes.py b/resources/lib/routes.py index ed2db90..13db225 100644 --- a/resources/lib/routes.py +++ b/resources/lib/routes.py @@ -75,15 +75,16 @@ def _player(item_id: int): play = Play(item_id) play.start() +@dispatcher.register(ROUTES.LOGOUT) +def _logout(): + from .session import startLogout + startLogout() + +@dispatcher.register(ROUTES.PROFILE) +def _profile(): + from .session import changeProfile + changeProfile(notify=True) + def dispatch(): - if _PARAMS.get('action'): - action = _PARAMS.get('action') - if action == 'logout': - from .session import startLogout - startLogout() - elif action == 'profile': - from .session import changeProfile - changeProfile(notify=True) - else: - mode = _PARAMS.get('menu', 'home') - dispatcher.run(mode) + route = _PARAMS.get('route', 'home') + dispatcher.run(route) diff --git a/resources/lib/views/Base.py b/resources/lib/views/Base.py index 848f913..fa4d47f 100644 --- a/resources/lib/views/Base.py +++ b/resources/lib/views/Base.py @@ -21,7 +21,7 @@ class Base: pages = False """ - True if is an static menu with predefined items + True if is an static route with predefined items """ static = False @@ -51,7 +51,7 @@ def show(self): Renders folder depending of config """ listing = [] - # Render static menu + # Render static route if self.static: listing = Render.static(self.items) else: diff --git a/resources/lib/views/MainMenu.py b/resources/lib/views/MainMenu.py index 6208490..306fb8a 100644 --- a/resources/lib/views/MainMenu.py +++ b/resources/lib/views/MainMenu.py @@ -3,7 +3,7 @@ class MainMenu(Base): """ - Main menu, default menu. Does not have a path string + Main menu, default route. Does not have a path string """ static = True items = [