Force Trailer Update/Scrape?
#1
Hi all,

I've got a ton of movies, but I'd like to add the Trailer into XBMC's DB. Is there a way (manual if required) to update just the trailer link for each movie without rescraping the entire library?

Thanks.
Reply
#2
Well, I just rolled my own for anyone interested. You'll need a TMDB API key of your own or from another app.

Be sure to update that key and the location of your DB. Also check that c09 and c19 are the right columns in your DB file.

Code:
#!/bin/bash

function geturl {
        imdbid=${1}
        youtubeid=""
        xbmcurl=""
        tmdbid=`wget -qO- http://api.themoviedb.org/2.1/Movie.imdbLookup/en/xml/<----APIKEY---->/${imdbid} | grep "<id>" | awk '{print $1}' | sed 's/<id>//g' | sed 's/<\/id>//g'`
        youtubeurl=`wget -qO- http://api.themoviedb.org/2.1/Movie.getInfo/en/xml/<----APIKEY---->/${tmdbid} | grep "<trailer>" | awk '{print $1}' | sed 's/<trailer>//g' | sed 's/<\/trailer>//g'`
        if [[ -n "$youtubeurl" ]]; then
                youtubeid=`echo $youtubeurl | sed 's/^.\+\(\/\|\&\|\?\)v=\([^\&]*\).*/\2/'`
                xbmcurl="plugin://plugin.video.youtube/?action=play_video&videoid=${youtubeid}"
        fi
        echo $xbmcurl
}

for id in `echo "select c09 from movie where c19 = '';" |sqlite3 /mnt/storage/MyVideos75.db`; do
        url=`geturl $id`
        sql="update movie set c19='${url}' where c09='${id}';"
        echo $sql
        echo $sql | sqlite3 /mnt/storage/MyVideos75.db
        sleep 2
done
Reply

Logout Mark Read Team Forum Stats Members Help
Force Trailer Update/Scrape?0