Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Upcoming moOde 8.1.2 release
#1
Hi,

Here are draft release notes for upcoming moOde 8.1.2 release.

Code:
################################################################################
#
# 2022-MM-DD TC moOde 8.1.2
#
################################################################################

Updates

- UPD: Improve support for non-embedded cue/flac format
- UPD: Add Gulp cachebuster to help prevent stale Browser cache after updates
- UPD: Help text for MPD options section in Audio Config

Bug fixes

- FIX: Cover art not showing for album directories in Folder view
- FIX: File name for UPnP album art fetcher
- FIX: File name for MPD conf merge utility
- FIX: Value for PHP max_input_vars limiting Queue to 1000 items
- FIX: Missing 32-bit variant for librespot for arm6
- FIX: Function encodeURIComponent() not being applied to cover thumb hash
- FIX: Missing alsa.php library causing BlueZ Config to crash
- FIX: Missing alsa.php library causing Squeezelite Config to crash
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#2
(07-03-2022, 03:39 AM)Tim Curtis Wrote: Hi,

Here are draft release notes for upcoming moOde 8.1.2 release.

Code:
################################################################################
#
# 2022-MM-DD TC moOde 8.1.2
#
################################################################################

Updates

- UPD: Improve support for non-embedded cue/flac format
- UPD: Add Gulp cachebuster to help prevent stale Browser cache after updates
- UPD: Help text for MPD options section in Audio Config

Bug fixes

- FIX: Cover art not showing for album directories in Folder view
- FIX: File name for UPnP album art fetcher
- FIX: File name for MPD conf merge utility
- FIX: Value for PHP max_input_vars limiting Queue to 1000 items
- FIX: Missing 32-bit variant for librespot for arm6
- FIX: Function encodeURIComponent() not being applied to cover thumb hash
- FIX: Missing alsa.php library causing BlueZ Config to crash
- FIX: Missing alsa.php library causing Squeezelite Config to crash

Hi Tim,

excellent. What do you mean with "Improve support for non-embedded cue/flac format"? So far I have tested extensively such thing, and works perfectly (apart from the bug not showing album art due to incorrect resulting containing folder, which I fixed).

Cheers, Al.
Reply
#3
Currently moOde code does not correctly parse the cover art and tracks from cue/flac format either non-embedded cue or embedded cue. The non-embedded format is much more straight forward and so thats where the improvements were made.

By non-embedded cue I mean there is a separate flac and cue file in the Album directory and the flac file does not contain an embedded cue sheet. I used XLD to create the example test files.

Example:

Code:
pi@moode:~ $ ls -l /media/VFAT128/Test_mixed/cue-test-no-embedded/
total 229504
-rw-r--r-- 1 root root      1388 Jun 27 02:56 Spectrum.cue
-rw-r--r-- 1 root root 234972804 Jun 27 02:56 Spectrum.flac

pi@moode:~ $ metaflac --list --block-number=2 /media/VFAT128/Test_mixed/cue-test-no-embedded/Spectrum.flac 
METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 198
  vendor string: reference libFLAC 1.3.3 20190804
  comments: 7
    comment[0]: ENCODER=X Lossless Decoder 20211018
    comment[1]: ALBUM=Spectrum
    comment[2]: GENRE=Jazz
    comment[3]: COMPOSER=Billy Cobham
    comment[4]: ALBUMARTIST=Billy Cobham
    comment[5]: DATE=1973
    comment[6]: MCN=4943674071838

Folder view
This shows the drill down starting with the Album directory "cue-test-no-embedded". When this is clicked the cue virtual directory named "Spectrum" is displayed. When this is clicked the tracks are displayed.
               

Audio info for one of the tracks
   

Playback and Playbar showing the embedded cover art in the flac file and the thumbnails for the Queue and Playbar that were generated during Library update.
         

Tag and Album view. There is still a bogus album header in the tracks list but this should be fixed for the upcoming 8.1.2 release.
         
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
(07-03-2022, 12:04 PM)Tim Curtis Wrote: Currently moOde code does not correctly parse the cover art and tracks from cue/flac format either non-embedded cue or embedded cue. The non-embedded format is much more straight forward and so thats where the improvements were made.

By non-embedded cue I mean there is a separate flac and cue file in the Album directory and the flac file does not contain an embedded cue sheet. I used XLD to create the example test files.

Example:

