INTERACT FORUM

Please login or register.

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

Author Topic: Request for Genre Script  (Read 5366 times)

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Request for Genre Script
« on: February 23, 2018, 09:40:00 am »

Following on from this thread:

https://yabb.jriver.com/interact/index.php/topic,114445.msg792198.html#msg792198

if he starts the thread, i'll give it a go.  MusicBringer, bring some detail if you want this to happen.    :P

I would like a similar script that tells me about my Genres, please.
For example:
How many tracks do I have in each Genre.
How Many Times I have played that Genre; or perhaps I am saying How Much (percentage) I have / have not played of a particular Genre - split into mp3s / flacs / or both.

I should be grateful to know How much I play one Genre against another, perhaps with a view to getting rid of some lesser played Genres.

I am not to sure what is possible, but I think you are getting my general drift of what I require.
Ha, its just that the marko script reveals I have never played 25% of my 125,000 tracks in the last five years, so why not I ask myself.

@ferday, I get the feeling that you are looking for a more specific requirement spec, sorry, that's all I have a the moment.


[late edit, brain, dump]
How many tracks in a Genre.
How many of those tracks have been played (and When: recent, last year,...)
What is that as say, a percentage of that Genre (nearly all played, of hardly touched)
Result will reveal what Genre gets played most, and more importantly what is being ignored.
I have about 125,000 tracks in MC22.0.108.
thanks,
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #1 on: February 23, 2018, 06:26:08 pm »

let's start simple  ;) 

make a new smartlist.  edit the smartlist (right click, edit).  set up a few simple rules (filepath, audio only, etc.)

now click "import/export" at the bottom left of the edit screen, and a window will pop up.  it will have the rules that you've entered

now above that, paste the following:
Code: [Select]
[=save(0,vnumtracks[genre])1]=1
[=save(0,vnumplays[genre])1]=1
this is creating our number of tracks per genre variable, and our number of plays per genre variable. 
under that, paste
Code: [Select]
[=save(math(1+load(vnumtracks[genre])),vnumtracks[genre])1]=1 [=save(math(if(isempty([Number Plays]),0,[Number Plays])+load(vnumplays[genre])),vnumplays[genre])1]=1this is filling those variables. 

heres the entire import/export window from my test:
Code: [Select]
[=save(0,vnumtracks[genre])1]=1 [=save(0,vnumplays[genre])1]=1 [=save(math(1+load(vnumtracks[genre])),vnumtracks[genre])1]=1 [=save(math(if(isempty([Number Plays]),0,[Number Plays])+load(vnumplays[genre])),vnumplays[genre])1]=1 [Filename (path)]="test" ~sort=[Artist]
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #2 on: February 23, 2018, 06:31:45 pm »

ok, we've now got confusion.  let's put some order into it

apply and ok the import/export stuff.  now we are looking at our smartlist.  right click and add an expression column.  paste in this
Code: [Select]
load(vnumtracks[genre])now add another expression column and paste in this
Code: [Select]
load(vnumplays[genre])
we now have one column that shows the # tracks / genre, and one column that shows the total # plays per that genre

to move forward with your ideas...  MC can't really get a "single number" (that's why we are displaying by column) but it can get a single number per field.  we can display by any combination of fields, so we can get the number of plays per artist per genre, or per genre per number of tracks, etc.  we can also do some maths like averaging and percentages etc.

so basically if you are hyper specific about the number you want to see, and that number can be based on one or more fields, we can probably do it.  in short - probably can't get the When that you wanted - but i will think about that.

final note while i wait for you - these "expression columns" can be turned into custom fields, so we can load the variables into normal views.  we do however have to save the variables in smartlists - technically we don't i guess, but they have to be initialised each time MC starts, and smartlists just so happen to do that for us :)
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #3 on: February 23, 2018, 06:54:14 pm »

here's one more fun one, just so you get an idea of what's possible.  this one gets the number of plays of each track as a percentage of the number of plays of that genre

add another expression column in your smartlist and paste
Code: [Select]
math((if(isempty([Number Plays]),0,[Number Plays]) * 100) / load(vnumplays[genre]))
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #4 on: February 23, 2018, 07:18:30 pm »

...final note while i wait for you

Sorry, things have happened at home (A&E).
Will try this later and come back to report.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #5 on: February 25, 2018, 05:38:06 am »

