I thought to share some of the scripts in my .local/bin, because why not. I'm sharing these as/is, if your computer has a nuclear meltdown when you run them thats your issue not mine.
I will warn you that these scripts are far from efficient, you might get eye cancer from looking at them.
I download YouTube videos as MP3's using yt-dlp with these flags, it sets YT thumbnail as the mp3 cover. One issue is it copies the whole description into the mp3 metadata. This one should be set as an alias.
#!/bin/sh yt-dlp -x --continue --add-metadata --embed-thumbnail --metadata-from-title "%(title)s" --audio-format mp3 --audio-quality 0 --prefer-ffmpeg -o "%(title)s.%(ext)s" $1
I use this to shred large folders, it takes a while because it overwrites the files with zeros.
#!/bin/sh if [ -z "$1" ]; then echo "no folder specified" else find "$1" -type f -exec shred -uvzn3 {} \; rm -rf "$1" fiBonus: shred -uzvn3 you can set this as an alias.
I organise my music playlists in folders, and use this to play them shuffled.
mdir="$HOME/music" cache="$HOME/.cache/mus" # To shuffle or not to shuffle? if [ -d $mdir/$1 ]; then dir=$mdir/"$1" else dir=$mdir/ fi get_song () { stat=0 while [ $stat -eq 0 ]; do song=$(find $dir -type f | shuf -n 1 ) [ ! -f $cache ] && echo $song >> $cache # if last song equal newly picked song if [ ! "$song" = "$(cat $cache)" ]; then stat=1 rm $cache && echo "$song" >> $cache fi done } while true; do get_song mpv --no-audio-display "$song" printf "\033c" # clears screen sleep 1 done
This script runs in my .xinitrc, to pick a random image from my wallpaper folder.
#!/bin/sh waldir="/home/$USER/visual/pix/Wallpapers" wall=$(find $waldir -type f | shuf -n 1) xwallpaper --zoom $wall