Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # to use with WinSCP
- # screen -d -m imdb !&
- for f in "$@"; do
- SOURCE=$f
- if [ "${SOURCE##*.}" = "mkv" ]; then
- # get name from file #
- MOVIENAME=$(echo $SOURCE | tr -s '.' ' ' | sed -e 's/\(.*\)\([0-9][0-9][0-9][0-9]\)\( .*$\)/\1\2/')
- # get IMDb ID from duckduckgo #
- IMDbID=$(lynx -dump -nonumbers -nolist "https://duckduckgo.com/?q=$MOVIENAME imdb" | sed -n '/imdb.com/{p;q;}' | cut -d "/" -f3)
- # Scrape IMDb with OMDb API #
- curl http://www.omdbapi.com/?i=$IMDbID | sed 's/\",\"/\n/g' | sed 's/\":\"/: /g' | sed 's/{\"//g' | sed -nr '/Title:|Year:|Genre:|imdbRating:|imdbVotes:|Actors:|Director:/p' >> "imdb.nfo"
- echo -e "URL: www.imdb.com/title/$IMDbID\n\n" >> "imdb.nfo"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment