Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # magnetify - dress up a magnet hash so you can make it clickable or use it in a torrent client
- # that supports magnet links, like tranmission (www.transmissionbt.com/).
- #
- # HEY!: why can't you just add the magnet hash directly into the torrent client?
- #
- # Language: sh
- # Author: Burton Samograd <burton@samograd.ca>
- # License: GPL3 or higher if applicable
- # Copyleft 2014
- # The idiom ${x?"error message"} will test to see if the variable is set, and print the
- # message "error message" and exit the shell (returning an error code) if it isn't.
- #
- # $1 is the first command line argument given to the script, followed by $2, $3...
- # It's good to put these $n variables into names at the top of the script so you
- # don't lose track of them. Good variable names are very im-por-tant.
- #
- # To get all arguments usefully use "$@" (don't ask), but if you don't have spaces
- # in your filenames (I mean, who does that these days?) you can use the old skool $*
- #
- hash=${1?"usage: magnetify <torrent magnet link hash>"}
- echo "magnet:?xt=urn:btih:$hash"
- exit 0 # return success, but don't dot (.) this or you'll kill your shell
- # tested with 71b4bcd801233939144ebf24ecf33d0fbdb6f317, #worksforme
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement