Author Topic: Virtual Tag: display <actual album track count> / <expected album track count>  (Read 520 times)

MusicMee

  • Jr. Member
  • **
  • Posts: 40
I used to use the FLAC tag "TRACKTOTAL" to document the expected track total of an album (vs what it is intended for - to document the expected track total of a disc). Once I realized I was using the tag incorrectly I corrected my mistake. However, by doing so, I broke one of my virtual tags:
$If(<Album Complete?>="Y",<Album Track Count>,<Album Track Count>/<Track Count>) Track(s)

If the album is "complete" the virtual tag shows the number of available tracks for the album: 32 Tracks (for eg)
If the album is not "complete" it shows the number of available tracks for the album over the number of expected tracks: 30/32 Tracks (for eg - 2 tracks are missing)

To get the above working again I need to replace <Track Count> with the album's "expected" track count (the sum of each disc's TRACKTOTAL) but I am not sure how to access this number. Any suggestions?
Last Edit: January 13, 2024, 03:09:21 PM by MusicMee

hiccup

  • Sr. Member
  • ****
  • Posts: 7904
This little puzzle is hurting my brain.
My gut says it is possible, but my brain seems to have left and is doing some other stuff at the moment.

In case my brain returns and asks: what are your grouping settings for 'what defines an album'?
Last Edit: January 13, 2024, 04:23:24 PM by hiccup

MusicMee

  • Jr. Member
  • **
  • Posts: 40
This little puzzle is hurting my brain.
My gut says it is possible, but my brain seems to have left and is doing some other stuff at the moment.

In case my brain returns and asks: what are your grouping settings for 'what defines an album'?

lol - sorry hiccup. I probably made it sound way more complicated than necessary. A tech writer I am not!  :)

Re: album grouping settings - I didn't even know this was a thing until you called it out. I am using MusicBee's default settings - the following fields define an album: 1. Album Artist; 2. Album Name

MusicBee has to calculate the number I am looking for to determine <Album Complete?>. I guess it's a question of - Can I access that number or calculate it myself?

hiccup

  • Sr. Member
  • ****
  • Posts: 7904
lol - sorry hiccup. I probably made it sound way more complicated than necessary. A tech writer I am not!  :)
Nah, I got it. (after reading three times ;-)
I was asking about 'album grouping' because a solution (if it exists) could depend on if e.g. 'disc#' is a part of what defines an album for you.

Let's see if somebody else beats me to a solution, or me admitting I can't think of a solution.

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1070
  • Heal The World
This is an adversary from (a little over) a year ago that I did not have much luck figuring out when you'd first brought it up:

https://getmusicbee.com/forum/index.php?topic=37144.msg204132#msg204132
https://getmusicbee.com/forum/index.php?topic=37163.msg204247#msg204247

I need to replace <Track Count> with the album's "expected" track count (the sum of each disc's TRACKTOTAL) but I am not sure how to access this number.
Getting that number from the confines of virtual tags seems rather impossible from what I can tell.
Maybe it will help you a bit if I explain how I think MusicBee is determining whether or not an album is complete.

I am trying to display the <expected track count> that <Album Complete?> is using to determine if a album is complete or not and <Track Count> doesn't appear to be it...
MusicBee's <Album Complete?> does not appear to be comparing <Album Track Count> vs <sum of each disc's track count>
On the surface, what it looks to be doing is (1) checking if each disc is complete and then (2) marking the whole album as incomplete if any of the discs are incomplete.

To replicate that evaluation process, you can set up virtual tags as follows:
<Disc_Tracks>              =    <Disc#><Album>
<Disc_Complete?>       =    $If($Count(<Disc_Tracks>)=<Track Count>,0,1)
<Album_Complete?>   =    $If($Sum(<Disc_Complete?>,<Album>)>0,N,Y)
I already spend hours on end on social media. Might as well spare a few of those to a greater purpose here.

tjinc

  • Sr. Member
  • ****
  • Posts: 333
When I first read this I thought 'surely that's straightforward'.................and then I tried to do it....................not so straightforward.
However I have come up with this (feels like rather clumsy) method using three virtual tags:

