35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# JELLYFIN PARTIAL SCAN script or JELLYFIN UPDATE script
|
|
# When Zurg detects changes, it can trigger this script IF your config.yml contains:
|
|
# on_library_update: sh jellyfin_update.sh "$@"
|
|
|
|
jellyfin_url="https://askar.tv" # Replace with your Jellyfin server URL (e.g., http://127.0.0.1:8096)
|
|
api_key="0571ee7fc7cb4a31afd30bad268caff6" # Generate a personal API key in Jellyfin via Dashboard > API Keys
|
|
zurg_mount="/mnt/zurg" # Replace with your Zurg mount path as seen by the host
|
|
jellyfin_mount="/data/rclone" # Replace with the equivalent path seen by Jellyfin
|
|
|
|
# Function to convert paths
|
|
convert_path() {
|
|
local host_path="$1"
|
|
echo "${host_path/$zurg_mount/$jellyfin_mount}"
|
|
}
|
|
|
|
# Process each argument passed to the script
|
|
for arg in "$@"
|
|
do
|
|
parsed_arg="${arg//\\}"
|
|
echo "Detected update on: $parsed_arg"
|
|
|
|
# Convert the path to match Jellyfin's view
|
|
modified_arg=$(convert_path "$zurg_mount/$parsed_arg")
|
|
echo "Absolute path for Jellyfin: $modified_arg"
|
|
|
|
# Send the update notification to Jellyfin
|
|
curl -X POST -H "X-Emby-Token: $api_key" -H "Content-Type: application/json" \
|
|
-d "{\"ItemPath\": \"$modified_arg\"}" \
|
|
"$jellyfin_url/Library/Media/Updated"
|
|
done
|
|
|
|
echo "All updated libraries refreshed"
|
|
|