albumsetup fallback for real

This commit is contained in:
yosh 2023-12-25 11:42:32 -06:00
parent e7abdd6793
commit 3ced9c9fbc
1 changed files with 8 additions and 8 deletions

View File

@ -69,7 +69,7 @@ extract_cover() {
mp3) ffmpeg -nostdin -i "$1" -map "0:v:0" -c:v copy "$2" ;;
*) die 'unknown filetype' ;;
esac
} >/dev/null
} >/dev/null 2>&1
set -e
# resize within the bounds of 1280x720
# if it's square then make it 722x720 so youtube doesn't make it a short
@ -78,14 +78,14 @@ extract_cover() {
# sets COVER_PIC for use in convert_vid
set_cover() {
tmp="$(mktemp -u -t ALBUMSETUP_COVER_XXXX)"
extract_cover "$1" "$tmp"
if [ -f "$tmp" ]; then
COVER_PICTURE="$tmp"
COVER_PICTURE="$(mktemp -u)"
extract_cover "$1" "$COVER_PICTURE"
if [ -f "$COVER_PICTURE" ]; then
:
elif [ -f "track$TRACKNUMBER.png" ]; then
COVER_PICTURE="track$TRACKNUMBER.png"
cp "track$TRACKNUMBER.png" "$COVER_PICTURE"
else
COVER_PICTURE="$DEFAULT_PICTURE"
cp "$DEFAULT_PICTURE" "$COVER_PICTURE"
fi
}
@ -114,7 +114,7 @@ shift "$((OPTIND - 1))"
mkdir -p "$OUTDIR"
# default cover image, fallback if tracks don't have embedded art
DEFAULT_PICTURE="$(mktemp -u ALBUMSETUP_DEFAULT_PIC.XXXX)"
DEFAULT_PICTURE="$(mktemp -u)"
magick convert "$tmpcover" -resize 1280x720 -background black -gravity center -extent 722x720 "$DEFAULT_PICTURE"
# copy audio codec if opus since output codec is opus