Nimbin2git.christianimmanuel.de / Games / dvd / search.sh

dvd files

last change 2026-09-04 (2 hours ago)

wget https://git.christianimmanuel.de/games/dvd/archive/dvd.tar.gz
search.sh 853 B · 28 lines raw
#!/bin/bash

# Function to search for DVD by barcode (UPC) using wget
search_dvd_by_barcode() {
    local barcode="$1"
    local api_url="https://api.upcitemdb.com/prod/trial/lookup?upc=$barcode"
    local api_key="your_upcitemdb_api_key"  # Replace with your UPCItemDB API key

    # Send request to UPCItemDB API and capture the response
    response=$(wget -qO- --header="Authorization: Bearer $api_key" "$api_url")

    # Parse the JSON response using jq to extract titles
    titles=$(echo "$response" | jq -r '.items[]?.title')

    if [[ -z "$titles" ]]; then
        echo "No results found for barcode $barcode."
    else
        echo "Titles found for barcode $barcode:"
        echo "$titles"
    fi
}

# Example usage:
barcode="0123456789012"  # Replace with actual barcode
while true; do
    read code
    search_dvd_by_barcode "$code"
done