diff --git a/addon.py b/addon.py index 1a4b461..3d24bfc 100644 --- a/addon.py +++ b/addon.py @@ -38,10 +38,9 @@ 'no_media_found': 30007, } - @plugin.route('/') def show_root(): - content_type = plugin.request.args.get('content_type') + content_type = __get_content_type() if not content_type: url = plugin.url_for(endpoint='show_content_types') return plugin.redirect(url) @@ -171,6 +170,16 @@ def search_result(content_type, search_string): return __add_podcasts(content_type, podcasts) +def __get_content_type(): + content_type = plugin.request.args.get('content_type') + if not content_type: + content_type = sys.argv[2].split("=") + if len(content_type) == 2: + content_type = content_type[1] + else: + content_type = None + return content_type + def __add_podcasts(content_type, podcasts): my_podcasts_ids = my_podcasts.get(content_type, {}).keys() items = []