Thank you for your clear and concise instructions, ha, even I could follow them.
Here's a screen print:
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #6 on: February 25, 2018, 05:44:04 am »

I know I am not good at reading table stats (I used to prepare excel s/s for others to analyse)
It seems that coz I use multiple genres such as British; Poprock or British; Progressive; Poprock; Live the stats are reporting that specific multiple genre, rather than say just Progressive.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #7 on: February 26, 2018, 05:47:23 am »

that's a hard one to get out of. 

you can get an item with listitem() if you know the position, but it will take a lot of if/else statements to try and account for all possibilities...
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #8 on: February 26, 2018, 06:28:49 am »

that's a hard one to get out of. 
Nevermind. It was simply a nice to have.
I thought it was worth asking, that's all, its certainly not important enough to spend a lot of energy on.
Thanks for considering my requirement, ferday.
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #9 on: February 27, 2018, 05:12:05 am »

@ferday, I may not be good at reading table stats but I am good at workarounds.

How about this:
I have started to populate the Field called Style - with one word such as Rock, Pop, Blues, R&B and so on.
I have edited your scripts by replacing genre with style and all seems to work so far.
My view shows the Number of tracks in a Style, and the Number of tracks in that Style that have been Played.

Can you give me a script that shows me the Percentage of a Style that has been played, please?
thanks,


*this doesn't show me: math((if(isempty([Number Plays]),0,[Number Plays]) * 100) / load(vnumplays[style]))
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #10 on: February 27, 2018, 05:15:19 am »

cool, glad you figured some things out

what do you mean by "Percentage of a Style that has been played"?

to make your expression work, try pasting this into the field

