summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorkrolyxon <krolyxon@tutanota.com>2022-10-20 07:59:20 +0530
committerkrolyxon <krolyxon@tutanota.com>2022-10-20 07:59:20 +0530
commit69905fb8727198e75bda617e75c3544032faf273 (patch)
tree7c0db8438a8d4a5e8b002b98a766ec47daae3aef /.local/bin
parentbf696a125ff181557172cda25c6416c9c5c659aa (diff)
changes
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/maimshot1
-rwxr-xr-x.local/bin/metadata12
-rwxr-xr-x.local/bin/pirokit68
-rwxr-xr-x.local/bin/sbar2
-rwxr-xr-x.local/bin/sd11
-rwxr-xr-x.local/bin/spammer15
-rwxr-xr-x.local/bin/upfile3
7 files changed, 82 insertions, 30 deletions
diff --git a/.local/bin/maimshot b/.local/bin/maimshot
index 10335f6..5c0a4a4 100755
--- a/.local/bin/maimshot
+++ b/.local/bin/maimshot
@@ -7,5 +7,4 @@ case "$(printf "a selected area (copy)\\ncurrent window (copy)\\nfull screen (co
"a selected area") maim -s ~/pix/ss/pic-selected-"$(date '+%y-%m-%d-%H-%M').png" ;;
"current window") maim -i "$(xdotool getactivewindow)" ~/pix/ss/pic-window-"$(date '+%y-%m-%d-%H-%M').png" ;;
"full screen") sleep 0.2 ; maim ~/pix/ss/pic-full-"$(date '+%y-%m-%d-%H-%M').png" ;;
-
esac
diff --git a/.local/bin/metadata b/.local/bin/metadata
deleted file mode 100755
index 44c1fb8..0000000
--- a/.local/bin/metadata
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-if [ -z "$*" ]; then
- input_file=$(fzf)
-else
- input_file=$*
-fi
-read -p "Title: " title
-read -p "Artist: " artist
-read -p "album: " album
-output_name="metadata-$input_file"
-ffmpeg -i "$input_file" -metadata title="$title" -metadata artist="$artist" -metadata album="$album" -c copy "$output_name"
-mv -f "$output_name" "$input_file"
diff --git a/.local/bin/pirokit b/.local/bin/pirokit
new file mode 100755
index 0000000..6986780
--- /dev/null
+++ b/.local/bin/pirokit
@@ -0,0 +1,68 @@
+#!/usr/bin/bash
+
+mkdir -p $HOME/.cache/pirokit
+
+if [ -z $1 ]; then
+ query=$(echo "" | dmenu -p "Search Torrent: ")
+else
+ query=$1
+fi
+
+baseurl="https://1337x.to"
+cachedir="$HOME/.cache/pirokit"
+query="$(sed 's/ /+/g' <<<$query)"
+
+#curl -s https://1337x.to/category-search/$query/Movies/1/ > $cachedir/tmp.html
+curl -s https://1337x.to/search/$query/1/ > $cachedir/tmp.html
+
+# Get Titles
+grep -o '<a href="/torrent/.*</a>' $cachedir/tmp.html |
+ sed 's/<[^>]*>//g' > $cachedir/titles.bw
+
+result_count=$(wc -l $cachedir/titles.bw | awk '{print $1}')
+if [ "$result_count" -lt 1 ]; then
+ notify-send "😔 No Result found. Try again 🔴"
+ exit 0
+fi
+
+
+# Seeders and 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
+
+
+
+# Clearning up some data to display
+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
+
+# Getting the line number
+LINE=$(paste -d\ $cachedir/size.bw $cachedir/seedleech.bw $cachedir/titles.bw |
+ dmenu -i -l 25 |
+ cut -d\- -f1 |
+ awk '{$1=$1; print}')
+
+url=$(head -n $LINE $cachedir/links.bw | tail -n +$LINE)
+fullURL="${baseurl}${url}/"
+
+# Requesting page for magnet link
+curl -s $fullURL > $cachedir/tmp.html
+magnet=$(grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" $cachedir/tmp.html | head -n 1)
+
+transadd "$magnet"
+
+# Simple notification
+notify-send "⬇️ Start downloading File 📁"
diff --git a/.local/bin/sbar b/.local/bin/sbar
index c26f46b..dc0ab74 100755
--- a/.local/bin/sbar
+++ b/.local/bin/sbar
@@ -10,7 +10,7 @@ update_cpu () {
}
update_memory () {
- memory=" $(free -h | sed -n "2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p")"
+ memory=" $(free -h --si | sed -n "2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p")"
}
update_time () {
diff --git a/.local/bin/sd b/.local/bin/sd
new file mode 100755
index 0000000..7e09bf6
--- /dev/null
+++ b/.local/bin/sd
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Open a terminal window in the same directory as the currently active window.
+
+PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
+PID="$(pstree -lpA "$PID")"
+PID="${PID##*"${SHELL##*/}"(}"
+PID="${PID#*lf(}"
+PID="${PID%%)*}"
+cd "$(readlink /proc/"$PID"/cwd)" || return 1
+"$TERMINAL"
diff --git a/.local/bin/spammer b/.local/bin/spammer
deleted file mode 100755
index 8b14491..0000000
--- a/.local/bin/spammer
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-i=0
-
-if [ -z $1 ]; then
- read -p "enter query: " query
-else
- query=$1
-fi
-
-while [ $i -le 100 ]
-do
- xdotool type "$query" ;xdotool key KP_Enter; sleep 1 ;
-
-done
diff --git a/.local/bin/upfile b/.local/bin/upfile
index c373eb0..ff30bf8 100755
--- a/.local/bin/upfile
+++ b/.local/bin/upfile
@@ -8,5 +8,6 @@ fi
[ -z "$file" ] && exit
-curl -F"file=@$file" 0x0.st | xclip -sel c
+# curl -F"file=@$file" 0x0.st | xclip -sel c
+curl -F"file=@$file" 0.tildevarsh.in | xclip -sel c
notify-send "The url has been copied to your clipboard. $(xclip -sel c -o)"