Skip to content

Commit de22893

Browse files
committed
weatherlight => [functions.bash][torrent.spell]
1 parent 53d97ae commit de22893

2 files changed

Lines changed: 40 additions & 41 deletions

File tree

runes/bash/functions.bash

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -226,47 +226,6 @@ function which() {
226226
esac
227227
}
228228

229-
function torrent() {
230-
pgrep -f transmission-daemon >/dev/null || {
231-
transmission-daemon --download-dir ~/dl/
232-
echo -n "waiting for deamon to start"
233-
sleep 5
234-
echo -en "\r\e[K"
235-
}
236-
case "$1" in
237-
a | add)
238-
transmission-remote -a "${@:2}"
239-
;;
240-
d | del)
241-
local t
242-
t="$(transmission-remote -l |
243-
grep -vP '^(\s+ID)|Sum:' |
244-
fzf --height="$(transmission-remote -l | wc -l)" \
245-
--layout=reverse |
246-
awk '{print $1}' |
247-
sed 's/\*//g')"
248-
[[ "$t" ]] || return 0
249-
transmission-remote -t "$t" --remove
250-
;;
251-
'' | l | list)
252-
transmission-remote -l
253-
;;
254-
*)
255-
cat <<EOF
256-
Usage: $0 COMMAND
257-
258-
Commands:
259-
l | list
260-
List running torrents
261-
a | add
262-
Add a torrent to the list
263-
d | del
264-
Remove a torrent
265-
EOF
266-
;;
267-
esac
268-
}
269-
270229
make-gif-of-photos() {
271230
if [ $# -lt 2 ]; then
272231
cat <<EOF

spells/torrent.spell

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
pgrep -f transmission-daemon >/dev/null || {
4+
transmission-daemon --download-dir ~/dl/
5+
echo -n "waiting for deamon to start"
6+
sleep 5
7+
echo -en "\r\e[K"
8+
}
9+
case "$1" in
10+
a | add)
11+
transmission-remote -a "${@:2}"
12+
;;
13+
d | del)
14+
local t
15+
t="$(transmission-remote -l |
16+
grep -vP '^(\s+ID)|Sum:' |
17+
fzf --height="$(transmission-remote -l | wc -l)" \
18+
--layout=reverse |
19+
awk '{print $1}' |
20+
sed 's/\*//g')"
21+
[[ "$t" ]] || return 0
22+
transmission-remote -t "$t" --remove
23+
;;
24+
'' | l | list)
25+
transmission-remote -l
26+
;;
27+
*)
28+
cat <<EOF
29+
Usage: $0 COMMAND
30+
31+
Commands:
32+
l | list
33+
List running torrents
34+
a | add
35+
Add a torrent to the list
36+
d | del
37+
Remove a torrent
38+
EOF
39+
;;
40+
esac

0 commit comments

Comments
 (0)