summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-03-11 11:07:59 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-03-11 11:07:59 +0100
commitbfeeb48f551dcef96819eb124aa72241656c393b (patch)
tree08b2cb0f684ca069397cabd6433ac70a47edbb86 /bin
parent49461617903c19c98cadac9da510a011a524ff59 (diff)
refactor
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common/ytclipo2
-rwxr-xr-xbin/extra/magnet2torrent8
-rwxr-xr-xbin/guiscripts/lh (renamed from bin/guiscripts/linkhandler)18
-rwxr-xr-xbin/menuscripts/mpass-otp2
4 files changed, 17 insertions, 13 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo
index 1a82df2..b11f84a 100755
--- a/bin/common/ytclipo
+++ b/bin/common/ytclipo
@@ -2,7 +2,7 @@
inp="$(ytlink)"
>&2 printf "inp: %s\n" "$inp"
-notify-send "ytclipo" "downloading <i>$inp</i>" || :
+notify-send "ytclipo" "$inp" || :
yt-dlp "$inp" \
--restrict-filenames \
diff --git a/bin/extra/magnet2torrent b/bin/extra/magnet2torrent
index 0a1f83e..9f7d006 100755
--- a/bin/extra/magnet2torrent
+++ b/bin/extra/magnet2torrent
@@ -21,7 +21,11 @@ fi
hash="${1##*btih:}"
hash="${hash%%&*}"
+url="$(curl -s "https://torrage.info/torrent.php?h=$hash" |
+ pup '#torrent-operation-link attr{href}')"
+>&2 printf "url: %s\n" "$url"
+
# Download the torrent file from a torrent website
torrent_file="${hash}.torrent"
-wget "https://itorrents.org/torrent/${hash}.torrent" -O "$torrent_file"
-echo "Torrent file written to ${torrent_file}"
+curl "$url" -H 'Referer: https://torrage.info/' > tmp.torrent
+echo "$torrent_file"
diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/lh
index 329e267..956b99b 100755
--- a/bin/guiscripts/linkhandler
+++ b/bin/guiscripts/lh
@@ -6,9 +6,9 @@
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
-test -z "${url:=$1}" &&
- url="$(xclip -sel c -o)"
-dunstify "linkhandler" "<b>handling</b> $url"
+[ "${url:=$1}" ] || url="$(clipo)"
+notify-send "linkhandler" "$url"
+echo "$url" > ~/file.txt
case "$url" in
file://*) file="${url##file:/}"
@@ -17,14 +17,14 @@ case "$url" in
image) imv "$file" ;;
*) xdg-open "$file" ;;
esac ;;
- *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
- setsid -f mpv --quiet --ytdl --ytdl-raw-options="format-sort=res:720" "$url" > /dev/null 2>&1 ;;
- *png|*jpg|*jpe|*jpeg|*gif)
- curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $IMAGE -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
+ *mkv|*webm|*mp4|*bitchute.com*|*odysee.com*) mpv "$url" ;;
+ *youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*) mpv "$(ytlink "$url")" ;;
+ *png|*jpg|*jpe|*jpeg|*gif) curl -sL "$url" | imv - ;;
*pdf|*cbz|*cbr)
- curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $VIEWER "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
+ curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"
+ $VIEWER "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
*mp3|*flac|*opus|*mp3?source*)
- mpv "$url" 'curl -LO' >/dev/null 2>&1 ;;
+ mpv "$url" ;;
*)
if [ -f "$url" ]
then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1
diff --git a/bin/menuscripts/mpass-otp b/bin/menuscripts/mpass-otp
index e771f9f..86690d3 100755
--- a/bin/menuscripts/mpass-otp
+++ b/bin/menuscripts/mpass-otp
@@ -4,4 +4,4 @@ pass="$(find "$PASSWORD_STORE_DIR"/keys/otp -name "*.gpg" -printf '%f\n' |
commander -c)"
[ "$pass" ] || exit 1
pass otp -c keys/otp/"$pass"
-notify-send -t 1000 "mpass" "copied <b>$pass</b>"
+notify-send -t 1000 "mpass" "copied $pass"