Skip to content

Commit

Permalink
[limit_library_search_by_ffprobe_data] v0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 31, 2024
1 parent 5f7c5aa commit d9a8309
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
3 changes: 3 additions & 0 deletions source/limit_library_search_by_ffprobe_data/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

**<span style="color:#56adda">0.0.5</span>**
- Use a different jsonata library that provides better stability with this plugin

**<span style="color:#56adda">0.0.4</span>**
- Bump jsonata python dependency to v0.2.5

Expand Down
2 changes: 1 addition & 1 deletion source/limit_library_search_by_ffprobe_data/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"on_library_management_file_test": 0
},
"tags": "audio,video,ffmpeg",
"version": "0.0.4"
"version": "0.0.5"
}
15 changes: 8 additions & 7 deletions source/limit_library_search_by_ffprobe_data/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jsonata==0.2.5
jsonata-python==0.4.0

0 comments on commit d9a8309

Please sign in to comment.