summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLM-LCL <hello@exaltedelite.club>2023-04-19 21:23:42 +0200
committerLM-LCL <hello@exaltedelite.club>2023-04-19 21:23:42 +0200
commitb98f0f496b6739749257804297468fb71845a776 (patch)
tree44096c59211f1d877515914273cde862fbf47c1f /lib
EZown
Diffstat (limited to 'lib')
-rwxr-xr-xlib/action/Clip23
-rwxr-xr-xlib/action/Clipboard12
-rwxr-xr-xlib/action/Download10
-rwxr-xr-xlib/action/Open6
-rwxr-xr-xlib/action/Play11
-rwxr-xr-xlib/action/Record7
-rwxr-xr-xlib/action/Rip19
-rwxr-xr-xlib/action/Stream10
-rwxr-xr-xlib/action/Torrent6
-rwxr-xr-xlib/action/aDownload13
-rwxr-xr-xlib/search/1337x67
-rwxr-xr-xlib/search/Odysee10
-rwxr-xr-xlib/search/PeerTube10
-rwxr-xr-xlib/search/Wallhaven8
-rwxr-xr-xlib/search/YouTube19
15 files changed, 231 insertions, 0 deletions
diff --git a/lib/action/Clip b/lib/action/Clip
new file mode 100755
index 0000000..d98cf0e
--- /dev/null
+++ b/lib/action/Clip
@@ -0,0 +1,23 @@
+#! /bin/bash
+
+source ./util/verify/cbd-https
+source ./util/menu/deasy-core
+source ./util/dpath
+
+url="$(is_https_url_cbd "$1")"
+
+from="$(deasy_core 'From (00:00/n)')"
+[ -z "$from" ] && exit 0
+
+to="$(deasy_core 'To (00:00/n)')"
+[ -z "$to" ] && exit 0
+
+filename="$(deasy_core 'Filename')"
+[ -z "$filename" ] && exit 0
+
+ffmpeg -n \
+ -ss "$from" \
+ -to "$to" \
+ -i "$(yt-dlp -f b --get-url "$url")" \
+ "$DPATH/$filename.mp4"
+
diff --git a/lib/action/Clipboard b/lib/action/Clipboard
new file mode 100755
index 0000000..b8e42e1
--- /dev/null
+++ b/lib/action/Clipboard
@@ -0,0 +1,12 @@
+#! /bin/bash
+
+source ./util/verify/cbd-core
+
+[ -z "$1" ] && url="$(get_cbd)" \
+ && [ -z "$url" ] \
+ && exit 0 \
+ || url="$1"
+
+printf "$url" | xclip -sel c
+printf "$url" | xclip
+
diff --git a/lib/action/Download b/lib/action/Download
new file mode 100755
index 0000000..01e8eb5
--- /dev/null
+++ b/lib/action/Download
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+source ./util/verify/cbd-https
+source ./util/dpath
+
+yt-dlp -f 'bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' \
+ -o "$DPATH/%(title)s.%(ext)s" \
+ --embed-chapters \
+ "$(is_https_url_cbd "$1")"
+
diff --git a/lib/action/Open b/lib/action/Open
new file mode 100755
index 0000000..76f1246
--- /dev/null
+++ b/lib/action/Open
@@ -0,0 +1,6 @@
+#! /bin/bash
+
+source ./util/verify/cbd-https
+
+xdg-open "$(is_https_url_cbd "$1")"
+
diff --git a/lib/action/Play b/lib/action/Play
new file mode 100755
index 0000000..fa56bac
--- /dev/null
+++ b/lib/action/Play
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+source ./util/verify/cbd-https
+
+url="$(is_https_url_cbd "$1")"
+
+[[ "$url" = *"&list="* ]] && playlist="$(echo "$url" | awk -F '&list=' '{print $2}')" \
+ && url="https://www.youtube.com/playlist?list=$playlist"
+
+mpv "$url"
+
diff --git a/lib/action/Record b/lib/action/Record
new file mode 100755
index 0000000..ac6c182
--- /dev/null
+++ b/lib/action/Record
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+source ./util/verify/cbd-https
+source ./util/dpath
+
+mpv --stream-record="$DPATH/$(date +'%Y-%m-%d—%T.mkv')" "$(is_https_url_cbd "$1")"
+
diff --git a/lib/action/Rip b/lib/action/Rip
new file mode 100755
index 0000000..fbdc0e0
--- /dev/null
+++ b/lib/action/Rip
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+source ./util/notify
+source ./util/dpath
+
+query="$(deasy "$1" 'Rip Query')"
+result="$(spotdl download "$query" --output "$DPATH" --no-cache)"
+
+if [[ "$result" =~ .*'No song matches found'.* ]]
+ then
+ notify 'Empty Response'
+elif [[ "$result" =~ .*'already downloaded'.* ]]
+ then
+ notify 'Already Downloaded'
+fi
+
+exit 0
+
diff --git a/lib/action/Stream b/lib/action/Stream
new file mode 100755
index 0000000..3cb2536
--- /dev/null
+++ b/lib/action/Stream
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+
+BASEURL='https://actvid.com/search/'
+tailurl="$(deasy "$1" 'Stream Query' | tr ' ' '-' \
+ | tr '[:upper:]' '[:lower:]')"
+
+xdg-open "$BASEURL$tailurl"
+
diff --git a/lib/action/Torrent b/lib/action/Torrent
new file mode 100755
index 0000000..4309da8
--- /dev/null
+++ b/lib/action/Torrent
@@ -0,0 +1,6 @@
+#! /bin/bash
+
+source ./util/verify/cbd-magnet
+
+qbittorrent "$(is_magnet_url_cbd "$1")"
+
diff --git a/lib/action/aDownload b/lib/action/aDownload
new file mode 100755
index 0000000..56fe212
--- /dev/null
+++ b/lib/action/aDownload
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+source ./util/verify/cbd-https
+source ./util/dpath
+
+yt-dlp -f 'bestaudio/best' \
+ -o "$DPATH/%(title)s.%(ext)s" \
+ --embed-thumbnail \
+ --extract-audio \
+ --audio-format mp3 \
+ --embed-chapters \
+ "$(is_https_url_cbd "$1")"
+
diff --git a/lib/search/1337x b/lib/search/1337x
new file mode 100755
index 0000000..7464fcd
--- /dev/null
+++ b/lib/search/1337x
@@ -0,0 +1,67 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+source ./util/notify
+
+CACHEDIR="$HOME/.cache/notflix-mod"
+[ -d "$CACHEDIR" ] || mkdir -p "$CACHEDIR"
+
+BASEURL='https://1337x.to'
+
+query="$(echo $(deasy "$1" 'Search 1337x') | sed 's/ /+/g')"
+curl -s "$BASEURL/search/$query/1/" > "$CACHEDIR/tmp.html"
+
+# Titles
+grep -o '<a href="/torrent/.*</a>' "$CACHEDIR/tmp.html" \
+ | sed 's/<[^>]*>//g' > "$CACHEDIR/titles.bw"
+
+# Void Check
+count=$(wc -l "$CACHEDIR/titles.bw" | awk '{print $1}')
+[ $count -lt 1 ] && notify 'Empty Response' && exit 0
+
+# Seeders & Leechers
+grep -o '<td class="coll-2 seeds.*</td>\|<td class="coll-3 leeches.*</td>' "$CACHEDIR/tmp.html" \
+ | sed 's/<[^>]*>//g' \
+ | sed 'N;s/\n/ /' > "$CACHEDIR/seedleech.bw"
+
+# Size
+grep -o '<td class="coll-4 size.*</td>' "$CACHEDIR/tmp.html" \
+ | sed 's/<span class="seeds">.*<\/span>//g' \
+ | sed -e 's/<[^>]*>//g' > "$CACHEDIR/size.bw"
+
+# Links
+grep -E '/torrent/' "$CACHEDIR/tmp.html" \
+ | sed -E 's#.*(/torrent/.*)/">.*/#\1#' \
+ | sed 's/td>//g' > "$CACHEDIR/links.bw"
+
+# Cleanup
+sed 's/\./ /g; s/\-/ /g' "$CACHEDIR/titles.bw" \
+ | sed 's/[^A-Za-z0-9 ]//g' \
+ | tr -s ' ' > "$CACHEDIR/tmp" && mv "$CACHEDIR/tmp" "$CACHEDIR/titles.bw"
+
+awk '{print NR " - ["$0"]"}' "$CACHEDIR/size.bw" > "$CACHEDIR/tmp" && mv "$CACHEDIR/tmp" "$CACHEDIR/size.bw"
+awk '{print "[S:"$1 ", L:"$2"]" }' "$CACHEDIR/seedleech.bw" > "$CACHEDIR/tmp" && mv "$CACHEDIR/tmp" "$CACHEDIR/seedleech.bw"
+
+# Line
+line="$(paste -d\ "$CACHEDIR/size.bw" "$CACHEDIR/seedleech.bw" "$CACHEDIR/titles.bw" \
+ | dmenu -i \
+ -l 20 \
+ -p 'Select Torrent:' \
+ -nb '#ffffff' \
+ -nf '#000080' \
+ -sb '#000080' \
+ -sf '#ffffff' \
+ | cut -d\- -f1 \
+ | awk '{$1=$1; print}')"
+[ -z "$line" ] && exit 0
+
+# 1. Magnet Page
+tailurl="$(head -n $line "$CACHEDIR/links.bw" | tail -n +$line)"
+curl -s "${BASEURL}${tailurl}/" > "$CACHEDIR/tmp.html"
+
+# 2. Magnet Link
+magnet="$(grep -Po 'magnet:\?xt=urn:btih:[a-zA-Z0-9]*' "$CACHEDIR/tmp.html" | head -n 1)"
+
+# 3. Magnet Action
+./rmt-action 'Torrent' "$magnet"
+
diff --git a/lib/search/Odysee b/lib/search/Odysee
new file mode 100755
index 0000000..58c900f
--- /dev/null
+++ b/lib/search/Odysee
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+
+query="$(deasy "$1" 'Search Odysee')"
+selected="$(./ext/ytfzf -D -L -cO "$query")"
+[ -z "$selected" ] && exit 0
+
+./rmt-action "$2" "$selected"
+
diff --git a/lib/search/PeerTube b/lib/search/PeerTube
new file mode 100755
index 0000000..ce083f2
--- /dev/null
+++ b/lib/search/PeerTube
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+
+query="$(deasy "$1" 'Search PeerTube')"
+selected="$(./ext/ytfzf -D -L -cP "$query")"
+[ -z "$selected" ] && exit 0
+
+./rmt-action "$2" "$selected"
+
diff --git a/lib/search/Wallhaven b/lib/search/Wallhaven
new file mode 100755
index 0000000..458e0ef
--- /dev/null
+++ b/lib/search/Wallhaven
@@ -0,0 +1,8 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+source ./util/dpath
+
+query="$(deasy "$1" 'Search Wallhaven')"
+./ext/waldl "$query" "$DPATH"
+
diff --git a/lib/search/YouTube b/lib/search/YouTube
new file mode 100755
index 0000000..dd4ab63
--- /dev/null
+++ b/lib/search/YouTube
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+source ./util/menu/deasy
+
+query="$(deasy "$1" 'Search YouTube')"
+query_type='video'; CH_SUFFIX='\C'
+
+if [[ "$query" == *"$CH_SUFFIX" ]]
+ then
+ query=${query%"$CH_SUFFIX"}
+ query_type='channel'
+fi
+
+[ -z "$query" ] && exit 0
+selected="$(./ext/ytfzf -D -L --type="$query_type" --ii='https://y.com.sb' "$query")"
+[ -z "$selected" ] && exit 0
+
+./rmt-action "$2" "$selected"
+