fnichol/tapasd

By fnichol

Updated over 9 years ago

Image
0

132

tapasd

A concurrent Ruby Tapas episode downloader, curiously written in Go. tapasd is focused on fetching the movie files for local mirroring and loading onto tablets for viewing later offline.

Features:

  • Simple runtime dependencies--in other words, none
  • Architected as a twelve-factor app, therefore easy to deploy with Docker
  • Defaults to a process which rechecks the XML feed every 6 hours
  • Maintains no state except for the downloaded content

baby-gopher

Usage

Vanilla

To perform a download of all episodes in the feed to the current directory with 4 workers which re-checks every 6 hours, you only need to provide 2 things: a username and password for the DPD site:

tapasd -user=sally@example.com -pass=secret

If you'd prefer to perform the check-and-download once, then use the -oneshot flag:

tapasd -user=sally@example.com -pass=secret -oneshot

For more details on the other options and modes, run tapasd -h:

Usage of tapasd:
  -concurrency=4: data directory for downloads
  -data="/Users/fnichol/Projects/go/src/github.com/fnichol/tapasd": data directory for downloads
  -interval=21600: number of seconds to sleep between retrying
  -oneshot=false: check and download once, then quit
  -pass="[required]": pass for RubyTapas account (required)
  -user="[required]": user for RubyTapas account (required)
Docker

In our example, we'll use a data container pattern to persist the downloaded episodes between re-launching of tapasd services. First, we'll create a named container (tapasd_data) with a volume of /data:

docker run -v /data --name tapasd_data busybox true

Next, we'll launch a tapasd service, mounting in the shared volume from our tapasd_data container. For good measure, we'll also give this container a name of tapasd:

docker run -d --volumes-from tapasd_data --name tapasd fnichol/tapasd -user="user@example.com" -pass="secret"

Finally, if you want to check on its progress, simply follow the log output from the tapasd container:

docker logs -f tapasd

For a bonus, you can launch an interactive container with the data mounted in /data with:

docker run --rm -t -i --volumes-from tapasd_data busybox sh

Killing off the tapasd service is easy:

docker kill tapasd

If you wanted to re-start it at a later date:

docker start tapasd

And to remove the tapasd container:

docker rm tapasd

Again, your data is persisted in the volume associated with the tapasd_data container. To free up disk space by removing the data, simply:

docker rm tapasd_data

Installation

Source

Clone

mkdir -p $GOPATH/src/github.com/fnichol
cd $GOPATH/src/github.com/fnichol
git clone https://github.com/fnichol/tapasd.git

Build

cd $GOPATH/src/github.com/fnichol/tapasd
./build

This will generate a binary called ./bin/tapasd.

Docker

A Docker trusted build exists at fnichol/tapasd, and can be pulled down with:

docker pull fnichol/tapasd

Development

Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add support for feature')
  4. Push to the branch (git push origin my-new-feature)

Authors

Created and maintained by Fletcher Nichol (fnichol@nichol.ca).

License

MIT (see License.txt)

Docker Pull Command

docker pull fnichol/tapasd