Warning: mysqli_query(): (HY000/1712): Index wp_posts is corrupted in /home/thermopyle/blog.contriving.net/wp-includes/wp-db.php on line 1821
Apple | Contriving

Tag Archives: Apple

Apple Trailer Downloader

This isn’t currently working because of changes to Apple’s site. I hope to fix it before the end of the year.

I wanted all the movie trailers from Apple in the highest resolution available (1080p for most of them), so I wrote this script in python to fetch them all.

Usage

Update: I wasn’t very clear about this before. ATD keeps a database of what it’s already downloaded, so each time you run it, it will just download everything you haven’t downloaded yet.

This works through the command line in a very simple manner.

I’ll start out with some examples and then provide a full option list.

The following example will download 500 megabytes worth of trailers and save them to C:\Trailers.

atd -l 500 -d "C:\Trailers"

The next example will do the same and also append “-trailer” to the filename and change the extension to “.hdmov”.

atd -l 500 -d "C:\Trailers" -a "-trailer" -e "hdmov"

If there is a certain trailer you would like atd to download again (say you deleted the trailer on accident), you can call it as follows. The one downside to this method is that all this does is tell ATD to not skip this trailer when processing the trailer list. If it doesn’t make it to the movie because you’ve used the download limit option it won’t download it again. Changing this behavior is on my todo list.

atd --redown "Iron Man 2"

If you want the maximum resolution it downloads to be 480p you do it like so:

atd --respref "480p"

To get help you do this:

atd -h

Which will ouput:

Usage: atd [options]

If no options passed, it will download all not already downloaded trailers to a
subdir called Trailers.

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -l MB, --downlimit=MB
                        Approxmiate megabytes to download per session
                        (default: 0)
  -d DIR, --dest=DIR    Destination directory. (default: Trailers)
  -a TEXT, --append=TEXT
                        Appends the specified text to the filename. (default:
                        -trailer)
  -r, --rename          Rename trailer with movies name.
  -e EXTENSION, --ext=EXTENSION
                        Changes file extension to what is specified
  --redown=movie name   Redownloads the trailer for the specified movie.  Ex:
                        --redown Iron Man 2
  --flush               WARNING: This option deletes your download history
                        which means that all trailers will be downloaded again
  --respref=RESPREF     Get specified resolution or less.  Options are
                        ['1080p', '720p', '480p', '640w', '480']
  --reslimit=RESLIMIT   Get specified resolution or dont get trailer at all
  --mdate=DATE          Only get trailers for movies with a release date after
                        this. (format: YYYY-MM-DD)
  --tdate=DATE          Only get trailers released after this date. (format:
                        YYYY-MM-DD)
  --fake                Don't download, just print list of movies it would
                        download trailers for with the specified commandline.
                        (Ignores download limit)
  --htenfo              Writes an nfo file for use with the Home Theater
                        Experience XBMC script.
  --imdb                Fetches missing information like MPAA rating from
                        IMDB.  (Slows down parsing)

Please report any bugs or feature requests you may have. This script is dependent upon how Apple presents it’s trailers on the web. If they change the correct (or incorrect depending on how you look at it) things this script will break. I’ll do my best to keep up with such changes.

Newest Version

Version 0.2.2 is here.

Source

ATD is now on github.

Older versions

Version 0.2.1 is here.

Version 0.2 for Windows users is here.
Version 0.2 for Linux users or users interested in the source can get it here.

Version 0.1 for Windows users is here.
Version 0.1 for Linux users or users interested in the source can get the source code here.

Planned Features

Rolling updates

With this feature, ATD will be able to keep a folder full of only trailers for movies past a certain date (for example, only trailers for movies that haven’t been released yet).  It will remove trailers for movies before the date and add/dl trailers for movies with new trailers.

Known Bugs

  • With --imdb, ATD fetches info for all trailers even if because of other options like --downlimit we’ve limited the number of trailers that will download.
  • Funkiness with --redown.
  • Unicode handling is currently a hackjob.