Added variable width for coverart
This commit is contained in:
parent
344efcc38b
commit
b6cf8005e4
@ -11,6 +11,7 @@ bitrate=192
|
|||||||
help=false
|
help=false
|
||||||
temp="/tmp/converted"
|
temp="/tmp/converted"
|
||||||
convertart=false
|
convertart=false
|
||||||
|
coverartsize=200
|
||||||
|
|
||||||
CheckDeps() {
|
CheckDeps() {
|
||||||
if [[ $1 == 0 ]]; then
|
if [[ $1 == 0 ]]; then
|
||||||
@ -59,8 +60,8 @@ CheckDeps() {
|
|||||||
GetOptions() {
|
GetOptions() {
|
||||||
|
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=s:d:t:cab:v::h
|
OPTIONS=s:d:t:ca::b:v::h
|
||||||
LONGOPTS=source:,dest:,temp:,convert,convert-art,bitrate:,verbose::,help
|
LONGOPTS=source:,dest:,temp:,convert,convert-art::,bitrate:,verbose::,help
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -110,6 +111,11 @@ GetOptions() {
|
|||||||
;;
|
;;
|
||||||
-a|--convert-art)
|
-a|--convert-art)
|
||||||
convertart=true
|
convertart=true
|
||||||
|
coverartsize=200
|
||||||
|
if [[ $2 != "" ]]; then
|
||||||
|
coverartsize=${2}
|
||||||
|
shift
|
||||||
|
fi
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-b|--bitrate)
|
-b|--bitrate)
|
||||||
@ -149,14 +155,14 @@ Usage() {
|
|||||||
echo "Syncronises music from one folder to another."
|
echo "Syncronises music from one folder to another."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -s, --source <source> The source folder of the music"
|
echo " -s, --source <source> The source folder of the music"
|
||||||
echo " -d, --dest <destination> The destionation folder of the music"
|
echo " -d, --dest <destination> The destionation folder of the music"
|
||||||
echo " -t, --temp <folder> The temporary cache for converted files (default: /tmp/converted)"
|
echo " -t, --temp <folder> The temporary cache for converted files (default: /tmp/converted)"
|
||||||
echo " -c, --convert Convert files before syncing"
|
echo " -c, --convert Convert files before syncing"
|
||||||
echo " -a, --convert-art Convert album-art before syncing"
|
echo " -a, --convert-art <width> Convert album-art before syncing (default width: 200)"
|
||||||
echo " -b, --bitrate When converting use this bitrate"
|
echo " -b, --bitrate When converting use this bitrate"
|
||||||
echo " -v, --verbose <0-6> Set log level (default: 2)"
|
echo " -v, --verbose <0-6> Set log level (default: 2)"
|
||||||
echo " -h, --help Display this help text"
|
echo " -h, --help Display this help text"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Log levels:"
|
echo "Log levels:"
|
||||||
echo " 0 | Verbose"
|
echo " 0 | Verbose"
|
||||||
@ -254,7 +260,7 @@ ConvertFiles() {
|
|||||||
if [[ $convertart == true ]]; then
|
if [[ $convertart == true ]]; then
|
||||||
mkdir -p "$temp/$line-images/"
|
mkdir -p "$temp/$line-images/"
|
||||||
eyeD3 --write-images "$temp/$line-images/" "$temp/$line" 1>/dev/null 2>/dev/null
|
eyeD3 --write-images "$temp/$line-images/" "$temp/$line" 1>/dev/null 2>/dev/null
|
||||||
convert "$temp/$line-images/FRONT_COVER.*" -resize 200x200 "$temp/$line-images/FRONT_COVER.jpg" 1>/dev/null 2>/dev/null
|
convert "$temp/$line-images/FRONT_COVER.*" -resize ${coverartsize}x${coverartsize} "$temp/$line-images/FRONT_COVER.jpg" 1>/dev/null 2>/dev/null
|
||||||
eyeD3 --remove-all-images "$temp/$line" 1>/dev/null 2>/dev/null
|
eyeD3 --remove-all-images "$temp/$line" 1>/dev/null 2>/dev/null
|
||||||
eyeD3 --add-image "$temp/$line-images/FRONT_COVER.jpg:FRONT_COVER" "$temp/$line" 1>/dev/null 2>/dev/null
|
eyeD3 --add-image "$temp/$line-images/FRONT_COVER.jpg:FRONT_COVER" "$temp/$line" 1>/dev/null 2>/dev/null
|
||||||
VerboseOutput 2 "Converted cover art: $line"
|
VerboseOutput 2 "Converted cover art: $line"
|
||||||
|
Loading…
Reference in New Issue
Block a user