INTERACT FORUM

Please login or register.

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

Author Topic: Command Line timing problem  (Read 2200 times)

Scronch

  • Guest
Command Line timing problem
« on: August 20, 2002, 02:02:31 am »

I can't get the timing to work on issuing some command line commands.  I want to clear Playing Now, raise the volume, play a short file (via a playlist name), lower the volume, and then append a playlist.  Two problems: The volume goes up and down before the first Play command is carried out, and the second playlist overrides the first.  Here is what I've tried:


@echo off
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Mode Megame
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Clear
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Command VolumeSet 100
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Play "TREEPATH=Playlists\Mixes\One Song Playlist"
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Command VolumeSet 80
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Append "TREEPATH=Playlists\Main Playlist"


I even tried putting a pause in between commands, but the pause gets executed (i.e. I hear silence) before any of the commands are carried out:


@echo off
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Mode Megame
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Clear
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Command VolumeSet 100
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Play "TREEPATH=Playlists\Mixes\One Song Playlist"
echo Waiting 2 second(s)...
echo Do                      >%TEMP%.\~tmp.vbs
echo Loop Until True = False>>%TEMP%.\~tmp.vbs
CSCRIPT //B //Nologo //T:2 %TEMP%.\~tmp.vbs
del %TEMP%.\~tmp.vbs
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Command VolumeSet 80
"C:\Program Files\J River\Media Jukebox\mjextman.exe" /Append "TREEPATH=Playlists\Main Playlist"


How can I get this to work?  Specifically, how can I get the volume to go up for one song, play that song, and THEN lower the volume back down--without trying to schedule a task time based on the length of the song?  And how can I get the Append command to wait for the other commands to complete before smashing in on everything?

Scronch
Logged

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20063
RE:Command Line timing problem
« Reply #1 on: August 20, 2002, 04:33:10 am »

Not to want to rain on your parade, but could you explain to me what your doing all this for?

is there a reason for runing this from a batch file?

maybe I am missing something here, But I'm just trying to finger out what all this batch file stuf is for.
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio, Music
https://MyAAGrapevines.com
https://centercitybbs.com
Fayetteville, NC, USA

Scronch

  • Guest
RE:Command Line timing problem
« Reply #2 on: August 20, 2002, 01:14:19 pm »

Because the whole thing is run by scheduled tasks, which call batch files, which call other batch files or issue MJ commands.  Works great, except for a few glitches like these.

Scronch
Logged

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20063
RE:Command Line timing problem
« Reply #3 on: August 20, 2002, 01:16:09 pm »

I See
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio, Music
https://MyAAGrapevines.com
https://centercitybbs.com
Fayetteville, NC, USA

RemyJ

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1249
RE:Command Line timing problem
« Reply #4 on: August 20, 2002, 07:54:11 pm »

Sounds like mjextman needs a /WaitForCommandToComplete option otherwise it just queues the command to the main application and returns.
Logged
Fedora 40 x86_64 Xfce

Scronch

  • Guest
RE:Command Line timing problem
« Reply #5 on: August 20, 2002, 09:44:50 pm »

I agree, but I think it's a little more complicated than that.  In the code above, when the "/Play" command is issued, it completes and the song starts playing.  But I don't want the "VolumeSet 80" to kick in until that one song has ended.  Not sure how to do that.

However, a /WaitForCommandToComplete option should fix the problem of the Append effectively cancelling the prior Play.

QUESTION: Why wouldn't you always want to wait for the previous command to complete?  I suppose some commands can be safely issued in parallel, but many of the MJ commands are sequential by their very nature.

Scronch
Logged

RemyJ

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1249
RE:Command Line timing problem
« Reply #6 on: August 20, 2002, 10:22:36 pm »

Someone on the development will have to jump in with the real answer of course, but I think they ARE being executed sequentially.  mjextman puts a command on a queue and returns.  MJ is monitoring the queue and executes the commands in the order they were placed on the queue.  Some commands are "executed" differently than others. Setting modes and volumes are simple short-lived actions.  Playing a track is not.  The thread that picks up messages from the queue can't wait for the track to finish playing before it picks up the next command so it has to dispatch the command off to something else and keep reading the queue.

Even though I suggested the /WaitFor... option, as I think about it I'm not sure it will be either easy or even possible to implement.   If you play a playlist for instance and use the theoretical /WaitFor... option, what happens if someone manually re-arranges, inserts, or deletes tracks from Playing Now?

All of this is just speculation of course based on how I've written stuff like this in the past.
Logged
Fedora 40 x86_64 Xfce

Scronch

  • Guest
RE:Command Line timing problem
« Reply #7 on: August 21, 2002, 12:36:19 am »

Assuming your conjecture is accurate, I think the problem with /Append smashing the previous /Play shows that MJ may not be reading the command queue quickly enough (?).

Scronch
Logged

Scronch

  • Guest
RE:Command Line timing problem
« Reply #8 on: August 25, 2002, 09:34:22 pm »

...waiting patiently for JRiver response...
Logged

Scronch

  • Guest
RE:Command Line timing problem
« Reply #9 on: August 26, 2002, 08:55:20 pm »

Logged

Beerhunter

  • Guest
RE:Command Line timing problem
« Reply #10 on: August 28, 2002, 11:29:18 pm »

Totally ignored, again, dude.  Really rad.
Logged

JimH

  • Citizen of the Universe
  • *****
  • Posts: 7604
  • Miller drives a tall-masted tractor on the ocean
RE:Command Line timing problem
« Reply #11 on: August 29, 2002, 06:45:58 am »

Scronch,
We're busy.  This is way way down the list in priority.

If you bring it up again in a few weeks, we MIGHT take a look.

Jim
Logged
Jim Hillegass
JRiver Media Center / Media Jukebox

Nikolay

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1681
  • Former CTO, JRiver, Inc.
RE:Command Line timing problem
« Reply #12 on: August 29, 2002, 08:52:34 am »

Scronch,

There is no easy way to do what you've described. /Play command is asynchronous. It will return immediately after a song has been added to the playlist.

One of the ways to do what you want is to write an Interface plug-in which will schedule the tasks.

Nikolay
Logged

Cephlen

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 98
  • someday I will find a pic that looks good...
RE:Command Line timing problem
« Reply #13 on: August 29, 2002, 10:22:54 am »

Yeah, write an interface plugin!

You would have so much more flexibility...

If you explain to me a bit more what you are trying to accomplish, I can help you out... if there is a need for something flexible like this, maybe I can write one for everyone.
Logged
All ICQ's are ignored unless I have added you.

Scronch

  • Guest
RE:Command Line timing problem
« Reply #14 on: September 02, 2002, 09:14:57 pm »

JimH - Makes sense to me.  I just like to hear that it's way way down the list, rather than wondering.

Nikolay - OK, guess I'm out of luck on setting the volume for one song.  I'm still not sure why the later /Append command completely overrides the earlier /Play command.  I would think that the song called out by the /Play command would be put in PN, and then the songs called out by the /Append command would be appended below that.  But what happens is that the /Play song never shows up in the list.  Something strange is going on with the timing of the commands.

Cephlen - I'm trying to clear Playing Now, raise the volume, play a short file (via a playlist name), lower the volume, and then append a playlist.  This is done in a batch file, which is executed as a scheduled task.

Thanks.

Scronch
Logged
Pages: [1]   Go Up