From 153809b195850f459be5dc32e462bd1fafd6d806 Mon Sep 17 00:00:00 2001 From: aman vsihwakarma Date: Fri, 15 Mar 2024 01:12:06 +0530 Subject: [PATCH 1/2] added ore color codes --- scripts/color | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/color b/scripts/color index d6a4fe8..28a5327 100755 --- a/scripts/color +++ b/scripts/color @@ -9,6 +9,13 @@ color() { declare -A color_mapping=( # TODO: Add more color values # Refer bash color codes + ['black']=30 + ['red']=31 + ['green']=32 + ['yellow']=33 + ['blue']=34 + ['magenta']=35 + ['cyan']=36 ['magenta']=35 ) From 58fb25ff2ea118ca29d95377603596c3fd8024b7 Mon Sep 17 00:00:00 2001 From: aman vsihwakarma Date: Fri, 15 Mar 2024 01:27:00 +0530 Subject: [PATCH 2/2] added code p4 to mp3 conversion --- scripts/music-extract | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/music-extract b/scripts/music-extract index 9659a0b..c38ab10 100644 --- a/scripts/music-extract +++ b/scripts/music-extract @@ -26,3 +26,20 @@ # └── Songs # ├── Song1.mp3 # └── Song2.mp3 + +convert_video_to_audio() { + local file_path="$1" + local output_dir="Music/${file_path%/*}" + mkdir -p "$output_dir" + local output_path="Music/${file_path%.mp4}.mp3" + ffmpeg -i "$file_path" -vn -ar 44100 -ac 2 -b:a 192k "$output_path" +} + +find_To_Convert_Files_From_Video_To_Audio() { + local dir="$1" + find "$dir" -type f -name '*.mp4' -print0 | while IFS= read -r -d '' file; do + convert_video_to_audio "$file" + done +} + +find_To_Convert_Files_From_Video_To_Audio "videos"