1. Create a unique identifier for each disc:

AlbDiscID
Code
<Disc#><Album><Album Artist>

2. Assign a number to each track which represents an average value for the expected disc track count (i.e. expected disc track count divided by actual disc track count):

ExpDiscTkCtAv
Code
$Div(<Track Count>,$Count(<AlbDiscID>))

3. Sum this average value over the whole album to give the expected album track count:

ExpAlbTkCount
Code
$Sum(<ExpDiscTkCtAv>,<Album>)

This definitely needs some more testing as I have only tried it on a system with a very small and simple library, but it appears to work.
I also feel that it might need some handling in the case of any rounding errors - not sure, and I haven't looked at this.

Edit 15/01/24
$Count(<AlbDiscID>) was $Count(<Title>,<AlbDiscID>) - removed unnecessary code producing the same output
Last Edit: January 15, 2024, 05:03:53 PM by tjinc

MusicMee

  • Jr. Member
  • **
  • Posts: 40
This is an adversary from (a little over) a year ago that I did not have much luck figuring out when you'd first brought it up:

https://getmusicbee.com/forum/index.php?topic=37144.msg204132#msg204132
https://getmusicbee.com/forum/index.php?topic=37163.msg204247#msg204247

I need to replace <Track Count> with the album's "expected" track count (the sum of each disc's TRACKTOTAL) but I am not sure how to access this number.
Getting that number from the confines of virtual tags seems rather impossible from what I can tell.
Maybe it will help you a bit if I explain how I think MusicBee is determining whether or not an album is complete.

I am trying to display the <expected track count> that <Album Complete?> is using to determine if a album is complete or not and <Track Count> doesn't appear to be it...
MusicBee's <Album Complete?> does not appear to be comparing <Album Track Count> vs <sum of each disc's track count>
On the surface, what it looks to be doing is (1) checking if each disc is complete and then (2) marking the whole album as incomplete if any of the discs are incomplete.

To replicate that evaluation process, you can set up virtual tags as follows:
<Disc_Tracks>              =    <Disc#><Album>
<Disc_Complete?>       =    $If($Count(<Disc_Tracks>)=<Track Count>,0,1)
<Album_Complete?>   =    $If($Sum(<Disc_Complete?>,<Album>)>0,N,Y)

Wow! Great memory. I only vaguely remember those posts. Since then I have tried plexamp (which is great for mobile and andriod auto), tried roon and come back full circle - MusicBee is too good! I just gotta clean up my UI (hence this post), tidy up my workflow and tweak that damn chromecast plugin (so awesome and so buggy!). I appreciate the explanation and I don't blame MusicBee - I am looking to do something that is pretty edge case but it's hard for me to let it go. Worst case I know I can use python to create my own ALBUMTRACKTOTAL tag but that seems like cheating and is far from elegant. Not to mention that kind of hack would cause me to lose sleep and eventually just delete the tags.  :)

MusicMee

  • Jr. Member
  • **
  • Posts: 40
When I first read this I thought 'surely that's straightforward'.................and then I tried to do it....................not so straightforward.
However I have come up with this (feels like rather clumsy) method using three virtual tags:

1. Create a unique identifier for each disc:

AlbDiscID
Code
<Disc#><Album><Album Artist>

2. Assign a number to each track which represents an average value for the expected disc track count (i.e. expected disc track count divided by actual disc track count):

ExpDiscTkCtAv
Code
$Div(<Track Count>,$Count(<Title>,<AlbDiscID>))

3. Sum this average value over the whole album to give the expected album track count:

ExpAlbTkCount
Code
$Sum(<ExpDiscTkCtAv>,<Album>)

This definitely needs some more testing as I have only tried it on a system with a very small and simple library, but it appears to work.
I also feel that it might need some handling in the case of any rounding errors - not sure, and I haven't looked at this.

I like the way you think! I never considered tackling it in stages via the virtual tags! I look forward to playing with this. I'll let you know how it goes....

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1070
  • Heal The World
Assign a number to each track which represents an average value for the expected disc track count...
$Div(<Track Count>,$Count(<Title>,<AlbDiscID>))
Talk about that free maths lesson :-)
Using an average didn't cross my mind, but you nailed it.
__________

