INTERACT FORUM

Please login or register.

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

Author Topic: auto-refresh Smartlists?  (Read 2071 times)

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
auto-refresh Smartlists?
« on: July 26, 2014, 04:58:47 pm »

i made an expression through smartlist which calls out average album bitrate.  then i made a custom field which either gives me the average album bitrate (mp3), CD Rip (FLAC), High Def (anything higher than 16/44) or multichannel (obvious)

it works great!  except...sometimes the mp3 files will display "CD Rip" instead of the bitrate.  i'm not sure what makes them revert to this, but refreshing the smartlist that calls out the variable makes everything go back to the right way

this isn't a big deal when using MC, but i made the custom field (Album Quality) for use with JRemote and my DLNA devices, as a way to sort the albums by quality rather than having duplicate tracks. 

is there a way to auto-refresh smartlists, or is there a way i can call my variables in the expression without using the smartlist, so that the field is permanent?

thanks

edit:  i did a similar thing with my videos and it always works, never had the tags showing wrong.  i called the variables out the same way with a smartlist (i used width/height to call out resolution)
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: auto-refresh Smartlists?
« Reply #1 on: July 26, 2014, 05:29:52 pm »

There's no simple way to get MC to auto-refresh smartlists without running them, which means loading them.  I've though about writing a little COM utility that runs any given search (and then discards the results) to allow for variables to be pre-loaded easily, though I haven't done it (pretty simple conceptually, though).

So, the difference here is that you need a variable to calculate average album bitrate.  This works well for video files because they're individual, so you don't need to calculate the average.

MrC explains variables to me here:
http://yabb.jriver.com/interact/index.php?topic=78210.msg532814#msg532814
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: auto-refresh Smartlists?
« Reply #2 on: July 26, 2014, 05:36:23 pm »

thanks for that link!  very useful, can't believe i didn't find it before when searching about variables

i've been working on variables lately....for me the easiest way by far has been to save them into smartlists, then i can call them from anywhere anytime, since the smarlist is always there.  i guess the problem must lie in that the variable is only "saved" on iteration of the program, so for a smartlist that is on refresh i guess

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: auto-refresh Smartlists?
« Reply #3 on: July 26, 2014, 05:47:05 pm »

If you're quite crafty, I think you can do it with the Files to Include filters on the Media Views.

Make a smartlist that:

1. Pre-loads any variables needed.
2. Always returns ALL files in your Library (doesn't filter anything, audio, video, images, or otherwise).

Then, you can use that smartlist as a Files to Include filter (Playlist Is Any Utilities\Preload Variables) on your Audio, Images, Video, and other top-level views.  Since the smartlist always returns everything, its actual effect on the files displayed will be nil.  However, it will execute every time you open any of your Views (because the children of the top-level ones, generally anyway, inherit from the top-level ones).

If you sometimes start up directly to Theater View, or use Media Network features, you'll need to add the same rule to the top levels of those systems as well.

I've never tried this.  I think MrC does it with some of his crazy systems, though I can't confirm.  The only problem I can see, and this could be an issue in some cases, is that it would re-save those variables every time you opened any View.  This could be a performance problem if they're complex, and could mess up the use-cases for the Variables if you intend to use them to do or track something later.

That's why a command line utility would be better, because you could just script it to always run just after you launch MC.  But I haven't done it.  :-[
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: auto-refresh Smartlists?
« Reply #4 on: July 26, 2014, 05:52:13 pm »

Actually, you could probably get around the "runs over and over" too.

During your Variable Saving "routine", at the end, save a Variable called VariablesAreLoaded or something and set it to 1.  Then, the very first thing in the Smartlist itself does essentially: If (VariablesAreLoaded) return;
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: auto-refresh Smartlists?
« Reply #5 on: July 26, 2014, 05:55:59 pm »

Hmmm... If I ever do this, an Inteface plugin would be better.  Then it would auto-load when MC does, so you wouldn't have to script that part or worry about it.  And, you could provide an interface to configure the variables.  Just have a table view where you type them in, and then enter their values (which could be fixed or expressions themselves, I think).

Added to the long-term list.  The list is pretty long though, and my time is short.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1852
Re: auto-refresh Smartlists?
« Reply #6 on: July 27, 2014, 07:16:13 am »

[removed the now redundant previous post]

Have just found that if you don't use compare in the tests and stick with a 0 or 1 lock it's even simpler...

You can do something like:



This approach is perhaps closer to what Glynor was suggesting.  It removes the decaying timestamp and replaces it with a simple LOCK that can be reset to 0 force the view to calculate again if necessary.

This approach doesn't seem to trip up the MC parser and Playlists are fine in the active AND block. [edit]Actually the parser does trip up so you still need to use the nested AND trick sometimes[/edit]

You would of course change the variable names etc to suit your own needs.

Any you might also need to add some clean-up rules outside the lock blocks to ensure that both LOCKED/UNLOCKED paths return the same files.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: auto-refresh Smartlists?
« Reply #7 on: July 27, 2014, 08:59:33 am »

Have just found that if you don't use compare in the tests and stick with a 0 or 1 lock it's even simpler...

Yep.  Exactly.  Just set a IsLoaded semaphore, basically.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: auto-refresh Smartlists?
« Reply #8 on: July 27, 2014, 11:08:54 am »

Wow, thanks

I'm no developer but I get where you're all going, I'll play with it as well and try to understand it
Logged
Pages: [1]   Go Up