move to new repo

This commit is contained in:
tumillanino
2026-03-24 20:17:22 +11:00
parent 083b57c87b
commit 35bcba335a
1910 changed files with 161640 additions and 41 deletions

View File

@@ -0,0 +1,13 @@
# torrent
This plugin creates a Torrent file based on a [MagnetURI](https://en.wikipedia.org/wiki/Magnet_URI_scheme).
To use it, add `torrent` to the plugins array in your zshrc file.
```zsh
plugins=(... torrent)
```
## Plugin commands
* `magnet_to_torrent <MagnetURI>`: creates Torrent file.

View File

@@ -0,0 +1,17 @@
#
# Algorithm borrowed from http://wiki.rtorrent.org/MagnetUri and adapted to work with zsh.
#
function magnet_to_torrent() {
[[ "$1" =~ xt=urn:btih:([^\&/]+) ]] || return 1
hashh=${match[1]}
if [[ "$1" =~ dn=([^\&/]+) ]];then
filename=${match[1]}
else
filename=$hashh
fi
echo "d10:magnet-uri${#1}:${1}e" > "$filename.torrent"
}