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

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
Are you a fan of Free-Jazz?  When I was younger I used to dismiss it as noisy nonsense, but as I get older I begin to find pleasure in the challenge of it.
Thanks for asking.
Yes, I have opinions on free-jazz, and on Coltrane, and on getting older and realising younger me would have fierce arguments and disagreements with older me.
But going into that would (should) get us reprimanded.

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
If you wish to continue discussion double-quotes, please take it to "Beyond Music Bee"
Yeah but, no but, the double-quote thingy directly refers to how AT&RT describes that matter.
So it might be good if somebody with a degree in English could say if it is wrong and should be changed, or if it is o.k. and can remain as it is?

boroda

  • Sr. Member
  • ****
  • Posts: 4595
Due to the vagaries of English, the _"_ symbol is actually called "double quotes", while the _'_ apostrophe symbol is "single quote".  So, when you say "put it in double quotes" you're actually just saying surround it in a single set of quotation marks, which is obviously the wrong syntax.

So, instead of "DOUBLE QUOTES" you should probably say something like "put it in two sets of double-quotes", or "double-double quotes", or even "quadruple quotes", though the last two are neither colloquially correct or properly descriptive.

thanks for correcting me. you might want to reimport ASR presets (though this is the only change i've made for presets).

i've fixed a UI bug for "paste tags from clipboard" command:

https://www.mediafire.com/file/h2t08o9562efboi/mb_TagTools_latest.zip/file

God knows why English became the de facto internet standard - almost anything else would have probably been better.

NO! it would be MUCH worse if CHINESE (or even russian) was internet standard language!  ;D

Electrolite

  • Newbie
  • *
  • Posts: 6
I'm trying to sort my albums by size but I can't get it working properly.

I used ALR to create the following preset:


Then I set it to a custom tag called Album Bytes. When I sort by this tag the order is incorrect.
I think there is an issue with either the ALR preset or the Custom tag.

MusicBee is indeed sorting by the Album Byte field but the issue is that these values do NOT reflect the actual album size.


I already set my custom tag to Number in Configure Fields but that didn't help.

boroda

  • Sr. Member
  • ****
  • Posts: 4595
1st of all, you CAN'T sort the output FILE using LR. table can be sorted only in preview (by clicking on column header), and this sorting is intended only for easy filtering results by some condition (e.g. write only those strings to file which has some field equal to/greater than/etc. some value). to sort the OUTPUT FILE (this sorting will be also default sorting of preview table), you need to sort MB VIEW you are using, when you generate the report.

2nd. what do you mean by "custom tag"? how do you set it? or do you mean "virtual tag" actually?

3d. from your 1st screenshot, LR, obviously, treats the <size> field as floating point numbers, and this is correct (because LR treats ANY number as floating point number). the problem is that the actual numbers are too big (all these E+19, E+20 ,... mean *10^19, *10^20 - multiply by 10 to the power of 19, etc.).

i suspect this is happening due to your windows regional settings. open mb menu> edit> prefs> plugins> tag tools> configure, check the measurement units.

if this doesn't solve the problem, create a static playlist containing 1 track, generate a report for it, and post screenshots of mb playlist view (containing <size> field) and of report.

EDIT:

you are using old plugin version. i've recently rewritten LR almost from scratch (and consolidated ALR/LR into one LR command). update plugin:

https://www.mediafire.com/file/h2t08o9562efboi/mb_TagTools_latest.zip/file
Last Edit: June 12, 2023, 01:54:19 AM by boroda

Electrolite

  • Newbie
  • *
  • Posts: 6
1st of all, you CAN'T sort the output FILE using LR. table can be sorted only in preview (by clicking on column header), and this sorting is intended only for easy filtering results by some condition (e.g. write only those strings to file which has some field equal to/greater than/etc. some value). to sort the OUTPUT FILE (this sorting will be also default sorting of preview table), you need to sort MB VIEW you are using, when you generate the report.

I didn't try to sort directly from the LR table. I set the results into a MusicBee custom tag using the 'Save Field (...) to tag (...) option like this:


2nd. what do you mean by "custom tag"? how do you set it? or do you mean "virtual tag" actually?

I used the 'Save field to tag' option from LR to save the table results into one of these custom tags, I didn't use the Virtual tags. I tried to follow a very old tutorial on Album size sorting and they said there was a bug with virtual tags.


3d. from your 1st screenshot, LR, obviously, treats the <size> field as floating point numbers, and this is correct (because LR treats ANY number as floating point number). the problem is that the actual numbers are too big (all these E+19, E+20 ,... mean *10^19, *10^20 - multiply by 10 to the power of 19, etc.).

i suspect this is happening due to your windows regional settings. open mb menu> edit> prefs> plugins> tag tools> configure, check the measurement units.

if this doesn't solve the problem, create a static playlist containing 1 track, generate a report for it, and post screenshots of mb playlist view (containing <size> field) and of report.

EDIT:

you are using old plugin version. i've recently rewritten LR almost from scratch (and consolidated ALR/LR into one LR command). update plugin:

https://www.mediafire.com/file/h2t08o9562efboi/mb_TagTools_latest.zip/file

I tried to update the plugin but now when I preview the table, I get this error:
MusicBee v3.5.8447.35843Store (Win10.0), 11 Jun 2023 23:31:

System.ArgumentException: An entry with the same key already exists.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
   at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
   at MusicBeePlugin.LibraryReportsCommand.executePreset(String[] queriedFiles, Boolean interactive, Boolean saveResultsToTags, String functionId)
   at MusicBeePlugin.LibraryReportsCommand.previewTrackList()
   at MusicBeePlugin.PluginWindowTemplate.serializedOperation()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Maybe I installed it incorrectly, I extracted the zip and used the add plugin to add the .dll file. I'm using the MusicBee from MS Store.

boroda

  • Sr. Member
  • ****
  • Posts: 4595
it seems you are familiar with plugin updating/reinstallation process for mb store version, but i'll remind you: disable plugin, then restart mb, and click 'add plugin' button in mb prefs pointing mb to new plugin .zip

try to temporarily install this debug version:

https://www.mediafire.com/file/e7ux0rauaptj74g/mb_TagTools_debug.zip/file

post more detailed error message.

Electrolite

  • Newbie
  • *
  • Posts: 6
I installed your debugger version, looks like the error now shows the line of code where the issue happens.

MusicBee v3.5.8447.35843Store (Win10.0), 12 Jun 2023 4:32:

System.ArgumentException: An entry with the same key already exists.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
   at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
   at MusicBeePlugin.LibraryReportsCommand.executePreset(String[] queriedFiles, Boolean interactive, Boolean saveResultsToTags, String functionId) in C:\Users\Alexander\Source\Repos\TagTools\Additional-Tagging-Tools\LibraryReports.cs:line 1168
   at MusicBeePlugin.LibraryReportsCommand.previewTrackList() in C:\Users\Alexander\Source\Repos\TagTools\Additional-Tagging-Tools\LibraryReports.cs:line 2214
   at MusicBeePlugin.PluginWindowTemplate.serializedOperation() in C:\Users\Alexander\Source\Repos\TagTools\Additional-Tagging-Tools\PluginWindowTemplate.cs:line 299
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

boroda

  • Sr. Member
  • ****
  • Posts: 4595
it seems that you have duplicated tracks in your library. try this version:

https://www.mediafire.com/file/e7ux0rauaptj74g/mb_TagTools_debug.zip/file

it's still a temporary debug version, i'll recompile it if no exceptions arise now.

keep in mind that Sum(Size) will be expressed in bytes. to see e.g. megabytes, use virtual tag "$Round($Div(<Custom1>, 1048756),1) MB"

but 1st, post a screenshot of preview table displaying album size using bytes. i want to make sure that numbers are not senselessly big (these E+19, E+20, etc.).
Last Edit: June 12, 2023, 02:15:18 PM by boroda

Electrolite

  • Newbie
  • *
  • Posts: 6
but 1st, post a screenshot of preview table displaying album size using bytes. i want to make sure that numbers are not senselessly big (these E+19, E+20, etc.).
This version is working, values on the table aren't unreasonably huge:


keep in mind that Sum(Size) will be expressed in bytes. to see e.g. megabytes, use virtual tag "$Round($Div(<Custom1>, 1048756),1) MB"
I think MusicBee isn't using the 1024 x 1024 bytes definition so I just had to change your conversion to "$Round($Div(<Custom1>, 1000000),1) MB". Now the Virtual tag is calculating the Album Size correctly.


Can I use a Virtual Tag Function to access the byte values directly from my Virtual Tag instead of saving these values into Custom1 tag?


And last question do I have to auto-apply the preset on every MusicBee startup or is there a way for the calculation to be called dynamically only if the album changes/new song is imported.

boroda

  • Sr. Member
  • ****
  • Posts: 4595
keep in mind that Sum(Size) will be expressed in bytes. to see e.g. megabytes, use virtual tag "$Round($Div(<Custom1>, 1048756),1) MB"
I think MusicBee isn't using the 1024 x 1024 bytes definition so I just had to change your conversion to "$Round($Div(<Custom1>, 1000000),1) MB". Now the Virtual tag is calculating the Album Size correctly.

No, it's not resolution in pixels (1024px*1024px) in virtual tag formula, it's file size in bytes/KB/MB/etc (K usually means 1024 for file sizes, M - 1024*1024, etc. for file size, not for resolution, which doesn't have any direct relation to file size). but anyway, LR has been incorrectly working with units of measurements. i've fixed this, see download link at end of post.

Can I use a Virtual Tag Function to access the byte values directly from my Virtual Tag instead of saving these values into Custom1 tag?

yes, you can. then you can use the formula (or just part of a formula): $LR(<URL>,function_id)

And last question do I have to auto-apply the preset on every MusicBee startup or is there a way for the calculation to be called dynamically only if the album changes/new song is imported.

LR (and ASR too) virtual tag functions are calculated dynamically (you might want to "save" results to <Null> tag in this case). auto-calculating LR presets on startup (and after given # of tag changes) may be required only if you want to persistently store aggregated function results (not virtual tag functions!) in (custom) tags.

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

1. i've added some simple formatting to LR aggregated functions (and as a consequence for the virtual tag functions): now results can be multiplied/divided by a number, rounded to a number of digits after decimal point, and some custom text can be inserted between tag number value and tag text postfix after number.

NOTE: rounding is being calculated for final results (not for every file)!



2. Treating of units of measurements by LR is fixed. now <Size> field equal to "700 KB" for individual file (before summarizing) is treated as "700 * 1024 B", previously it has been treated as "700 * 1000 B". the same for <Bitrate> field and other similar fields.  

https://www.mediafire.com/file/h2t08o9562efboi/mb_TagTools_latest.zip/file
Last Edit: June 13, 2023, 07:50:43 PM by boroda

Electrolite

  • Newbie
  • *
  • Posts: 6
First of all, thanks for the effort these are great changes.

No, it's not resolution in pixels (1024px*1024px) in virtual tag formula, it's file size in bytes/KB/MB/etc (K usually means 1024 for file sizes, M - 1024*1024, etc. for file size, not for resolution, which doesn't have any direct relation to file size). but anyway, LR has been incorrectly working with units of measurements. I've fixed this, see download link at end of post.
Sorry, there was a miscommunication here. We have 1 MB = 2^20 = 1024 x 1024 = 1,048,576 bytes but there is another definition for MB that is: 1 MB = 10^3 =1000 x 1000 = 1,000,000 bytes.
I meant to ask which definition of MB LR or MusicBee were using and if that was the reason for the wrong unit conversions.

2. Treating of units of measurements by LR is fixed. now <Size> field equal to "700 KB" for individual file (before summarizing) is treated as "700 * 1024 B", previously it has been treated as "700 * 1000 B". the same for <Bitrate> field and other similar fields.  
Oh, so the issue was what I asked about, LR was using the 1MB = 10^3 bytes definition not the classic 1MB = 2^20 bytes.

I'm calculating the MB size directly on LR and just created a virtual tag that fetches results from the virtual function:


The virtual tag works fine to display the album sizes in the panels:


Unfortunately, I can't use the virtual tag for any kind of sorting, when I sort my albums by the virtual tag it just crashes MusicBee. I suppose this happens due to the asynchronous nature of the LR function? This is a very old bug because I saw old posts talking about it.

Anyway if this can't be fixed I'll use the virtual tags for displaying album sizes dynamically and the static custom tag for sorting, this solution will work just fine :)
Last Edit: June 14, 2023, 08:02:46 AM by Electrolite

boroda

  • Sr. Member
  • ****
  • Posts: 4595
frankly speaking, i never tried to sort albums by any virtual in general, and by virtual tag containing $LR() function particularly.

i've implemented LR own caching several months ago, but i've commented this code out because mb also caches custom virtual tag function results, and this mb caching was working fine in my tests.

i'll try this to see what is happening and fix possible issues, but i don't promise.

boroda

  • Sr. Member
  • ****
  • Posts: 4595
mb 3.5.8554 Portable is not crashing, when i try to sort albums by $LR(files size)  virtual tag, but it's working very slowly and unreliably. sometimes mb sorts by album size, sometimes doesn't, depending on the number of albums in the current view.

i don't see how this can be solved because sorting by $LR function may require calculation of this function for thousands of albums (if the entire library is included in the current view).

Electrolite

  • Newbie
  • *
  • Posts: 6
I'm using the same version but from MS Store. Now my MB isn't crashing but the sorting isn't working just like you.

But don't worry about this, I imagine solving this async problem will be a pain, using custom tags for sorting will work just fine :)