volumio / Volumio2

Volumio 2 - Audiophile Music Player
http://volumio.org
Other
1.37k stars 316 forks source link

Local Music stored in /data/INTERNAL without an ID3 tag is not being discovered #1335

Open TheSnoozer opened 7 years ago

TheSnoozer commented 7 years ago

Hi, first of all thanks for this great music player :-) I recently started using it, so this might be a thing that can be configured somewhere but I haven't found any reference/documentation about it. So in general I copied a bit of my Music to /data/INTERNAL (which should pop up in the getting-started guide somewhere) and I noticed that not all of my music is being found by the volumio music search.

When connected with ssh a search for ".mp3" `find /data/INTERNAL -type f -name ".mp3" | wc -lresults in1619` files however the web interface tells me that about 467 tracks (http://volumio.local/plugin/system_controller-networkfs) have been found.

My Folder structure can be breaken down to the following:

/data/INTERNAL/Anberlin/The Feel Good Drag.mp3
/data/INTERNAL/The Vision Bleak/Into the Unknown.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/11. The Road.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/09. White Line Fever.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/15. Someone, Somewhere (Ben Bruce Acoustic).mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/10. Moving On.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/06. Poison.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/12. Until The End.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/03. The Death Of Me.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/05. Break Down The Walls.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/01. Don't Pray For Me.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/08. Creature.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/07. Believe.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/04. Run Free.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/14. Dead.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/02. Killing You.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/13. The Death Of Me (Rock Mix) (Bonus Track).mp3

the difference can be summarized as /data/INTERNAL/${ARTIST}/${ALBUMNAME}/*.mp3 VS. /data/INTERNAL/${ARTIST}/*.mp3 or even /data/INTERNAL/*.mp3.

TLDR

The songs stored inside /data/INTERNAL/${ARTIST}/*.mp3 are not being found by the volumio music search. I would propose to have a configuration that allows this to be found with an Untitled or Unknown-Album-Name. This would even apply for songs without a missing artist and album-name (aka. stored inside /data/INTERNAL/*.mp3)

TheSnoozer commented 7 years ago

Even when moving the files to an Untitled folder with the below script the mp3-files are not being found.

Current folder structure:

/data/INTERNAL/The Vision Bleak/Untitled/Into the Unknown.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/11. The Road.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/09. White Line Fever.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/15. Someone, Somewhere (Ben Bruce Acoustic).mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/10. Moving On.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/06. Poison.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/12. Until The End.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/03. The Death Of Me.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/05. Break Down The Walls.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/01. Don't Pray For Me.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/08. Creature.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/07. Believe.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/04. Run Free.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/14. Dead.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/02. Killing You.mp3
/data/INTERNAL/Asking Alexandria/From Death To Destiny/13. The Death Of Me (Rock Mix) (Bonus Track).mp3
/data/INTERNAL/Asking Alexandria/Untitled/Alerion.mp3
/data/INTERNAL/Asking Alexandria/Untitled/The Death Of Me - Rock Mix.mp3
/data/INTERNAL/Asking Alexandria/Untitled/The Final Episode  Let s Change Channel .mp3
/data/INTERNAL/Asking Alexandria/Untitled/The Black.mp3

Script used for moving the files:

#!/bin/bash
find . -maxdepth 2 -name '*.mp3' |
{
    while read FNAME
    do
    DIR=${FNAME%/*}
    FILE=${FNAME##*/}
    FULLPATH="$DIR/Untitled/"

    echo "mkdir -p \"$FULLPATH\""
    mkdir -p "$FULLPATH"

    echo "mv \"$FNAME\" \"$FULLPATH\""
    mv "$FNAME" "$FULLPATH"
    done
}

Consider this script free and as unencumbered software released into the public domain.

TheSnoozer commented 7 years ago

I think i figured out why the files are not being displayed which makes this even more annoying. Interestingly my MP3s located inside /data/INTERNAL/${ARTIST}/${ALBUMNAME}/*.mp3 do have a valid id3v2 tag info and those located inside /data/INTERNAL/${ARTIST}/*.mp3 don't have this...

sudo apt-get install id3v2

Example song that shows up:

$ id3v2 -l /data/INTERNAL/Asking\ Alexandria/From\ Death\ To\ Destiny/01.\ Don\'t\ Pray\ For\ Me.mp3 
id3v2 tag info for 01. Don't Pray For Me.mp3:
TALB (Album/Movie/Show title): From Death To Destiny
TPE1 (Lead performer(s)/Soloist(s)): Asking Alexandria
TPE2 (Band/orchestra/accompaniment): Asking Alexandria
TPOS (Part of a set): 1/1
TIT2 (Title/songname/content description): Don't Pray For Me
TRCK (Track number/Position in set): 01/15
TYER (Year): 2013
APIC (Attached picture): ()[, 3]: image/jpeg, 65873 bytes

Example song that didn't show up:

$ id3v2 -l /data/INTERNAL/Asking\ Alexandria/Untitled/01.\ Alerion.mp3 
01. Alerion.mp3: No ID3 tag

After adjusting the ID-Tag with id3v2 -a "Asking Alexandria" -A "Untitled" -t "Alerion" 01.\ Alerion.mp3 the song showed up in the playlist...

Edit: Sample workaround script to fix it: Note: Script assumes that files are stored inside the /data/INTERNAL/${ARTIST}/${ALBUMNAME}/*.mp3 layout fashion and then tries to extract the corresponding information.

#!/bin/bash -u
find . -name "*.mp3" |
{
  while read FNAME
  do
    filePattern='^\./[^/]*/[^/]*/[^/]*\.mp3$'
    if [ -n "$FNAME" -a -z "${FNAME/*$filePattern*}" ] ; then
      exit 1
    else
      id3v2 -l "${FNAME}" | grep 'No ID3 tag' &> /dev/null
      if [ $? == 0 ]; then
        echo "${FNAME} processing....";
        FULLDIR=${FNAME%/*}
        CURRENTDIR=$(basename "$FULLDIR")
        PARENTDIR=$(dirname "$FULLDIR")
        MP3_FILE_NAME=${FNAME##*/}

        ARTIST=${PARENTDIR#./}
        ALBUM=${CURRENTDIR}
        TITLE=${MP3_FILE_NAME%.mp3}

        echo "  id3v2 -a \"${ARTIST}\" -A \"${ALBUM}\" -t \"${TITLE}\" \"${FNAME}\" -c \"MP3-Tag assigned automatically\""
        id3v2 -a "${ARTIST}" -A "${ALBUM}" -t "${TITLE}" "${FNAME}" -c "MP3-Tag assigned automatically"
      fi
    fi
  done
}

echo "DONE...";

Consider this script free and as unencumbered software released into the public domain.