More > JRiver Media Center 31 for Windows
revisiting album average rating-taking into account non rated tracks
zeltak:
Hi all
I have searched (and found!) many good posts here on different ways (both simple and uber sophisticated) to calculate a user filed with the mean rating of an album.
yet I cant see anyway to do so while taking into account non rated tracks.
What I would love is to consider unrated tracks as `1` and take that into account when calculating average album ratings
anyone has done something like this before?
kind regards
Z
zybex:
Solution 1:
A single FieldQuery() almost gets you there, but unfortunately it ignores empty values. So the expression needs to be more complicated in order to generate the missing ratings:
--- Code: ---save(ItemCount(/[Artist - Album /(Year/)/]), _count)/
save(FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], Rating, 1, 1), _ratings)/
save(1, _noRating)/
FormatNumber(Math((listmath([_ratings],2) + ([_count]-listcount([_ratings])) * [_noRating]) / [_count]),1)
--- End code ---
This may be too slow if you have a large library. For most cases, it will work fine and much faster if you use 'Current View' Scope mode in FieldQuery() - just change this line:
--- Code: ---save(FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], Rating, 1, 0), _ratings)/
--- End code ---
zybex:
Solution 2 (simpler):
- create a calculated field called [RatingOr1] with expression: FirstNotEmpty([Rating,0],1)
- Use this expression for the album average:
--- Code: ---FormatNumber(ListMath(FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], RatingOr1, 1, 1),3),1)
--- End code ---
Again, try it with the Scope=0 to see if it works for you as it's faster:
--- Code: ---FormatNumber(ListMath(FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], RatingOr1, 1, 0),3),1)
--- End code ---
zeltak:
wow thx so mych @zybex!!
I tried both methods and both with the `Scope=0` and with both as you said MC comes to a crawl :) (using latest OSX and MBP with m1pro chip)
I wonder is the slow crawl persistent or does MC calculates the mean rating as a one off thing and then stores this in file tags?
thx so much again
Z
zybex:
Yeah, Fieldquery can be slow :( One way to go about it is use/show it only on Views having few albums, like only when displaying all albums for a given artist. Even so, if your collection is huge then it will be slow regardless.
I think MC caches the results for 1 minute only, so it's not persistent.
If you have a windows machine available, you can use ZStats to pre-calculate the ratings - you can configure it to just run an expression on all files, and re-run it daily/nightly to update the numbers:
https://yabb.jriver.com/interact/index.php/topic,131845.0.html
Navigation
[0] Message Index
[#] Next page
Go to full version