Hacker News new | ask | show | jobs
by codetrotter 1706 days ago
> there is a metadata file alongside though and a album-cover.jpg

Is the metadata file in a format that you made yourself or was it produced by a third-party piece of software? And is it text based or binary format?

> There's a lot of Android and Linux based front-ends but most of them insist on only indexing locally stored music, and also only supporting file types with built-in metadata support, even though my music is stored in a logical Artist/Album/Track.wav folder/file naming convention.

Ok, so if we start off with that part of it, and we ignore the additional metadata file for now.

> stored on a central file server currently only accessible via SMB/CIFS.

Can you SSH into the server? Or alternatively, manage the server with a locally connected keyboard and monitor? Or is this some kind of NAS box that does not allow you to do any of those kinds of things?

Because I have a couple of ideas but it will depend on the specifics of your setup.

2 comments

Metadata is XML, but could be easily converted post ripping (as a scheduled batch process I guess)

It's currently a file share on a Windows Server box, but at some point will probably move to a dedicated NAS (due to rising energy costs)

> It's currently a file share on a Windows Server box

I see. I don’t know if the following will really be helpful since there may be some nuances that will differ a bit. But if that installation of Windows has WSL then hopefully the following might be helpful.

In summary, my idea is as follows: If you have enough space on the server for it, you could create a new top-level directory next to the one that you currently have for your music, and then create a script that loops over all of the files, transcoding them to flac with ffmpeg and adding metadata with a flac metadata edit tool. (ffmpeg can edit flac metadata too, but I think a dedicated flac metadata edit tool will be more straight forward to use).

So on KDE Neon Linux and other Ubuntu based distros, here’s what I’d do, and hoping this might be somehow useful even though you are using Windows:

First install ffmpeg, lltag and mediainfo if you don’t have them already:

    sudo apt install ffmpeg lltag mediainfo
Then let’s say that the directory hierarchy for your music was at /data/Music/ so you’d have "/data/Music/Steppenwolf/For Ladies Only/3. Shackles and Chains.wav" etc.

Then I’d create a new directory next to the Music directory and name that one "flacs" for example:

    mkdir /data/flacs
Transcoding and tagging. For now we include only artist name, album name and track names, extracted from the directory names and file names in your hierarchy, omitting other metadata such as for example the album cover art. But since we retain all of your original data, you can at a later point delete these flac files and do a transcoding and tagging run where you include more metadata (or do a run that keeps the transcoded files and only edits the metadata of them if you'd like). The idea for now is to do something simple as a first step, and then you can refine it in the future.

    origdir="/data/Music"
    flacdir="/data/flacs"
    find "${origdir}" -mindepth 1 -maxdepth 1 -type d | xargs -I{} basename '{}' | while IFS= read artist ; do
      mkdir -p "${flacdir}/${artist}"
      find "${origdir}/${artist}/" -mindepth 1 -maxdepth 1 -type d | xargs -I{} basename '{}' | while IFS= read album ; do
        mkdir -p "${flacdir}/${artist}/${album}"
        find "${origdir}/${artist}/${album}/" -mindepth 1 -maxdepth 1 -type f -name '*.wav' | xargs -I{} basename '{}' | while IFS= read trackwav ; do
          tracktitle="${trackwav%.*}"
          ffmpeg -i "${origdir}/${artist}/${album}/${trackwav}" "${flacdir}/${artist}/${album}/${tracktitle}.flac"
          lltag --clear -a "${artist}" -t "${tracktitle}" -A "${album}" --yes "${flacdir}/${artist}/${album}/${tracktitle}.flac"
        done
      done
    done
And now if we look at one of the transcoded files with mediainfo:

    mediainfo "/data/flacs/Steppenwolf/For Ladies Only/3. Shackles and Chains.flac"
Then we see among the lines of the output the following, showing us that we have successfully tagged the transcoded file with artist, album and track title:

    Album                                    : For Ladies Only
    Track name                               : 3. Shackles and Chains
    Performer                                : Steppenwolf
And likewise for all of the other files. All transcoded to flac and tagged with artist, album and track title.

And your original wav files and other data remains unchanged where they were, so that you can do more detailed tagging etc in the future.

Thanks for your detailed response! I'll certainly look into creating a mirror copy of my music library as this seems the best way to be compatible with commercial and open source front ends. I'll favourite your comment, and come back to it when I need to.

Also, how did you know that I like Steppenwolf?! :D

> Also, how did you know that I like Steppenwolf?! :D

I figured that anyone that appreciates music so much that they maintain a collection of music files on their machine would probably appreciate Steppenwolf :)

Is there a sort of universal format for music metadata? I know image metadata has XMP.
id3 is the standard for music metadata

https://id3.org/

Looks like it's a standard for embedding within MP3 files. But ss there ecosystem support for reading it from a "sidecar" file? I know digikam can read XMP data from a file that lives alongside image files that don't support such embedding.