- #!/bin/sh
- # Original source:
- # <http://blog.gonzih.me/blog/2012/02/17/how-to-use-magnet-links-with-rtorrent/>.
- DIR="${HOME}/downloads/_torrents/misc"
- [[ -d "$DIR" ]] || mkdir --parents "$DIR"
- [[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
- FILE="${DIR}/meta-${BASH_REMATCH[1]}.torrent"
- echo "d10:magnet-uri${#1}:${1}e" > "$FILE"
- notify-send "Magnet link downloaded" "$FILE"
|