diff --git a/source/limit_library_search_by_ffprobe_data/changelog.md b/source/limit_library_search_by_ffprobe_data/changelog.md index e35fc072e..5edcdf5d2 100644 --- a/source/limit_library_search_by_ffprobe_data/changelog.md +++ b/source/limit_library_search_by_ffprobe_data/changelog.md @@ -1,4 +1,7 @@ +**0.0.5** +- Use a different jsonata library that provides better stability with this plugin + **0.0.4** - Bump jsonata python dependency to v0.2.5 diff --git a/source/limit_library_search_by_ffprobe_data/info.json b/source/limit_library_search_by_ffprobe_data/info.json index 81b8f5335..f560d88b5 100644 --- a/source/limit_library_search_by_ffprobe_data/info.json +++ b/source/limit_library_search_by_ffprobe_data/info.json @@ -11,5 +11,5 @@ "on_library_management_file_test": 0 }, "tags": "audio,video,ffmpeg", - "version": "0.0.4" + "version": "0.0.5" } diff --git a/source/limit_library_search_by_ffprobe_data/plugin.py b/source/limit_library_search_by_ffprobe_data/plugin.py index 8af387969..c9b15d25f 100644 --- a/source/limit_library_search_by_ffprobe_data/plugin.py +++ b/source/limit_library_search_by_ffprobe_data/plugin.py @@ -83,19 +83,20 @@ def file_ends_in_allowed_values(probe_info, stream_field, allowed_values): return False try: - context = jsonata.Context() - discovered_values = context(stream_field, probe_info) + expr = jsonata.Jsonata(stream_field) + discovered_values = expr.evaluate(probe_info) + except KeyError as e: + logger.debug("Failed to match the JSONata query keys to in the FFprobe data of the file '%s'.", file_path) except ValueError as e: - logger.debug("Failed to match the JSONata query to in the FFprobe data of the file '%s'.", file_path) + logger.debug("Failed to match the JSONata query values to in the FFprobe data of the file '%s'.", file_path) #logger.debug("Exception:", exc_info=e) return False for allowed_value in allowed_values.split(','): # Ignore empty values (if plugin is configured with a trailing ',' - if allowed_value: - if allowed_value in discovered_values: - logger.debug("File '%s' contains one of the configured values '%s'.", file_path, allowed_value) - return True + if allowed_value and discovered_values and allowed_value in discovered_values: + logger.debug("File '%s' contains one of the configured values '%s'.", file_path, allowed_value) + return True # File is not in the allowed video values logger.debug("File '%s' does not contain one of the specified values '%s'.", file_path, allowed_values) diff --git a/source/limit_library_search_by_ffprobe_data/requirements.txt b/source/limit_library_search_by_ffprobe_data/requirements.txt index 9e6f0344a..f67861751 100644 --- a/source/limit_library_search_by_ffprobe_data/requirements.txt +++ b/source/limit_library_search_by_ffprobe_data/requirements.txt @@ -1 +1 @@ -jsonata==0.2.5 \ No newline at end of file +jsonata-python==0.4.0