From 3c2da7ca345ea21080dccb34098da573afd6fe44 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 22 Jan 2025 12:09:23 +0300 Subject: [PATCH] Yazi: Add torrent download. --- home/file/yazi/module/Yazi.nix | 20 ++++++++++++++------ home/program/bash/module/Transmission.sh | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/home/file/yazi/module/Yazi.nix b/home/file/yazi/module/Yazi.nix index 44737b5..88064ee 100644 --- a/home/file/yazi/module/Yazi.nix +++ b/home/file/yazi/module/Yazi.nix @@ -63,6 +63,12 @@ run = "mpv --no-video --shuffle \"$@\"/**"; } ]; + bottle_run = [ + { + desc = "Run bottle"; + run = openWith "btp"; + } + ]; browser = [ { desc = "Browser"; @@ -142,12 +148,6 @@ run = openWith "steam-run"; } ]; - bottle_run = [ - { - desc = "Run bottle"; - run = openWith "btp"; - } - ]; unlock = [ { desc = "Unlock"; @@ -162,6 +162,13 @@ run = openWith "nvim"; } ]; + torrent = [ + { + desc = "Download"; + orphan = true; + run = openWith "tdla"; + } + ]; video = [ { desc = "Video"; @@ -223,6 +230,7 @@ (mkMime "application/vnd.openxmlformats-officedocument.*" [ "document" ]) (mkMime "application/x-executable" [ "steam_run" ]) (mkMime "application/x-pie-executable" [ "steam_run" ]) + (mkMime "application/x-bittorrent" [ "torrent" ]) { mime = "inode/directory"; diff --git a/home/program/bash/module/Transmission.sh b/home/program/bash/module/Transmission.sh index c989812..6bb72e5 100644 --- a/home/program/bash/module/Transmission.sh +++ b/home/program/bash/module/Transmission.sh @@ -6,10 +6,22 @@ function tdl() { # Download torrent files to home. # Usage: tdla function tdla() { - tdl -a "${@}" + tdl --add "${@}" } # List download torrents. function tdll() { - transmission-remote home.local -l + transmission-remote home.local --list +} + +# Remove torrent by id. +# Usage: tdlr +function tdlr() { + tdl -t"${@}" --remove +} + +# Remove and delete files torrent by id. +# Usage: tdlrd +function tdlrd() { + tdl -t"${@}" --remove-and-delete }