From 6a242b158e7cb40fd062edce7b98b005181c2143 Mon Sep 17 00:00:00 2001 From: shibao Date: Thu, 25 Apr 2024 10:58:58 -0400 Subject: [PATCH] add standardize-music script --- home/default/scripts/append-urls-to-titles | 2 ++ home/default/scripts/convert-to-audio | 32 ----------------- home/default/scripts/standardize-music | 41 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 32 deletions(-) delete mode 100755 home/default/scripts/convert-to-audio create mode 100755 home/default/scripts/standardize-music diff --git a/home/default/scripts/append-urls-to-titles b/home/default/scripts/append-urls-to-titles index eed84b0..9df291a 100755 --- a/home/default/scripts/append-urls-to-titles +++ b/home/default/scripts/append-urls-to-titles @@ -21,3 +21,5 @@ fi cat append.txt | wget-titles-from-urls >> titles.txt cat append.txt | youtube-audio > append.txt + +standardize-music diff --git a/home/default/scripts/convert-to-audio b/home/default/scripts/convert-to-audio deleted file mode 100755 index 6235b63..0000000 --- a/home/default/scripts/convert-to-audio +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env sh - -# rename .MKV -> .MKV -count=`ls -1 *.JPG 2>/dev/null | wc -l` -if [ $count != 0 ]; then - rename MKV mkv *.MKV -fi - -# convert to opus -count=`ls -1 *.mkv 2>/dev/null | wc -l` -if [ $count != 0 ]; then - for i in *.mkv; do - ffmpeg -i "$i" "${i%.mkv}.opus"; - rm "$i"; - done -fi - -# rename .WEBM -> .webm -count=`ls -1 *.WEBM 2>/dev/null | wc -l` -if [ $count != 0 ]; then - rename WEBM webm *.WEBM -fi - -# convert to opus -count=`ls -1 *.webm 2>/dev/null | wc -l` -if [ $count != 0 ]; then - for i in *.webm; do - ffmpeg -i "$i" "${i%.webm}.opus"; - rm "$i"; - done -fi - diff --git a/home/default/scripts/standardize-music b/home/default/scripts/standardize-music new file mode 100755 index 0000000..4c84669 --- /dev/null +++ b/home/default/scripts/standardize-music @@ -0,0 +1,41 @@ +#!/usr/bin/env sh +set -oux pipefail + +# removes more modern codecs to just files that can fit on my mp3 player + +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%.*}.ogg" && rm "$i" + done +fi + +count=`ls -1 *.WEBM 2>/dev/null | wc -l` +if [ $count != 0 ]; then + rename WEBM webm *.WEBM +fi + +count=`ls -1 *.webm 2>/dev/null | wc -l` +if [ $count != 0 ]; then + for i in *.webm; do + ffmpeg -y -i "$i" "${i%.*}.ogg" && rm "$i" + done +fi + +count=`ls -1 *.OPUS 2>/dev/null | wc -l` +if [ $count != 0 ]; then + rename OPUS opus *.OPUS +fi + +count=`ls -1 *.opus 2>/dev/null | wc -l` +if [ $count != 0 ]; then + for i in *.opus; do + ffmpeg -y -i "$i" "${i%.*}.ogg" && rm "$i" + done +fi +