Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the code for mp4 to mp3 converter in file named music-extract. #16

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/color
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
17 changes: 17 additions & 0 deletions scripts/music-extract
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 5 additions & 0 deletions scripts/password-generator
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
# Issue: Implement Password Generation Functions
# Description:
# Create a function that generates passwords, The password should consist of uppercase letters, lowercase letters, numbers, and special characters. The function should take in a single argument, which is the length of the password to generate. The function should return the generated password.

generate_password(length) {
local password=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9!@#$%^&*()' | fold -w "$length" | head -n 1)
echo "$password"
}