keroserene / rickrollrc

Rick Astley invades your terminal.
1.38k stars 157 forks source link

Cache the audio and video #17

Open tpenguinltg opened 8 years ago

tpenguinltg commented 8 years ago

Warning: This was only tested on Linux.

On Linux, the cached copies are stored in $XDG_CACHE_HOME (or its default, ~/.cache) according to the XDG specification. On Mac, the cache dir is ~/Library/Caches. On Windows, the cache dir remains /tmp. In all cases, a new subfolder under the cache dir named "astley" is made and the files are stored there.

The integrity of the cached copies is verified using MD5 hashes.

Mac has md5 and Linux and Cygwin should have md5sum as part of coreutils. This catches the case where the file was only partially downloaded, and if so, it will refetch the file.

Resolves #14

tpenguinltg commented 8 years ago

Re-fetching could be avoided if curl's -C flag or wget's -c flag were used, but I don't know how to do that if we're piping the data to stdout.