Code:
pi@moode:~ $ ls -l /media/VFAT128/Test_mixed/cue-test-no-embedded/
total 229504
-rw-r--r-- 1 root root      1388 Jun 27 02:56 Spectrum.cue
-rw-r--r-- 1 root root 234972804 Jun 27 02:56 Spectrum.flac

pi@moode:~ $ metaflac --list --block-number=2 /media/VFAT128/Test_mixed/cue-test-no-embedded/Spectrum.flac 
METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 198
  vendor string: reference libFLAC 1.3.3 20190804
  comments: 7
    comment[0]: ENCODER=X Lossless Decoder 20211018
    comment[1]: ALBUM=Spectrum
    comment[2]: GENRE=Jazz
    comment[3]: COMPOSER=Billy Cobham
    comment[4]: ALBUMARTIST=Billy Cobham
    comment[5]: DATE=1973
    comment[6]: MCN=4943674071838

Folder view
This shows the drill down starting with the Album directory "cue-test-no-embedded". When this is clicked the cue virtual directory named "Spectrum" is displayed. When this is clicked the tracks are displayed.
  

Audio info for one of the tracks


Playback and Playbar showing the embedded cover art in the flac file and the thumbnails for the Queue and Playbar that were generated during Library update.
 

Tag and Album view. There is still a bogus album header in the tracks list but this should be fixed for the upcoming 8.1.2 release.
 

The first five images reflect exactly how it is currently working on my "branch".
The main problem with album art was the appended "track0005" (for example) which resulted in the parent folder being the name of the cue file, messing up things (checked for ".cue/track" and removed it before looking for album art, and this fixed the problem)

Last two images show the cue file itself added as a track... I saw this today too, as I was messing around with the preferences - never saw it before, and got fixed with a "rebuild library"...

Anyway, I discovered that when parsing the entries for building the various library / folder views there is special attention that has to be paid to the .cue extension. Also, cue's are (well, were, for what is worth on my "branch... ) doubled (one browseable, as you show in your pics, and one not), and I believe that one entry is the cue itself, while the other one is the cue treated as a folder.

I do not remember what I actually did, but spent much time monitoring what every single entry in the folder view was about, and fixed the behavior.

For the TAG / ARTIST / ALBUM views, the problem was only related to the album art not being displayed; and the problem was "only" the appended "track<4_zeroes_padded_track_number>" => pathinfo(PATHINFO_DIRNAME) returned <cue filename> => not a valid audio file nor a real folder => no album art found.

Everything else is correctly parsed by MPD, I believe: I can add a single track, a whole album, or a whole DISC (if my cue embeds more than one disk, as per Pink Floyd - The Wall for instance), or the whole DOUBLE ALBUM directly from the TAG / ARTIST / ALBUM view. Folder view does not allow for single disk, but allows whole album and single track.

Again, I have not a single song as FLAC: I only have around 300 discs, all ripped to single FLAC + CUE, and I can do whatever I want from whatever view.

The fact that in audio info there is track000? in the filename is IMO correct (could be displayed differently, if you like, but is correctly showing what info we are looking at).
Also, track number and disc number are correctly shown (track number from CUE info, and disc number from the FLAC file the track belongs to)

I will compare your changes to mine; and if they fix everything as I was able to do, I'll be more than happy to discard all my code; if not I will see what is missing, and come back to you for a chat about embedding further changes... does it sound ok to you?

cannot attach text files... here is how "The Wall" is set up in my library:

This is an example of a CUE file addressing 2 FLACS in my library:

DIRECTORY CONTENTS:

pi@moode-lounge:/media/Spare 2/Music/P/Pink Floyd/The Wall $ ls -l
total 455036
-rw-r--r-- 1 pi pi 218268704 Jun 17 19:16 'Pink Floyd - The Wall - disc 1.flac'
-rw-r--r-- 1 pi pi 247668935 Jun 17 19:16 'Pink Floyd - The Wall - disc 2.flac'
-rw-rw-r-- 1 pi pi      1924 Jun 20 17:14 'Pink Floyd - The Wall.cue'



METAFLAC INFO of file 1

pi@moode-lounge:/media/Spare 2/Music/P/Pink Floyd/The Wall $ metaflac --list --block-type=VORBIS_COMMENT ./Pink\ Floyd\ -\ The\ Wall\ -\ disc\ 1.flac 
METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 178
  vendor string: reference libFLAC 1.3.3 20190804
  comments: 7
    comment[0]: ALBUM=The Wall
    comment[1]: ARTIST=Pink Floyd
    comment[2]: DISCNUMBER=1
    comment[3]: GENRE=Progressive Rock
    comment[4]: DATE=1979
    comment[5]: TOTALDISCS=02
    comment[6]: TITLE=The Wall - disc 1



METAFLAC INFO of file 2

pi@moode-lounge:/media/Spare 2/Music/P/Pink Floyd/The Wall $ metaflac --list --block-type=VORBIS_COMMENT ./Pink\ Floyd\ -\ The\ Wall\ -\ disc\ 2.flac 
METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 178
  vendor string: reference libFLAC 1.3.3 20190804
  comments: 7
    comment[0]: ALBUM=The Wall
    comment[1]: ARTIST=Pink Floyd
    comment[2]: DISCNUMBER=2
    comment[3]: GENRE=Progressive Rock
    comment[4]: DATE=1979
    comment[5]: TOTALDISCS=02
    comment[6]: TITLE=The Wall - disc 2



THE FLAC FILE ITSELF

TITLE "The Wall"
PERFORMER "Pink Floyd"
FILE "Pink Floyd - The Wall - disc 1.flac" WAVE
  TRACK 01 AUDIO
    TITLE "In The Flesh?"
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    TITLE "The Thin Ice"
    INDEX 01 03:20:30
  TRACK 03 AUDIO
    TITLE "Another Brick in the Wall, Part 1"
    INDEX 01 05:47:07
  TRACK 04 AUDIO
    TITLE "The Happiest Days of Our Lives"
    INDEX 01 08:58:63
  TRACK 05 AUDIO
    TITLE "Another Brick in the Wall, Part 2"
    INDEX 01 10:49:51
  TRACK 06 AUDIO
    TITLE "Mother"
    INDEX 01 14:48:43
  TRACK 07 AUDIO
    TITLE "Goodbye Blue Sky"
    INDEX 01 20:23:23
  TRACK 08 AUDIO
    TITLE "Empty Spaces"
    INDEX 01 23:10:49
  TRACK 09 AUDIO
    TITLE "Young Lust"
    INDEX 01 25:18:28
  TRACK 10 AUDIO
    TITLE "One of My Turns"
    INDEX 01 28:48:26
  TRACK 11 AUDIO
    TITLE "Don’t Leave Me Now"
    INDEX 01 32:25:11
  TRACK 12 AUDIO
    TITLE "Another Brick in the Wall, Part 3"
    INDEX 01 36:41:06
  TRACK 13 AUDIO
    TITLE "Goodbye Cruel World"
    INDEX 01 37:55:36
FILE "Pink Floyd - The Wall - disc 2.flac" WAVE
  TRACK 14 AUDIO
    TITLE "Hey You"
    INDEX 01 00:00:00
  TRACK 15 AUDIO
    TITLE "Is There Anybody Out There?"
    INDEX 01 04:40:33
  TRACK 16 AUDIO
    TITLE "Nobody Home"
    INDEX 01 07:22:26
  TRACK 17 AUDIO
    TITLE "Vera"
    INDEX 01 10:45:18
  TRACK 18 AUDIO
    TITLE "Bring the Boys Back Home"
    INDEX 01 12:18:44
  TRACK 19 AUDIO
    TITLE "Comfortably Numb"
    INDEX 01 13:45:58
  TRACK 20 AUDIO
    TITLE "The Show Must Go On"
    INDEX 01 20:08:07
  TRACK 21 AUDIO
    TITLE "In the Flesh"
    INDEX 01 21:44:47
  TRACK 22 AUDIO
    TITLE "Run Like Hell"
    INDEX 01 26:00:22
  TRACK 23 AUDIO
    TITLE "Waiting for the Worms"
    INDEX 01 30:23:64
  TRACK 24 AUDIO
    TITLE "Stop"
    INDEX 01 34:20:68
  TRACK 25 AUDIO
    TITLE "The Trial"
    INDEX 01 34:51:53
  TRACK 26 AUDIO
    TITLE "Outside the Wall"
    INDEX 01 40:10:25


Cheers, Al.
Reply
#5
Interesting. I'll push the commit to the develop branch in a bit so you can compare/test.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
The commit has been pushed
https://github.com/moode-player/moode/co...5bdaead394

If you don't have a Gulp build environment setup yet I can post a download link to the minified JS files.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
(07-03-2022, 04:57 PM)Tim Curtis Wrote: The commit has been pushed
https://github.com/moode-player/moode/co...5bdaead394

If you don't have a Gulp build environment setup yet I can post a download link to the minified JS files.

I do have one, although I was not able to test it locally with the moode-PI just as the backend: I just make the changes locally, deploy everything, and then copy the JS + MAPS (also PHP or CSS if there are changes in those as well) over to the PI and ctrl+F5 on the browser window to see the results.

I'll grab your code later tonight, or tomorrow morning, depending what I'll have for dinner...

Cheers, Al.
Reply
#8
(07-03-2022, 04:57 PM)Tim Curtis Wrote: The commit has been pushed
https://github.com/moode-player/moode/co...5bdaead394

If you don't have a Gulp build environment setup yet I can post a download link to the minified JS files.

Hi Tim,

I had a quick look at your changes, and they do exactly what I do, except for the dirname function taking 2 arguments, for ease of extracting deeper folders...

ONE VERY IMPORTANT THING, THOUGH:


Code:
$path = stripos(dirname($path), '.cue', -4) === false ? $path : str_replace('.cue', '.flac', dirname($path));

You may not want to just change the extension to .flac, as the cue may contain ANY format... I need to look again, I think I did a quick cycle in the cue to find the last FILE entry BEFORE the track index (taken from /track????) or the first FILE entry if no /track??? is present.

I'll need the whole 8.1.x thing you are working on ATM to test it thoroughly, as I believe I cannot just replace those 6 files onto my 8.0.2; but nevertheless, I'll try applying them manually, one by one on a fresh 8.0.2 codebase, adding my CUE "parser" where needed.
I'll let you know, anyway.


Cheers, Al.
Reply
#9
I think flac and wav are most often used with cue sheets.

There are a couple of places where .flac is assumed but I can prolly change that to also check for .wav or alternatively parse out the file extension from the FILE param in the cue sheet.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#10
(07-04-2022, 01:03 PM)Tim Curtis Wrote: I think flac and wav are most often used with cue sheets.

There are a couple of places where .flac is assumed but I can prolly change that to also check for .wav or alternatively parse out the file extension from the FILE param in the cue sheet.

This is ehat I have done:

Code:
// CUE helper
function ensureAudioFile($path) {
    $result = false;
    $normalized = false;

    $track = 'ANY';
    // if (strpos($path, '.cue/track') != false) {
    if (str_contains($path, '.cue/track')) {
        $track = (int)str_replace('track', '', pathinfo($path, PATHINFO_BASENAME)); // e.g. "0001"
        $path = pathinfo($path, PATHINFO_DIRNAME); // "filename.cue"
    }
    $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));

    if ('cue' == $ext) {

        if (!str_starts_with($path, MPD_MUSICROOT)) {
            $path = MPD_MUSICROOT . $path;
            $normalized = true;
        }

        if (file_exists($path)) {
            $lastfile = '';

            $cuesheetlines = file($path);
            $totlines = count($cuesheetlines);
            $linendx = 0;

            while (!$result && $linendx < $totlines) {
                $line = trim($cuesheetlines[$linendx]);
                if (str_starts_with($line, 'FILE ') &&  str_ends_with($line, ' WAVE')) {
                    $lastfile = pathinfo($path, PATHINFO_DIRNAME) . '/' . str_replace('"', '', str_replace('FILE ', '', str_replace(' WAVE', '', $line)));
                }
                else
                if (str_starts_with($line, 'TRACK ')) {
                    $trackdata = explode(' ', $line, 3);
                    $tracknumber = (int)$trackdata[1];
                    if (('ANY' == $track) || ($track == $tracknumber)) {
                        $result = $lastfile;
                    }
                }
                $linendx++;
            }
        }

        if ($normalized && str_starts_with($path, MPD_MUSICROOT)) {
            $path = str_replace(MPD_MUSICROOT, '', $path);
        }
    }
    else {
        $result = $path;
    }

    return $result;
}

I call this function in getFileHash() and getCoverHash(), in playerlib.php, and also in coverart.php to normalize $path, just before the first check for $search_pri

This, no matter what, will give you the correct file to which the track belongs to. The function is defined in playerlib.php, of course. Works like a charm for me.

What do you think? (apart from the fact that you will write it better... I see I am no longer a skilled one in PHP...)

Cheers, Al.
Reply


Forum Jump: