diff --git a/CHANGELOG.md b/CHANGELOG.md index c2357f4..95e2e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +* [v1.34.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.34.0): + * Add movie results max size filter + * [v1.33.1](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.33.1): * Fix py3 issue diff --git a/a4kStreaming/explorer.py b/a4kStreaming/explorer.py index ccfde20..0ca8f25 100644 --- a/a4kStreaming/explorer.py +++ b/a4kStreaming/explorer.py @@ -2300,7 +2300,7 @@ def sorter(): results_keys = sorted(results_keys, key=sorter()) - max_quality = int(core.kodi.get_setting('general.max_quality')) + 1 + max_quality = core.kodi.get_int_setting('general.max_quality') + 1 quality_list = ['4K', '1080P', '720P', 'SD'] excluded_quality = quality_list[:len(quality_list) - max_quality] if len(excluded_quality) > 0: @@ -2310,6 +2310,14 @@ def sorter(): else: core.kodi.notification('No results for specified quality. Showing all results.') + if provider_params.title.mediatype == 'movie': + max_movie_size = core.kodi.get_int_setting('general.max_movie_size') + results_keys_filtered = [key for key in results_keys if results[key]['size'] <= max_movie_size] + if len(results_keys_filtered) > 0: + results_keys = results_keys_filtered + else: + core.kodi.notification('No results for specified movie size. Showing all results.') + result_style = '[LIGHT]%s[/LIGHT]' autoplay = core.kodi.get_bool_setting('general.autoplay') and not params.force_sourceselect diff --git a/a4kStreaming/provider.py b/a4kStreaming/provider.py index d754eb6..473eda1 100644 --- a/a4kStreaming/provider.py +++ b/a4kStreaming/provider.py @@ -165,15 +165,17 @@ def __search(core, params): use_recommended = core.kodi.get_bool_setting('provider.use_recommended') recommended = core.utils.recommended - try: - source = core.importlib.import_module(__sources_module_name(core) + ('.%s' % recommended.lower())) - sources[recommended] = source.sources() - except: pass + + if use_recommended: + try: + source = core.importlib.import_module(__sources_module_name(core) + ('.%s' % recommended.lower())) + sources[recommended] = source.sources() + except: pass if len(sources) == 0 or not use_recommended: use_recommended = False for key in provider: - if not provider[key] or key == recommended: + if not provider[key] or sources.get(key, None): continue try: diff --git a/addon.xml b/addon.xml index b123b89..4b9b507 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ @@ -32,6 +32,9 @@ Designed for low-end devices and Estuary skin. screenshot-06.jpg +[v1.34.0]: + * Add movie results max size filter + [v1.33.1]: * Fix py3 issue diff --git a/packages/addons.xml b/packages/addons.xml index 00060e7..be645c9 100644 --- a/packages/addons.xml +++ b/packages/addons.xml @@ -4,7 +4,7 @@ @@ -35,6 +35,9 @@ Designed for low-end devices and Estuary skin. screenshot-06.jpg +[v1.34.0]: + * Add movie results max size filter + [v1.33.1]: * Fix py3 issue diff --git a/packages/addons.xml.crc b/packages/addons.xml.crc index 6d078f5..d7f0e3f 100644 --- a/packages/addons.xml.crc +++ b/packages/addons.xml.crc @@ -1 +1 @@ -059eeb95c9894b50e059aa26893d6f08d2669a22 \ No newline at end of file +0133a8a6f1b2c51403ffc52ed28ffa88819d2fa0 \ No newline at end of file diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 2c9beeb..78c90df 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -60,6 +60,10 @@ msgctxt "#33107" msgid "Episode title template" msgstr "" +msgctxt "#33108" +msgid "Max movie size (GB)" +msgstr "" + # Season Title Templates msgctxt "#33111" msgid "Season 1 (2020) - 10 Episodes" diff --git a/resources/settings.xml b/resources/settings.xml index 296f8c6..24f7857 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -3,6 +3,7 @@ + diff --git a/tests/test_suite.py b/tests/test_suite.py index 2508590..5f0fa3a 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -62,6 +62,7 @@ def __invoke(a4kstreaming_api, action, params={}, settings={}, prerun=None, remo 'general.lists_page_size': '29', 'general.season_title_template': '0', 'general.episode_title_template': '0', + 'general.max_movie_size': '200', 'views.menu': '0', 'views.titles': '0', 'views.seasons': '0',