Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Spider Monkey Panel (foo_spider_monkey_panel) (Read 347742 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1050
Eole theme has a problem with SMP 1.6.0
Mouse right button menu does not show on some panels.
Library Tree, Playlist manager, Graphic Browser etc...

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1051
Thanks everyone for the bug reports!
I've unlisted v1.6.0 for now, till all the reported bugs are fixed.

PS: The the unusual amount of bugs is caused by the total rewrite of one of the core elements of the component (it amounts for ~10% of the whole code), which was needed to fix some long standing bugs and is required for some future features.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1052
With update to SMP1.6.0 I am getting quite some instability and crashes, especially when changing presets within CUI. Crash location SMP,  call path entry=>app_mainloop, see attached.
Reverted back to SMP1.5.2, which is stable on my side. Any idea what could cause the issue?

Can you attach a .dmp file as well, please?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1053
@kutuzof , @TT , @kgena_ua , I fixed some bugs, could you, plz, try the latest dev build and check if it works for you as well?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1054
@TheQwertiest, biography also doesn't work with developer build. Plus, some other panels began to fall.


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1056
ReadTextFile fails detecting the codepage (UTF-8) of this file when BOM is not set (which I have disabled for Unix compatibility). Edit the file path as needed and use this code.
Code: [Select]
include(fb.ComponentPath + 'docs\\Codepages.js');
const playlistPath = 'd:\\foobar2000\\profile\\playlist_manager\\Playlist C.m3u8';
let originalText = utils.ReadTextFile(playlistPath).split('\r\n');
if (typeof originalText !== 'undefined' && originalText.length) {
    console.log(originalText[10]);
    if (originalText[1] === '#EXTENC:UTF-8') {originalText = utils.ReadTextFile(playlistPath, convertCharsetToCodepage('UTF-8')).split('\r\n');} // Hack
    console.log(originalText[10]);
}
Quote
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenfänger - Rock Me Amadeus.mp3  // Automatic charset detection
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenfänger - Rock Me Amadeus.mp3  // Hack

Right now I have to use the hack to check for playlists with are encoded as utf-8. Since the manager may also load playlists written by other programs, if I simply force reading as UTF-8 it may break things for playlist written outside Foobar scope.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1057
Right now I have to use the hack to check for playlists with are encoded as utf-8. Since the manager may also load playlists written by other programs, if I simply force reading as UTF-8 it may break things for playlist written outside Foobar scope.
Nothing can be done about it - codepage detection is heuristic based, which does not provide 100% accuracy. The only way to ensure that UTF is detected correctly is by using UTF BOM.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1058
Not sure I see the issue here. If you have m3u8 files they're always going to be UTF8 with or without BOM.

If a file has any kind of BOM, the optional codepage arg is always ignored because processing never gets that far. BOM handling always takes precedence and the function returns early. If supplying a codepage arg for UTF8 without BOM is required, it's a total non issue.

edit: I am making assumptions about the behaviour of ReadTextFile not having changed that much since the fork :P

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1059
I have provided a m3u8 file as example, but obviously the playlists formats are not limited to m3u8 but also m3u and pls and those may use UTF8 with and without BOM. Therefore it's an issue as soon as you apply the same logic to those files. m3u uses the same directives and I would have to look for the #EXTENC:UTF-8 line, since it's perfectly valid to have a m3u utf8 file  ::)

Then the BOM thing... as far as I have been reported, playlist files with BOM are not always compatible with other programs (VLC?) and lets not talk about programs outside windows ecosystem, so I have totally abandoned the idea of forcing BOM as default.

If there is no better approach for the current heuristics, will try adding safe-checks after reading the files (like obvious errors Ä -> ä). And adding some notes about it on the readme to use BOM if still having problems.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1060
You haven't comprehended my post at all so here's a code example...

First of all forget this...
Code: [Select]
include(fb.ComponentPath + 'docs\\Codepages.js');

Just use this...
Code: [Select]
const CP_UTF8 = 65001;
const filename = ...
let text = utils.ReadTextFile(filename, CP_UTF8);

This should handle ANY UTF8 file with or without BOM. That was the point I was trying to make. If you can't understand my previous post by reading it, go away and test this with all the UTF8 files you can throw at it. You shouldn't need to inspect the contents of the file, it should just work.

Now the problem you MAY face is that m3u files don't have to be UTF8 and you could be entering the murky world of windows ANSI codepage nonsense which I can't even begin to explain because I'm clueless. If you're dealing with cross platform players like VLC which also run on linux etc, you're unlikely to encounter these.

So now you have 2 choices, don't support those files or check by file extension so that you specify CP_UTF8 for all m3u8 files and if the file extension is m3u then omit the codepage so you call ReadTextFile like this.

Code: [Select]
let text = utils.ReadTextFile(filename);

 

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1061
You haven't comprehended my post at all so here's a code example...

First of all forget this...
Code: [Select]
include(fb.ComponentPath + 'docs\\Codepages.js');

Just use this...
Code: [Select]
const CP_UTF8 = 65001;
const filename = ...
let text = utils.ReadTextFile(filename, CP_UTF8);

This should handle ANY UTF8 file with or without BOM. That was the point I was trying to make. If you can't understand my previous post by reading it, go away and test this with all the UTF8 files you can throw at it. You shouldn't need to inspect the contents of the file, it should just work.

Now the problem you MAY face is that m3u files don't have to be UTF8 and you could be entering the murky world of windows ANSI codepage nonsense which I can't even begin to explain because I'm clueless. If you're dealing with cross platform players like VLC which also run on linux etc, you're unlikely to encounter these.

So now you have 2 choices, don't support those files or check by file extension so that you specify CP_UTF8 for all m3u8 files and if the file extension is m3u then omit the codepage so you call ReadTextFile like this.

Code: [Select]
let text = utils.ReadTextFile(filename);

I have understood it perfectly fine. XD You are telling me: "If you know the codepage, put it in the code". Great, thanks. That's the problem  ::) I have to support multiple file formats from multiple OSes and programs which may use or not UTF8 with or without BOM. And obviously I'm not supposed to know if they will use BOM, neiher their codepage, nor the final user is expected to handle/understand these things. There are some use-cases where the encoding may be written to the file (non standard extensive M3U directives) or suppossed (m3u8 files), but that's not all.

About VLC, they handle non BOM files without problems, like most software. It seems windows is the only OS with software which has problems with UTF8 files without BOM. So I would not consider it as a reference if we talk about codepage handling ::) and for sure I would not code following that behavior if possible.

Code: [Select]
include(fb.ComponentPath + 'docs\\Codepages.js');
const playlistPath = 'd:\\foobar2000\\profile\\playlist_manager\\Playlist C.m3u';
const line = 9;
let originalText = utils.ReadTextFile(playlistPath).split('\r\n');
console.log(originalText[line]);
if (originalText.some((line) => {return line.indexOf('ä') !== -1})){
    originalText = utils.ReadTextFile(playlistPath, convertCharsetToCodepage('UTF-8')).split('\r\n');
    console.log(originalText[line]);
}
Quote
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenfänger - Rock Me Amadeus.mp3
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenfänger - Rock Me Amadeus.mp3
Another perfectly fine playlist file in m3u format whose encoding can not be supposed by format or #flags.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1062
Your original post was about m3u8. Those absolutely should be UTF8 and if they're not, user error, not interested. OS/BOM are all irrelevant because the file extension alone is enough. It really is that simple.

And now we've moved on to m3u files, you're just parroting what I've already told you. You cannot make assumptions about the contents so I listed the 2 choices you have. Treat them as windows ANSI by not supplying any code page (or use the default of 0) or don't support them at all. My inclination would be to use the default codepage argument of 0 (the same as omitting it) and treat them as windows ANSI. What environment are we using?? Oh yeah, it's windows.

I'd just use this...
Code: [Select]
function is_m3u8(filename) {
   return path.split('.').pop().toLowerCase() ==  'm3u8';
}

const CP_UTF8 = 65001;
const filename = ...
let text = utils.ReadTextFile(filename, is_m3u8(filename ? CP_UTF8 : 0);

This will probably fail for m3u playlists that are UTF8 (which aren't plain text and contain exotic characters). But they should be using m3u8 for that anyway.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1063
And you can't simply suppose everything is utf8 and done. Neither letting ReadTextFile identify the codepage works flawlessly.
Code: [Select]
include(fb.ComponentPath + 'docs\\Codepages.js');
const playlistPath = 'd:\\foobar2000\\profile\\playlist_manager\\Playlist D.m3u';
const line = 9;
let originalText = utils.ReadTextFile(playlistPath).split('\r\n');
console.log(originalText[line]);
originalText = utils.ReadTextFile(playlistPath, convertCharsetToCodepage('UTF-8')).split('\r\n');
console.log(originalText[line]);
originalText = utils.ReadTextFile(playlistPath, 28591).split('\r\n');
console.log(originalText[line]);
Quote
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenf�nger - Rock Me Amadeus.mp3
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenf�nger - Rock Me Amadeus.mp3
D:\foobar2000\_\Big Retro Hits 90s\063. Wolkenfänger - Rock Me Amadeus.mp3

About these files having to be m3u8 files... well that's your opinion. m3u may use any codepage.. And pls files too https://en.wikipedia.org/wiki/PLS_(file_format). With all due respect, you are the only one who talked specifically about m3u8 and thought I was talking only about them, I said playlist files in general from the start.

The codepage heuristics is not foolproof and that's all. These are not specially exotic files anyway, and other tools identify them without problems:
https://nlp.fi.muni.cz/projects/chared/

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1064
Moving the goalposts as always. Your original complaint was about UTF8 detection not working, the developer of the component already told you the detection isn't 100% reliable and then I told you how to override it when you know for sure the files are definitely UTF8 as indicated by the file extension of the only example you gave.

Now your complaint is exclusively about windows codepage detection, I'll leave that between you and @TheQwertiest.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1065
Right now I have to use the hack to check for playlists with are encoded as utf-8. Since the manager may also load playlists written by other programs, if I simply force reading as UTF-8 it may break things for playlist written outside Foobar scope.
Nothing can be done about it - codepage detection is heuristic based, which does not provide 100% accuracy. The only way to ensure that UTF is detected correctly is by using UTF BOM.
@snotlicker really... do you read your posts?  ::) he understood my "complaint" from the start and already gave the final answer (heuristics in SMP fail, for UTF8 and for any codepage). Maybe I'm really bad at English, writing my "complains" or whatever, point taken.

But I can't really understand your goals answering in a passive-agressive way everytime treating others like idiots who don't know what they want to do. We already had a clear answer and you simply keep posting and analyzing my code goals doing exactly what you say now (goalpost moving) XD. Take it easy. As said, the answer was already given at his post  ::)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1066
FWIW, I think you're the one being needlessly combative.

I'm trying to explain things in the simplest way possible because you really seem to struggle with the basic concepts I'm layout out. Your first post was about m3u8 files without BOM not being handled properly and I gave you a bulletproof workaround for that scenario. No acknowledgement from you, not a word of thanks. Just ranting about other playlists with other extensions that cannot be assumed to be UTF8 which I very clearly stated and agreed with.

Independent readers can make their own minds up.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1067
FWIW, I think you're the one being needlessly combative.

I'm trying to explain things in the simplest way possible because you really seem to struggle with the basic concepts I'm layout out. Your first post was about m3u8 files without BOM not being handled properly and I gave you a bulletproof workaround for that scenario. No acknowledgement from you, not a word of thanks. Just ranting about other playlists with other extensions that cannot be assumed to be UTF8 which I very clearly stated and agreed with.

Independent readers can make their own minds up.

Man I'm done. You keep being condescending. Really, check your behavior.

