INTERACT FORUM

Please login or register.

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

Author Topic: Weight album ratings based on album number of readings  (Read 3916 times)

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Weight album ratings based on album number of readings
« on: December 27, 2016, 02:15:31 pm »

Hello,

I've seen there is a high concentration of genius here (on my mind any people able to understand and create expression like in this thread for instance is certainly a genius  ;D :o ;D) so I keep asking my silly questions :

We've seen in some other thread, how to give a rating per album instead of per track and how also create views that would sort album based on this rating.

Now, I would like to be able to weight the rating of an album depending on it's number of reading. For instance, an album read more than 5 times would get a bonus of 0.5 to it's rating, read more than 10 time a bonus of 1 to it's rating, and so on.

How would you achieve that ?

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Logged

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Weight album ratings based on album number of readings
« Reply #2 on: December 28, 2016, 07:57:20 am »

Thanks Ferday. Different but interesting. I'm going to study this :)

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Weight album ratings based on album number of readings
« Reply #3 on: December 28, 2016, 08:13:44 am »

I use variables a lot to calculate album stuff.  They aren't very intuitive.  I'll see if I can come up with something to help but it's very busy.  Happy holidays and have fun learning :)
Logged

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Weight album ratings based on album number of readings
« Reply #4 on: December 28, 2016, 08:25:17 am »

I use variables a lot to calculate album stuff.  They aren't very intuitive.
;D ;D ;D. Yeah...we can say that ....  ;D ;D ;D

I'll see if I can come up with something to help but it's very busy.  Happy holidays and have fun learning :)

The link you provide is interesting and close enough to what I was looking for and it's still better than what I expected. I may be able to adapt it to my needs.

Anyway I'm not sure I understand quit well : it seems (from what I understand) that the calculated result should apply to the whole album (and no per track). But when I try to create a smartlist based on the expression given I get result per tracks and not per album. It's the same when I create a View pane. I got the ratings calculated per tracks. Is there an easy way to correct that ?



Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Weight album ratings based on album number of readings
« Reply #5 on: December 28, 2016, 02:53:47 pm »

Ok. I've spent some time today trying to figure out how all this stuff work and I won't say I understand better, but at least I understand enough to clarify what I need, which is certainly very easy for you guys.

I would definitively use the link you gave earlier Ferday as I can adapt it for my own usage.
But I havn't been able to figure out how to calculate the total number of plays of an album.

Like if an album have 3 track and track 1 have been played 2 times, track 2 one time and track 3 5 times, I need to get : 8.
How would you calculate that ?

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Weight album ratings based on album number of readings
« Reply #6 on: December 28, 2016, 05:36:25 pm »

ok, i've tested this a little bit and it seems working

make a new smartlist, and in the import/export box, paste this

Code: [Select]
[=save(0,var_number_of_tracks[album artist (auto)][album])1]=1 [=save(0,var_plays_sum[album artist (auto)][album])1]=1 [=save(math(1+load(var_number_of_tracks[album artist (auto)][album])),var_number_of_tracks[album artist (auto)][album])1]=1 [=save(math([Number Plays]+load(var_plays_sum[album artist (auto)][album])),var_plays_sum[album artist (auto)][album])1]=1 [=save(math(load(var_plays_sum[album artist (auto)][album]) / load(var_number_of_tracks[album artist (auto)][album])),var_album_plays[album artist (auto)][album])1]=1 [Media Type]=[Audio] ~sort=[Actors],[Number Plays]-d,[Media Type],[Album Artist (auto)],[Album]
now, in the same smartlist, right click any column, and Add Expression Column.  in the editor that will come up, paste this for an "average times the album has been played as a whole " (second expression column in screenshot)

Code: [Select]
load(var_album_plays[album artist (auto)][album])   

or this for "number of times the album has had any track played from it" (first expression column in screenshot) - basically the sum like you asked for

Code: [Select]
load(var_plays_sum[album artist (auto)][album])
it seems to be working for me and gives you a good start.  you can calculate with these numbers as normal (in custom fields or expression columns), but you must refresh a smartlist when you import new tracks, they don't self refresh.

**note - i use album artist(auto) / album to delineate what is an album.  if you have different tags you may need to change that part, as it helps determine what is in fact an album. also you need to have all your tags existing and correct


now, as a really simple example of weighting, make yet another expression column and paste this

Code: [Select]
=Math([rating] + load(var_album_plays[album artist (auto)][album]) / 10)
which will simply add a decimal weighting factor based on the average number of album plays.  you can get as complex as you want here (see the points thread i posted - he went pretty nuts with that one) - just call the load(...) as you would a normal field for calculations.



Logged

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Weight album ratings based on album number of readings
« Reply #7 on: December 29, 2016, 03:59:46 am »

Wow ! This looks very exciting  :D !
Thanks a lot :) for your efforts Ferday, this is very kind of you. I'll have a deeper look on that today and be back later on the subject.

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Weight album ratings based on album number of readings
« Reply #8 on: December 29, 2016, 02:45:13 pm »

So. I spent the main part of my afternoon on this, trying to solve several things.

First of all, for the main part I've been busy trying to figure why ... this wasn't working. At all.
Until I realised that my MC has it's language set to french...so your expression couldn't work at all with my fields in french...welcome in Duhland  :D

But at least all this time spent trying to figure how all of that was working wasn't a waste as I understand much better now how variables works.

If I get it right, the following line

Code: [Select]
[=save(0,var_number_of_tracks[album artist (auto)][album])1]=1
Mean define variable "var_number_of_tracks", affect it to "Album artist + album" and set its initial value to 0

while

Code: [Select]
[=save(math(1+load(var_number_of_tracks[album artist (auto)][album])),var_number_of_tracks[album artist (auto)][album])1]=1
mean : loop for each track of the album, "var_number_of_tracks" = "var_number_of_tracks" + 1


The remaining problem now is that "var_plays_sum" (calculation of the sum of how many times each track have been played within one album) works only if ALL tracks have been played at least once. If some tracks have never been played, "var_plays_sum" is still equal to zero.

I've been trying to find a solution with some "if(compare([Number Plays],>,0)..." tests (thinking that maybe the fact that "Number plays" field is empty (no '0' value in it) when a track have not been played could cause some problem with calculation) but with no success.

What I do not understand is that the calculation of the rating total of an album (which has basically the exact same syntax than the total number of tracks played one) is working correctly (If I've rated only 3 tracks on 10, the sum of the ratings is calculated).

Would you have an idea on how to solve that ?

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Weight album ratings based on album number of readings
« Reply #9 on: December 29, 2016, 05:40:36 pm »

try changing [Number Plays] to

formatnumber([Number Plays, 0])

that should force it to be 0 rather than undefined
Logged

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Weight album ratings based on album number of readings
« Reply #10 on: December 31, 2016, 06:18:11 am »

Thank you Ferday, this did the trick !  :D

You've been a great help on this subject, thanks again !!! (now I can fully get nuts too playing on this Album rating thing !  ;D :o ;D)
Pages: [1]   Go Up