Code: [Select]
=if(isempty([number plays]),0,math([Number Plays] * 100 / load(vnumplays[style]))
or (to avoid div 0)

Code: [Select]
=if(isempty([number plays]),0,if(isequal(load(vnumplays[style]),0,2),0,math([Number Plays] * 100 / load(vnumplays[style])))
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #11 on: February 27, 2018, 05:43:28 am »

Sorry to say neither of these two work. I get Expression Error displayed. All the others worked first time.

Percentage of a Style that has been played?
For example if I have 1000 Rock tracks and 650 of them have been played it'll tell me that the percentage played is 65%
Like wise if I have 500 Folk style tracks and just 25 have been played that's 5% of the Style.
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #12 on: February 27, 2018, 05:58:14 am »

Weird, my tests are working

Can you paste your import/export window and I will take a look.

Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #13 on: February 27, 2018, 06:43:13 am »

I must be pasting it in the Smartlist wrong.
I add it to both the Smartlist and to a column in the view. Right?

Code: [Select]
[=save(0,vnumtracks[style])1]=1 [=save(0,vnumplays[style])1]=1 [Media Type]=[Audio] [=save(math(1+load(vnumtracks[style])),vnumtracks[style])1]=1 [=save(math(if(isempty([Number Plays]),0,[Number Plays])+load(vnumplays[style])),vnumplays[style])1]=1 isempty [number plays] ,0,if isequal load vnumplays[style] ,0,2 ,0,math ([Number Plays] * 100 / load vnumplays[style]) ~sort=[Style]-d,[Media Type],[Album Artist (auto)],[Album],[Disc #]
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #14 on: February 27, 2018, 06:49:14 am »

or is it this one, getting confused  :o

Quote
[=save(0,vnumtracks[style])1]=1 [=save(0,vnumplays[style])1]=1 [Media Type]=[Audio] [=save(math(1+load(vnumtracks[style])),vnumtracks[style])1]=1 [=save(math(if(isempty([Number Plays]),0,[Number Plays])+load(vnumplays[style])),vnumplays[style])1]=1 isempty [number plays] ,0,if isequal load vnumplays[style] ,0,2 ,0,math ([Number Plays] * 100 / load vnumplays[style]) ~sort=[Style]-d,[Media Type],[Album Artist (auto)],[Album],[Disc #]
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #15 on: February 27, 2018, 07:14:38 am »

I don't have time exactly now, but I'll say - if it has "load" you paste in a column and NOT the smartlist.  We need to "create" a variable every time we start MC, and a Smartlist is a good way to do that....but loading a variable into something useful is for fields or columns

I'll take a good look at it for you as soon as I can.  Variables are neat but messy!
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #16 on: February 27, 2018, 07:37:23 am »

I don't have time exactly now
That's quite alright, take your time, I can wait, deal with whatever, and come back when convenient to you.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #17 on: March 02, 2018, 08:19:30 am »

hey mate, i'm super busy with stuff but i've tested a little bit

save (something like) this into the smartlist itself
Code: [Select]
[=save(0,vnumtracks[style])1]=1 [=save(0,vnumplays[style])1]=1 [Media Type]=[Audio] [=save(math(1+load(vnumtracks[style])),vnumtracks[style])1]=1 [=save(math(if(isempty([Number Plays]),0,[Number Plays])+load(vnumplays[style])),vnumplays[style])1]=1 then in a column paste this
Code: [Select]
=if(isempty([number plays]),0,if(isequal(load(vnumtracks[style]),0,2),0,math([number plays] * 100 / load(vnumtracks[style]))))
i tested quick so my names were a bit different, but i got it to display what you were asking.  if it doesn't work, first step is:
-check brackets (and spelling; my testing names are different so my copypasta might be off)
-post your smartlist import/export
-post your column expression

and i'll take a look.  it definitely is possible to get what you want or close enough.  my quick testing gives me the percentage and it is correct. 

like i alluded to:  think about it that the smartlist sets the variables up for use.  we use a smartlist as it initialises when MC starts.  then, we load the variable data into a column (or field) later on.  so we never combine saving and loading into a smartlist.
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #18 on: March 02, 2018, 05:17:14 pm »

Thanks,
I'll need some time to study this.
As you are super busy (aren't we all)  ;) I will call back after the weekend
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #19 on: March 07, 2018, 08:19:31 am »

Apologies for the delay.
The reason I didn't come back earlier is I don't know how to say what I require using words we both understand.
For example you asked:
what do you mean by "Percentage of a Style that has been played"?

I answered with:
For example if I have 1000 Rock tracks and 650 of them have been played, it'll tell me that the percentage played is 65%
Like wise if I have 500 Folk style tracks and just 25 have been played, then that's 5% of the Style.

I think the scripts are looking at each individual track and giving a figure for that one track, whereas I want to consider the Genre as a Whole, or as we have now found a workaround, all the entries in a Style.

Perhaps I am asking too much.
At the end of the day I wish to see what Genre/Style I have "overplayed" in contrast to what Genre/Style I ignore.
Percent Played will tell me that.

thanks for what you have done,
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #20 on: March 08, 2018, 04:21:25 am »

number of tracks in the genre: vnumtracks[style]
number of tracks played in the genre: vnumplays[style]

in the smartlist import/export box, paste:
Code: [Select]
[=save(0,vnumtracks[style])1]=1
[=save(0,vnumplays[style])1]=1
[=save(math(1+load(vnumtracks[style])),vnumtracks[style])1]=1
[=save(math(if(isempty([Number Plays]),0,[Number Plays])+load(vnumplays[style])),vnumplays[style])1]=1

now: in a field / column, paste:
Code: [Select]
math(100*load(vnumplays[style]) / load(vnumtracks[style]))
when i do this, i get the percentage you are looking for
for example - i have 4500 tracks in "post rock" and 1200 "plays from post rock" and the column gives me 26.666... which is indeed correct

let me know how it goes for you
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #21 on: March 08, 2018, 07:05:46 am »

let me know how it goes for you

It goes very well thank you  :D
What a marvel you are, and I am sure you have better things to do than bother about me and my whims.

Your column gives you 26.66666 - any chance of rounding that up to whole numbers (no fractions) please.

Of course I do get some figures that are above 100% coz tracks have been played more than once which means that they are included to the score (vnumplays[style]?) more than once.

I cannot pretend to understand what you do and how you do it, I am no coder/programmer, but I can appreciate the skills and patience you have as proven by the results here.
Thank You.
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #22 on: March 08, 2018, 07:22:21 am »

paste this into the column instead

Code: [Select]
math(round(100*load(vnumplays[style]) / load(vnumtracks[style])))
if you want to get fancy, you can try this
Code: [Select]
if(isequal(math(round(100*load(vnumplays[style]) / load(vnumtracks[style]))),100,5),100,math(round(100*load(vnumplays[style]) / load(vnumtracks[style]))))
which should display 100 (if it's over 100) or the rounded percentage otherwise.
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #23 on: March 08, 2018, 07:59:03 am »

Not quite there yet.
For example in my sample I have a Style called Rock & Roll, as you do; there are 30 played tracks, 8 unplayed, making 38 tracks in all.
Some of the 30 have been played more than once, which inflates the score to fool the Scripts into thinking they have ALL been played whereas only about 80% have been played (30 out of 38)

This could go on forever, so please say Stop when you want to.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #24 on: March 08, 2018, 08:16:14 am »

in the import/export window of the smartlist, paste this

Code: [Select]
[=save(0,vnumtracks[style])1]=1
[=save(0,vnumplays[style])1]=1
[=save(math(1+load(vnumtracks[style])),vnumtracks[style])1]=1
[=save(math(if(isempty([Number Plays]),0,1)+load(vnumplays[style])),vnumplays[style])1]=1

i have tested it and it appears to be working but my [Number Plays] fields are pretty flaky due to a lot of library messing about.  this means it's a bit harder to test accurately...but try it and see what happens.  you should be able to leave the columns as they were before.

what i think it's doing is:
38 tracks, 30 played - the new vnumplays = 30 (old vnumplays = 30)
38 tracks, 1 played 30 times - the new vnumplays = 1 (old vnumplays = 30)
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #25 on: March 08, 2018, 08:35:40 am »

That seems to be it, thanks ferday.
I think we should  give it a rest for a while, that will give me a chance to populate many more of my empty Style fields. I waited till the script was behaving itself a bit better.

So now I have to condense the ; separated multi Genres into one word.

"I am just going think about this and may be some time"
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #26 on: March 12, 2018, 02:04:59 pm »

Wow its taking some time to populate ~121K tracks with meaningful Style names.
One thing that would be nice is a script (?) that tells me what percentage a style is of the whole library.

For example if I have 12000 Blues Styles that's just less than 10% of the library.
If I have 20000 Hard Rock Styles then that's about 16½% of the library total.

You are busy I know, so have a go, if you wish, when convenient to you.
thanks,
 :)

Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #27 on: March 13, 2018, 03:45:51 am »

try pasting this into a column

Code: [Select]
math(round(100*load(vnumplays[style]) / Groupcount()))
note: groupcount() will give you the count of files in that view.  so if we are in the smartlist, it should count everything.  let me know if this works
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #28 on: March 13, 2018, 04:50:09 am »

Sorry Nope, don't work.
I am unable to tell you what it is doing. All I am seeing is a single digest figure under 10 with a peppering of a few 11s. Strange.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #29 on: March 13, 2018, 05:33:00 am »

please try a column (in the smartlist) with just

groupcount()

and tell me if it is giving you a number that seems right (for the amount of tracks in the view)
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #30 on: March 13, 2018, 05:51:24 am »

Yes. groupcount() gives me exactly the number of files in the view - that is, all music, image, and text files.

EDIT
I have just edited the view to show just music media - took ages to find the correct name (Media Type)

So now groupcount() gives me the exact number of music files in my library. Good.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #31 on: March 13, 2018, 06:14:48 am »

Try the above column again?

It's working for me...we can get the number of total tracks with a variable but that's the last tree we want to bark up when there are built ins that can work
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #32 on: March 13, 2018, 06:49:14 am »

Umm, yes I suppose they were correct all the time, sorry.

I was just expecting to see significant figures not so many under 10%'s.

Its coz I have a dozen or so Styles - and that is pruned down dramatically from the number of Genres.
I might condense the Styles some more, but then I am not sure the results will be meaningful enough for me.
I am not a statistician / number person, and was hoping my percent pie chart, being visual, would suit me better that looking at a table of figures which I fail to comprehend.

...once again Thank You Very Much,
 :)
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Request for Genre Script
« Reply #33 on: March 13, 2018, 08:34:57 am »

I move stuff around and it messes with number plays, so i get the same as you with low numbers

I hope this gives you an idea of how the system works and what you might be able to make MC do. 

If you like charts, you can very easily export these numbers into excel and make them :)
Logged

MusicBringer

  • Galactic Citizen
  • ****
  • Posts: 439
  • MC33.0.30 x64bit
Re: Request for Genre Script
« Reply #34 on: March 13, 2018, 09:31:33 am »

I move stuff around and it messes with number plays

So do I, a lot.
And even using Rename Move and Copy fails to do it properly; sometimes it behaves, yet more often it will Add to Library, rather than point to the new location. Grrhh.
Logged
Caesar adsum jam forte. Brutus aderat. Caesar sic in omnibus. Brutus sic inat.
Pages: [1]   Go Up