Quote from: regor
ReadTextFile fails detecting the codepage (UTF-8) of this file when BOM is not set (which I have disabled for Unix compatibility)...

The file being m3u8 was a coincidence, an example, not a requisite (which TheQwertiest understood but not you, it's fine, but I explained it later) .

Quote from: TheQwertiest
Nothing can be done about it - codepage detection is heuristic based, which does not provide 100% accuracy. The only way to ensure that UTF is detected correctly is by using UTF BOM.
TheQwertiest already answered it all before you.

Quote from: snotlicker
Not sure I see the issue here. If you have m3u8 files they're always going to be UTF8 with or without BOM.

If a file has any kind of BOM, the optional codepage arg is always ignored because processing never gets that far. BOM handling always takes precedence and the function returns early. If supplying a codepage arg for UTF8 without BOM is required, it's a total non issue.
 
Then you had to continue with obvious comments... like you always do. "hey man, X is X, don't you see it?"

Quote from: regor
I have provided a m3u8 file as example, but obviously the playlists formats are not limited to m3u8 but also m3u and pls and those may use UTF8 with and without BOM. T
I clearly noted I was referring to a variety of playlists formats.

Quote from: snotlicker
You haven't comprehended my post at all so here's a code example...
And then your high point comment. "Let me show you how you don't understand anything again". And so on and so on.

It really takes 1 minute to see your constant attitude of treating others like kids, just joining the points. Please, from now on just skip my comments/complaints/posts since I have no tolerance for that toxic attitude. Thanks.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1068
I will always explain component internals in a dumbed down manor. I've never going to assume anyone has read and understood the C++ behind the scenes unless they explicitly state that up front. Clearly you had no idea or your query would not exist.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1069
@TheQwertiest I have this error in the Properties script, it happens quite often

Error: Spider Monkey Panel v1.5.2 (Properties: Properties by marc2003)
f is null

File: list.js
Line: 933, Column: 21
Stack trace:
  _list/this.init/this.add_meta@list.js:933:21
  _list/this.update@list.js:574:10
  _list/this.metadb_changed@list.js:91:9
  on_metadb_changed@:33:7
  _panel/this.item_focus_change@panel.js:11:4
  on_playlist_switch@:74:8

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1070
That's strange. It implies this call to GetFileInfo is failing and returning null. WSH/JSP never did this and always return a valid object???

https://github.com/TheQwertiest/smp_2003/blob/80af82ddba0b1827dcbd2f03d5b90aaeea5cb8e4/js/list.js#L572

But having checked the docs, it does outline the possibility of the return value being null.

https://theqwertiest.github.io/foo_spider_monkey_panel/assets/generated_files/docs/html/FbMetadbHandle.html#GetFileInfo

I guess the script will need updating to check the return value before trying to use it.

edit: this would render the script utterly useless. It wouldn't be able to iterate over all tags without knowing their names in advance and the tech info fields. Hopefully something can be done component side.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1071
I see the difference now. I'm using this "simplified" method

Code: [Select]
	//! Simplified method, always returns non-null, dummy info if nothing to return.
virtual metadb_info_container::ptr get_info_ref() const = 0;

SMP is using

Code: [Select]
	//! \since 1.3
//! Retrieve a reference to the primary info. \n
//! You can hold the reference to the info as long as you like, call the method in any context you like with no lock semantics involved. The info held by the returned reference will remain constant even if the metadb content changes. \n
//! Returns true and sets outInfo to a reference to this item's primary info on success, returns false on failure (no info known at this time).
virtual bool get_info_ref(metadb_info_container::ptr & outInfo) const = 0;

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1072
@kutuzof , @TT , @kgena_ua , I fixed some bugs, could you, plz, try the latest dev build and check if it works for you as well?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1073
TheQwertiest, thank you! Both biography panels work well. So far, there are no failures.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1074
Two Questions:
Is there any way to change the sort order on autoplaylist.js?
Is there any way to bind ratings to albums in instead of just artist and track while still using SMP database in ratings.js? (I'm guessing no here.)
Thanks.