From 28e8bdf7f8286bd431b7f3b709e79f3827b31469 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:54:03 +0900 Subject: updates --- debian/.local/bin/transadd | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 debian/.local/bin/transadd (limited to 'debian/.local/bin/transadd') diff --git a/debian/.local/bin/transadd b/debian/.local/bin/transadd new file mode 100755 index 0000000..ffd8ded --- /dev/null +++ b/debian/.local/bin/transadd @@ -0,0 +1,29 @@ +#!/bin/sh + +# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. + +# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. + +pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "💡 Starting transmission daemon..." && sleep 3 && pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}") + +directory="$HOME/Torrents" + +[ "$1" = "-l" ] && { + URL=$(xclip -selection clipboard -o) + case "$URL" in + http://* | https://* | magnet:?*) + transmission-remote -a "$URL" && notify-send "🔽 Torrent added." + exit 0 + ;; + *) + added_torrents=$(transmission-remote -l | grep -vE '^ID|Sum' | awk '{print $NF}' | sed 's/\.torrent$//') + filtered_files=$(ls "$directory"/*.torrent 2>/dev/null | sed "s|^$directory/||" | sed 's/\.torrent$//' | grep -vF "$added_torrents") + [ -n "$filtered_files" ] && { + choice=$(echo "$filtered_files" | dmenu -i -l 20 -p "Select Torrent:") + [ -n "$choice" ] && transmission-remote -a "$directory/$choice.torrent" && notify-send "🔽 Torrent added." + } || notify-send "🤷 No new torrent found." + ;; + esac +} || { + transmission-remote -a "$@" && notify-send "🔽 Torrent added." "$TR_TORRENT_NAME" +} -- cgit v1.2.3