improve scripts

This commit is contained in:
shibao 2024-11-02 15:38:09 -04:00
parent ec66d63089
commit a30bef3b29
5 changed files with 26 additions and 17 deletions

View File

@ -3,6 +3,6 @@ set -ou pipefail
for dir in */; do for dir in */; do
name=`echo "$dir" | sed 's/\/$//g'` name=`echo "$dir" | sed 's/\/$//g'`
(cd $dir && ls | grep -v -E '\.txt|\.m3u' > "$name.m3u") (cd $dir && echo "#EXTM3U" > "$name.m3u" && ls | grep -v -E '\.txt|\.m3u' >> "$name.m3u")
done done

View File

@ -1,7 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eou pipefail set -eou pipefail
echo $(pacman -Qqe) | \ sudo bash -c 'echo $(pacman -Qqe) | tr " " "\n" | sort > /packages.txt'
tr " " "\n" | \
sort \
> /packages.txt

View File

@ -9,7 +9,7 @@ fi
count=`ls -1 *.ogg 2>/dev/null | wc -l` count=`ls -1 *.ogg 2>/dev/null | wc -l`
if [ $count != 0 ]; then if [ $count != 0 ]; then
for i in *.ogg; do for i in *.ogg; do
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i" ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
done done
fi fi
@ -21,7 +21,7 @@ fi
count=`ls -1 *.webm 2>/dev/null | wc -l` count=`ls -1 *.webm 2>/dev/null | wc -l`
if [ $count != 0 ]; then if [ $count != 0 ]; then
for i in *.webm; do for i in *.webm; do
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i" ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
done done
fi fi
@ -33,9 +33,21 @@ fi
count=`ls -1 *.opus 2>/dev/null | wc -l` count=`ls -1 *.opus 2>/dev/null | wc -l`
if [ $count != 0 ]; then if [ $count != 0 ]; then
for i in *.opus; do for i in *.opus; do
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i" ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
done
fi
count=`ls -1 *.M4A 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename M4A m4a *.M4A
fi
count=`ls -1 *.m4a 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.m4a; do
ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
done done
fi fi
shopt -s nullglob shopt -s nullglob
rsgain custom -a -s i -L -S *.m4a *.mp3 *.ogg *.opus rsgain custom -S -L -a -s i *.mp3 *.flac

View File

@ -5,15 +5,15 @@ sudo mkdir -p /run/media/default
echo "mounting /run/media/default/MUSIC" echo "mounting /run/media/default/MUSIC"
sudo fsck -fy /dev/disk/by-uuid/E6F8-C183 || true sudo fsck -fy /dev/disk/by-uuid/E6F8-C183 || true
sudo mkdir /run/media/default/MUSIC sudo mkdir /run/media/default/MUSIC || true
sudo mount -U E6F8-C183 /run/media/default/MUSIC sudo mount -U E6F8-C183 /run/media/default/MUSIC
echo "syncing music..." echo "syncing music..."
sudo rsync --info=progress2 -W -r --delete ~/Music/* /run/media/default/MUSIC/ sudo rsync --info=progress2 -W -r --delete /home/default/Music/* /run/media/default/MUSIC/
sudo sync /run/media/default/MUSIC/ sudo sync /run/media/default/MUSIC/
cd /run/media/default/MUSIC cd /run/media/default/MUSIC
sudo generate-playlists sudo /home/default/scripts/generate-playlists
cd /home/default cd /home/default
echo "unmounting /run/media/default/MUSIC" echo "unmounting /run/media/default/MUSIC"

View File

@ -4,16 +4,16 @@ set -eou pipefail
sudo mkdir -p /run/media/default sudo mkdir -p /run/media/default
echo "mounting /run/media/default/MUSIC" echo "mounting /run/media/default/MUSIC"
sudo fsck -fy /dev/disk/by-uuid/DB09-89C3 sudo fsck -fy /dev/disk/by-uuid/4619-9B49 || true
sudo mkdir /run/media/default/MUSIC sudo mkdir -p /run/media/default/MUSIC || true
sudo mount -U DB09-89C3 /run/media/default/MUSIC sudo mount -U 4619-9B49 /run/media/default/MUSIC
echo "syncing music..." echo "syncing music..."
sudo rsync --info=progress2 -W -r --delete ~/Music/* /run/media/default/MUSIC/ sudo rsync --info=progress2 -W -r --delete /home/default/Music/* /run/media/default/MUSIC/
sudo sync /run/media/default/MUSIC/ sudo sync /run/media/default/MUSIC/
cd /run/media/default/MUSIC cd /run/media/default/MUSIC
sudo generate-playlists sudo /home/default/scripts/generate-playlists
cd /home/default cd /home/default
echo "unmounting /run/media/default/MUSIC" echo "unmounting /run/media/default/MUSIC"