From bfeeb48f551dcef96819eb124aa72241656c393b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 11 Mar 2024 11:07:59 +0100 Subject: refactor --- bin/common/ytclipo | 2 +- bin/extra/magnet2torrent | 8 +++-- bin/guiscripts/lh | 33 +++++++++++++++++++ bin/guiscripts/linkhandler | 33 ------------------- bin/menuscripts/mpass-otp | 2 +- config/common/newsraft/feeds | 38 ++++++++++++++++++++++ .../newpipe_subscriptions_202402222357.json | 1 + 7 files changed, 80 insertions(+), 37 deletions(-) create mode 100755 bin/guiscripts/lh delete mode 100755 bin/guiscripts/linkhandler create mode 100644 config/common/newsraft/feeds create mode 100644 config/common/newsraft/newpipe_subscriptions_202402222357.json 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 $inp" || : +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/lh b/bin/guiscripts/lh new file mode 100755 index 0000000..956b99b --- /dev/null +++ b/bin/guiscripts/lh @@ -0,0 +1,33 @@ +#!/bin/sh + +# Feed script a url or file location. +# If an image, it will view in sxiv, +# if a video or gif, it will view in mpv +# if a music file or pdf, it will download, +# otherwise it opens link in browser. + +[ "${url:=$1}" ] || url="$(clipo)" +notify-send "linkhandler" "$url" +echo "$url" > ~/file.txt + +case "$url" in + file://*) file="${url##file:/}" + case "$(file -bi "$file" | cut -f1 -d'/')" in + audio|video) mpv "$file" ;; + image) imv "$file" ;; + *) xdg-open "$file" ;; + esac ;; + *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 ;; + *mp3|*flac|*opus|*mp3?source*) + mpv "$url" ;; + *) + if [ -f "$url" ] + then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 + else setsid -f "$BROWSER" "$url" >/dev/null 2>&1 + fi +esac diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler deleted file mode 100755 index 329e267..0000000 --- a/bin/guiscripts/linkhandler +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# Feed script a url or file location. -# If an image, it will view in sxiv, -# if a video or gif, it will view in mpv -# 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" "handling $url" - -case "$url" in - file://*) file="${url##file:/}" - case "$(file -bi "$file" | cut -f1 -d'/')" in - audio|video) mpv "$file" ;; - 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 & ;; - *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 & ;; - *mp3|*flac|*opus|*mp3?source*) - mpv "$url" 'curl -LO' >/dev/null 2>&1 ;; - *) - if [ -f "$url" ] - then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 - else setsid -f "$BROWSER" "$url" >/dev/null 2>&1 - fi -esac 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 $pass" +notify-send -t 1000 "mpass" "copied $pass" diff --git a/config/common/newsraft/feeds b/config/common/newsraft/feeds new file mode 100644 index 0000000..f4f7030 --- /dev/null +++ b/config/common/newsraft/feeds @@ -0,0 +1,38 @@ +@ Hardware +https://www.youtube.com/feeds/videos.xml?channel_id=UC9PBzalIcEQCsiIkq36PyUA "Digital Foundry" +https://www.youtube.com/feeds/videos.xml?channel_id=UCI8iQa1hv7oV_Z8D35vVuSg "Hardware Unboxed" +https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw "Linus Tech Tips" +https://www.youtube.com/feeds/videos.xml?channel_id=UChIs72whgZI9w6d6FhwGGHA "Gamer's Nexus" + +@ Top +https://www.youtube.com/feeds/videos.xml?channel_id=UCaTznQhurW5AaiYPbhEA-KA "Molly Rocket" +https://www.computerenhance.com/feed "Computer, Enhance!" +https://xkcd.com/rss.xml + +@ Hacking +https://www.youtube.com/feeds/videos.xml?channel_id=UClcE-kVhqyiHCcjYwcpfj9w "LiveOverflow" +https://feeds.feedburner.com/TheHackersNews + +@ Music +https://www.youtube.com/feeds/videos.xml?channel_id=UC3vYz1SAtcbRhsatydObGQw "Shijun Wang" +https://www.youtube.com/feeds/videos.xml?channel_id=UC2q7OXP-mPxHzJerA9tXe7Q "Ashish Xiangyi Kumar" + +@ Blogs +https://arthurmelton.com/blogs.rss "Arthur Melton's blog'" + +@ Linux +https://www.youtube.com/feeds/videos.xml?channel_id=UC-V8FVQCUpRRUPNClviki3w "Luke Smith" +https://youtube.com/feeds/video.xml?channel_id=UCngn7SVujlvskHRvRKc1cTw "Bugswriter" +https://youtube.com/feeds/video.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg "DistroTube" + +@ Entertainment +https://www.youtube.com/feeds/videos.xml?channel_id=UCi8C7TNs2ohrc6hnRQ5Sn2w "Programmers are also human" +https://www.youtube.com/feeds/videos.xml?channel_id=UCUyeluBRhGPCW4rPe_UvBZQ "The Primagean" + +@ VIM +https://www.youtube.com/feeds/videos.xml?channel_id=UCVk4b-svNJoeytrrlOixebQ "The Vimagean" +https://www.youtube.com/feeds/videos.xml?channel_id=UCd3dNckv1Za2coSaHGHl5aA "TJ DeVries" + +@ News +https://rss.rtbf.be/article/rss/highlight_rtbf_info.xml?source=internal +https://news.ycombinator.com/rss diff --git a/config/common/newsraft/newpipe_subscriptions_202402222357.json b/config/common/newsraft/newpipe_subscriptions_202402222357.json new file mode 100644 index 0000000..fbb88e7 --- /dev/null +++ b/config/common/newsraft/newpipe_subscriptions_202402222357.json @@ -0,0 +1 @@ +{"app_version":"0.25.2","app_version_int":994,"subscriptions":[{"service_id":0,"url":"https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw","name":"3Blue1Brown"},{"service_id":0,"url":"https://www.youtube.com/channel/UC9PBzalIcEQCsiIkq36PyUA","name":"Digital Foundry"},{"service_id":0,"url":"https://www.youtube.com/channel/UChIs72whgZI9w6d6FhwGGHA","name":"Gamers Nexus"},{"service_id":0,"url":"https://www.youtube.com/channel/UCI8iQa1hv7oV_Z8D35vVuSg","name":"Hardware Unboxed"},{"service_id":0,"url":"https://www.youtube.com/channel/UCCuoqzrsHlwv1YyPKLuMDUQ","name":"Jonathan Blow"},{"service_id":0,"url":"https://www.youtube.com/channel/UCXuqSBlHAE6Xw-yeJA0Tunw","name":"Linus Tech Tips"},{"service_id":0,"url":"https://www.youtube.com/channel/UCaTznQhurW5AaiYPbhEA-KA","name":"Molly Rocket"},{"service_id":0,"url":"https://www.youtube.com/channel/UC8ENHE5xdFSwx71u3fDH5Xw","name":"ThePrimeagen"},{"service_id":0,"url":"https://www.youtube.com/channel/UCUyeluBRhGPCW4rPe_UvBZQ","name":"ThePrimeTime"}]} \ No newline at end of file -- cgit v1.2.3