* Added script shell to convert wav files to flac * #93: Minor change to script to convert wav files to flac * #93: Added more code to for the music file conversion * #93: Script to convert wav files to flac files is done * #93: Clean up * #93: Starting work to implement flac support * #93: Minor update to conversion script * #93: Added dotnet manifest file Includes the dotnet-ef tool * #93: Updated README and migration script * #93: Created skeleton for saving flac files * #93: Making some changes to how the file extension is determined * #93: Updated gitignore * #93: Another gitignore update * #93: Making some changes to the process of saving a song to the filesystem * #93: Adding SQL script to drop and create database * #93: Saving uploaded song to a temporary location for processing * #93: Initializing some properties in the song model earlier * #93: Uploading wav songs works. Moving on to flac support * #93: Added more code to save flac files * #93: Updated some code that affects filename generation for audio files * #93: Song Model changes and support for different file types * #93: Working on build errors, removed DotnetZip dependency, and added new Ionic.Zlip.Netstandard dependency * #93: Reduce build errors * #93: Removed ID3 dependency * #93: Cleanup
This commit was merged in pull request #101.
This commit is contained in:
@@ -1,28 +1,29 @@
|
||||
echo "Adding migrations..."
|
||||
|
||||
echo "Adding User migration"
|
||||
~/.dotnet/tools/dotnet-ef migrations add User --context UserContext
|
||||
dotnet dotnet-ef migrations add User --context UserContext
|
||||
echo "Adding Album migration"
|
||||
~/.dotnet/tools/dotnet-ef migrations add Album --context AlbumContext
|
||||
dotnet dotnet-ef migrations add Album --context AlbumContext
|
||||
echo "Adding Artist migration"
|
||||
~/.dotnet/tools/dotnet-ef migrations add Artist --context ArtistContext
|
||||
dotnet dotnet-ef migrations add Artist --context ArtistContext
|
||||
echo "Adding Genre migration"
|
||||
~/.dotnet/tools/dotnet-ef migrations add Genre --context GenreContext
|
||||
dotnet dotnet-ef migrations add Genre --context GenreContext
|
||||
echo "Adding Cover art migration"
|
||||
~/.dotnet/tools/dotnet-ef migrations add CoverArt --context CoverArtContext
|
||||
dotnet dotnet-ef migrations add CoverArt --context CoverArtContext
|
||||
echo "Adding Song migration"
|
||||
~/.dotnet/tools/dotnet-ef migrations add Song --context SongContext
|
||||
dotnet dotnet-ef migrations add Song --context SongContext
|
||||
|
||||
echo "Updating migrations.."
|
||||
echo "Updating User migration"
|
||||
~/.dotnet/tools/dotnet-ef database update --context UserContext
|
||||
dotnet dotnet-ef database update --context UserContext
|
||||
echo "Updating Album migration"
|
||||
~/.dotnet/tools/dotnet-ef database update --context AlbumContext
|
||||
dotnet dotnet-ef database update --context AlbumContext
|
||||
echo "Updating Artist migration"
|
||||
~/.dotnet/tools/dotnet-ef database update --context ArtistContext
|
||||
dotnet dotnet-ef database update --context ArtistContext
|
||||
echo "Updating Genre migration"
|
||||
~/.dotnet/tools/dotnet-ef database update --context GenreContext
|
||||
dotnet dotnet-ef database update --context GenreContext
|
||||
echo "Updating Cover art migration"
|
||||
~/.dotnet/tools/dotnet-ef database update --context CoverArtContext
|
||||
dotnet dotnet-ef database update --context CoverArtContext
|
||||
echo "Updating Song migration"
|
||||
~/.dotnet/tools/dotnet-ef database update --context SongContext
|
||||
dotnet dotnet-ef database update --context SongContext
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
drop database Icarus;
|
||||
|
||||
create database Icarus;
|
||||
Executable
+137
@@ -0,0 +1,137 @@
|
||||
#!/usr/bin/zsh
|
||||
#
|
||||
# Working directory
|
||||
# Output directory
|
||||
# Folder name creation
|
||||
# Sub-folder name creation
|
||||
#
|
||||
# Validation
|
||||
# Check if WORK_DIR is an actual directory
|
||||
# Check if OUTPUT_DIR exists
|
||||
# Check if the Folder and Sub folder has been created
|
||||
# Check if WORK_DIR contains .wav files
|
||||
#
|
||||
# Conversion
|
||||
# Convert wav files to flac files
|
||||
# Create folder and sub folder if it does not exist
|
||||
# Move the converted flac files to the sub folder
|
||||
#
|
||||
# Final
|
||||
# Check if OUTPUT_DIR has the folder structure. Delete if so
|
||||
# Move the folder and sub folder to OUTPUT_DIR
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
my_text="No arguments provided. Provide four arguments:\n"
|
||||
my_text+="script.zsh \"working_dir\" \"output_dir\" \"folder_name\" \"sub_folder_name\""
|
||||
|
||||
echo "$my_text"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -n "$2" ]]; then
|
||||
echo "The \"output_dir\" has not been provided"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -n "$3" ]]; then
|
||||
echo "The \"folder_name\" has not been provided"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -n "$4" ]]; then
|
||||
echo "The \"sub_folder_name\" has not been provided"
|
||||
exit
|
||||
fi
|
||||
|
||||
WORK_DIR=$1
|
||||
OUTPUT_DIR=$2
|
||||
FOLDER=$3
|
||||
SUB_FOLDER=$4
|
||||
|
||||
# Validation
|
||||
|
||||
if [[ ! -d $WORK_DIR ]]; then
|
||||
echo "$WORK_DIR is not a directory"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -d $OUTPUT_DIR ]]; then
|
||||
echo "$OUTPUT_DIR does not exist"
|
||||
exit
|
||||
fi
|
||||
|
||||
FOLDER_DIR="$OUTPUT_DIR/$FOLDER"
|
||||
|
||||
if [[ ! -d $FOLDER_DIR ]]; then
|
||||
echo "$FOLDER_DIR directory does not exist. Creating directory"
|
||||
mkdir $FOLDER_DIR
|
||||
echo "Created $FOLDER_DIR directory"
|
||||
fi
|
||||
|
||||
FOLDER_DIR="$FOLDER_DIR/$SUB_FOLDER"
|
||||
|
||||
if [[ ! -d $FOLDER_DIR ]]; then
|
||||
echo "$FOLDER_DIR directory does not exist. Creating directory"
|
||||
mkdir $FOLDER_DIR
|
||||
echo "Created $FOLDER_DIR directory"
|
||||
fi
|
||||
|
||||
# Find all files matching the pattern in the directory
|
||||
matched_files=( "$WORK_DIR"/*.wav )
|
||||
|
||||
# Check if any files were found
|
||||
if [[ ${#matched_files[@]} -gt 0 ]]; then
|
||||
echo "Files matching the pattern exist in the directory:"
|
||||
else
|
||||
echo "No files matching the pattern were found."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Working directory: $WORK_DIR"
|
||||
echo "Output directory: $OUTPUT_DIR"
|
||||
echo "Folder name: $FOLDER"
|
||||
echo "Sub folder name: $SUB_FOLDER"
|
||||
|
||||
# Conversion
|
||||
i=1
|
||||
|
||||
for file in "${matched_files[@]}"; do
|
||||
file_output="track"
|
||||
|
||||
if [[ $i -lt 10 ]]; then
|
||||
file_output="track0$i.flac"
|
||||
else
|
||||
file_output="track$i.flac"
|
||||
fi
|
||||
|
||||
echo "$i file: $file"
|
||||
|
||||
output_file_path="$FOLDER_DIR/$file_output"
|
||||
echo "Output file path: $output_file_path"
|
||||
|
||||
echo "Converting wav file to flac"
|
||||
flac --best $file -o $output_file_path
|
||||
|
||||
ALBUM_FILE="$WORK_DIR/new-album.json"
|
||||
TARGET_ALBUM_FILE="$FOLDER_DIR/album.json"
|
||||
|
||||
if [[ -f $ALBUM_FILE ]]; then
|
||||
echo "Copying album file"
|
||||
cp -a $ALBUM_FILE $TARGET_ALBUM_FILE
|
||||
fi
|
||||
|
||||
matched_img_files=( "$WORK_DIR"/*.[j,J,p,P][p,P,n,N]* )
|
||||
|
||||
# Check if any files were found
|
||||
if [[ ${#matched_img_files[@]} -gt 0 ]]; then
|
||||
echo "Files matching the pattern exist in the directory:"
|
||||
echo "Copying cover art file(s)"
|
||||
|
||||
for img_file in "${matched_img_files[@]}"; do
|
||||
cp -a $img_file $FOLDER_DIR
|
||||
done
|
||||
fi
|
||||
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user