More > Media Center 14 (Development Ended)
Smartlists for "Played today" and "Played Yesterday"
marko:
Here's something that might be of interest to anyone who has sussed that the stock MC smartlist for "Played Today" actually returns files "Played in the last 24 hours" which is not quite the same thing.
So, to get a true list of files "Played Today", use the following expression:
[=isequal([last played],formatdate(now(),dd//MM//yyyy),8)]=1 ~sort=[last played]
And to get a true list of files "Played Yesterday", use:
[=isequal([last played],formatdate(math(now()-1),dd//MM//yyyy),8)]=1 ~sort=[Last Played]
These two strings can be equally, if not more, useful when used with "Date Imported"...
Imported Today:
[=isequal([date imported],formatdate(now(),dd//MM//yyyy),8)]=1 ~sort=[date imported]
Imported Yesterday
[=isequal([date imported],formatdate(math(now()-1),dd//MM//yyyy),8)]=1 ~sort=[date imported]
You may need to tweak the "dd//MM//yyyy" bits to match the format your system uses for dates. Check how MC populates a [date imported] or [last played] column for you, and adjust the string to match the format.
I've used the strings above as entries in a "Search List" category, and quite useful they are too!
If you're not sure what I mean by "Search List" category, follow this link and scroll down to the third heading titled "Categories (panes)" for an explanation.
Have fun,
-marko :)
Gl3nn:
Thanks Marko but could you tell me how one strips off the time portion of [Last Played] so the comparison works? I couldn't find anything useful in the wiki regarding syntax for these expressions.
Daydream:
--- Quote from: Crescent on March 10, 2010, 05:00:38 pm ---I couldn't find anything useful in the wiki regarding syntax for these expressions.
--- End quote ---
I'm going offtopic here for a second. I believe the wiki describing the Functions has the wrong structure. Or maybe the reason for the current structure escapes me.
The 'examples' are examples of syntax. Not of the functions returning actual results. If I'm an extraterrestrial from somewhere (I am - to programmers) I need to know that 1 + 1 = 2, not only that the function Addition is 1 + 1. The practical outcome is not shown. For me the extraterrestrial the meaning of 1 + 1 can be your sign for a blue medusa or a flying carpet or anything in between (colorful enough?). Therefore the learning process is shot to hell.
marko:
--- Quote from: Crescent on March 10, 2010, 05:00:38 pm ---Thanks Marko but could you tell me how one strips off the time portion of [Last Played] so the comparison works? I couldn't find anything useful in the wiki regarding syntax for these expressions.
--- End quote ---
First of all, I'll show you how to strip the time from [last played] in case you want it later somewhere else, then I'll explain why you don't need to do that in order for the above examples to work...
So, to strip the time from an MC default date field, you tell the expression engine to work with the raw library data by adding a zero to the field, like so: [last played,0]
You then use that with the FormatDate function to tell the expression engine how you would like the date to be formatted.
So, using the examples above, you would enter: formatdate([last played,0],dd//MM//yyyy)
You must use two 'forward slashes'. The first is referred to as an 'escape character' and tells the expression engine to treat the character that comes next literally, rather than a part of the expression formula itself. The end result is that a single forward slash is output in the expression result.
Why do you not need this extra typing in the four examples in post #1?
If you look at them, you will see ",8". This figure instructs the expression engine in how you would like the two components to be compared.
In this case, I've used the figure, 8, which means that the compare should be a 'case insensitive sub-string compare' or in plain english, "ignore the case, if [last played] contains this string, we have a match, and if not, we don't"
If the expression examples are not working for you, then the "day/month/year" (dd//MM//yyyy) part of the expression must be wrong for your locale. I think the USA use MM//dd//yyyy for example. Simply check how MC is displaying the date part of [last played] and mirror that in your expression, then everything should work as expected.
--- Quote from: Crescent on March 10, 2010, 05:00:38 pm ---I couldn't find anything useful in the wiki regarding syntax for these expressions.
--- End quote ---
This Page on the wiki contains a list of expression functions, and endeavours to explain how to use them, which brings us to....
--- Quote from: Daydream on March 10, 2010, 09:38:10 pm ---I'm going offtopic here for a second. I believe the wiki describing the Functions has the wrong structure. Or maybe the reason for the current structure escapes me.
The 'examples' are examples of syntax. Not of the functions returning actual results. If I'm an extraterrestrial from somewhere (I am - to programmers) I need to know that 1 + 1 = 2, not only that the function Addition is 1 + 1. The practical outcome is not shown. For me the extraterrestrial the meaning of 1 + 1 can be your sign for a blue medusa or a flying carpet or anything in between (colorful enough?). Therefore the learning process is shot to hell.
--- End quote ---
If you check the discussion tab of the wiki page linked above, which I presume is the one you're referring to, you'll see that over a year ago, I posted that I felt the page was a little inadequate and unwieldy. There are also currently two, possibly three expression functions that are so far not documented on that page, and I keep meaning to add them.
I will do, but, in the absence of any other firm ideas, they will get added in the same format as all the rest.
Way back, when expressions were first introduced, JRiver kept a simple web page buried in the 'dev zone' with a current list of expression functions. When the wiki was introduced, I basically ported that page into the wiki and kept adding to it, and that is why it is the way it is.
Any re-write of that page is going to take some time, so in order to for that time not be wasted, it needs to be 'done right' from the get-go.
I understand that you're saying you would find it more helpful if the expected output were given alongside the given syntax examples, which when compared to re-writing the entire page, possibly breaking it up into different pages, shouldn't take too long at all, but, is there anything else that you, or anyone else with an interest who's reading, can suggest for making the expression pages more user friendly?
-marko.
Gl3nn:
Thanks, Marko, as usual. I appreciate very much your explanations and time taken to convey them.
I had already changed the order of mm and dd to match what's used here. What I didn't understand by inspecting the [Last Played] field was that it was using a single "m and d". Once I changed that, it worked fine. I'm not sure how that's set or where one could look to clearly determine the format (I guessed basically - I certainly missed it yesterday!).
I found the page in the Wiki you referenced (and I certainly appreciate the work folks like you do in trying to flesh-out the wiki) but it just didn't provide enough info for someone like me who needs to really start at the beginning. So, for instance, when you state: "...to strip the time from an MC default date field, you tell the expression engine to work with the raw library data by adding a zero to the field, like so: [last
played,0]", where is that described? It's probably somewhere but it's hard to find. Same with the two forward slash thing... or the ",8".
I consider these "expressions" in the same ballpark as "functions" in Microsoft Excel, if you've used that. That's what I'd like to see somewhere in MC... or in the Wiki: detailed syntax. Maybe it's buried somewhere in MC... I dunno... but it should be comprehensive and easily accessible.
My biggest frustration in using MC is not spending the time to learn how to use a feature but FINDING information! I don't mind taking a hour to read what I need to read in order to understand... what I mind is taking an hour to run search after search to (maybe) find a thread or an article that only touches on a portion of it. And I know that some of the advanced folks here get impatient with newbies asking what to them appear like dumb and lazy questions, so I use the forum reluctantly when I am stuck.
I love MC and I use it every day. I just wish there was a better help function than the wiki. I know that's not a popular opinion here but it's the way I feel.
Anyway... I REALLY appreciate your contributions and help! Thank you!
Navigation
[0] Message Index
[#] Next page
Go to full version