INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Group by Album Count  (Read 108 times)

JimK

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 71
  • nothing more to say...
Group by Album Count
« on: October 27, 2024, 02:48:30 pm »

Is there a way to create a library tree view that groups album artists by number of albums? I was able to create a view that lists the number of albums by album artist, but not a way to group them.

For example:

Number of Albums
    8 Albums
         Album Artist #1
         Album Artist #2
   11 Albums
         Album Artist #1
         Album Artist #2
         Album Artist #3
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2563
Re: Group by Album Count
« Reply #1 on: October 28, 2024, 07:06:26 am »

You can add an Expression category with GroupCountQuery(), set it as Descending:
GroupCountQuery(Album Artist /(Auto/), Artist - Album /(Year/)) Albums

Then add an Artist category, and under that add the Artist - Album (Year) Category (or just Album name, as you prefer).

Be warned that this will likely be unusably slow due to GroupCountQuery(). Ideally you would need to pre-calculate that expression and save it into a Field, and then use that field as a Category instead of the Expression. ZStats can help with that.
Logged

JimK

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 71
  • nothing more to say...
Re: Group by Album Count
« Reply #2 on: October 28, 2024, 08:08:44 am »

Thanks for the reply.

I create the expression using GroupCountQuery. When I have it in the list of categories in any position other than first, it returns the correct value almost immediately. However, when it is the first category, it never finishes processing, and I have to kill the application in Task Manager.

If I do create a calculated field to store the album count, how would I tie that field to the Artist?
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2563
Re: Group by Album Count
« Reply #3 on: October 28, 2024, 09:35:08 am »

You can set the field to "Relational: One value per Album Artist (Auto)".
The way MC works, it will still want to calculate this value for each and every file even though the result is the same for the same artist, which kind of defeats the purpose of a Relational field.

This expression is likely much faster, but it will only refresh the counts if you restart MC:
Code: [Select]
if(isempty(load(_acount_{[Album Artist /(Auto/)]})),save(GroupCountQuery(Media Sub Type;Album Artist /(Auto/), Artist - Album /(Year/)), _acount_{[Album Artist /(Auto/)]}),load(_acount_{[Album Artist /(Auto/)]})) Movies
Logged

JimK

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 71
  • nothing more to say...
Re: Group by Album Count
« Reply #4 on: October 28, 2024, 10:35:56 am »

Thank you! That expression worked exactly the way I needed and displayed instantaneously.
Logged
Pages: [1]   Go Up