HammerFlicks [Sun, 27 Nov 2011 17:00:27 +0000]
As of early 2015, the HammerFlicks application is no longer working due to the end of Netflix's public API. For more information on the death of HammerFlicks, click here [http://blog.humaneguitarist.org/2015/04/27/caffeinato-decapitato-the-end-of-hammerflicks/].
Table of Contents
Introduction Source Code How it Works Live Demo FAQ
HammerFlicks is a small project to discover which Hammer Films [http://www.hammerfilms.com/] movies are available as streaming movies on Netflix [http://www.netflix.com]. You can see it live here [http://blog.humaneguitarist.org/uploads/HammerFlicks/currentVersion/HammerFlicks.php]. As of November, 2011 HammerFlicks script runs thrice a day, querying the Netflix API as to which Hammer Films are available for streaming. HammerFlicks checks for films (not shorts) listed in the Hammer Filmography [http://en.wikipedia.org/wiki/Hammer_filmography] on Wikipedia. The previous name of the project was "HammerFlix" though this was changed to comply with the Netflix API branding requirements [http://developer.netflix.com/docs/Branding]. If you're interested in learning why this project exists, please read the original "HammerFlix" entry here [http://blog.humaneguitarist.org/2011/02/27/hammerflix/].
You can download the source code for HammerFlicks here [http://blog.humaneguitarist.org/uploads/HammerFlicks/HammerFlicks_1.0.zip].
How it Works
HammerFlicks sends each movie title from HammerFlicks_filmography.txt [http://blog.humaneguitarist.org/uploads/HammerFlicks/currentVersion/HammerFlicks_filmography.txt] (derived from the Wikipedia filmography) to the Netflix API and requests only one result back per movie. It assumes that if the production year for the returned result is within one year of the date listed in the filmography file that the result is most likely the Hammer Film in question. If the production year reported by Netflix doesn't match the +/- one year range, then it is assumed that Netflix doesn't carry the movie in either DVD or streaming formats - i.e. the returned result was for the closest match within the Netflix catalog, though for a completely different film. Cross-reference links are also created by HammerFlicks given that many earlier Hammer Films were released under different titles (UK and US versions). As seen below, the filmography file contains a non-unique "movie_id" field which is used to associate a title with its corresponding alternate title. In the example below, "The Public Life of Henry the Ninth" has no alternate title, but "The Mystery of the Marie Celeste" and "The Phantom Ship" are notated as the same film as they both share the same movie_id. As such, HammerFlicks will create a cross-reference link between the two.
title year titles_and_year movie_id
The Public Life of Henry The Ninth 1935 The Public Life of Henry The Ninth 1935 1
The Mystery of the Marie Celeste 1935 The Mystery of the Marie Celeste / The Phantom Ship 1935 2
The Phantom Ship 1935 The Mystery of the Marie Celeste / The Phantom Ship 1935 2
When HammerFlicks has determined whether or not the film likely lives on Netflix, it creates an HTML "snippet" inside the ./apiResults [http://blog.humaneguitarist.org/uploads/HammerFlicks/currentVersion/apiResults/] folder with any applicable cross-reference links. Applicable hyperlinks to the Netflix page for the film as well as the Watch Instantly link are also placed within the snippet.
The PHP similar_text [http://php.net/manual/en/function.similar-text.php] function is used to assign a "match score" within each snippet if it believes Netflix carries the film. This helps determine the reliability of HammerFlicks given that occasionally an incorrect match is generated if the result returned was for a completely differently movie that happens to fall within the correct date range. Comparing the sent title with the one returned by Netflix helps address this issue.
Finally, the HammerFlicks.php [http://blog.humaneguitarist.org/uploads/HammerFlicks/currentVersion/HammerFlicks.php] file strings all the snippets together, allowing a user to traverse the list of Hammer Films and see which ones are on Netflix or not.
You can see HammerFlicks in the frame below or you can go directly to the page by clicking here [http://blog.humaneguitarist.org/uploads/HammerFlicks/currentVersion/HammerFlicks.php]. I recommend the latter otherwise if you click on a link the Netflix page will open in the frame below as well.
1. I don't care for Hammer Films, but would like to do something similar for a list of other films. Can the source code be easily modified for this purpose?
+ I don't see why not. You probably only need to edit the "HammerFlicks_filmography.txt" file to reflect the films you are interested in. Editing the CSS file and logo would also be necessary for aesthetic reasons though they have no effect on functionality. Of course, you'll need to register [http://developer.netflix.com/member/register] for your own API key.
+ Note that HammerFlicks is only designed to support cross-referencing films with no more than one alternate title. This may or may not be an issue depending on the films you are interested in checking.