Author Topic: Additional Tagging & Reporting Tools  (Read 937828 times)

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
And throwing out another thought:

When you use the 'proper' way to install AT&RT (Preferences > Plugins > Add Plugin...), no presets are placed in any folder in MusicBee's installation path.
So the buttons 'import new' and 'import all' simply won't work.
If possible I think it would be good when installing AT&RT, the presets were placed in a location within the MusicBee installation folder so that these import functions will work without the need to learn and understand you should copy them first yourself to some location.

And I agree with Messiaen that three import buttons seem a bit much.
Perhaps just have one, that after clicking provides some options on what to import (and from where)?

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
2. you can assign virtual tag function id to any preset, and use this preset in virtual tags, file naming templates, etc. as $ASR(<URL>,preset_id).
note: this option may be useful for simple asr presets, but it will return last changed tag for complex (multistep) presets, what may be not very obvious in this case.
I have read this a couple of times, but I still don't think I understand this feature.



1.
Is it so that this makes it possible for a preset to use the output of an existing virtual tag, or the other way around, a virtual tag being able to use the output of a preset?

2.
What would you enter exactly in the entry field? The name of an existing virtual tag? Some unique text of your own choice?

3.
What does the (pointed at) button do?

4.
So $ASR is a function that can be used for virtual tags?
Should I then add it here?:
https://getmusicbee.com/forum/index.php?topic=35868.msg196257#msg196257

edit, I now see $ALR and $ASR are explained in the readme on the plugins page.
So maybe I should learn to read readme's ;-)
Last Edit: January 06, 2023, 11:25:29 AM by hiccup

Messiaen

  • Jr. Member
  • **
  • Posts: 103
$ASR and $ALR are both fantastic functions.  I'll give a couple examples of how I've used them.

Say I wanted to embed a 0-width space in a virtual function (yes, I know, "But why?" - have patience :))... I'd first create a preset which looks like

Search for: ^(.*)
Replace with: \@char[[200B]]

In the "Assign virtual function id", I would just enter "0Width", which can then be used in a virtual expression like:

$IsNull(<Playlist>,,{color: 128,255,255}$ASR(<URL>,0Width))<Title (vf)>

The effect is that the embedded 0-Width Space character actually "activates" the {color} code, allowing <Title (vf)> to be one colour or another, whereas without the 0-Width Space just using <Title (vf)> in a conditional virtual expression the {color} doesn't activate for any following text.  (If that makes sense.)

An even better example (which I imagine Boroda would find amusing) is in the use of $ALR.  Say I wanted to store the length of a classical "work" (as the sum of individual movements), I would first define an Auto-Library-Report as:

<Grouping>: Album Artist, Album, Work, Sum(Time) -> Save Field: Sum(Time)

and assign that ALR a virtual function ID of "SetWorkDur".

Then create the ASR preset that looks like this:

Search for: ^(.*)
Replace with: \@eval[[$IsNull(<Work>,"0:00",$ALR(<URL>,SetWorkDur))]]

where the result is assigned (conditionally!) to a custom tag <Work Duration (c)>.

This allows me to set a hotkey to the ASR (since ALR's don't have hotkeys), and I can apply it on an ad-hoc/one-off basis, instead of it being used as a normal ALR auto-executed command.

So... yeah.  A little complex, but infinitely useful once you get the hang of it.  I actually meant to request Boroda export the \@char[[]] function as a full virtual $Char() function (since none of the usual \xnnnn regex codes seem to work as they should), but I found the use of the virtual ID name easier to use than remembering the code for 0-width space to begin with.  Unfortunately I have to create a new preset for each unicode character I need (hence $Char makes sense), but the "Assign virtual ID" code makes it recognisable in a complex expression.
Last Edit: January 06, 2023, 12:09:55 PM by Messiaen

Messiaen

  • Jr. Member
  • **
  • Posts: 103
I will freely admit that I have absolutely no idea what that extra checkbox-type thing does.  :)

A result of the <Work Duration (c)> example can be seen used in the picture from this post: https://getmusicbee.com/forum/index.php?topic=37692.0  Note the display at the end of the <Work> headers.  (By the way, hiccup, I got the idea for these sorts of things from reading your expansive posts on how to promote classical music collections, so it wasn't all in vain.  Cheers for that.  ;) )
Last Edit: January 06, 2023, 11:13:10 AM by Messiaen

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
$ASR and $ALR are both fantastic functions.  I'll give a couple example of how I've used them.
Thanks Messiaen! These are great explanations and examples.
This has been untreaded territory for me, this was very helpful.

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
I will freely admit that I have absolutely no idea what that extra checkbox-type thing does.  :)
It must be making the function some place of interest ;-)
https://unicode-table.com/en/2318/

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
4.
So $ASR is a function that can be used for virtual tags?
Should I then add it here?:
https://getmusicbee.com/forum/index.php?topic=35868.msg196257#msg196257
Answering myself: Yes, you probably should.
As a brief explanation I am thinking of this:

- - -
$ALR(<URL>,function_id)

$ASR(<URL>,preset_id)

These functions make it possible to use and integrate ALR (Auto Library Reports) and ASR (Advanced Search & Replace) presets in virtual tags.
- - -

Would that be a correct description?
Any suggestions for better wordings or other improvements?

(since the functions are rather complex I won't explain them further in the cheatsheet, but create links to the plugin page (README) and to Messiaen's explanation and examples)

Messiaen

  • Jr. Member
  • **
  • Posts: 103
Would that be a correct description?
Seems pretty succinct to me... though either way it requires a bit of trial-and-error before one finds that elusive "A-Ha!" moment when using them.  ::)

(Slightly aside, for me discovering the \@eval[[]] function was a revelation in the real use of ASR/ALR Virtual ID's, but that wouldn't belong in your guide as it's plugin-specific.  "But Daddy, you can't put a universe inside a universe inside another universe - I'd be scared of falling in!")

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
(Slightly aside, for me discovering the \@eval[[]] function was a revelation in the real use of ASR/ALR Virtual ID's, but that wouldn't belong in your guide as it's plugin-specific.
Yeah, that falls outside the scope and intention of the cheatsheet.
But as I said, I will add a link to your explanatory post here.
So if you feel like it, you could always edit that post and add more interesting stuff like these advanced functions to it?
Or write and publish an "AT&RT for Dummies" book ;-)

Messiaen

  • Jr. Member
  • **
  • Posts: 103
So if you feel like it, you could always edit that post and add more interesting stuff like these advanced functions to it?
Yeah, I kind of have already, but it just gets messy trying to over-explain something so arcane in excessive detail.  Things like that are best left to immediate use-case questions, like "How do I just make it go forward?"  (When I discovered horses didn't come with automatic break-systems the romance of riding became somewhat tarnished, if you know what I mean; Snooker is one of those games that's much easier to play on telly than it is in real life.)  ;)

Or write and publish an "AT&RT for Dummies" book
My forays, trisques, and self-effacing callumnies combined with irrepressible sesquipedalianesque tendencies towards longwindedness would scupper that particular lyrical essay before I even finished the frontispiece.  ;)  <Cough>

Seriously though, considering AS&RT is (at its core) a Reg-Ex meister's wet-dream, it's no small task making it beginner friendly, never mind dumbing it down to being actually practical (like the fun Boroda's having making the UI ergonomically viable with well-meaning hecklers like us in the audience).  I help where I can, but I'm still learning myself.
Last Edit: January 06, 2023, 02:05:52 PM by Messiaen

hiccup

  • Sr. Member
  • ****
  • Posts: 7908
My forays, trisques, and self-effacing callumnies combined with irrepressible sesquipedalianesque tendencies towards longwindedness would scupper that particular lyrical essay before I even finished the frontispiece.  ;)  <Cough>
You are smoking a pipe, right?

Messiaen

  • Jr. Member
  • **
  • Posts: 103
You are smoking a pipe, right?
If you've ever read The Decline and Fall of the Roman Empire by Edward Gibbon, it's a paraphrastic play on his 18th-century style of writing.  Who said you can't mix abstruse tech with a little cultural entertainment? No pipes necessary, though phred is going to scold us for going too far off-topic soon.   :)
Last Edit: January 06, 2023, 02:29:15 PM by Messiaen

boroda

  • Sr. Member
  • ****
  • Posts: 4657
Honestly, I think 5 seconds to be a bit short, considering if you apply a preset to (for example) a thousand files at once, the message doesn't show up until after the task is done (which can take up to 5 or 10 seconds), so immediate notification would be my preference (with longer display time)
the problem is that preset can be applied conditionally (only if tracks belongs to some auto or regular playlist), so it's impossible to show a status bar message before applying preset. but i've increased displayed time to 10 sec.

https://www.mediafire.com/file/m6jo0wczobidwkp/mb_TagTools_beta.zip/file

However, now that you've settled on single-click to activate checkboxes, it'd be nice if double-click could be employed for "Rename / Edit", as that's a function I use most and searching for a button (impractically placed next to "Delete") to edit something repeatedly (as happens with RegEx's!) was always awkward.  It's also generally the default for list-view d-click's.  
again, there is a problem. predefined presets can't be edited, and most users won't create custom presets. what do you think, maybe it's worth to edit custom preset and edit the copy of predefined preset (there may be warning dialog shown asking to edit the copy) on double-clicking?

When you use the 'proper' way to install AT&RT (Preferences > Plugins > Add Plugin...), no presets are placed in any folder in MusicBee's installation path.
So the buttons 'import new' and 'import all' simply won't work.
the proper way is to manually copy plugin zip content to "mb folder\plugins". just because "add plugin" button had been added to mb relatively recently, AND plugin can't be UPDATED via "add plugin" button (i've asked Steven to implement full support for installing/updating/removing plugins by the means of mb, without manually copying/deleting any files. maybe he will make this for mb 3.6).

but anyway, what you have written is not the case already a couple of days. now plugin searches in both "appdata\plugins\asr presets" and "mb folder\plugins\asr presets" folders for importing presets

moreover, portable mb 3.5rc3 installs plugins to "mb folder\plugins" rather than "mb folder\appdata\plugins" as it was earlier (of course installer mb3.5rc3 still installs plugins to writable "appdata\plugins" folder rather than to write-protected "c:\program files (x86)\musicbee\plugins\").

And I agree with Messiaen that three import buttons seem a bit much.
for now, i'll just rename import/export buttons because they have different meanings for importing/exporting user presets, and for importing predefined presets.



What would you enter exactly in the entry field? The name of an existing virtual tag? Some unique text of your own choice?

What does the (pointed at) button do?
these 2 buttons assigns virtual tag function id, and removes assignment. my fault, i had to make a tool tips for these buttons.

An even better example (which I imagine Boroda would find amusing) is in the use of $ALR.  Say I wanted to store the length of a classical "work" (as the sum of individual movements), I would first define an Auto-Library-Report as:

<Grouping>: Album Artist, Album, Work, Sum(Time) -> Save Field: Sum(Time)

and assign that ALR a virtual function ID of "SetWorkDur".
it's not very important, but tou can save Sum(Time) to <Null> tag to save one custom tag, and still assign virtual tag function id to Sum(Time).

also, you can assign individual id to every aggregated function (and saving aggregated functions to custom tags is not obligatory).


-----------------------------------


hiccup, Messiaen, i'm very impressed by your conversation  8)

Messiaen

  • Jr. Member
  • **
  • Posts: 103
i've increased displayed time to 10 sec.
Thank you.

predefined presets can't be edited, and most users won't create custom presets. what do you think, maybe it's worth to edit custom preset and edit the copy of predefined preset
I just imagined it working the way it does now - if you click Rename / Edit on a preset it just opens up in the editor so the user can look at it... sure, it can't be edited, but I learned a lot just from looking at your reg-ex codes without actually needing to copy the whole thing over first.  So, a double-click would just be the same as pressing the Edit button, without anything special.  Like you say, most users don't create custom edits and it stands to reason that those self-same users would be terrified of actually editing one of yours blindly.  ;)  So just being able to look at it is sufficient, I should think, they can always copy it later.

these 2 buttons assigns virtual tag function id, and removes assignment
Huh, I always just assumed that the Save All/Close button did that automatically - if the text field has content, then it's applied, if the field is empty, it's removed.  If there's some mystical need for this two-step approach, then it definitely should be documented better! :)

you can save Sum(Time) to <Null> tag to save one custom tag, and still assign virtual tag function id to Sum(Time).
Yeah I know (I did that accidentally and was surprised it worked), but when writing that example above the more pressing concern was brevity/clarity.  Also, sometimes I have a heck of a time getting the ALR configurations to work as I expect them to (forgetting or accidentally changing even a small grouping element can wreak havoc), so the standard philosophy is "if it ain't broke..."  :)

hiccup, Messiaen, i'm very impressed by your conversation
I kind of figured you'd come home after a long day only to find that the kids had messed up the house (thread) again, and who wants to read all this bloody English text anyway?  :-\

(Any thoughts on the idea of exporting a proper $Char() function?  The world isn't really banging on your door demanding one so I suppose it's not of much use to anyone else, and my work-around is functional, so it's just a thought.)

boroda

  • Sr. Member
  • ****
  • Posts: 4657
i've added a few new tool tips to ASR, and renamed "import all"/"import new" buttons to "update all"/"update new". double-clicking on user preset now opens it for editing, double-clicking on predefined presets open preset copy for editing, but i will change it so original predefined presets will be opened in read-only mode.

i've made new virtual tag function $Char(hexadecimal unicode code). it was just a couple of new lines of code. it works the same way as ASR function
Code
\@char[[charcode]]
https://www.mediafire.com/file/m6jo0wczobidwkp/mb_TagTools_beta.zip/file