blob: 12804a8d423dc25b975b824f44d9e43121a34b3a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env bash
source "$HOME/scripts/modules/utils.sh";
DOWNLOAD_LOCATION=$HOME/Downloads/dl;
is_magnet() { echo "$1" | grep '^magnet:'; }
add_magnet_link() {
is_magnet "$1" && \
transmission-remote -a "$1" && \
notify-send "Torrent" "Added torrent for downloading";
}
add_from_clipboard() {
add_torrent "$(read_clipboard)";
}
add_torrent() {
transmission-remote -a "$1" && \
notify-send "Torrent" "Added torrent for downloading";
#local name=$(btinfo "$1" | awk -F': ' '/Name:/ {print $2}');
#btcli add -d "$DOWNLOAD_LOCATION/$name" "$1";
}
case "$1" in
add) add_magnet_link "$2" ;;
magnet) add_magnet_link "$2" ;;
torrent) add_torrent "$2" ;;
add_from_clipboard) add_from_clipboard ;;
esac;
|