INTERACT FORUM

Please login or register.

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

Author Topic: Feature Request. Before track playback and After track playback expressions  (Read 1125 times)

rbmjr

  • World Citizen
  • ***
  • Posts: 143

I am so happy to see the Before Playback expression being added to MC33. MC needs two more expression fields; the first is a Before Track Plays and the other is an After Track Plays expression. The current Before Playback and After Playback are not granular enough.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831

I fail to see the difference, can you please elaborate?
The current "Before Playback" should already be firing before every track, same for "After Playback".
Logged

rbmjr

  • World Citizen
  • ***
  • Posts: 143

Hold on, I have some things on my calendar today. I have the queue loaded and when I return I'll run through the playback and report the results.
Logged

EnglishTiger

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1183

I fail to see the difference, can you please elaborate?
The current "Before Playback" should already be firing before every track, same for "After Playback".

Zybex at a guess "Before track playback" could be used to provide a list of tracks where Date Modified is > Last Played and  "After track playback" to provide a list of tracks where Last Played > Date Modified.

But since that is something that can be achieved with 2 Smarlists I can not see any logical reason to turn them into Expressions.
Logged
Apple Mac Mini Desktop Computer with M4 Pro chip with 12 core CPU and 16 core GPU: 24GB Unified Memory, 512GB SSD Storage, Gigabit Ethernet, 3 Thunderbolt5 + 2USBC ports.

ET Skins, TrackInfo Plugins and Other Goodies - https://englishtiger.uk/index.html

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9242

I fail to see the difference, can you please elaborate?
The current "Before Playback" should already be firing before every track, same for "After Playback".
I have a desire, and I thought about you :D

