Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[limit_library_search_by_ffprobe_data] v0.0.5 #428

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading