Thank you for your donation!


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


Problem: Changes in JS
#1
Hi everybody,

in relation to my thread about the missing album-art with FLAC + CUE-sheets of a few days ago, I had a look at the code, both PHP and JS, and it seems like the JS code makes a couple of wrong assumptions when generates the hash for the image name it expects to be generated by thmcache.php.

I would like to test some changes to check my theory (presumably just a couple of lines for some substring) into player.js and scripts.library.js.

My problem is I have no clue about how to minimize and obfuscate the JS code, in order to just obtain the three JS files in the /var/www folder (config.min.js, lib.min.js and main.min.js). I am pretty sure my changes will affect just lib.min.js, but as I said, I don't know how to regenerate it from the original source code.

Thanks in advance to anybody for the help.
Cheers, Al.
Reply
#2
(06-07-2022, 06:41 PM)Nutul Wrote: Hi everybody,

in relation to my thread about the missing album-art with FLAC + CUE-sheets of a few days ago, I had a look at the code, both PHP and JS, and it seems like the JS code makes a couple of wrong assumptions when generates the hash for the image name it expects to be generated by thmcache.php.

I would like to test some changes to check my theory (presumably just a couple of lines for some substring) into player.js and scripts.library.js.

My problem is I have no clue about how to minimize and obfuscate the JS code, in order to just obtain the three JS files in the /var/www folder (config.min.js, lib.min.js and main.min.js). I am pretty sure my changes will affect just lib.min.js, but as I said, I don't know how to regenerate it from the original source code.

Thanks in advance to anybody for the help.
Cheers, Al.

Have a look at the Master Development Guide and especially the referenced Development with Gulp document.

I'll be interested to see how you two deal with the fact that a cue sheet is both a file and a pseudo-directory, especially when it comes to the Folder view.

Regards,
Kent
Reply
#3
(06-07-2022, 06:41 PM)Nutul Wrote: Hi everybody,

in relation to my thread about the missing album-art with FLAC + CUE-sheets of a few days ago, I had a look at the code, both PHP and JS, and it seems like the JS code makes a couple of wrong assumptions when generates the hash for the image name it expects to be generated by thmcache.php.

I would like to test some changes to check my theory (presumably just a couple of lines for some substring) into player.js and scripts.library.js.

My problem is I have no clue about how to minimize and obfuscate the JS code, in order to just obtain the three JS files in the /var/www folder (config.min.js, lib.min.js and main.min.js). I am pretty sure my changes will affect just lib.min.js, but as I said, I don't know how to regenerate it from the original source code.

Thanks in advance to anybody for the help.
Cheers, Al.

If the changes are relatively straight forward feel free to post them here along with an explanation of what they are fixing or enhancing and I can run some quick tests on my end.

This will give you some time to work through setting up a Gulp development environment.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
(06-07-2022, 06:52 PM)TheOldPresbyope Wrote:
Have a look at the 
Master Development Guide and especially the referenced Development with Gulp document.

I'll be interested to see how you two deal with the fact that a cue sheet is both a file and a pseudo-directory, especially when it comes to the Folder view.

Regards,
Kent

Thank you, first (well, actually second or third...) thing tomorrow morning :-)

p.s.
The handling of the CUE files (in the folder view) is enough stable, as I can see (it has glitches, mostly graphically speaking, which I'd like to address).

One major issue, though, is that if "Ignore CUE files" is set to false, the library database for artists / albums / genres is not populated... as if scanning the CUEs, every audio file contained in them is automatically discarded from the library; and the information inside the CUE is ignored as well (title / performer); this could be more difficult to deal with; I haven't looked into it yet, but am confident :-)

Timestamps, track indexes and titles are correctly parsed, though, as I have been seeing in the past days, as well as CUEs with multiple audio files: I use to have only one CUE per album, even if the album itself is spanned across 2 or more CDs... it still requires me to hand-collate two or more CUEs, but that's only till I'll automate it...


Regards, Al.
Reply
#5
(06-07-2022, 07:12 PM)Tim Curtis Wrote: If the changes are relatively straight forward feel free to post them here along with an explanation of what they are fixing or enhancing and I can run some quick tests on my end.

This will give you some time to work through setting up a Gulp development environment.

I need to verify the image names and the generated hashes... that is: make a change, add some console.log, check, bla-bla-bla...
I usually do not post experimental changes out of my mind ;-)

