Author Topic: Creating an Album Play Count custom tag  (Read 5556 times)

Bee-liever

  • Member
  • Sr. Member
  • *****
  • Posts: 3830
  • MB Version: 3.6.8830 P
Creating an Album Play Count custom tag to give similar results to Overall Top Albums in Last.FM statistics

As promised to boroda and Zak

With reference to original posts here: https://getmusicbee.com/forum/index.php?topic=29176.0
                                                 and here: https://getmusicbee.com/forum/index.php?topic=29247.0

After some discussion (and much thought) on having an Album Play Count tag that could be used to play most played albums in Auto-DJ mode, I worked out that a simple average of track play counts won't do.  It is too easily thrown off by a single favourite track from an Album being played multiple times.

With more research I found a Manipulated-Mean Album Play Count (MAPC) gives results comparable to Overall Top Albums from Last.FM.

Prerequisites

Minimum:
  • MusicBee 3.3 Update4 (MB3.3.7310);
  • Additional Tagging & Reporting Tools plugin (ATT5.2.7278);
  • 1 free Custom tag;
  • 3 free Virtual tags;
  • Your files tagged with Disc#, Disc Count, Track# and Track Count.

*I have 'files for each album are organised in their own folder' enabled.

Method

1. Set up a Custom tag 'MAPC'

2. Set up Virtual tags
  • Path4ALR [label] <Path> [formula];
  • PCsq [label] $Mul(<Play Count>,<Play Count>) [formula];
  • AlbumPCmean [label] $Round($Sqrt($Div($ALR(<URL>,PC2_sum),$If(<Track Count>><Album Track Count>,<Track Count>,<Album Track Count>))),1) [formula].

3. set up first ALR
  • Go to Menu> Tools> Additional Tagging Tools> Auto Library Reports...;
     * this path depends on how you set up ATT
  • select 'New preset' and then highlight <Empty preset>;
  • from RH list select Path4ALR;
  • change 'Function for new fields:' to 'Minimum';
  • from RH list select Play Count;
  • change 'Function for new fields:' to 'Maximum';
  • from RH list select Play Count;
  • change 'Function for new fields:' to 'Sum';
  • from RH list select PCsq;
  • change 'Save field' to Sum(PCsq);
  • enter 'Sum(PCsq)' in 'Assign virtual tag function id:';
  • select 'Update preset';
  • select 'Preview' and check that report runs;
  • select 'Clear';

5. set up second ALR
  • select 'New preset' and then highlight <Empty preset>;
  • from RH list select Path4ALR;
  • change 'Function for new fields:' to 'Average value' and 'of checked tag per tag' to 'URL';
  • from RH list select AlbumPCmean;
  • leave 'Average value' and 'URL' as they are;
  • from RH list select MAPC;
  • change 'Save field' to Average value(AlbumPCmean/URL) and 'to tag:' to MAPC;
  • tick 'Save only if tag' box and change values to 'Average value(AlbumPCmean/URL)' 'is greater than' 'Average value(MAPC/URL)';
  • select 'Update preset';
  • select 'Preview' and check that report runs;
     * if you have a large library, this can take quite a while
  • select 'Clear';

6. set ALR's to auto-run at start up

If both ALR's ran successfully then;
  • highlight preset, tick box in front of preset name and press 'Update preset';
  • do the same for the other preset;
  • re-start MB and the ALR's will run and update the MAPC tag automatically at every start.

Optional

If you want to have manual control on applying the MAPC values then you need to set up an ASR preset.
  • Go to Menu> Tools> Additional Tagging Tools> Advanced Search & Replace...;
    * this path depends on how you set up ATT
  • select 'TOY: 'Copy tag' command' and press 'Copy';
  • change the 'Preset name:' to 'CUSTOM: Copy 'AlbumPCmean' virtual to 'MAPC' custom;
  • select <Tag 1> as 'read only' and 'corresponds to' as 'AlbumPCmean';
  • select <Tag 2> as 'writable' and 'corresponds to' as 'MAPC';
  • check Step 1 'Search for:' is still ^(.*) and 'in tag:' is <Tag 1>;
  • check Step 1 'Replace with:' is still $1 and 'in tag:' is <Tag 2>;
  • click 'OK';

You can now run the ASR preset to update an albums MAPC tag on demand.

_______________________________________________________________________

 
My library is just over 25,000 tracks and I found that running the ALR on every start is a bit over-kill, so I only run the presets monthly.

I couldn't get 'Calculate aggregated functions and save them to tags for ticked presets on every XX tag changes' to work consistently for me.
You may have better luck.

With the way my library is structured <Album unique Id>, <File path> and <Folder>, within Auto Library Reports options, would also not work for me.
Feel free to try these options with your set up and please post your results.
If these options work you won't need the Path4ALR virtual tag, and freeing up a virtual tag is always something to be desired.


Happy MB-ing everyone!  :)
Last Edit: January 14, 2020, 12:02:24 AM by Bee-liever
MusicBee and my library - Making bee-utiful music together

SonicRings

  • Sr. Member
  • ****
  • Posts: 277
Thanks a lot for your tutorial! However, I'm confused why it's necessary to go through all of this when MusicBee clearly already keeps track of the album play count total?



Is there a way to reference this value, which is visible when editing an album?
It's also an available stat in the Library Statistics window:


Pingaware

  • Sr. Member
  • ****
  • Posts: 1110
Bee-liever, you are a star. I've been thinking about this for literally years. At one point I was planning on coding a plugin to do numerical functions directly just to do this more easily (laziness and real life got in the way of that...). I even had a similar setup to work out if an album was unplayed in its entirety which was imperfect to say the least. I will find time to try this one day soon.
Bold words in my posts are links unless expressly stated otherwise.