chezmoi init
This commit is contained in:
commit
530d6d7195
1176 changed files with 111325 additions and 0 deletions
13
dot_oh-my-zsh/plugins/torrent/README.md
Normal file
13
dot_oh-my-zsh/plugins/torrent/README.md
Normal 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.
|
17
dot_oh-my-zsh/plugins/torrent/torrent.plugin.zsh
Normal file
17
dot_oh-my-zsh/plugins/torrent/torrent.plugin.zsh
Normal 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"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue