• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions API endpoint to scan a single library

     
    • 0 Vote(s) - 0 Average

    API endpoint to scan a single library

    I-G-1-1
    Offline

    Junior Member

    Posts: 25
    Threads: 3
    Joined: 2023 Jun
    Reputation: 0
    #4
    2025-07-11, 03:13 PM (This post was last modified: 2025-07-12, 11:03 AM by I-G-1-1. Edited 1 time in total.)
    I know this post is old, but to trigger a single Library scan thanks to "url scheme" suggested by TheDreadPirate I solved writing this script:

    Code:
    #!/bin/sh

    # CHANGE THESE:
    JELLYFIN_SERVER="http://192.168.1.1:8096"
    API_KEY="<YOUR_API_KEY>"

    echo "Retrieving available libraries..."

    # Get the list of libraries from the Jellyfin server using the API key for authentication
    LIBRARIES=$(curl -s -H "X-Emby-Token: $API_KEY" "$JELLYFIN_SERVER/Library/VirtualFolders")

    # Extract the names of the libraries from the JSON response
    NAMES=$(echo "$LIBRARIES" | grep -o '"Name":"[^"]*"' | sed 's/"Name":"\(.*\)"/\1/')
    # Extract the IDs of the libraries from the JSON response
    IDS=$(echo "$LIBRARIES" | grep -o '"ItemId":"[^"]*"' | sed 's/"ItemId":"\(.*\)"/\1/')

    # Combine and print the name and ID of each library in a readable format
    paste <(echo "$NAMES") <(echo "$IDS") | while IFS=$'\t' read -r name id; do
      echo "Name: $name | ID: $id"
    done

    echo
    read -p "Enter the ID of the library to scan: " LIBRARY_ID

    if [[ -z "$LIBRARY_ID" ]]; then
      echo "Library ID not provided. Exiting."
      exit 1
    fi

    echo "Starting scan of library $LIBRARY_ID ..."
    # Send a POST request to trigger a scan/refresh of the specified library on the Jellyfin server
    curl -X POST "$JELLYFIN_SERVER/Items/$LIBRARY_ID/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&RegenerateTrickplay=false&ReplaceAllMetadata=false" \
      -H "Content-Type: application/json" \
      -H "X-Emby-Token: $API_KEY"

    echo
    echo "Scan started (check the Jellyfin dashboard for status)."

    exit 0
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    Messages In This Thread
    API endpoint to scan a single library - by alextruppel - 2025-02-12, 01:47 PM
    RE: API endpoint to scan a single library - by TheDreadPirate - 2025-02-12, 04:38 PM
    RE: API endpoint to scan a single library - by arjuan - 2025-03-31, 09:32 PM
    RE: API endpoint to scan a single library - by I-G-1-1 - 2025-07-11, 03:13 PM

    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode