INTERACT FORUM

Please login or register.

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

Author Topic: Indicator for "Played Today"  (Read 1648 times)

StFeder

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1493
  • Fight! You may win. If you don't, you already lost
Indicator for "Played Today"
« on: June 28, 2010, 11:14:42 am »

I've searched the forum, studied the wiki and did try&error with MC but I didn't get it :(

What I am trying to do is to create two calculated fields.
One, which contains a sign (like *) if a file was played today and another one which does the same for files played within the last 12 hours. But I cannot figure out how it could be done. And I'm sure it's possible...

Could anybody give a hint?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Indicator for "Played Today"
« Reply #1 on: June 28, 2010, 11:45:15 am »

Played Today: http://yabb.jriver.com/interact/index.php?topic=56487.0 :)

To turn that into a calculated library field that displays *, use: if(isequal([last played],formatdate(now(),dd//MM//yyyy),8),*,) paying attention to the comments in the linked post regarding locale differences.

"In the last 12 hours" is not so easy to query, still working on that ...


StFeder

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1493
  • Fight! You may win. If you don't, you already lost
Re: Indicator for "Played Today"
« Reply #2 on: June 28, 2010, 11:53:55 am »

I already found that thread and read it. Didn't work :-\

Now it does :D Expressions are to complex for me, I think...

Thanks for your fast help!! Looking forward to your 12h solution ;)
Logged

StFeder

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1493
  • Fight! You may win. If you don't, you already lost
Re: Indicator for "Played Today"
« Reply #3 on: June 28, 2010, 12:03:27 pm »

Just a question concerning the 12h-Problem:
I was playing around with the (stock-)smartlist "audio -- Top Hits -- listend to today". Isn't it possible to have a calculated field that just looks if a file is in this smartlist? Smartlists can - as you know better than me of course - be easy set to include files played within the last x hours, minutes, days etc. I tried the something like
Code: [Select]
if(isequal([playlist], ID, 8),*, )Didn't work. Shouldn't it work? I tried to use playlist name and playlistID as well.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Indicator for "Played Today"
« Reply #4 on: June 28, 2010, 12:08:43 pm »

I think this works for 'last 12 hours': if(isrange([last played,0],math(now()-0.5)-now()),!,)

I used an exclamation mark to differentiate between these and the "Today" results, but haven't played enough tracks recently to test the results conclusively...

Does it work for you?


EDIT:
It's frustrated me for many years that playlists cannot be referenced by the expression engine, so, the answer to your question, as you have found, is unfortunately, "no".

StFeder

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1493
  • Fight! You may win. If you don't, you already lost
Re: Indicator for "Played Today"
« Reply #5 on: June 28, 2010, 02:30:23 pm »

Hm, it doesn't work (I did copy&paste). It marks ALL files. Even those I never played.

Thanks anyway! I'm happy to have at least the indicator for played today. Just one last question: possible to mark files played "yesterday"? Would be a nice workaround for parties which go over midnight :)
Logged

Lasse_Lus

  • Citizen of the Universe
  • *****
  • Posts: 999
Re: Indicator for "Played Today"
« Reply #6 on: June 28, 2010, 05:00:53 pm »

Feder can you paste this

if(isrange([last played,0],math(Left(FormatNumber(now(),5),5).mid(FormatNumber(now(),7),6,7)-0.5)-now()),!,)

and see if you get the correct ones
Logged
MT5FR

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Indicator for "Played Today"
« Reply #7 on: June 29, 2010, 01:16:15 am »

Hm, it doesn't work (iI did copy&paste). It marks ALL files. Even those I never played.

I'm not sure why it doesn't work for you, as it's working perfectly here, with the exclamation marks dropping off as the 12 hours pass since last played.
if(isrange([last played,0],math(now()-0.5)-now()),!,)

Lasse_Lus, I'm not sure if you see something different, but,

math(Left(FormatNumber(now(),5),5).mid(FormatNumber(now(),7),6,7)-0.5) and math(now()-0.5) both produce the exact same result here?
Could it be that some locales use a comma instead of a decimal point? If that is the problem, then wouldn't [last played,0] suffer the same issue, requiring "replace([last played,0],/,,.)" to bring into line with the range check? "replace()" won't work directly on the "now()" function, but does work if you create a calculated library field using simply now() and then use the following expression: replace([Current Date (Raw)],/,,.)

Dates, numbers and locales must be a right pain for developers!!

Just one last question: possible to mark files played "yesterday"? Would be a nice workaround for parties which go over midnight :)
This ought to take care of that...
Played Yesterday: if(isequal([last played],formatdate(math(now()-1),dd//MM//yyyy),8),Y,)

-marko

Lasse_Lus

  • Citizen of the Universe
  • *****
  • Posts: 999
Re: Indicator for "Played Today"
« Reply #8 on: June 29, 2010, 02:53:18 am »

Lasse_Lus, I'm not sure if you see something different, but,

nope, i'm learning from you  :)

i wrote in your "Smartlists for "Played today" and "Played Yesterday"" thread about this, and when using math and decimals there will be issues if you don't use the same internal settings as MC does..

i myself use a calculated field as you have recommended, and i forgot about the replace function, so it's a better choise  :)
Logged
MT5FR

StFeder

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1493
  • Fight! You may win. If you don't, you already lost
Re: Indicator for "Played Today"
« Reply #9 on: June 29, 2010, 08:57:53 am »

Feder can you paste this
if(isrange([last played,0],math(Left(FormatNumber(now(),5),5).mid(FormatNumber(now(),7),6,7)-0.5)-now()),!,)
and see if you get the correct ones

It works. I don't understand how or why, but it does. Thanks!

This ought to take care of that...
Played Yesterday: if(isequal([last played],formatdate(math(now()-1),dd//MM//yyyy),8),Y,)

This doesn't work. Anyway: A field showing the files played the last x hours does the trick for me!

math(Left(FormatNumber(now(),5),5).mid(FormatNumber(now(),7),6,7)-0.5) and math(now()-0.5) both produce the exact same result here?

For me math(now()-0.5) always returns 0.

Big thanks to both of you!!
Logged
Pages: [1]   Go Up