INTERACT FORUM

Please login or register.

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

Author Topic: [HOWTO: Variables] IsPlayingNowAlbum  (Read 3759 times)

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1851
[HOWTO: Variables] IsPlayingNowAlbum
« on: August 30, 2012, 05:24:41 am »

Found another use of variables that I thought others might find useful, which extends the isplaying() expression to allow you to record and highlight the album currently playing.

First, create variables showing the current playing Artist and Album...

Create a new Playlist (I call mine 'Var: Album Playing Now')

and import the following string:

[=isplaying()]=1 [=save([artist],var_artistplayingnow)1]=1 [=save([album],var_albumplayingnow)1]=1

This will create two variables (var_artistplayingnow and var_albumplayingnow) based on the currently playing track.

Next, create a user field: IsPlayingNowAlbum as a calculated field:

if(isequal(load(var_albumplayingnow),[album]),if(isequal(load(var_artistplayingnow),[artist]),1,0),0)

This can be called in any smartlist/view and will return a 1 for the currently playing album.

Finally, in the view you want to use a highlight, create an expression column at the front of the view:

if([isplayingnowalbum],>>>>>>,)

Note: YOU MUST call the playlist above that assigns the variable in any such view (and will need to refresh it to get an update), just add:

Playlists Is Any 'Var: Album Playing Now' to your view

And there you go, you can now highlight the currently playing album using the power of variables and the isplaying() expression.

Enjoy  ;D

Logged

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #1 on: August 30, 2012, 02:32:00 pm »

Are these Save() and Load() functions documented somewhere?
Logged

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #2 on: August 30, 2012, 04:06:50 pm »

Quote
Are these Save() and Load() functions documented somewhere?

Probably not, but the Expression Editor includes them in the 'Insert Function' list—along with the usual tooltips explaining their purpose and syntax. But that's the easy part. It's more challenging to figure out how to use them to produce a desired result. For that understanding, I recommend trying out the several applications Mark has come up with. Even if you're not interested in the same result, you'll probably see a use for something similar.
Logged

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #3 on: August 30, 2012, 04:09:25 pm »

Thanks
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1851
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #4 on: August 31, 2012, 02:16:48 am »

Variables have really opened up new functionality for me.  I can now do album related processing using them, eg calculate album average ratings; when album was played last based on the track played longest ago; count the number of tracks on an album; album duration; album playing now (above); number of tracks left to vote on an album etc etc etc. 

And then construct smartlists/views using the variables.

A very powerful addition to MC.
Logged

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #5 on: August 31, 2012, 03:58:24 am »

Do you find there's any slow-down related to the number of different variables you're determining, or does it depend more on whether or not the variables are actually used in a view. I've got a number of different 'sets' used for different things (with some overlap). Now I'm wondering if it would be easier to just sum everything sum-able for albums and artists (playing now and not), give them meaningful variable names, and be done with it. Then I could calculate fascinating stats like 'artist playing now file size bytes per second of play' whenever the mood strikes me. 8)
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1851
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #6 on: August 31, 2012, 04:07:52 am »

I do see a hit when you call the variable populating smartlist for sure, and the more variables being set the bigger the hit.

I did look at ways to optimise, eg have a populating script called only at start up, but I found that my most useful variables changed during a session (eg as I'm rating tracks it's great to see the album rating update) and so I'd rather take a refresh hit as I personally don't mind the small added delay for the huge added functionality.  And besides, computers will just get faster and those delays will get shorter...
Logged

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #7 on: August 31, 2012, 04:55:18 am »

Understood. So I should move in the other direction—making sure I'm only calculating what I really need. That's something I have to keep an eye on because I use my primary Audio view most of the time. It's a Panes View that includes a 'playlist group' pane of all my audio playlists. That, in turn, includes all my global variable smartlists. So everything gets updated on every refresh. That slows things down, but, like you, I feel the results are worth it (most of the time). I suppose I should try creating 'fast' and 'slow' versions of my primary view... :-\

Quote
And besides, computers will just get faster and those delays will get shorter...

Actually, I've come to expect the program will get faster. If I have to buy a new computer, it's Matt's fault. ;)
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1851
Re: [HOWTO: Variables] IsPlayingNowAlbum
« Reply #8 on: August 31, 2012, 07:37:39 am »

Right.  I target only those required for the view; I don't update the entire bunch every time...

Good point re: Matt and speeds  ;D

Logged
Pages: [1]   Go Up