Btw, <Title> looks to be redundant in the above as <AlbDiscID> is already representing each file appearing in the disc.
I already spend hours on end on social media. Might as well spare a few of those to a greater purpose here.

hiccup

  • Sr. Member
  • ****
  • Posts: 7904
When I first read this I thought 'surely that's straightforward'.................and then I tried to do it....................not so straightforward.
However I have come up with this (feels like rather clumsy) method using three virtual tags:
Well done tjinc.
I haven't been able to find a better solution, or one that needs less virtual tags.

tjinc

  • Sr. Member
  • ****
  • Posts: 333
Btw, <Title> looks to be redundant in the above as <AlbDiscID> is already representing each file appearing in the disc.

Ah yes, you are right - I have edited my post to remove the unnecessary code (nobody likes unnecessary code).

Although this method does work I am not sure how useful it is in real operation. The problem being that, on restarting MusicBee, the virtual tag ExpAlbTkCount throws an error (or more accurately results in the tag not being calculated). This can be corrected by sending the refresh command (F5) but it is a little frustrating.
I would guess that this is the result of one calculated tag being dependent on the result of another calculated tag, or at least the result of stacking certain mathematical functions.
Bit of a shame.

hiccup

  • Sr. Member
  • ****
  • Posts: 7904
The problem being that, on restarting MusicBee, the virtual tag ExpAlbTkCount throws an error (or more accurately results in the tag not being calculated). This can be corrected by sending the refresh command (F5) but it is a little frustrating.
I would guess that this is the result of one calculated tag being dependent on the result of another calculated tag, or at least the result of stacking certain mathematical functions.
Bit of a shame.
I can confirm the error being thrown after restarting MusicBee.
The fact that the virtual tag works fine initially, but fails after restarting MusicBee may suggest there is a software bug in play here.

Bee-liever

  • Member
  • Sr. Member
  • *****
  • Posts: 3840
  • MB Version: 3.6.8878 P
When I first read this I thought 'surely that's straightforward'.................and then I tried to do it....................not so straightforward.
However I have come up with this (feels like rather clumsy) method using three virtual tags:

1. Create a unique identifier for each disc:

AlbDiscID
Code
<Disc#><Album><Album Artist>

2. Assign a number to each track which represents an average value for the expected disc track count (i.e. expected disc track count divided by actual disc track count):

ExpDiscTkCtAv
Code
$Div(<Track Count>,$Count(<AlbDiscID>))

3. Sum this average value over the whole album to give the expected album track count:

ExpAlbTkCount
Code
$Sum(<ExpDiscTkCtAv>,<Album>)

This definitely needs some more testing as I have only tried it on a system with a very small and simple library, but it appears to work.
I also feel that it might need some handling in the case of any rounding errors - not sure, and I haven't looked at this.

Edit 15/01/24
$Count(<AlbDiscID>) was $Count(<Title>,<AlbDiscID>) - removed unnecessary code producing the same output

Unfortunately this will only work if have some tracks from each disc present, if you are missing a disc from a set then it doesn't calculate properly.

I use a similar virtual tag to MusisMee's original
$If(<Album Complete?>="Y",<Album Track Count>,<Album Track Count>/<Track Count>) Track(s)
but I also display the disc count
Code
$IsNull(<Disc Count>,,$If(<Disc Count>!=1,<Disc Count>" Discs",<Disc Count>" Disc")) - $If(<Track Count>><Album Track Count>,$If($Contains(<Keywords>,TTC=)="T",$Split($RSplit(<Keywords>,=,1),;,1),<Track Count>),<Album Track Count>) Tracks$If($Or(<Album Track Count>=<Track Count>,<Album Complete?>="Y"),,*)
To overcome the missing disc problem I added TotalTrackCount (TTC=) to the Keywords tag for that case.
I also just show an asterisk (*) if the album is incomplete rather than <Album Track Count>/<Track Count>, but MusicMee should be able to change the virtual tag to suit their needs.
Last Edit: January 16, 2024, 01:29:38 AM by Bee-liever
MusicBee and my library - Making bee-utiful music together