add scripts

This commit is contained in:
Never Gude 2025-12-29 23:40:17 +01:00
parent da6833b55b
commit a1d7377ca1
17 changed files with 265 additions and 45 deletions

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
for file in *.opus; do
ffmpeg \
-hide_banner \
-i "${file}" -i "cover.jpg" \
-map_metadata 0:s:a:0 -disposition attached_pic \
-metadata date="$1" \
-c:a copy "0${file}"
rm "$file"
mv "0${file}" "${file#"0"}"
done

35
.local/scripts/musicmenu.fish Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env fish
set input (mpc list title group album group artist | perl -077 -pe 's/\s*?(\S.*?)\s*$/$1\n/igs' | fuzzel -w 100 --dmenu || exit 0)
if string match -r "\s{8}" $input != ""
mpc insert (mpc find title (string trim $input))
mpc play
exit 0
end
if string match -r "\s{4}" $input != ""
mpc clear
mpc findadd album (string trim $input)
mpc play
exit 0
end
if string match -r "\s{0}" $input != ""
set input (mpc list title artist (string trim $input) group album | fuzzel -w 100 --dmenu || exit 0)
if string match -r "\s{4}" $input != ""
mpc insert (mpc find title (string trim $input))
mpc play
exit 0
end
if string match -r "\s{0}" $input != ""
mpc clear
mpc findadd album (string trim $input)
mpc play
exit 0
end
end

View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
Xwayland :10 & env -i DISPLAY=":10" openbox

30
.local/scripts/playlist-dl.bash Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
url=$1
album=$(yt-dlp -I 1:1 --skip-download --print "%(album)s" ${url})
artist=$(yt-dlp -I 1:1 --skip-download --print "%(artists.0,artist)s" ${url})
folder="${artist} - ${album}"
yt-dlp \
--embed-metadata \
--parse-metadata "%(playlist_index)s:%(track_number)s" \
--parse-metadata "%(release_date,upload_date)s:%(date)s" \
--parse-metadata "%(artists.0,artist)s:%(artist)s" \
--extract-audio --audio-format opus \
-o "${folder}/%(playlist_index)s - %(title)s.%(ext)s" ${url}
yt-dlp -I 1:0 --write-thumbnail -o "${folder}/cover.jpg" ${url}
cd "${folder}"
for file in *.opus; do
ffmpeg \
-hide_banner \
-i "${file}" -i "cover.jpg" \
-map_metadata 0:s:a:0 -disposition attached_pic \
-c:a copy "0${file}"
rm "$file"
mv "0${file}" "${file#"0"}"
done

View file

@ -0,0 +1,8 @@
#!/usr/bin/env fish
set playlist (string split (mpc playlist))
set input (mpc playlist | fuzzel -w 100 --dmenu || exit 0)
echo $input
mpc play (math (contains -i $input $playlist) + 1)

21
.local/scripts/powermenu.fish Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env fish
set input (echo -e 'Suspend\nShutdown\nRestart' | fuzzel --dmenu -l 3 || exit 0)
set check (echo -e 'Cancel\nProceed' | fuzzel --dmenu -l 2 || exit 0)
if test $check = "Cancel"
exit 0
end
switch $input
case Suspend
systemctl suspend
case Shutdown
systemctl poweroff
case Restart
systemctl restart
end