Script Summary: Kino München - Link to movie trailer from Munich's official site http://www.muenchen.de/ and from Artechock's weekly cinema program http://www.artechock.de/.
What the script does
The website http://www.artechock.de/ presents the weekly cinema program for the city of Munich. Unfortunately, no links to movie trailers are available. These are provided by www.moviemaze.de, but the site does not contain information specific to Munich movie theatres.
This script appends a clickable 'filmstrip' icon next to each movie title of the movie program (in all its different views). Upon clicking on the icon, a new tab is opened in background with the movie review and trailer from moviemaze.de.
The city's official website http://www.muenchen.de/ embeds the artechock list into a subframe; the script also works in this case (from the left menu choose 'Kino München' and then 'Kino -> Programm nach Filmen/Kinos').
The script was born as a small application of Yahoo's YQL to Greasemonkey. Ideally, it should consist of very few lines, however it actually has to go through a number of hops to achieve its goal, for example:
- Search is only possible by the German title of the movie
- Artechock uses to append the name in original language to the movie title, which affects the search in moviemaze.de
- Yahoo!'s YQL engine does not like certain special characters in urls
- Moviemaze sometimes capitalizes words differently from Artechock, or substitutes ciphers by their spelled equivalent (e.g. 'Ten' for '10')
- Yahoo's YQL engine substitutes some html tags by other xthml equivalents, e.g.
<b>, or single spaces by a series of spaces and newlines
For this reason additional checks and manipulations are needed. In particular, the script retrieves the whole result set of a title search from moviemaze.de instead of just the link to the trailer, as was originally intended. This is done in order to be able to do some string manipulation which xpath is not capable of(as of yet).
The script makes its best at matching titles from Artechock with those from Moviemaze. If despite this efforts no match is found, the new tab opens with the search results for the selected title, so that the user can click on the trailer link if available. This happens luckily only in exceptional cases.