I'll have a look into the environment setup, and eventually come back here for help/clues.


Cheer, Al.
Reply
#6
Sounds good Al :-)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
Soooo,

I wasn't able to use the (develop) branch, as something was not working properly (I assume due some changes in the backend) and I did not want to flash a development branch on my Pi4.

So I pull-ed (master) which is on 8.0.2, and tested my changes there.
(to test, I made a build locally, and then replaced the minimized JS files in my Pi4)

So far I was able to have the album art shown in:

1. the header entry of the exploded CUE in Folder view.
2. all albums in the Tag view
3. all albums in the Album view

added a helper function, and called in 2 places in scripts-library.js, and in 3 places in playerlib.js
(the function is duplicated in both files, till I make it public and imported, eventually)

Still not working:
the album art is not shown in the big picture of the now-playing screen IF adding/playing:
- a single track from the exploded CUE in folder view
- a single track or entire album from both the Tag and Album views

(these issues may be on the PHP side, during library generation)

I will look into these tomorrow or Friday, time permitting.

I am not committing anything anywhere, of course.
Reply
#8
URRRAAAAAAHHHH!!!! :-D :-D :-D

So, at the end I think I managed to fix all the glitches that affected a good experience with the CUE sheets:

1. double CUE item in the folder (one expandable, one not) - if ignore CUE = true, only the non-expandable is shown, as was since the beginning; else, only the expandable is shown (and has CUE sheet span below its name, which is also without extension)
2. missing album art in the expanded CUE (folder view)
3. missing album art in the audio info modal
4. fixed missing data in the audio info modal (audio format and encoded at)
5. changed Encoded at field from "File does not exists" to "Not playing" if the source is empty
6. missing album art in the Tag and Album views
7. missing album art in now playing if adding single tracks from Tag, Album and expanded CUE views
8. missing album art in the down-left image in Tag and Album view

And probably some other which I cannot remember.

Affected files:

var/www/inc/playerlib.php
var/www/js/playerlib.js
var/www/js/scripts-library.js

I can upload the files here (well, if that's allowed in the first place, of course), so you can diff them and see the changes: most of them are one-liners (due to a couple of helper functions defined at the beginning of the file, to make things more readable).

For now this is only on my machine and my Pi4, and works like a charm :-)


Cheers, Al.
Reply
#9
Great job!
Reply
#10
(06-09-2022, 07:17 PM)Nutul Wrote: URRRAAAAAAHHHH!!!! :-D :-D :-D

So, at the end I think I managed to fix all the glitches that affected a good experience with the CUE sheets:

1. double CUE item in the folder (one expandable, one not) - if ignore CUE = true, only the non-expandable is shown, as was since the beginning; else, only the expandable is shown (and has CUE sheet span below its name, which is also without extension)
2. missing album art in the expanded CUE (folder view)
3. missing album art in the audio info modal
4. fixed missing data in the audio info modal (audio format and encoded at)
5. changed Encoded at field from "File does not exists" to "Not playing" if the source is empty
6. missing album art in the Tag and Album views
7. missing album art in now playing if adding single tracks from Tag, Album and expanded CUE views
8. missing album art in the down-left image in Tag and Album view

And probably some other which I cannot remember.

Affected files:

var/www/inc/playerlib.php
var/www/js/playerlib.js
var/www/js/scripts-library.js

I can upload the files here (well, if that's allowed in the first place, of course), so you can diff them and see the changes: most of them are one-liners (due to a couple of helper functions defined at the beginning of the file, to make things more readable).

For now this is only on my machine and my Pi4, and works like a charm :-)


Cheers, Al.

You should be able to upload and attach a zip file but if not then upload it to a cloud drive and post a download link.

If the changes are relatively straight forward I might be able to slip them into the code b4 releasing 8.1.0 later this month.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: