Created
April 2, 2022 04:52
-
-
Save pandamoon21/1b208800b36a149fb02f1df5c93f2dff to your computer and use it in GitHub Desktop.
bash/zsh functions for easy torrent creation on private trackers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TORRENT_WATCH_DIR="$HOME/rtorrent/watch/load" | |
ANNOUNCE_BTN='http://landof.tv/YOUR_PASSKEY/announce' | |
ANNOUNCE_PTP='http://please.passthepopcorn.me:2710/YOUR_PASSKEY/announce' | |
ANNOUNCE_HDB='http://tracker.hdbits.org/announce.php?passkey=YOUR_PASSKEY' | |
mkt() { | |
tracker="$1" | |
announce=$(eval printf -- "'%s'" "\$ANNOUNCE_$tracker") | |
if [[ -z "$announce" ]]; then | |
printf 'Error: $ANNOUNCE_%s is not set\n' "$tracker" >&2 | |
return 1 | |
fi | |
rest=() | |
i=1 | |
for arg; do | |
if [[ $i -eq $# ]]; then | |
filename="$arg" | |
elif [[ $i -ge 2 ]]; then | |
rest+=("$arg") | |
fi | |
let i++ | |
done | |
torrentname="${filename##*/}[$tracker]" | |
mktor -p -v -H -x '*.txt' -x '*.nfo' -x '*.png' -x '*.jpg' -o "$torrentname.torrent" "${rest[@]}" "$filename" "$announce" && | |
mv "$torrentname-resume.torrent" "$TORRENT_WATCH_DIR" && | |
rm -f "$torrentname.torrent" | |
} | |
alias mkbtn='mkt BTN' | |
alias mkptp='mkt PTP --no-cross-seed -s info.source=PTP' | |
alias mkhdb='mkt HDB --no-cross-seed -s info.source=HDBits' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment