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: Library Tree Discussion (Read 127933 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Library Tree Discussion

Reply #250
1. I'll take a look whether fb2k API provides any such functionality.

2. I don't think I will change this - note that these are global, i.e. they can't be used by multiple scripts simultaneously (or more like it will trigger corresponding callback in EVERY script). Ideally there should be a different mechanism to assign global hotkeys, that could target specific scripts, but I'm not sure if it's achievable with the current fb2k API.

4. This comment means exactly what it says: SMP component does not receive a key event if it was handled by fb2k ('space' key down event in this case). So I can't pass to script (or suppress) what I don't have. You'll have to disable global 'space' shortcut if you want to use it in the scripts.
[EDIT] 4. Another alternative would be to use a popup to pass a string for searching.

Re: Library Tree Discussion

Reply #251
1.
Quote from: WilB
case uses of your $rgb call
Here's what I meant:

It all boils down to aesthetic choices, but for me it makes a huge difference in readability. Another case use would be 'releases' branch under 'album artist' - I could dim a little everything that has %release type% as single, ep etc., so that full length albums would stand out by being a bit brighter.

Quote from: WilB
It's actually quite complex to set different colours for different parts of a line of text. This plus the extra handling needed in various places, so all scenarios etc work, would increase the overhead
Overhead for your code or for the speed of the tree on my side?
If it's the first, then sure, I understand. If it's the latter, then no worries, I don't think three or four $rgb() calls in my sub-label branch would slow down things at all:
Code: [Select]
$nodisplay{%date%}$nodisplay{%albumartistsortorder%}['{'%catalognumber%'} ']%album artist% - %album%' ['$year(%date%)']'[' ∙ '$meta(media type,0)['/'$abbr($meta(media type,1))]' ∙ ']
Honestly I've been conditionally formatting CUI playlists for years and they're all lightspeed fast even if I throw thousands of tracks at them. E.g. in my 'title' column I have recognition of extra-titular info like remix/instrumental etc. and additional highlighting of the remixer:

Absolutely nothing about any CUI elements or SMP has ever been noticeably slow for me, no matter what I do (...unless I make calls to foo_customdb, but it's an old and slow extension in itself).

2.
Quote from: TheQwertiest
Ideally there should be a different mechanism to assign global hotkeys, that could target specific scripts, but I'm not sure if it's achievable with the current fb2k API.
I.e. scripts and particular properties within them. I mean, yeah, I feel like this is probably too much, but I think you agree that a mechanism for communicating between different panels/scripts would be a massively powerful tool: I could draw a button in panel stack splitter that would access particular SMP and change the property 'SYSTEM.View By' to a given value. And vice versa, I could have any PSS element that would react to changes in a particular SMP. So maybe something like $set_smp(smp_id,property,value) and $get_smp(smp_id,property).

3.
Quote from: WilB
Use $if2": e.g. $if2(%album%,Unknown)
Yeah, pretty much what I did, except I didn't really want to see the ones with empty fields, so I made it as unobtrusive as possible by wrapping the whole view pattern in a conditional. Like, you can see in that snap from my previous post, there's just a little hyphen at the top that has no item count (I could replace it with a zero-width space too or some exotic script character that would move it to the end of the list). Setting all filters to have additional 'PRESENT' is a good idea too, thanks.

4.
Quote
on_key_down(vkey); Note: keyboard shortcuts defined in the main preferences are always executed first and are not passed to the callback.
Hm, not sure if I fully understand this, because both things happen at once for me: playback pauses and the library tree search field receives a space.
However I've already checked other CUI panels with typing option, like 'Typefind' or 'Youtube Source Search' and keystrokes work locally in them, they don't execute foobar's global hotkeys. So I suppose they're somehow isolated, like pop-ups?

5.
Quote from: WilB
That may be because "mode > auto collapse nodes" is enabled.
Nope, I have it disabled. I can expand multiple nodes in, say, 'by date' view, change the view to 'by artist', then change back to 'by date' again and all the decades will be collapsed again. The panel doesn't remember tree state between views, it only remember it on closing/opening foobar.

6.
Thanks for this one!


Re: Library Tree Discussion

Reply #253
@Awesomeo

Formatting. I've added the following:
Code: [Select]
$colour{normal,hover,selected}
Normal, hover & selected can either be r-g-b or a highlight or dim indicator. The latter are analogous to the DUI playlist highlight / dim method, except here they should also support hover & selected text, and I think will use +++, ++, +, -, --, ---. Either should enable setting different colours for parts of a line.

Remember tree state. I've added an option to remember tree state of all views independently (expanded nodes etc).

These should be in the next version (exact syntax of $colour might change), provided nothing unexpected arises during further testing etc.

Re: Library Tree Discussion

Reply #254
That's so great, thank you! This panel is heaven sent.

 

Re: Library Tree Discussion

Reply #255
Hey, I'm just wondering if you're still planning this update any time soon or whether you put this on hold for now? Sorry if I come off as nagging too much about it :(

Re: Library Tree Discussion

Reply #256
There will be an update shortly with the new features indicated above (i.e. new colour handling [including setting different colours for parts of a line] and the ability to remember the tree state of all views independently etc). I was waiting to see if anything appeared in SpiderMonkey Panel v1.2.2 that was relevant to some of your other comments, and that would require attention, plus I was rather busy. But now SpiderMonkey Panel v1.2.2 is out...

Re: Library Tree Discussion

Reply #257
@WilB, sorry, nothing relevant in this one =) (apart from bug fixes)
I'm planning to add new keyboard shortcut functionality, which will allow to assign global fb2k hot keys to panel specific actions, but it requires a lot of internal changes. Hopefully it will be ready for the next release.

Re: Library Tree Discussion

Reply #258
New Version: Library Tree 2.1.2

CHANGELOG

NEW: Option to remember tree state of all views independently (expanded nodes etc; menu > ... options > mode > Remember Tree State).

NEW: Colour options:

1) Option to set a custom colour for the selected item frame: _Custom.Colour Frame Selected (panel properties).

2) Option to set different colours for parts of a line of text:

$colour{normal,hover,selected}

For use in view patterns.

Normal, hover & selected can either be r-g-b or a highlight or dim indicator, e.g.
$colour{r-g-b,r-g-b,r-g-b} or $colour{-,++,+++}

Highlight & dim indicators:

- dim text
-- dimmer text
--- dimmest text
+ bright text
++ brighter text
+++ brightest text

All colours are optional: any undefined are set to default. Format, r-g-b & -/+ style, can be mixed in same $colour{} function.

Examples:
$colour{} reset all colours to defaults
$colour{255-0-0} set normal text colour to red; set hover & selected text colours to defaults since undefined
$colour{,,+++} set selected text colour to brightest; set normal & hover text colours to defaults since undefined
$colour{0-255-0,++} set normal text colour to green & hover text colour to brighter; set selected text colour to default since undefined
$colour{255-0-0,0-255-0,0-255-255} set normal, hover and selected text colours to red, green & cyan, respectively

Example pattern:
Code: [Select]
View by Artist - Album // $colour{-}%album artist%[$colour{+} - %album%][$colour{96-127-127} ∙ '['%date%']'][$colour{111-132-138} ∙ %genre%]$colour{--}|[[%discnumber%.]$colour{--,++,0-192-192}%tracknumber%. ]$colour{-,++,0-228-228}[%track artist% - ]%title%

Colours apply after the $colour code until either another $colour code is encountered or a branch point is reached (| in the view pattern).

Item counts are a special case. They don't form part of the view pattern.
   Align right: drawn separately; not controlled by $colour codes; already dimmed.
   End of text: effected by $colour codes. Use $colour{} at the end of the line [i.e. before branch point: | ]  to reset or set to a different colour if desired ($colour{--} is used in the example above).

Re: Library Tree Discussion

Reply #259
Thank you so much! I'm starting formatting right away.

Re: Library Tree Discussion

Reply #260
@WilB
Perfect, Thank you :)








Re: Library Tree Discussion

Reply #261
I don't know what the problem is, but when you hover over the song, the color does not change (in this case to yellow 255-255-0)

My test code:
Code: [Select]
Test colours // $colour{255-0-0,255-0-0,255-0-0}'('%date%')'$colour{} - %album%|%tracknumber%. $colour{255-0-0,255-255-0,0-255-255}%title%
normal

hover

selected



Re: Library Tree Discussion

Reply #262
I tried your code sample, and it worked as expected for me, i.e. title showed in yellow on hover.

Please ensure the following is enabled: right click menu … > options > show > highlight text on hover.

Re: Library Tree Discussion

Reply #263
Please ensure the following is enabled: right click menu … > options > show > highlight text on hover.
Yes indeed, the option you mention about was missing. Now everything works as it should. Once again, thank you very much for your work  :)

Re: Library Tree Discussion

Reply #264
@WilB

Hello WilB, even with this last version I am getting this error:

Error: Spider Monkey Panel v1.2.2-preview+0db3c6a4 (Library Tree v2.1.2 by WilB)
OrderByRelativePath failed:
allocation size overflow

File: <main>
Line: 542, Column: 61

Stack trace:
  Panel/this.sort@<main>:542:61
  rootNames@<main>:1205:48
  Library/this.getLibrary@<main>:1190:119
  Timers/this.lib/<@<main>:2911:115

Regards,
Andrea

Re: Library Tree Discussion

Reply #265
Ever since I realised you're using a very large library I've routinely run tests on an artificially created 640,000 library.

That works fine on my pc, including with view by folder structure.

The actual error seems to be in the handleList sort: handleList.OrderByRelativePath(); I'm not sure that I have any control over what that's doing, as it's a SpiderMonkey Panel function.

So it's not clear to me whether this is actually a SpiderMonkey Panel issue, possibly related to memory handling / memory available on your device, or whether something could be optimised in the script.

@TheQwertiest - any ideas?

Re: Library Tree Discussion

Reply #266
Works great and it made my information-overloaded branches much more readable: https://imgur.com/a/MjqhJVJ (at least to me). Thank you again!

One thing I noticed though, is that $colour{} function doesn't work inside other functions (conditional or string). For conditionals it outputs invalid syntax error, for $replace(%some_tag%,'some_string',$colour{x-y-z}'some_string') all sorts of weird breaks happen. I suppose that's intended not to work within functions?

In the end managed to get around it mostly and it's not such a big issue, but I was just wondering, because e.g. $nodisplay{} works within functions.

Re: Library Tree Discussion

Reply #267
Yes I had spotted that one & it should be fixed on my copy. I'm awaiting to see if  @TheQwertiest can help with the issue raised in posts 231 & 232, before releasing an updated version.

But the fix is very minor, and you could change it yourself if you're inclined and don't want to wait until the next version. Shift + right click > menu > configure

On line 616 replace "," with "`" (2 instances on that line)
On line 1790 similarly replace ',' with '`' (1 instance on that line)
i.e. replace the commas on those lines with backticks. Do not alter any other lines.

I tested it with conditional strings, but please confirm it works with your conditional or string scenarios, if you want to try it, else advise me if you prefer to wait until the next version.

HTH

Re: Library Tree Discussion

Reply #268
Yes! Works like a charm:

Thanks again for so quick help!

Re: Library Tree Discussion

Reply #269
But the fix is very minor, and you could change it yourself if you're inclined and don't want to wait until the next version. Shift + right click > menu > configure

On line 616 replace "," with "`" (2 instances on that line)
On line 1790 similarly replace ',' with '`' (1 instance on that line)
i.e. replace the commas on those lines with backticks. Do not alter any other lines.

I confirm, it now works inside the function. Earlier I had to add a square bracket to make it work. Thank you for the correction, it makes operation much easier  ;D

Re: Library Tree Discussion

Reply #270
@AndreaT , does this happen on SMP v1.2.1 as well? Is it consistently reproducible? How big is your library (i.e. the number of tracks)?

Re: Library Tree Discussion

Reply #271
Is it possible for the color to work inside the $replace function?
Code: [Select]
$if($or($strstr(%title%,feat.),$strstr(%title%,Feat.)),$replace(%title%,Feat.,$colour{128-255-0,128-255-0}feat.$colour{}),%title%[ '('$colour{128-255-0,128-255-0}feat.$colour{} %featuring%')'])
The second part of the code works (without the $replace function)
Code: [Select]
,%title%[ '('$colour{128-255-0,128-255-0}feat.$colour{} %featuring%')']

I don't know if it's possible to work around this  ::)

Re: Library Tree Discussion

Reply #272
@Tropoje $replace is case sensitive, but you can do it over infinite number of arguments, so just make replacements for both cases.

Code: [Select]
$if($or($strstr(%title%,feat.),$strstr(%title%,Feat.)),$replace(%title%,feat.,$colour{128-255-0,128-255-0}feat.$colour{},Feat.,$colour{128-255-0,128-255-0}Feat.$colour{}),%title%[ '('$colour{128-255-0,128-255-0}feat.$colour{} %featuring%')'])

Re: Library Tree Discussion

Reply #273
@Tropoje $replace is case sensitive, but you can do it over infinite number of arguments, so just make replacements for both cases.

Code: [Select]
$if($or($strstr(%title%,feat.),$strstr(%title%,Feat.)),$replace(%title%,feat.,$colour{128-255-0,128-255-0}feat.$colour{},Feat.,$colour{128-255-0,128-255-0}Feat.$colour{}),%title%[ '('$colour{128-255-0,128-255-0}feat.$colour{} %featuring%')'])
Thank you very much for your quick reply  ;D
My goal is to always make changes Feat. (uppercase)  to feat. (lowercase). I have slightly modified your code and now it works as it should. This solves my problem  ;D  ;D  ;D
Code: [Select]
$if($or($strstr(%title%,feat.),$strstr(%title%,Feat.)),$replace(%title%,Feat.,$colour{128-255-0,128-255-0}feat.$colour{},feat.,$colour{128-255-0,128-255-0}feat.$colour{}),%title%[ '('$colour{128-255-0,128-255-0}feat.$colour{} %featuring%')'])

Re: Library Tree Discussion

Reply #274
@TheQwertiest
@AndreaT , does this happen on SMP v1.2.1 as well? Is it consistently reproducible? How big is your library (i.e. the number of tracks)?

Yes, with SMP 1.2.1 I had to remove Library Tree immediately, it was completely unusable. No way to "start-up" Library Tree View.
With the new SMP 1.2.2 and the new Library Tree View things are going better, At least I can have it running for a while.
My library contains about 600k records (live recordings made over 30+ years).

PS: Nothing critical for me. No hurry. I already reverted back to Album List (it is slow, but it works).
Regards, Andrea