One of the things I have been wanting to have in my HTPC is instant access to a library of movie trailers that I can pick to view on-demand.
After spending time at the Apple Movie Trailers pages I noticed recently that they had made the entire collection available via iTunes. This immediately caught my attention because I already knew how iTunes communications worked and that it used XML. Well, XML had to be better than trying to spider a web page right?
So I grabbed iTunes and with my trusty network monitoring tools I went about tracing the requests and the XML data being returned. The XML is unfortunately designed to create a screen and not to communicate raw data (it sorely lacks meta information) but it is structured and that means XPATH queries can be used instead of ugly regular expressions that break a lot.
The result is my release of the Movie Trailer Import utility for Xlobby. You DO NOT need iTunes since I go directly to the backend.
The application will do the following:
- Connect to Apple and locate the list of movie studios
- For each movie studio, grab each page of trailers details
- For each trailer, download the cover art (if it does not exist)
- For each trailer, grab the URL for the small, medium or large QuickTime Movie
It will then update the database file and populate it with:
- Trailer Movie Title
- Cover Art (locally downloaded)
- Studio Name
- Genre(s)
- Actors
- Rating
- Direct URL to the QuickTime preview
This application takes four command line parameters, one for the xlobby trailers database (/db=) the directory to store the downloaded cover art (/covers=), a /newonly flag to limit the spidering to just the new trailers section and a /size flag to specify small, medium or large trailers.
For example:
MovieTrailers.exe /db=trailers.xml /covers=Covers
MovieTrailers.exe /db=trailers.xml /covers=Covers /newonly /size=large
If you do a full spider the result will be an xlobby database with about 700+ trailers in it. After that, using the /newonly should keep the database current.
I use Media Player Classic with Quicktime Alternative launched from Xlobby to actually play the trailer from the online location. This application does NOT download the actual trailer itself just the direct URL to it.
A WORD OF CAUTION: I doubt Apple will look kindly on the spidering of their iTunes data and the cover art is copyrighted. I cannot advise you or take any responsibility for the use of this application. Although I have tried to formulate flexible XPATH queries, the application may well break if Apple changes iTunes or the structure of their XML
If you agree with the above, you can download from here and enjoy!
Release log:
1.0 : Initial release
1.1 : Updated to include /newonly flag
1.2 : Fixed code bugs, added /size flag, included source code archive