jellyfin/test.sh
2025-06-05 16:12:21 +00:00

36 lines
No EOL
1 KiB
Bash
Executable file

#!/bin/bash
# Define the JSON file name
json_file="./plugin_manifests/2025.03.27/dkanada.json" # Let's test with dkanada.json first
# Define the search term
search_term="$1"
search_term_lower=$(echo "$search_term" | tr '[:upper:]' '[:lower:]')
# Check if a search term is provided
if [ -z "$search_term" ]; then
echo "Usage: $0 <search_term>"
exit 1
fi
# Use jq to search the specified fields and get the latest version
jq -r --arg term "$search_term_lower" '
def get_field($obj; $field):
if ($obj | has($field)) and ($obj[$field] | type == "string") then
$obj[$field] | ascii_downcase
else
""
end;
.[] | select(
(get_field(.; "category") | contains($term)) or
(get_field(.; "description") | contains($term)) or
(get_field(.; "name") | contains($term)) or
(get_field(.; "overview") | contains($term)) or
(get_field(.; "owner") | contains($term))
) |
{
name: .name,
latest_version: (.versions | sort_by(.timestamp) | last | {version, targetAbi})
}
' "$json_file"