Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: formatting string to count total tracks by artist? (Read 4069 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

formatting string to count total tracks by artist?

Hi,

I'm looking for some code that will return the total number of tracks by an artist.
I thought this might do it: $meta_num(artist), but I want it to return the total tracks in the library by the artist.

So for example, if I had a total of 10 tracks by X and 5 by Y, I'd like to put something like this in the "Total Track" column.

Artist - Title - Total Tracks
X - Song 1 - 10  (i.e. it looks at the %artist% and returns the total count of songs by that artist)
X - Song 2 - 10
Y - Song 1 - 5
Y - Song 2 - 5

etc .. 
Something like %total_tracks_by_artists%
(I pray there isn't %total_tracks_by_artists%  ) I didn't find it, if there is).

Any help or suggestions greatly appreciated.

C.
PC = TAK + LossyWAV  ::  Portable = Opus (130)

formatting string to count total tracks by artist?

Reply #1
Title formatting is not suited to calculate such aggregate functions.

Use the album list (%<artist>%|%title%) or facets (%<artist>% + statistics/tracks) to display the number of tracks for each artist.

formatting string to count total tracks by artist?

Reply #2
Thanks for the quick reply Frank.
The problem is that it's not really for display purposes as such; I was hoping to use it as part of a calculation which (if I remember the "cwb_hooks deprecation spin-off thread" correctly) constitute title formatting abuse.

Unfortunately at present there's nothing else to use to do such things.

I understand that "Title formatting is not suited to calculate such aggregate functions" but is it possible?

Thanks again.

C.
PC = TAK + LossyWAV  ::  Portable = Opus (130)

 

formatting string to count total tracks by artist?

Reply #3
I understand that "Title formatting is not suited to calculate such aggregate functions" but is it possible?
It's as much possible as it is possible to make pigs fly.
It surely is if you try hard enough but it's not the pig that does the hard part anymore; in our case, it would be somebody's weird component doing the math, not your "title formatting code", and the whole thing would most likely be horribly slow.
We are the bork. Your software bugs will be added to our own. Resistance is futile.

formatting string to count total tracks by artist?

Reply #4
That sounds like a no. 
I shall stop dreaming of pigs with foo_wings.

Thanks for the quick response (and your excellent work with foobar2k).

C.
PC = TAK + LossyWAV  ::  Portable = Opus (130)