Bug 36 - Album art stored in wrong directory
Summary: Album art stored in wrong directory
Status: CONFIRMED
Alias: None
Product: abcde
Classification: Unclassified
Component: Album art (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Assignee: Andrew Strong
URL:
Depends on:
Blocks:
 
Reported: 2016-07-19 07:39 BST by Peter Hülstede
Modified: 2020-04-07 12:36 BST (History)
3 users (show)

See Also:


Attachments
Patch to fix (702 bytes, patch)
2020-04-07 12:35 BST, Patrick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hülstede 2016-07-19 07:39:37 BST
When the OUTPUTFORMAT is "${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM} ${TRACKFILE}" the album art is stored in the artist directory instead of the album directory.

The reason is that in this case the ALBUMARTDIR in do_getalbumart() is "Artist/Album/".
do_getalbumart() then calls $(dirname "$OUPUTDIR/$ALBUMARTDIR") and ends up with "Artist/", which is not how it was intended.

A possible fix is to check for the trailing slash before calling dirname:

    FINALALBUMARTDIR="$OUTPUTDIR/$ALBUMARTDIR"
    if [ "${FINALALBUMARTDIR: -1}" != "/" ] ; then
        FINALALBUMARTDIR="$(dirname "$OUTPUTDIR/$ALBUMARTDIR")"
 
instead of

    FINALALBUMARTDIR="$(dirname "$OUTPUTDIR/$ALBUMARTDIR")"

in abcde do_getalbumart() line 3238.
Comment 1 Ethan 2017-08-13 07:12:39 BST
(In reply to Peter Hülstede from comment #0)
> When the OUTPUTFORMAT is "${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}
> ${TRACKFILE}" the album art is stored in the artist directory instead of the
> album directory.
> 
> The reason is that in this case the ALBUMARTDIR in do_getalbumart() is
> "Artist/Album/".
> do_getalbumart() then calls $(dirname "$OUPUTDIR/$ALBUMARTDIR") and ends up
> with "Artist/", which is not how it was intended.
> 
> A possible fix is to check for the trailing slash before calling dirname:
> 
>     FINALALBUMARTDIR="$OUTPUTDIR/$ALBUMARTDIR"
>     if [ "${FINALALBUMARTDIR: -1}" != "/" ] ; then
>         FINALALBUMARTDIR="$(dirname "$OUTPUTDIR/$ALBUMARTDIR")"
>  
> instead of
> 
>     FINALALBUMARTDIR="$(dirname "$OUTPUTDIR/$ALBUMARTDIR")"
> 
> in abcde do_getalbumart() line 3238.

I think this should work:
     FINALALBUMARTDIR="$OUTPUTDIR/${ALBUMARTDIR%/*}"
Comment 2 Patrick 2020-04-07 12:35:44 BST
Created attachment 90 [details]
Patch to fix
Comment 3 Patrick 2020-04-07 12:36:41 BST
Alternatively, add a string to the end of the $OUTPUTFORMAT (etc) variables when deriving the ALBUMARTDIR - attached patch does just that.