diff options
-rwxr-xr-x | ctwebp.sh | 13 | ||||
-rwxr-xr-x | mp3ogg.sh | 15 | ||||
-rwxr-xr-x | newsboatreload.sh | 12 | ||||
-rwxr-xr-x | oggmp3.sh | 15 | ||||
-rwxr-xr-x | profmux.sh | 9 | ||||
-rwxr-xr-x | rofibooks.sh | 12 | ||||
-rwxr-xr-x | screenrec.sh | 21 | ||||
-rwxr-xr-x | screenshots.sh | 28 | ||||
-rwxr-xr-x | screenzug.sh | 15 | ||||
-rwxr-xr-x | urlselect.sh | 9 | ||||
-rwxr-xr-x | ymao.sh | 73 |
11 files changed, 222 insertions, 0 deletions
diff --git a/ctwebp.sh b/ctwebp.sh new file mode 100755 index 0000000..e95b236 --- /dev/null +++ b/ctwebp.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +convert_to_webp () { + for file in ~/stf/ss/bnw/*.png + do + OUTPUT=${file%.png} + echo "$OUTPUT" + convert -quality 80 "$file" "$OUTPUT.webp" + done + rm -f ~/stf/ss/bnw/*.png +} + +convert_to_webp diff --git a/mp3ogg.sh b/mp3ogg.sh new file mode 100755 index 0000000..704d754 --- /dev/null +++ b/mp3ogg.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +for file in *.mp3; do + OUTPUT=${file%.mp3} + echo $OUTPUT + ffmpeg -i "$file" "$OUTPUT.ogg" +done + +printf "\n¿Borrar archivos originales? (s / n) " +read respuesta + +case $respuesta in +s) + rm -f *.mp3 ;; +esac diff --git a/newsboatreload.sh b/newsboatreload.sh new file mode 100755 index 0000000..2abcddd --- /dev/null +++ b/newsboatreload.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +while true; do + kill $(pidof newsboat) + rm $XDG_CONFIG_HOME/newsboat/queue + $TERMINAL -e newsboat + if [[ $? == 0 ]] ; then + exec newsboat && break + else + break + fi +done diff --git a/oggmp3.sh b/oggmp3.sh new file mode 100755 index 0000000..b4e8bfa --- /dev/null +++ b/oggmp3.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +for file in *.ogg; do + OUTPUT=${file%.ogg} + echo $OUTPUT + ffmpeg -i "$file" "$OUTPUT.mp3" +done + +printf "\n¿Borrar archivos originales? (s / n) " +read respuesta +if [ $respuesta = "s" ] ; then + rm -f *.ogg +else + echo > /dev/null +fi diff --git a/profmux.sh b/profmux.sh new file mode 100755 index 0000000..6357c26 --- /dev/null +++ b/profmux.sh @@ -0,0 +1,9 @@ +#!/bin/sh +session="xmpp-chat" + +tmux new-session -d -s $session + +tmux new-window -t $session:0 -n 'chat' +tmux send-keys -t $session:0 profanity 'Enter' + +tmux attach-session -t $session diff --git a/rofibooks.sh b/rofibooks.sh new file mode 100755 index 0000000..40cd72e --- /dev/null +++ b/rofibooks.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +seleccion=$(find $HOME/stf/books/ -mindepth 2 -type f | + cut -d "/" -f 6- | + awk '{ printf $0 "\n" }' | + rofi -dmenu -font "Iosevka Nerd Font 12" -p "Book") + +case $seleccion in +*.pdf) zathura "$HOME/stf/books/$seleccion" ;; +*.epub) zathura "$HOME/stf/books/$seleccion" ;; +*.odt) libreoffice "$HOME/stf/books/$seleccion" ;; +esac diff --git a/screenrec.sh b/screenrec.sh new file mode 100755 index 0000000..7629029 --- /dev/null +++ b/screenrec.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Wal colors dmenu +. "${HOME}/.cache/wal/colors.sh" + +# Alias Dmenu +alias give_to_dmenu='dmenu -c -nf "$color0" -nb "$color15" -sb "$color1" -sf "$color15" -fn "Iosevka-11"' + +# Vars +video_output_dir="~/stf/sr" +number_of_displays=$(xrandr | grep " connected" | wc -l) +display_selection=$(xrandr | grep " connected" | awk '{print $1}' | give_to_dmenu -l $number_of_displays -p "Which display would you like to capture?:") +screen_res=$(xrandr | grep "$display_selection" | grep -o '[[:digit:]]\+x[[:digit:]]\+') +screen_coord=$(xrandr | grep "$display_selection" | grep -o '+[[:digit:]]\++[[:digit:]]') +#output_res=$(printf "640:480\n800:600\n1024:768\n852:480\n1280:720\n1600:900\n1920:1080" | give_to_dmenu -l 7 -p "Output Resolution:") +video_name=$(echo "" | give_to_dmenu -p Name:) + +# Capture +ffmpeg -f x11grab -s $screen_res -i :0.0$screen_coord -f pulse -i default ~/stf/sr/"$video_name.mp4" \ +& dunstify " Recording video in $video_output_dir as $video_name.mp4" \ +|| dunstify "ERROR: Video is not being recorded" diff --git a/screenshots.sh b/screenshots.sh new file mode 100755 index 0000000..00c31e4 --- /dev/null +++ b/screenshots.sh @@ -0,0 +1,28 @@ +#!/bin/sh + + +# Wal colors dmenu +. "${HOME}/.cache/wal/colors.sh" + +# Alias dmenu +alias give_to_dmenu='dmenu -c -nf "$color15" -nb "$color0" -sb "$color3" -sf "$color15" -fn "Iosevka-11"' + +# Vars +number_of_displays=$(xrandr | grep " connected" | wc -l) +main_menu_selection=$(printf "Fullscreen\nRegion" | give_to_dmenu -l 2 -p Capture:) + +# Menu +case $main_menu_selection in + "Fullscreen") + display_selection=$(xrandr | grep " connected" | awk '{print $1}' | give_to_dmenu -l $number_of_displays -p Display:) + screenshot_res=$(xrandr | grep "$display_selection" | grep -o '[[:digit:]]\+x[[:digit:]]\++[[:digit:]]\++[[:digit:]]\+') + screenshot_name=$(echo "" | give_to_dmenu -p Name:) + maim -g $screenshot_res -d 1 ~/stf/ss/"$screenshot_name.png" && dunstify " Screenshot taken" || dunstify "ERROR: Screenshot not taken" + ;; + "Region") + destination_selection=$(printf "SS\nShitposter" | give_to_dmenu -l 2 -p Destination:) + screenshot_name=$(echo "" | give_to_dmenu -p Name:) + [[ $destination_selection == SS ]] && destination=$SS_DIR || destination=$SHIT_DIR + maim -d 1 -s $destination/"$screenshot_name.png" && dunstify " Region screenshot taken" || dunstify "ERROR: Screenshot not taken" + ;; +esac diff --git a/screenzug.sh b/screenzug.sh new file mode 100755 index 0000000..eeb69a3 --- /dev/null +++ b/screenzug.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +HDMI_ON_OFF=$(xrandr | grep Screen | awk '{ print $8 }') +CONFIG="$HOME/.config/i3/config" + +case $HDMI_ON_OFF in + 3280) + sed -i '/"ncmpzug"/s/462/1822/g' $CONFIG + st -n ncmpzug -e ncmpcpp-ueberzug + ;; + 1920) + sed -i '/"ncmpzug"/s/1822/462/g' $CONFIG + st -n ncmpzug -e ncmpcpp-ueberzug + ;; +esac diff --git a/urlselect.sh b/urlselect.sh new file mode 100755 index 0000000..69359aa --- /dev/null +++ b/urlselect.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +ext="${1##*.}" + +case $ext in + mp4|webm|jpeg|jpg|png|webp|mp3|opus|gif) setsid -f mpv --loop "$1" > /dev/null 2>&1 ;; + pdf|epub) setsid -f zathura "$1" > /dev/null 2>&1 ;; + *) setsid -f $BROWSER --new-tab "$1" > /dev/null 2>&1 ;; +esac @@ -0,0 +1,73 @@ +#!/bin/bash + +# deps: "yt-dlp" "curl" "awk" "sed" + +# Vars +music_dir="$MUSIC_DIR" + +# Functions +main() { + read -p "Artist: " artist + read -p "Album: " album + final_dir="$music_dir"/"$artist"/"$album" + artist_query=$(sed 's/[[:punct:]]//g;s/ /+/g' <<< "$artist") + album_query=$(sed 's/[[:punct:]]//g;s/ /+/g' <<< "$album") + mkdir "$final_dir"/ 2> /dev/null + [[ ! -z $i_option ]] && read -p "Playlist's ID: " playlist || search_playlist + yt-dlp -x --audio-format mp3 --add-metadata -o "$final_dir/%(title)s.%(ext)s" --yes-playlist "https://yewtu.be"/"$playlist" + [[ ! -z $t_option ]] && get_album_art + [[ ! -z $c_option ]] && convert_ogg +} + +search_playlist() { + invidious_url="https://yewtu.be/search?q=$artist_query+$album_query+album&page=1&date=none&type=playlist&duration=none&sort=relevance" + lastfm_url="https://www.last.fm/music/$artist_query/$album_query" + album_len=$(curl -s "$lastfm_url" | grep -Eo ' [0-9]+ tracks' | awk 'NR==1{print $1 " songs"}') + playlist=$(curl -s "$invidious_url" | grep -Eoi "playlist\?list=.+[a-zA-Z0-9]|[0-9]+ videos" | + sed 's/ videos$/ songs/g' | paste - -s -d'\t\n' | grep -E "${album_len}" | awk 'NR==1 {print $1}') +} + +get_album_art() { + album_cover_url="https://itunes.apple.com/search?term=$artist_query+$album_query&media=music&entity=musicTrack" + curl -o "$final_dir"/AlbumArt.jpg "$(curl -s "$album_cover_url" | grep -o -m1 'https://is.*x30bb.jpg' | sed 's/30x30bb.jpg/600x600bb.jpg/')" +} + +convert_ogg() { + for file in "$final_dir"/*.mp3 + do + OUTPUT=${file%.mp3} + echo "$OUTPUT" + ffmpeg -i "$file" "$OUTPUT.ogg" + done + rm -f "$final_dir"/*.mp3 +} + +check_deps() { + for dep + do + if ! command -v "$dep" >/dev/null ; then + exit_on_error "\"$dep\" is not installed.\n" + fi + done +} + +exit_on_error () { + printf "$*" >&2 + exit 1 +} + +# Options +while getopts ':cti' opt; do + case $opt in + c) c_option=1 ;; + t) t_option=1 ;; + i) i_option=1 ;; + \?) echo "Invalid option: -$OPTARG." >&2 ; exit 1 ;; + esac +done +shift $((OPTIND-1)) + +# Check dependencies and start +check_deps "yt-dlp" "curl" "awk" "sed" + +main |