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: 2017-08-13 07:12 BST (History)
2 users (show)

See Also:


Attachments

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%/*}"