Script to execute file

Post Reply
marko3d
Posts: 5
Joined: Tue Sep 28, 2010 8:11 pm

Script to execute file

Post by marko3d »

Hi,
Does anybody know how to make a script that will execute some .exe file every time some movie is played via wild media server ?

Thank you,
Marko
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Script to execute file

Post by Eugene »

Hi,

If playback does not matter, you can add a transcoding profile, which will call a exe-file as a transcoder or use the system ole-objects. Set a transcoding profile for some movie.
marko3d
Posts: 5
Joined: Tue Sep 28, 2010 8:11 pm

Re: Script to execute file

Post by marko3d »

What I would like to accomplish is to call an exe file on some "important" events.

For example, I have log file somewhere on the network, and I have report.exe which connects to my server and reports an status.
report.exe accepts parameter for example
When movie1 is played to call report.exe "Movie1 playing"
When movie1 is stopped to call report.exe "Movie1 stopped"

this can also be accomplished by calling to an URL instead exe file
For example:
When movie1 is played to call http://www.myserver.com/report.php?text=Movie1 playing
When movie1 is stopped to call http://www.myserver.com/report.php?text=Movie1 stopped

Is it possible to accomplish in Wild media server ? :)
Thank you,
Marko
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Script to execute file

Post by Eugene »

marko3d wrote:What I would like to accomplish is to call an exe file on some "important" events.

For example, I have log file somewhere on the network, and I have report.exe which connects to my server and reports an status.
report.exe accepts parameter for example
When movie1 is played to call report.exe "Movie1 playing"
When movie1 is stopped to call report.exe "Movie1 stopped"

this can also be accomplished by calling to an URL instead exe file
For example:
When movie1 is played to call http://www.myserver.com/report.php?text=Movie1 playing
When movie1 is stopped to call http://www.myserver.com/report.php?text=Movie1 stopped

Is it possible to accomplish in Wild media server ? :)
Thank you,
Marko
In this case, no concepts start-stop. In fact it is http-server, the device may request content from any position and portions. Request content from position 0 - event "After the beginning of a playback" of a media resource", transfer the last byte of the media resource - event "After the end of a playback of a media-resource" (Settings - Additional - Events). You can use the system ole-objects for http-requests in the events "After the beginning of a playback" of a media resource", "After the end of a playback of a media-resource"
marko3d
Posts: 5
Joined: Tue Sep 28, 2010 8:11 pm

Re: Script to execute file

Post by marko3d »

Thank you Eugene,
Could you please give me an example of such script ?
I'm not good at programming so I don't know how to accomplish that.

Thank you very much
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Script to execute file

Post by Eugene »

Settings - Processing - Add - Name: Start playback
Script:

Code: Select all

begin
  //WmsLogMessage(mtiInfo, 'http://www.myserver.com/report.php?text=' + WmsHttpEncode(CurrentMediaItem.Properties[mpiTitle] + ' playing'))
  WmsDownloadUrl('http://www.myserver.com/report.php?text=' + WmsHttpEncode(CurrentMediaItem.Properties[mpiTitle] + ' playing'))
end.
Ok - Add - Name: End playback
Script:

Code: Select all

begin
  //WmsLogMessage(mtiInfo, 'http://www.myserver.com/report.php?text=' + WmsHttpEncode(CurrentMediaItem.Properties[mpiTitle] + ' stopped'))
  WmsDownloadUrl('http://www.myserver.com/report.php?text=' + WmsHttpEncode(CurrentMediaItem.Properties[mpiTitle] + ' stopped'))
end.
Ok - Ok
Additonal - Events - "After the beginning of a playback..." - "Start playback" - "After the end of a playback..." - "End playback" - OK
marko3d
Posts: 5
Joined: Tue Sep 28, 2010 8:11 pm

Re: Script to execute file

Post by marko3d »

It's been a while.
This solution you provided worked very good.. but now I'm thinking of a different approach and I would love to call an exe file with some parameter when playback is started or ended.
It should be the same way as this url calling but is there some procedure instead WmsDownloadUrl that will call program ? .. something like WmsExecute("program.exe start");
and when stopped WmsExecute("program.exe stop");
Is there some function that will accomplish that ? ..
Thank you,
Marko
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Script to execute file

Post by Eugene »

Post Reply