Cinema Times - Odeon and Vue

Following my previous post, I've now got an extended script which not only grabs times for the Odeon, but also grabs times for Vue. The sources for the data would need to be changed for your local cinema - note that this relies on the way that these chains format their data and so would need modification outside the UK.

The Odeon section in particular isn't pretty, but it works!

[sourcecode language="bash"] #!/bin/sh

cd ~/geektool/

# This bit gets the times for the odeon in Guildford. It's a bit more complicated than for vue as it is screenscraping.

day=$(date +"%A")

echo "Odeon Guildford - Today's Film Times" > .cinemaworking echo " " >> .cinemaworking curl --silent http://www.odeon.co.uk/fanatic/film_times/s92 | sed -n '/<!-- FILMS -->/,$p' | tr -d '\n\r' | sed 's/<!-- END FILMS -->[[:print:]]*//g' | sed 's/</\ </g' | sed 's/Film information, ratings &amp; guest reviews of &quot;\([[:print:]]*\)&quot;/SAVEMETITLEOFFILM \1SAVEME/g' | sed 's/Classification: \([[:print:]]*\)"\/>/SAVEMEClassification: (\1)INSERTNEWLINESAVEME/g' | sed 's/on \('${day}'\)[[:print:]]*">\([0-9][0-9]:[0-9][0-9]\)/SAVEME\2SAVEME/g' | grep 'SAVEME' | sed 's/SAVEME\([[:print:]]*\)SAVEME/\ SAVEME\1\ /g' | grep 'SAVEME' | sed 's/SAVEME//g' | sed 's/\([0-9][0-9]:[0-9][0-9]\)/\1, /g' | tr -d '\n\r' | sed 's/TITLEOFFILM /\ /g' | sed 's/Classification://g' | grep '[0-9][0-9]:[0-9][0-9]' | sed "s/&#039;/'/g" | sed 's/$/\ /g' | sed 's/INSERTNEWLINE/\ /g' >> .cinemaworking

# This bit grabs the vue times

# break out the title from the text and fix the classification which had a big space in it - then break out the times - discard everything else - using the 'saveme' tag I added # then use tr to put everything on one line, and use title to put each film on it's own line.

curl --silent http://rss.myvue.net/getfeed.aspx?cinema=77 | sed 's/<title>/\ \ SAVEME<title>/g' | sed 's/<\/title>/<\/title>\ \ /g' | sed 's/<pubDate>[[:print:]]*<\/pubDate>//g' | sed 's/[[:space:]]*)/)/g' | sed 's/\([0-9][0-9]:[0-9][0-9]\)/\ SAVEME\1, \ /g' | grep 'SAVEME' | sed 's/SAVEME//g' | tr -d '\n\r' | sed 's/<title>/\ \ /g' | sed 's/<\/title>/\ /g' >> .cinemaworking

cat .cinemaworking | sed '/./,/^$/!d' | sed 's/, $//g' [/sourcecode]

Geektool runs this script every 90 minutes or so, and embeds the result into my desktop.

This is the result:

Odeon Guildford - Today's Film Times

3D Avatar (12A)
15:45, 16:30, 19:15, 20:15, 

Alvin and the Chipmunks 2: The Squeakquel (U)
14:45, 15:30, 17:00, 15:30, 

Daybreakers (15)
15:15, 19:00, 21:30, 

Did You Hear About The Morgans? (PG)
15:30, 18:15, 21:15, 15:30, 18:15, 21:15, 

It's Complicated (15)
15:00, 17:45, 20:45, 

Nine (12A)
17:30, 20:30, 

Sherlock Holmes (12A)
13:45, 16:45, 18:00, 20:00, 21:00, 

The Road (15)
16:00, 18:30, 21:15, 

Vue Camberley - Todays Film Times

Alvin and the Chipmunks: The Squeakquel (U)
15:45, 18:15, 

Avatar 3D (12A)
16:00, 17:00, 19:30, 20:30, 23:50, 

Daybreakers (15)
13:45, 16:10, 18:30, 21:15, 23:00, 23:50, 

Did You Hear About the Morgans? (PG)
14:35, 16:50, 19:40, 22:50, 

It's Complicated (15)
15:15, 18:00, 21:00, 23:40, 

Nine (12A)
20:00, 22:35, 

Sherlock Holmes (12A)
16:30, 19:50, 20:45, 22:40, 23:30, 

St. Trinian's 2 - The Legend of Fritton's Gold (PG)
15:10, 17:30, 

The Road (15)
15:00, 17:45, 20:15, 23:00, 

This is embedded into my desktop using geektool, along with lots of other information which I need from time to time.

My desktop