1.0.014 - improved tag fixes, added opus support

pull/139/head
RandomNinjaAtk 2 years ago committed by GitHub
parent 2093d5089c
commit 6643dac16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion=1.0.013 scriptVersion=1.0.014
if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
if [ "$lidarrUrlBase" == "null" ]; then if [ "$lidarrUrlBase" == "null" ]; then
@ -71,14 +71,16 @@ find "$getFolderPath" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 |
if [ "$fileExt" == "flac" ]; then if [ "$fileExt" == "flac" ]; then
log "Processing :: $getAlbumFolderName :: $fileName :: Getting Lyrics from embedded metadata" log "Processing :: $getAlbumFolderName :: $fileName :: Getting Lyrics from embedded metadata"
getLyrics="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.LYRICS" | sed "s/null//g" | sed "/^$/d")" getLyrics="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.LYRICS" 2>/dev/null | sed "s/null//g" | sed "/^$/d")"
log "Processing :: $getAlbumFolderName :: $fileName :: Getting ARTIST_CREDIT from embedded metadata" log "Processing :: $getAlbumFolderName :: $fileName :: Getting ARTIST_CREDIT from embedded metadata"
getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.ARTIST_CREDIT" | sed "s/null//g" | sed "/^$/d")" getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.ARTIST_CREDIT" 2>/dev/null | sed "s/null//g" | sed "/^$/d")"
fi fi
if [ "$fileExt" == "opus" ]; then if [ "$fileExt" == "opus" ]; then
log "Processing :: $getAlbumFolderName :: $fileName :: Getting Lyrics from embedded metadata" log "Processing :: $getAlbumFolderName :: $fileName :: Getting Lyrics from embedded metadata"
getLyrics="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".streams[].tags.LYRICS" | sed "s/null//g" | sed "/^$/d")" getLyrics="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".streams[].tags.LYRICS" 2>/dev/null | sed "s/null//g" | sed "/^$/d")"
log "Processing :: $getAlbumFolderName :: $fileName :: Getting ARTIST_CREDIT from embedded metadata"
getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".streams[].tags.ARTIST_CREDIT" 2>/dev/null | sed "s/null//g" | sed "/^$/d")"
fi fi
if [ ! -z "$getLyrics" ]; then if [ ! -z "$getLyrics" ]; then
@ -93,10 +95,28 @@ find "$getFolderPath" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 |
if [ "$fileExt" == "flac" ]; then if [ "$fileExt" == "flac" ]; then
if [ ! -z "$getArtistCredit" ]; then if [ ! -z "$getArtistCredit" ]; then
log "Processing :: $getAlbumFolderName :: $fileName :: Setting ARTIST tag to match ARTIST_CREDIT tag..." log "Processing :: $getAlbumFolderName :: $fileName :: Setting ARTIST tag to match ARTIST_CREDIT ($getArtistCredit) tag..."
metaflac --remove-tag=ARTIST "$file" metaflac --remove-tag=ARTIST "$file"
metaflac --remove-tag=ALBUMARTIST "$file"
metaflac --set-tag=ARTIST="$getArtistCredit" "$file" metaflac --set-tag=ARTIST="$getArtistCredit" "$file"
metaflac --set-tag=ALBUMARTIST="$getAlbumArtist" "$file"
else
log "Processing :: $getAlbumFolderName :: $fileName :: ARTIST_CREDIT not found..."
metaflac --remove-tag=ARTIST "$file"
metaflac --remove-tag=ALBUMARTIST "$file"
metaflac --set-tag=ARTIST="$getAlbumArtist" "$file"
metaflac --set-tag=ALBUMARTIST="$getAlbumArtist" "$file"
fi
fi
if [ "$fileExt" == "opus" ]; then
if [ ! -z "$getArtistCredit" ]; then
log "Processing :: $getAlbumFolderName :: $fileName :: Setting ARTIST tag to match ARTIST_CREDIT ($getArtistCredit) tag..."
python3 "/config/extended/scripts/tag_opus.py" --file "$file" --songartist "$getArtistCredit" --songalbumartist "$getAlbumArtist"
log "Processing :: $getAlbumFolderName :: $fileName :: Done!"
else else
python3 "/config/extended/scripts/tag_opus.py" --file "$file" --songartist "$getAlbumArtist" --songalbumartist "$getAlbumArtist"
log "Processing :: $getAlbumFolderName :: $fileName :: ARTIST_CREDIT not found..." log "Processing :: $getAlbumFolderName :: $fileName :: ARTIST_CREDIT not found..."
fi fi
fi fi

Loading…
Cancel
Save