mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
need another beer
This commit is contained in:
@@ -5,7 +5,8 @@ menu_droid() {
|
||||
}
|
||||
|
||||
menu_linux() {
|
||||
bemenu --fn 'Cascadia Mono 15' -i -c -W 0.6 -B 3 -l 25 -p "$1"
|
||||
[ -z "$3" ] && width="0.6" || width="$3"
|
||||
bemenu --fn 'Cascadia Mono 15' -i -c -W "$width" -B 3 -l 25 -p "$1"
|
||||
}
|
||||
|
||||
search_droid() {
|
||||
@@ -29,7 +30,7 @@ info_droid() {
|
||||
}
|
||||
|
||||
info_linux() {
|
||||
notify-send "$1" -r '10' -i "$2"
|
||||
notify-send "$1" -r '10' -i "$2" $3
|
||||
}
|
||||
|
||||
error_droid() {
|
||||
|
||||
2
ani-new
2
ani-new
@@ -50,7 +50,7 @@ case $(uname -o) in
|
||||
*ndroid*)
|
||||
os="droid"
|
||||
download_dir="/sdcard"
|
||||
script_dir="$HOME"
|
||||
script_dir=""
|
||||
;;
|
||||
*)
|
||||
os="linux"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
[bkmark.webm](https://user-images.githubusercontent.com/76195824/207424619-dd64a520-877d-4d3e-a1ad-f3b400be68eb.webm)
|
||||
|
||||
## setwall
|
||||
## setwall (removed as It works on system-level) (coming soon for hyprland)
|
||||
|
||||
- Caution: don't blindly run this script as it edits the file on system level, read the actual code before proceeding
|
||||
- this only works for St and bspwm (hyprland with foot coming soon)
|
||||
|
||||
2
rss
2
rss
@@ -2,7 +2,7 @@
|
||||
|
||||
if [ "$(uname -o)" = "Android" ]; then
|
||||
os="droid"
|
||||
script_dir="$HOME"
|
||||
script_dir=""
|
||||
else
|
||||
os="linux"
|
||||
script_dir="$HOME/repos_scripts"
|
||||
|
||||
80
screen
Executable file
80
screen
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
|
||||
# script for screeen recording with either mic or speaker
|
||||
# ability to record both mic and speaker at same time is coming soon
|
||||
|
||||
info() {
|
||||
notify-send -h "string:x-canonical-private-synchronous:${0##*/}" -i "$1" -t "${2:-5000}" "$3" "$4"
|
||||
}
|
||||
|
||||
menu() {
|
||||
bemenu --fn 'IBM Plex Sans 15' -i -c -W "0.${2:-5}" -B 3 -p "$1" -l 26
|
||||
}
|
||||
|
||||
record (){
|
||||
rm -f "$tmp_file" "$process_file"
|
||||
source=$(printf "screen only\nspeaker\nmic" | menu "Audio Source:" "3")
|
||||
monitor=$(hyprctl monitors | sed -nE 's|Monitor ([^ ]*).*|\1|p')
|
||||
[ "$(printf '%s\n' "$monitor" | wc -l)" -gt 1 ] && monitor=$(printf '%s' "$monitor" | menu "Choose Monitor:" "3")
|
||||
[ -z "$source" ] && info "" "2000" "No option Selected" && return 0
|
||||
info "simplescreenrecorder" "700" "Recording Started" "Capturing $monitor($source)"
|
||||
sleep 0.3
|
||||
[ "$source" = "screen only" ] && setsid -f wf-recorder -t -m "mp4" -f "$tmp_file" >/dev/null 2>&1 && return 0
|
||||
pactl set-default-source "$(eval "printf \$$source")"
|
||||
setsid -f wf-recorder -a -t -m "mp4" -f "$tmp_file" --output "$monitor" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
compress() {
|
||||
duration=$(ffprobe -hide_banner -i "$tmp_file" 2>&1 | sed -nE 's|.*Duration: ([^,]*).*|\1|p')
|
||||
i=19
|
||||
|
||||
while :;do
|
||||
ffmpeg -loglevel error -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i "$tmp_file" -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp "$i" "$process_file" -y -progress - | while read -r line;
|
||||
do
|
||||
complete=$(printf "%s\n" "$line" | sed -nE 's|out_time=(.*)|\1|p')
|
||||
[ -n "$complete" ] && info "ffmpeg" "700" "Compressing File under 25 MB Using Quality Preset : $i.." "$complete out of $duration ($(du -m "$process_file" | cut -f1) MB)"
|
||||
[ "$(du -m "$process_file" | cut -f1)" -gt 25 ] && killall -s KILL ffmpeg && break
|
||||
done
|
||||
[ "$(du -m "$process_file" | cut -f1)" -lt 25 ] && break
|
||||
: $((i+=1))
|
||||
done
|
||||
info "ffmpeg" "1000" "File Successfully compressed with Quality Preset : $i"
|
||||
[ -f "$process_file" ] && tmp_file=$process_file
|
||||
}
|
||||
|
||||
stop (){
|
||||
pgrep -af wf-recorder >/dev/null && killall -s SIGINT wf-recorder 2>/dev/null || return 0
|
||||
info "" "" "Recording Stopped"
|
||||
case $(printf "save locally\nupload to oshi\nupload to discord" | menu "Post-Record:" '3') in
|
||||
*oshi)
|
||||
info "icloud" "" "Uploading to Oshi"
|
||||
out=$(curl -sk https://oshi.at -F shorturl=0 -F "f=@$tmp_file")
|
||||
[ -z "$out" ] && info "" "2000" "Unable to upload to oshi,moved the file from temp to your home folder as <unix_timestamp>.mp4" && mv "$tmp_file" "$HOME/$(date +%s).mp4" && return 1
|
||||
printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && info "com.github.davidmhewitt.clipped" "2000" "Uploaded and Copied link to clipboard"
|
||||
;;
|
||||
*discord)
|
||||
[ "$(du -m "$tmp_file" | cut -f1)" -gt 25 ] && compress #compressing file if greater than 25 MB
|
||||
#will push discord code in next commit
|
||||
;;
|
||||
save*)
|
||||
filename=$(: | menu "Enter Filename (default: screenrecord.mp4):")
|
||||
mv "$tmp_file" "$HOME/$filename"
|
||||
;;
|
||||
*)
|
||||
rm -f "$tmp_file" "$process_file" && info "user-trash" "2000" "Temporary File Deleted"
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
tmp_file="/tmp/screenrecord.mp4"
|
||||
process_file="/tmp/processed.mp4"
|
||||
#shellcheck disable=SC2034
|
||||
mic="alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_6__source" #It is called in eval on line 9
|
||||
#shellcheck disable=SC2034
|
||||
speaker="alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink.monitor" #It is called in eval on line 9
|
||||
|
||||
# shellcheck source=./.functions
|
||||
. "$script_dir/.functions"
|
||||
|
||||
$1 "$2"
|
||||
2
tor-bay
2
tor-bay
@@ -15,7 +15,7 @@ display() {
|
||||
case $(uname -o) in
|
||||
*ndroid*)
|
||||
os="droid"
|
||||
script_dir="$HOME"
|
||||
script_dir=""
|
||||
;;
|
||||
*)
|
||||
os="linux"
|
||||
|
||||
2
tor-cli
2
tor-cli
@@ -3,7 +3,7 @@
|
||||
case $(uname -o) in
|
||||
*ndroid*)
|
||||
os="droid"
|
||||
script_dir="$HOME"
|
||||
script_dir=""
|
||||
;;
|
||||
*)
|
||||
os="linux"
|
||||
|
||||
2
torrent
2
torrent
@@ -14,7 +14,7 @@ down() {
|
||||
|
||||
if [ "$(uname -o)" = "Android" ]; then
|
||||
os="droid"
|
||||
script_dir="$HOME"
|
||||
script_dir=""
|
||||
else
|
||||
os="linux"
|
||||
script_dir="$HOME/repos_scripts"
|
||||
|
||||
21
youtube
21
youtube
@@ -14,20 +14,31 @@ part() {
|
||||
read start
|
||||
printf "${c_yellow}Enter Upto Seconds:${c_cyan}"
|
||||
read dur
|
||||
ffmpeg -loglevel error -stats -i $(yt-dlp -f "$3" --get-url "$1") -ss $start -t $dur /sdcard/$(date +%s).$2
|
||||
ffmpeg -loglevel error -stats -i "$(yt-dlp -f "$3" --get-url "$1")" -ss "$start" -t "$dur" "$download_dir/$(date +%s).$2"
|
||||
}
|
||||
|
||||
#program starts from here..
|
||||
case $(uname -o) in
|
||||
*ndroid*)
|
||||
download_dir="/sdcard"
|
||||
x=$(termux-clipboard-get)
|
||||
[ "$1" = "v" ] && yt-dlp "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "video downloaded" && exit 0
|
||||
;;
|
||||
*)
|
||||
download_dir="$HOME"
|
||||
x=$(wl-paste)
|
||||
;;
|
||||
esac
|
||||
|
||||
#program starts from here..
|
||||
[ -n "$1" ] && x=$1
|
||||
[ "$1" = "v" ] && yt-dlp "$x" -o "$download_dir/%(title)s.%(ext)s" && termux-notification -c "video downloaded" && exit 0
|
||||
printf "\n${c_blue} video 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 "\n${c_reset}Enter choice:${c_green}"
|
||||
read choice
|
||||
case $choice in
|
||||
a) yt-dlp -f 'ba' -x --audio-format mp3 "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "audio downloaded" ;;
|
||||
a) yt-dlp -f 'ba' -x --audio-format mp3 "$x" -o "$download_dir/%(title)s.%(ext)s" && termux-notification -c "audio downloaded" ;;
|
||||
f) part "$x" "mp3" "ba" && termux-notification -c "audio downloaded" ;;
|
||||
v) yt-dlp "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "video downloaded" ;;
|
||||
v) yt-dlp "$x" -o "$download_dir/%(title)s.%(ext)s" && termux-notification -c "video downloaded" ;;
|
||||
p) part "$x" "mp4" "b" && termux-notification -c "video downloaded" ;;
|
||||
q) exit 0 ;;
|
||||
esac
|
||||
|
||||
21
yt-music
21
yt-music
@@ -55,7 +55,7 @@ help() {
|
||||
}
|
||||
|
||||
get_data() {
|
||||
curl -X POST -A "$agent" -s "$base_url/youtubei/v1/$1?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30&prettyPrint=false" -H "content-type:application/json" -H "x-youtube-client-name:67" -H "x-youtube-client-version:1.20221128.01.00" -d "$2" -b "$cookie" -e "$base_url/$3" -c "$cookie"
|
||||
curl -X POST -A "$agent" -s "$base_url/youtubei/v1/$1?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30&prettyPrint=false" -H "content-type:application/json" -d "$2" -b "$cookie" -e "$base_url/$3" -c "$cookie"
|
||||
}
|
||||
|
||||
loop() {
|
||||
@@ -88,13 +88,14 @@ play() {
|
||||
[ -z "$id" ] && printf "[ youtube ] Invalid link\n" && exit 1
|
||||
|
||||
#get song's audio url
|
||||
random_no=$(head /dev/urandom | tr -dc '0-2' | cut -c1)
|
||||
droid_agent="com.google.android.youtube/18.10.36 (Linux; U; Android 1$random_no) gzip"
|
||||
random_no=$(head /dev/urandom | tr -dc '1-2' | cut -c1)
|
||||
andy_yt_ver="6.13.52"
|
||||
droid_agent="com.google.android.apps.youtube.music/$andy_yt_ver (Linux; U; Android 1$random_no) gzip"
|
||||
json="{
|
||||
\"context\": {
|
||||
\"client\": {
|
||||
\"clientName\": \"ANDROID\",
|
||||
\"clientVersion\": \"18.10.36\",
|
||||
\"clientName\": \"ANDROID_MUSIC\",
|
||||
\"clientVersion\": \"$andy_yt_ver\",
|
||||
\"androidSdkVersion\": $((random_no + 29)),
|
||||
\"userAgent\": \"$droid_agent\",
|
||||
\"hl\": \"en\",
|
||||
@@ -103,7 +104,6 @@ play() {
|
||||
}
|
||||
},
|
||||
\"videoId\": \"$id\",
|
||||
\"params\": \"8AEB\",
|
||||
\"playbackContext\": {
|
||||
\"contentPlaybackContext\": {
|
||||
\"html5Preference\": \"HTML5_PREF_WANTS\"
|
||||
@@ -113,7 +113,8 @@ play() {
|
||||
\"racyCheckOk\": true
|
||||
}"
|
||||
|
||||
audio_url=$(curl -X POST -A "$droid_agent" -s "https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false" -H "content-type:application/json" -d "$json" -b "$cookie" | sed -nE 's_.*itag":251,"url":"([^"]*)".*_\1_p')
|
||||
audio_url=$(curl -X POST -A "$droid_agent" -s "https://www.youtube.com/youtubei/v1/player?key=AIzaSyAOghZGza2MQSZkY_zfZ370N-PUdXEo8AI&prettyPrint=false" -H "content-type:application/json" -d "$json" -H "x-youtube-client-version:$andy_yt_ver" -H "x-youtube-client-name:21" | sed -nE 's_.*itag":251,"url":"([^"]*)".*_\1_p')
|
||||
[ -z "$audio_url" ] && return 0
|
||||
if [ -n "$2" ]; then
|
||||
printf "Name >> %s\n" "$title"
|
||||
printf "videoID >> %s\n" "$id"
|
||||
@@ -136,7 +137,7 @@ play() {
|
||||
\"context\": $(cat "$logdir/context")
|
||||
}"
|
||||
get_data "next" "$json_next" | sed 's/playlistPanelVideoRenderer/\n/g' | sed -nE 's_.*text":"(.*)"}.*longBylineText":\{"runs":\[\{"text":"([^"]*)","navigationEndpoint.*videoId":"([^"]*)".*_\1 - \2\t\3_p' | sed "/$id/d;/$prev_id/d" >"$next_data" &
|
||||
pgrep -f "yt-music loop" || setsid -f $HOME/repos_scripts/yt-music loop
|
||||
pgrep -f "yt-music loop" >/dev/null || setsid -f "$HOME"/repos_scripts/yt-music loop
|
||||
}
|
||||
|
||||
search_play() {
|
||||
@@ -144,8 +145,8 @@ search_play() {
|
||||
#call this by "script-name" "search_play" "search_query"
|
||||
[ -z "$1" ] && query=$(: | menu "Yt-music [Search]:") || query="$1"
|
||||
[ -z "$query" ] && notify-send "Err.. Search query empty" -u critical -r 5 && exit 1
|
||||
curl -A "$agent" -s "$base_url/" -c "$cookie" | sed -nE 's|.*INNERTUBE_CONTEXT":(.*),"INNERTUBE_CONTEXT_CLIENT_NAME.*|\1|p' >"$logdir/context"
|
||||
|
||||
printf '{"client":{"clientName":"WEB_REMIX","clientVersion":"1.20230731.00.00"}}' >"$logdir/context"
|
||||
json_search="{
|
||||
\"context\" : $(cat "$logdir/context"),
|
||||
\"query\": \"$query\",
|
||||
@@ -171,7 +172,7 @@ base_url="https://music.youtube.com"
|
||||
[ -d "$logdir" ] || mkdir "$logdir"
|
||||
cookie="$logdir/cookies"
|
||||
next_data="$logdir/next"
|
||||
agent="Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/110.0"
|
||||
agent="Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0"
|
||||
|
||||
#call this script by script-name "function_name" "query"
|
||||
[ -z "$1" ] && help "$@"
|
||||
|
||||
Reference in New Issue
Block a user