mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
code cleanup
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
static const char *fonts[] = {
|
static const char *fonts[] = {
|
||||||
"Comic Sans MS:size=15"
|
"Roboto:size=13"
|
||||||
};
|
};
|
||||||
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
||||||
static const char *colors[SchemeLast][2] = {
|
static const char *colors[SchemeLast][2] = {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
static const char *fonts[] = {
|
static const char *fonts[] = {
|
||||||
"Comic Sans MS:size=15"
|
"Roboto:size=13"
|
||||||
};
|
};
|
||||||
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
||||||
static const char *colors[SchemeLast][2] = {
|
static const char *colors[SchemeLast][2] = {
|
||||||
|
|||||||
BIN
dmenu-5.0/dmenu
BIN
dmenu-5.0/dmenu
Binary file not shown.
Binary file not shown.
9
rss
9
rss
@@ -1,18 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#script for downloading latest anime episode via torrent using rss provided by website named "subsplease.org"
|
#script for downloading latest anime episode via torrent using rss provided by website named "subsplease.org"
|
||||||
|
|
||||||
#parsing rss file
|
#parsing rss file
|
||||||
notify-send "Parsing SubsPlease RSS... Please Wait..."
|
notify-send "Parsing SubsPlease RSS... Please Wait..."
|
||||||
curl -s https://subsplease.org/rss/?r=1080 | tr "<" "\n" > $HOME/.cache/rss
|
curl -s https://subsplease.org/rss/?r=1080 | tr "<" "\n" > $HOME/.cache/rss
|
||||||
|
|
||||||
#extracting names and providing the menu for selecting particular title
|
#extracting names and providing the menu for selecting particular title
|
||||||
name=$(sed -n -e 's/title>\[.*Please\] \(.*\)/\1/p' .cache/rss | dmenu -l 25 -p "Search anime:")
|
name=$(sed -n -e 's/title>\[.*Please\] \(.*\)/\1/p' .cache/rss | dmenu -l 25 -p "Search anime:")
|
||||||
|
[ -z "$name" ] && notify-send -u critical "Err.. Query empty" && exit 0
|
||||||
if [ -z "$name" ]; then
|
|
||||||
notify-send -u critical "Err.. Query empty"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#extracting id from anime_name_[id].mkv
|
#extracting id from anime_name_[id].mkv
|
||||||
id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p')
|
id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p')
|
||||||
@@ -21,4 +16,4 @@ id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p')
|
|||||||
magnet=$(sed -n -e "s/link>\(.*$id.*\).*/\1/p" .cache/rss | sed 's/amp;//g')
|
magnet=$(sed -n -e "s/link>\(.*$id.*\).*/\1/p" .cache/rss | sed 's/amp;//g')
|
||||||
|
|
||||||
#custom script for downloading torrent using aria2c.. you can use your own bittorrent client here
|
#custom script for downloading torrent using aria2c.. you can use your own bittorrent client here
|
||||||
st -e $HOME/repos_scripts/torrent "$magnet" &
|
setsid -f st -e $HOME/repo_scripts/torrent "$magnet"
|
||||||
|
|||||||
47
tor-cli
47
tor-cli
@@ -1,62 +1,37 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
mkdir -p $HOME/.cache/pirokit
|
mkdir -p $HOME/.cache/pirokit
|
||||||
|
|
||||||
query=$(printf "" | dmenu -p "Search Torrent: ")
|
query=$(printf "" | dmenu -p "Search Torrent: ")
|
||||||
|
|
||||||
baseurl="https://www.1337xx.to"
|
baseurl="https://www.1337xx.to"
|
||||||
cachedir="$HOME/.cache/pirokit"
|
cachedir="$HOME/.cache/pirokit"
|
||||||
query="$(sed 's/ /+/g' <<<$query)"
|
query="$(sed 's/ /+/g' <<<$query)"
|
||||||
|
curl -s "$baseurl/search/$query/1/" > $cachedir/tmp.html
|
||||||
curl -s -G $baseurl/search/$query/1/ > $cachedir/tmp.html
|
|
||||||
|
|
||||||
# Get Titles
|
# Get Titles
|
||||||
grep -o '<a href="/torrent/.*</a>' $cachedir/tmp.html |
|
grep -o '<a href="/torrent/.*</a>' $cachedir/tmp.html | sed 's/<[^>]*>//g' > $cachedir/titles.bw
|
||||||
sed 's/<[^>]*>//g' > $cachedir/titles.bw
|
|
||||||
|
|
||||||
result_count=$(wc -l $cachedir/titles.bw | awk '{print $1}')
|
result_count=$(wc -l $cachedir/titles.bw | awk '{print $1}')
|
||||||
if [ "$result_count" -lt 1 ]; then
|
[ "$result_count" -lt 1 ] && notify-send "😔 No Result found. Try again 🔴" && exit 0
|
||||||
notify-send "😔 No Result found. Try again 🔴"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Seeders and Leechers
|
# Seeders and Leechers
|
||||||
grep -o '<td class="coll-2 seeds.*</td>\|<td class="coll-3 leeches.*</td>' $cachedir/tmp.html |
|
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
|
||||||
sed 's/<[^>]*>//g' | sed 'N;s/\n/ /' > $cachedir/seedleech.bw
|
|
||||||
|
|
||||||
# Size
|
# Size
|
||||||
grep -o '<td class="coll-4 size.*</td>' $cachedir/tmp.html |
|
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
|
||||||
sed 's/<span class="seeds">.*<\/span>//g' |
|
|
||||||
sed -e 's/<[^>]*>//g' > $cachedir/size.bw
|
|
||||||
|
|
||||||
# Links
|
# Links
|
||||||
grep -E '/torrent/' $cachedir/tmp.html |
|
grep -E '/torrent/' $cachedir/tmp.html | sed -E 's#.*(/torrent/.*)/">.*/#\1#' | sed 's/td>//g' > $cachedir/links.bw
|
||||||
sed -E 's#.*(/torrent/.*)/">.*/#\1#' |
|
|
||||||
sed 's/td>//g' > $cachedir/links.bw
|
|
||||||
|
|
||||||
# Clearning up some data to display
|
# Clearning up some data to display
|
||||||
sed 's/\./ /g; s/\-/ /g' $cachedir/titles.bw |
|
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
|
||||||
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 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
|
awk '{print "[S:"$1 ", L:"$2"]" }' $cachedir/seedleech.bw > $cachedir/tmp && mv $cachedir/tmp $cachedir/seedleech.bw
|
||||||
|
|
||||||
# Getting the line number
|
# Getting the line number
|
||||||
LINE=$(paste -d\ $cachedir/size.bw $cachedir/seedleech.bw $cachedir/titles.bw |
|
LINE=$(paste -d\ $cachedir/size.bw $cachedir/seedleech.bw $cachedir/titles.bw | dmenu -l 25 | cut -d\- -f1 | awk '{$1=$1; print}')
|
||||||
dmenu -l 25 |
|
[ -z "$LINE" ] && notify-send -u critical "Err.. No torrent selected!!" && exit 0
|
||||||
cut -d\- -f1 |
|
|
||||||
awk '{$1=$1; print}')
|
|
||||||
|
|
||||||
if [ -z "$LINE" ]; then
|
|
||||||
notify-send -u critical "Err.. No torrent selected!!"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
url=$(head -n $LINE $cachedir/links.bw | tail -n +$LINE)
|
url=$(head -n $LINE $cachedir/links.bw | tail -n +$LINE)
|
||||||
fullURL="${baseurl}${url}/"
|
|
||||||
|
|
||||||
# Requesting page for magnet link
|
# Requesting page for magnet link
|
||||||
curl -s $fullURL -o $cachedir/tmp.html
|
magnet=$(curl -s "${baseurl}${url}" | sed -nE 's/.*class="(.*)" href="([^"]*)" .*/\2/p')
|
||||||
magnet=$(grep -Po "magnet.*\" " $cachedir/tmp.html | tr -d \")
|
setsid -f st -e $HOME/repos_scripts/torrent "$magnet"
|
||||||
|
|
||||||
st -e $HOME/repos_scripts/torrent "$magnet" &
|
|
||||||
|
|||||||
5
torrent
5
torrent
@@ -9,13 +9,10 @@ c_reset="\033[0m"
|
|||||||
down(){
|
down(){
|
||||||
tput reset
|
tput reset
|
||||||
notify-send "Torrent: Downloading"
|
notify-send "Torrent: Downloading"
|
||||||
aria2c -d movies --select-file=$2 --seed-time=0 $1 && notify-send "Torrent: Download complete" && rm -f $file || notify-send -u critical "Torrent: Error!!"
|
aria2c -d movies --select-file=$2 --seed-time=0 $1 && notify-send "Torrent: Download complete" && rm -f $file || notify-send -u critical "Torrent: Error!!" }
|
||||||
}
|
|
||||||
|
|
||||||
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
|
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
|
||||||
|
|
||||||
[ -z "$*" ] && magnet=$(xclip -out clipboard) || magnet=$*
|
[ -z "$*" ] && magnet=$(xclip -out clipboard) || magnet=$*
|
||||||
|
|
||||||
echo "$magnet"
|
echo "$magnet"
|
||||||
printf "${c_yellow}Download>>\n${c_green}[f]ull torrent\n${c_cyan}[p]artial torrent \n${c_red}[q]uit"
|
printf "${c_yellow}Download>>\n${c_green}[f]ull torrent\n${c_cyan}[p]artial torrent \n${c_red}[q]uit"
|
||||||
printf "${c_reset}\n\tenter choice:"
|
printf "${c_reset}\n\tenter choice:"
|
||||||
|
|||||||
10
youtube
10
youtube
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# script for downloading youtube videos and split it into pieces..
|
# script for downloading videos/audios and/or extract part from it..
|
||||||
|
|
||||||
# defining shell colors for distinction
|
# defining shell colors for distinction
|
||||||
c_red="\033[1;31m"
|
c_red="\033[1;31m"
|
||||||
@@ -12,16 +12,14 @@ c_cyan="\033[1;36m"
|
|||||||
c_reset="\033[0m"
|
c_reset="\033[0m"
|
||||||
|
|
||||||
#function to download full video/audio
|
#function to download full video/audio
|
||||||
full()
|
full(){
|
||||||
{
|
|
||||||
[ -z "$2" ] &&
|
[ -z "$2" ] &&
|
||||||
yt-dlp -o "$HOME/Videos/%(title)s.%(ext)s" "$1" ||
|
yt-dlp -o "$HOME/Videos/%(title)s.%(ext)s" "$1" ||
|
||||||
yt-dlp -f 'ba' -x --audio-format mp3 "$1" -o "$HOME/Music/%(title)s.%(ext)s"
|
yt-dlp -f 'ba' -x --audio-format mp3 "$1" -o "$HOME/Music/%(title)s.%(ext)s"
|
||||||
}
|
}
|
||||||
|
|
||||||
# function to download part of a video/audio..
|
# function to download part of a video/audio..
|
||||||
part()
|
part(){
|
||||||
{
|
|
||||||
video=$1
|
video=$1
|
||||||
printf "${c_magenta}Enter Start Point(hh:mm:ss)or(mm:ss)${c_reset}:"
|
printf "${c_magenta}Enter Start Point(hh:mm:ss)or(mm:ss)${c_reset}:"
|
||||||
read start
|
read start
|
||||||
@@ -35,7 +33,7 @@ part()
|
|||||||
#program starts from here..
|
#program starts from here..
|
||||||
x=$(xclip -out clipboard)
|
x=$(xclip -out clipboard)
|
||||||
printf "${c_blue}Youtube link :${c_magenta}$x\n"
|
printf "${c_blue}Youtube link :${c_magenta}$x\n"
|
||||||
printf "${c_yellow}Download>>\n${c_blue}[a]Audio only\n${c_magenta}[f]part of Audio only\n${c_green}[v]Full video\n${c_cyan}[p]Part of video\n${c_red}[q]Quit"
|
printf "${c_yellow}Download>>\n${c_blue}[a]udio only\n${c_magenta}[f]part of Audio only\n${c_green}[v]ideo\n${c_cyan}[p]art of video\n${c_red}[q]uit"
|
||||||
printf "\n${c_reset}Enter choice:${c_green}"
|
printf "\n${c_reset}Enter choice:${c_green}"
|
||||||
read choice
|
read choice
|
||||||
case $choice in
|
case $choice in
|
||||||
|
|||||||
Reference in New Issue
Block a user