INTERACT FORUM

Please login or register.

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

Author Topic: Removing files from list if played  (Read 3036 times)

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Removing files from list if played
« on: January 16, 2012, 03:59:08 pm »

Last night I DJed a dance using MC. one thing I ran into was that I played my set list (dedicated playlist in MC) out of sequence and at one point couldn't remember what I had played.  I was thinking that with MC I could probably set up a view that would filter out the songs in the list that have been played since the start of the dance.

I setup a rule under customize view: Last Played - Is Before...  To get the correct syntax for the rule I played a song and copied the Last Played tag from the action panel. In this case "1/16/2012 3:58 PM" and pasted it into the last part of the rule. after after applying the rule and exciting there were no songs in the list. Going back to the rule the rule had been hacked, The rule only had the date in it. The time and PM were in two additional "custom" rules. Clearly I did not choose a good method to get the syntax right. However, I deleted the two new rules and left the rule: Last Played - Is Before - 1/16/2012. That worked, in that it filtered out everything played today. I tried replacing the date with a few variations of time, but that did not work. Can I make this rule work using the time instead of the date?  Is there a better method to accomplish the same funtion?
Thanks

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Removing files from list if played
« Reply #1 on: January 16, 2012, 08:48:49 pm »

There are a couple of complications.  First, to perform the date comparisons you have to deal with dates using the raw field data, of the form:

  [Last Played,0]

where the ,0 indicates the MC should use the raw, internally stored data.  A date/time is stored internally as a floating point number in the form <num days>.<frac of day>.  To compare a date against a known date is a little more complex, as you have to grab the floating point value, and not the pretty formatted date that MC gives you when you copy from a date field.

Second, your dances may cross the midnight hour, so this complicates simple hour/minute calculations (eg. probably can't say today, anything after 5pm, since tomorrow at 2am -- when the dance is in full swing -- won't work).

To get a date/time from a date field, the way you were trying to proceed, you'd have to assign the date to some decimal field, and then copy that decimal field's value, yielding a decimal number which you can now use in numeric comparisons.  So you could create a [Last Played (raw)] field, of type Decimal, and make it an Expression field, where the expression is [Last Played,0].  Then, you'll have a raw last played date field which you can use to copy/paste.  This would allow you a fast way to get to the dance, play some baseline Start Of Dance track, grab the [last played (raw)] date from that file, and use that value.

Using this value, you can create an expression column (or filter) to show values such as Never Played, Played Tonight, Not played Tonight.  To get an idea how this feels, create the field mentioned above, and then create an expression column in a panes view:

Code: [Select]
If(isempty([Last Played (raw)]), Never Played,
   If(Math(below([Last Played (raw)], 40924.7006712962975143)),
      Not Played Tonight,
      Played Tonight))

but repalce the 40924.70.... in the expression with the copy/pasted baseline track's [Last Played (raw)] field.  Now, the pane will allow you to dynamically filter based upon what you've played since the start of the dance.

Here's another interesting expression column you may find handy, at least to give you ideas of what is possible and how to use values, expressions, etc..  You can add it next to the column above.

Code: [Select]
IfElse(isequal([Last Played], never played),
                Never Played,
          Compare(Math(Now() - [Last Played,0]), >, 1),
                Not played last 24hrs\regex(formatdate([Last Played,0], Elapsed), /#^(.+)\s(.+)$#/, -1)[R2]\[R1],
          1,
               Played last 24hrs\formatdate([Last Played,0], hour):formatdate([Last Played,0], minute))&datatype=[list]

Edit: the second expression here will only work in MC17.  Use the following for MC16:

Code: [Select]
If(isequal([Last Played], never played),
  Never Played,
  if(isequal(Math(Now() > [Last Played,0]), 1, 5),
      Not played last 24hrs\regex(formatdate([Last Played,0], Elapsed),
                /#^(.+)\s(.+)$#/, -1)[R2]\[R1],
      Played last 24hrs\formatdate([Last Played,0], hour):formatdate([Last Played,0], minute))&datatype=[list]
Logged
The opinions I express represent my own folly.

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #2 on: January 17, 2012, 08:40:32 am »

Wow, crunch crunch crunch. :)
Ill check it out tonight. Thanks
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Removing files from list if played
« Reply #3 on: January 17, 2012, 08:09:00 pm »

Here's a screenshot of what the two expression look like in a pane.  I like the second one, as it provides you an expandable hierarchy, where the Last Played time (hour:minute) is shown for plays in the past 24 hours, and groups plays by hours/days/years for tracks not played in the past 24 hours.  I modified the 2nd expression a bit to show also the track name and artist, so when you're dancers come over and ask what song you played two songs ago, or at about 6:35, you can provide an answer almost immediately.

Code: [Select]
If(isequal([Last Played], never played),
  Never Played,
  if(isequal(Math(Now() > [Last Played,0]), 1, 5),
      Not played last 24hrs\regex(formatdate([Last Played,0], Elapsed),
                /#^(.+)\s(.+)$#/, -1)[R2]\[R1],
      Played last 24hrs\formatdate([Last Played,0], hour):padnumber(formatdate([Last Played,0], minute),2) - [Name] : [Artist])&datatype=[list]
Logged
The opinions I express represent my own folly.

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #4 on: January 19, 2012, 07:35:15 pm »

Nice stuff man, I got this working and it will defiantly be useful for me.

Quote
I modified the 2nd expression a bit to show also the track name and artist, so when you're dancers come over and ask what song you played two songs ago, or at about 6:35, you can provide an answer almost immediately.
As my daughter would say "Sweet"!

great idea

Logged

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #5 on: January 20, 2012, 08:42:37 am »

One thing I did was to transfer the expressions to Fields instead of columns so I can use them anywhere I want.  However, the drawback to that is that when I want to paste the [Last Played (raw)] value in the expression, I have to dig deeper.  I’m not sure there is that much of a benefit to the change; I may just stick with the column expressions and just copy it when I need to use it elsewhere.

 It would be nice to be able to set a variable that can be referenced in the expression without having to dig into the expression each time, possibly screwing up the expression if I’m in a hurry having other problems getting setup for the dance etc. One idea is to add a field name something like "First Song" a yes or nothing setting.  That could be set easily when the first song is played. Then maybe the expression could be built to read "Last Played (raw)" for the file with "first Song" set. 
Is that even remotely feasible?

One problem I see is that I would have to remember to clear "first song" at the end of a set so I don’t end up with two "First Song"s set.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Removing files from list if played
« Reply #6 on: January 20, 2012, 07:54:09 pm »

I was thinking about this too.  Here's another way which may be much easier.

Instead of copying/pasting a date value into an expression, we'll create a new field which will store the current time.  Let's call it "Date (start of dance)".

And we'll modify the expression to use this new field instead of the copy/pasted raw time:

If(isempty([Last Played (raw)]), Never Played,
   If(Math(below([Last Played (raw)], [Date (start of dance)])),
      Not Played Tonight,
      Played Tonight))

Open the Action Window > Tag, and select the pull down menu at the top left, and select Also Show > Date (start of dance).

Now, at the beginning of the dance, open the Action Window > Tag, select all your tracks, and paste into the "Date (start of dance)" field the expression:

  =Now()

This will timestamp your files with the current time, and the expression above uses this value to determine anything more recent.

I further modified the expression to allow you to see what is currently playing now:

If(IsPlaying(), Currently Playing,
   if(isempty([Last Played (raw)]), Never Played,
      If(Math(below([Last Played (raw)], [Date (baseline)])),
         Not Played Tonight,
         Played Tonight)))
Logged
The opinions I express represent my own folly.

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #7 on: January 21, 2012, 09:59:30 pm »

Good stuff! I'm trying it out but after replacing the expression and setting the "Date (start of dance)" tag in the playlist, I get "played tonight" for all songs except "never played" songs.  I looked at the expression and it seems right to me.  especially the logic for:
Quote
If(Math(below([Last Played (raw)], [Date (start of dance)])),
      Not Played Tonight,
      Played Tonight))
I had to read up on Math and Below but they seem to be setup correctly. to bad there is not a formula evaluator like in Excel :D.
Next Ill extract the raw Last Play and Start of dance value and see if that provides some insight.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Removing files from list if played
« Reply #8 on: January 22, 2012, 01:31:07 am »

The one possible difference between our usage may be that I'm tagging ALL my tracks with Now() in the Date (start of dance) field, not just those songs in a playlist.

If you want to just tag the playlist tracks, that will be fine, but be sure to have the view limit files to only show those from the playlist.  That reduces the universe and will allow the expression to only operate on those.  Customize the view, and configure the Set rules for file display..., setting a criteria of Playlists is any <name of playlist>.
Logged
The opinions I express represent my own folly.

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #9 on: January 22, 2012, 08:20:29 am »

Quote
If you want to just tag the playlist tracks, that will be fine, but be sure to have the view limit files to only show those from the playlist.  That reduces the universe and will allow the expression to only operate on those.  Customize the view, and configure the Set rules for file display..., setting a criteria of Playlists is any <name of playlist>.

That's exactly what I have done.  I created two Veiws, Dance Set Played and Dance Set Unplayed. I'm going go back through everything and verify my setup again and allso try it by tagging everything as in your original method.
Logged

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #10 on: January 22, 2012, 01:12:04 pm »

I noticed that in your original expression there was a possible rawness conflict in the below expression (sorry I couldn't help myself :D ).
Quote
If(isempty([Last Played (raw)]), Never Played,
   If(Math(below([Last Played (raw)], [Date (start of dance)])),
      Not Played Tonight,
      Played Tonight))
last played is raw and start of dance is not. not being sure if it matters, I created several fields based on the math portion of the expression to compare raw vs not raw.

=math(below([Last Played(raw)],[Date (start of dance)]))

=math(below([Last Played(raw)],[Date Start of Dance (RAW)]))

=math(below([Last Played],[Date (start of dance)]))

the results are that the result is always "0" which equates to my nearly always getting "Played Tonight" as a result. Which I think has nothing to do with rawness at the moment.
I will post a screen shot shortly

Logged

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #12 on: January 22, 2012, 01:20:35 pm »

Only the top two songs Last Played tags are newer than the Date(start of dance) tags so they should have "1" in the math/below logic (I think) and should be also tagged "Played Tonight". But everything is a "0" and played tonight.  

Clearly I am on the wrong page :-[
Logged

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #13 on: January 22, 2012, 02:40:30 pm »

Quote
math(below([Last Played (raw)], [Date Start of Dance (RAW)]
math(below([Last Played(raw)],[Date Start of Dance (RAW)]
The culprit was a space! between Played and (RAW).

Note to self, always use the insert field option vs typing in the field name...
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Removing files from list if played
« Reply #14 on: January 22, 2012, 02:47:44 pm »

Ouch.

For future reference, you can just copy/paste the expressions directly into the Expression Editor.  This will maintain the formatting, and avoid these little niggles.
Logged
The opinions I express represent my own folly.

Robert H

  • Junior Woodchuck
  • **
  • Posts: 50
Re: Removing files from list if played
« Reply #15 on: January 22, 2012, 06:14:29 pm »

I really appreciate your help with this!
Logged
Pages: [1]   Go Up