Currently, my "after playback  expression" is:
setfield(Play History,formatdate([last played,0],yyyy//MM//dd HH:mm:ss);[play history])

and that has been working just peachy since the feature inception.

Now, my "Recent Movies" view in Theater View includes movies that don't match the criteria, but do match on [Watch Later] is [1]

I have been unable to figure out how to add: If(IsEqual([Watch Later],1),setfield([Watch Later],0,) to that After Playback expression.

Are you able to encourage my laziness? (in a, "only if you see it instantly, DOH!" kind of way :))
Logged

Some alternative skins are here | Import Stats on Steroids | Middle click the close button=One of the neatest things added to MC in a long time

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2066

If i can answer too, remove [] from setfield
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831

Hi Marko,
Maybe I'm missing something, but shouldn't it work just by adding both code items?
SetField(Play History, blablabla)
SetField(Watch Later, 0)

The if() seems redundant, and there's a closing parenthesis missing. Also, Setfield takes a field name without brackets, not a [field] :)

Edit: Ninja'd by Lepa.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2066

Let's just wait for the D'oh  :D
Logged

rbmjr

  • World Citizen
  • ***
  • Posts: 143

sorry for the delay, attached are .gif files for

SmartList selection
Zone as 1st track begins to play
Zone after all tracks played
Before Playback expression
After Playback expression



Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831

I still don't know what you are asking for.

Hint: that expression you have for SetField(AfterPlaybak, some_date_format_stuff) is equivalent to just SetField(AfterPlayback, Now())

Edit: If this is related to your other thread about "Last Played" not getting updated for the first track, then it's better to pursue the other thread, this one is going nowhere. Are you perhaps setting the [Last Played] field in some other piece of code, perhaps when you mark the track as SELECTED?
Logged

rbmjr

  • World Citizen
  • ***
  • Posts: 143
Re: Feature Request. Before track playback and After track playback expressions
« Reply #10 on: February 25, 2025, 10:59:31 am »

Sorry again, have to dash, just thought I'd add this to the topic until I return

I expected to see WorkString in Green before playback, Yellow during playback, and Red After Playback.

Of course there is the ongoing issue in this thread where the first track does not get processed. https://yabb.jriver.com/interact/index.php/topic,140681.0.html

I believe they are all related


Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Feature Request. Before track playback and After track playback expressions
« Reply #11 on: February 25, 2025, 01:43:07 pm »

"Before Playback" triggers immediately before a track starts playing, not when it's queued or added to a playlist. The "Before Playback" should therefore be used to set your yellow "Playing" text. There's currently no way to set the green "Ready to play" for tracks waiting to be played, unless you use some other mechanism.

"After Playback" triggers when a track finishes, so you can use it to set the red "Played".

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9242
Re: Feature Request. Before track playback and After track playback expressions
« Reply #12 on: February 25, 2025, 10:44:45 pm »

Let's just wait for the D'oh  :D
Here it is :D
For some reason, I had it fixed in my head that the thing would only accept a single expression, and the idea that adding another line might be possible never entered my head, and probably never would have. Got it working great now. Once the 'watch later' ones are watched, they too are dropping out of the recent view. Brilliant. Thank you both. PS. all the errors in the expressions were because I was typing them from my phone, no MC in front of me :|

@rbmjr, apologies for borrowing your thread.
Logged

Some alternative skins are here | Import Stats on Steroids | Middle click the close button=One of the neatest things added to MC in a long time

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9242
Re: Feature Request. Before track playback and After track playback expressions
« Reply #13 on: February 25, 2025, 10:48:55 pm »

There's currently no way to set the green "Ready to play" for tracks waiting to be played, unless you use some other mechanism.
Couldn't IsInPlayingNow() be used for this? I'm not sure if there's a way to exclude the currently playing track though?
Logged

Some alternative skins are here | Import Stats on Steroids | Middle click the close button=One of the neatest things added to MC in a long time

rbmjr

  • World Citizen
  • ***
  • Posts: 143
Re: Feature Request. Before track playback and After track playback expressions
« Reply #14 on: February 26, 2025, 11:05:28 am »

While I agree Before Playback Expression and After Playback Expressions should work as you described. I disagree that it is actually working as we both want them too

This morning I went and set...

Before Playback Expression to:
Code: [Select]
SetField( WorkString, <font color="FF00FF">PLAYING<//font>  )  and
After Playback Expression to:
Code: [Select]
SetField( WorkString, <font color="808080">PLAYED<//font>  )
Then selected a few tracks and sent them to my MC ID Zone: 3008MCID

After the 1st track played, here are the results. Things start off well. WorkString is set to PLAYING. Then things begin to go off the rails. The Last Played date is not updated. When the track ends, instead of WorkString being set to PLAYED, PLAYED was set into WorkString for the 2nd track. I suspect the Last Played date of the 2nd track is also receiving the Last Played value of the 1st track too.

 How can we figure this out?


Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Feature Request. Before track playback and After track playback expressions
« Reply #15 on: February 26, 2025, 12:49:30 pm »

You may be right that it doesn't work as expected.

It looks like the [Last Played] field is only set when the playback reaches the last 5 seconds of the file (this is likely by design) - and that's also when the [After Playback] expression is being executed. If you press NEXT or STOP a track before the -5s mark, the expression is NOT executed, and [Last Played] is also not set. This is not what I would expect.

The -5s mark is also when MC starts buffering the next track, which may explain what you're seeing. I can't reproduce your case when playing directly on my PC, but I suspect that MC may be executing against the wrong track when using DLNA or playing to a remote streamer. The streamer will pull the file into its internal buffer, often in much larger chunks that 5 seconds, so it's likely that MC is not catching that the file is ending until it's already pulling the next track, and by that time MC may have the wrong track in the LastPlayed/AfterPlayback context. It's possible that this is also caused by some setting in your DLNA config - I can't test this as I don't use MC for audio and don't use DLNA.

@JRiver TLDR:
- [Last Played] and AfterPlayback may be getting executed on the wrong track when using DLNA
- I would expect AfterPlayback to also be executed when the user presses NEXT or STOP... setting [LastPlayed] and [Number Plays] in this case is debatable.


Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Feature Request. Before track playback and After track playback expressions
« Reply #16 on: February 26, 2025, 01:03:47 pm »

One other consideration - if you're using an MC Client to control devices with the library on some other MC Server, then you should set the Before/After playback expressions on the Server, not the Client. Not sure how this whole client/server/dlna playback would interact with the execution of those expressions, specially if you have different expressions set on the client and server.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2066
Re: Feature Request. Before track playback and After track playback expressions
« Reply #17 on: February 26, 2025, 02:08:34 pm »

- I would expect AfterPlayback to also be executed when the user presses NEXT or STOP... setting [LastPlayed] and [Number Plays] in this case is debatable.
If I cannot determine actual trigger (SKIP, STOP, END) I wouldn't like AfterPlayback to trigger for the SKIP or STOP

I seem to remember that remotes (MO remote at least) triggers AfterPlayback on server right away when you start playing track in the device
Logged

rbmjr

  • World Citizen
  • ***
  • Posts: 143
Re: Feature Request. Before track playback and After track playback expressions
« Reply #18 on: February 27, 2025, 10:23:06 am »

I realize that I should have mentioned that these were Remote Zones, not Local Zones. Local Zones do not experience this problem. I have tried linking Zones together, however the playback gets out of sync between the Remote Zone and the Local Zone and honestly I cannot remember if that was the only reason I abandoned that approach. Where do I go with this?
Logged
Pages: [1]   Go Up