Added convertFLACtoALAC.sh. Not finished yet though.

master
parent 9a34944e30
commit ff50607e6d

@ -12,6 +12,9 @@ This script was written to automatically sync the backups I create on my server
This script will convert your HEIC files (a format Apple saves photos with) to JPGs. Flip saveasjpg at the top to save as PNG instead. This will result in much larger file sizes. Set keeporiginals to 0 to delete the HEIC files after they're converted. The HEIC files are saved kept around by default. For best results set this up as a cron job. This script will convert your HEIC files (a format Apple saves photos with) to JPGs. Flip saveasjpg at the top to save as PNG instead. This will result in much larger file sizes. Set keeporiginals to 0 to delete the HEIC files after they're converted. The HEIC files are saved kept around by default. For best results set this up as a cron job.
\* Requires the ImageMagick CLI software to be installed with HEIC support. There are links at the top of the script to do this. \* Requires the ImageMagick CLI software to be installed with HEIC support. There are links at the top of the script to do this.
**convertFLACtoALAC.sh**
This script converts files from the FLAC format to the ALAC format (Apple's lossless codec). For some reason iOS doesn't natively support FLAC in the default music app so this is my way to make it work.
**cleanupBeatSaberSongs.sh** **cleanupBeatSaberSongs.sh**
I wrote this script because I was tired of using the excuse that the folder names are jibberish (98e299036de1688c3f60cda87728ee3c2969188<wbr>8 for example) to not clean up my custom song library. This script goes through all the folders that are 40 characters long (didn't check for only hexadecimal characters so be warned ye ol 40 character song titles), extracts information from their info.dat files (in 2 ways funny enough), and renames the folders to the actual song names with the artist and mapper separated by hyphens. This way if you happen to have a song mapped by different people they don't get overwritten. I wrote this script because I was tired of using the excuse that the folder names are jibberish (98e299036de1688c3f60cda87728ee3c2969188<wbr>8 for example) to not clean up my custom song library. This script goes through all the folders that are 40 characters long (didn't check for only hexadecimal characters so be warned ye ol 40 character song titles), extracts information from their info.dat files (in 2 ways funny enough), and renames the folders to the actual song names with the artist and mapper separated by hyphens. This way if you happen to have a song mapped by different people they don't get overwritten.

@ -0,0 +1,90 @@
#!/bin/bash
# Default to the current directory if none provided
# https://stackoverflow.com/a/48829326
dir="${1:-.}"
dbg=$1
# Colors are fun
blk=$(tput setaf 0);red=$(tput setaf 1);grn=$(tput setaf 2)
ylw=$(tput setaf 3);blu=$(tput setaf 4);cyn=$(tput setaf 6)
wht=$(tput setaf 7);und=$(tput smul);bld=$(tput bold)
# Uncoloring is important
rst=$(tput sgr0)
function dependencycheck() {
which ffmpeg
if [[ $? -eq 1 ]]; then
die "Dependency check failed. ffmpeg not found."
fi
}
major=0;minor=0;
function getversion() {
# This script was written with 4.4. Other versions may work but are untested
#local version=5.5 #`ffmpeg -version | head -n1 | cut -d' ' -f3 | cut -d- -f1`
major=`echo $version | cut -d. -f1`
minor=`echo $version | cut -d. -f2`
}
function die() {
echo -en ${rst}${red}Exiting for: ${rst}
echo -e ${rst}${2:-$red}${1}${rst}
[[ $dbg != "--dont-die" ]] && exit 1
}
function warn() {
echo -en ${rst}${ylw}Warning: ${rst}
echo -e ${rst}${2:-$ylw}${1}${rst}
}
function info() {
echo -en ${rst}${blu}Info: ${rst}
echo -e ${rst}${2:-$blu}
}
function checkversion() {
if [[ $major -eq 0 && $minor -eq 0 ]]; then
die "version check failed."
fi
if [[ $major -lt 4 || $major -eq 4 && $minor -lt 4 ]]; then
warn "ffmpeg version less than 4.4 ($major.$minor). This script may work but it has not been tested"
fi
}
# trap ctrl-c and call ctrl_c()
# https://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash
trap ctrl_c INT
function ctrl_c() {
tput cnorm
echo "${rst}${red}CTRL+C Detected, exiting.${rst}"
exit
}
function convertfile () {
# https://stackoverflow.com/a/62520505
local file=$1
local filename=`echo $file | rev | cut -d. -f2- | rev`
ffmpeg -i $filename.flac -c:v copy -c:a alac $filename.m4a
}
###############################################################
# _| _| _| _| #
# _|_| _|_| _|_|_| _|_|_| _|_|_| _| #
# _| _| _| _| _| _| _| _| _| _| #
# _| _| _| _| _| _| _| _| _| #
# _| _| _|_|_| _|_|_| _| _|_|_| _| _| _| #
# _| _|_|_| #
# _|_| _| #
###############################################################
dependencycheck
getversion
checkversion
Loading…
Cancel
Save