2012-12-14, 02:24
I created a little script to get smartplaylists for the award season.
This script downloads the list of nominations from IMDB (e.g. Golden Globe Awards) and checks for matching movies in your XBMC-databse.
http://www.imdb.com/oscars/nominations/golden-globes
http://www.imdb.com/oscars/nominations/s...tors-guild
http://www.imdb.com/oscars/nominations/baftas
Since there is no better way yet (see: http://forum.xbmc.org/showthread.php?tid=142141) it uses the localized movie titles of your XBMC-database.
Therefore you need to run the script every time you add a nominated movie to your database.
The purpose of this script is a filter to see what movies you still n0edt to watch for a specific award show.
Feel free to improve the script.
This script downloads the list of nominations from IMDB (e.g. Golden Globe Awards) and checks for matching movies in your XBMC-databse.
http://www.imdb.com/oscars/nominations/golden-globes
http://www.imdb.com/oscars/nominations/s...tors-guild
http://www.imdb.com/oscars/nominations/baftas
Since there is no better way yet (see: http://forum.xbmc.org/showthread.php?tid=142141) it uses the localized movie titles of your XBMC-database.
Therefore you need to run the script every time you add a nominated movie to your database.
The purpose of this script is a filter to see what movies you still n0edt to watch for a specific award show.
Feel free to improve the script.
Code:
#!/bin/sh
#################################################################################################################
#
# by GodzillaXP
# 2012-12-14
#
# This script creates a smartplaylist from a list of award-nominees from IMDB.
# Sorted by number of nominations (ascending).
#
# It parses the IMDB-ID from the webpage, looks them up in your own XBMC-movie-databse
# and uses the localized titles of the movies to create the smartplaylist.
# This is necessary, because some titles wont math in some languages.
#.
# Since your databse grows by the time (movies get added) you need to recreate the playlist every now and then.
# Only movies wich are present in your databse get added to the playlist.
#
# Requirements:
# - copy your MyVideoXX.db to the same directory this script is located
# see: http://wiki.xbmc.org/index.php?title=XBMC_databases#The_Video_Library
# - install "sqlite3"
#
#################################################################################################################
####
# define some values
####
# MyVideo-database from XBMC
DBFILE="MyVideos60.db"
# filename of playlist
PLAYLISTFILE="nominees_globe_2013_movies.xsp"
# title of playlist
PLAYLISTNAME="Golden Globe Nominees (2013)"
# URL to IMDB-Nominee-List
NOMINEEURL="http://www.imdb.com/oscars/nominations/golden-globes"
# temp-file for IMDB-Nominee-List
NOMINEEHTML="nominees.html"
# temp-file for IMDB-Nominee-List
IDSTEMP="ids.temp"
####
# Downloading list of nominees from imdb.com
####
echo -e "Downloading list of nominees from imdb.com ..."
wget $NOMINEEURL -O $NOMINEEHTML -q
####
# Printing header to playlist
####
echo -e "Printing header to playlist ..."
echo -e "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>" > $PLAYLISTFILE
echo -e "<!-- This Smartplaylist was created by \"nominees2playlist.sh\" at `date +%F\ %T` -->" >> $PLAYLISTFILE
echo -e "<smartplaylist type=\"movies\">" >> $PLAYLISTFILE
echo -e " <name>$PLAYLISTNAME</name>" >> $PLAYLISTFILE
echo -e " <match>one</match>" >> $PLAYLISTFILE
####
# Getting movietitles and printing them to playlist
####
echo -e "Getting movietitles and printing them to playlist ..."
cat $NOMINEEHTML | grep -i "class=\"nominee" | grep -i "/title/tt" | sed 's/<\/div>/\n/g' | grep -v '^$' | sed 's#.*/title/##' | sed 's#/.*##' | sort | uniq -c | sort | awk '{print $2}' > $IDSTEMP
cat $IDSTEMP | awk '{print "sqlite3 MyVideos60.db \"SELECT c00 FROM movieview WHERE c09 IS '\''"$1"'\''\""}' | sh \
| awk '{print " <rule field=\"title\" operator=\"is\">"$0"</rule>"}' >> $PLAYLISTFILE
####
# Printing footer to playlist
####
echo -e "Printing footer to playlist ..."
echo -e "</smartplaylist>" >> $PLAYLISTFILE
####
# Deleting temp-files
####
echo -e "Deleting temp-files ..."
#rm $NOMINEEHTML
#rm $IDSTEMP
echo -e "\nNow copy \"$PLAYLISTFILE\" to your userdata-directory.\nSee: http://wiki.xbmc.org/index.php?title=Userdata"
echo -e "The End."
exit 0