aboutsummaryrefslogtreecommitdiff
path: root/scripts/torrent.sh
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-12-24 00:06:27 +0530
committerAkshay Nair <phenax5@gmail.com>2020-12-24 00:06:27 +0530
commit865728068c965e066d0f8971c5b5ba26e12e7dce (patch)
treec16195f0a04cf7d004fe5b396255734f4d60bb00 /scripts/torrent.sh
parent649ef5f225039e498358c3d056dfd7fcbc56f014 (diff)
downloadnixos-config-865728068c965e066d0f8971c5b5ba26e12e7dce.tar.gz
nixos-config-865728068c965e066d0f8971c5b5ba26e12e7dce.zip
Adds scripts and links scripts and wallpapers
Diffstat (limited to '')
-rwxr-xr-xscripts/torrent.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/torrent.sh b/scripts/torrent.sh
new file mode 100755
index 0000000..12804a8
--- /dev/null
+++ b/scripts/torrent.sh
@@ -0,0 +1,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;
+