script_dir (UMS.conf setting)

For help and support with Universal Media Server in general
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
User avatar
squadjot
Moderator
Posts: 652
Joined: Fri Jun 01, 2012 4:24 am

script_dir (UMS.conf setting)

Post by squadjot » Wed Oct 03, 2018 11:13 am

Hi!

I fell over this old post where sharkhunter mentions implementing script_dir setting to UMS.conf

I guess this is the code for it:
https://github.com/UniversalMediaServer ... java#L1142

It works so far that i can define a folder and see it in "Server settings", i can also see whatever files is in the folder, but when i try to "play" my hello_world.bat file, the TV just says that it lost it's connection to the server and the bat file never runs.

Code: Select all

DEBUG 2018-10-03 01:00:13.989 [HTTPv2 Request Worker 2] Starting transcode/remux of hello world with media info: Container: MPEGPS, Size: 0, Mime Type: video/mpeg
DEBUG 2018-10-03 01:00:13.991 [HTTPv2 Request Worker 2] Caught exception: null
DEBUG 2018-10-03 01:00:13.999 [HTTPv2 Request Worker 3] Recognized media renderer "BRAVIA KDL-40W5500"
DEBUG 2018-10-03 01:00:14.085 [cling-17] TransportState: TRANSITIONING
DEBUG 2018-10-03 01:00:14.499 [HTTPv2 Request Worker 3] Starting transcode/remux of hello world with media info: Container: MPEGPS, Size: 0, Mime Type: video/mpeg
DEBUG 2018-10-03 01:00:14.501 [HTTPv2 Request Worker 3] Caught exception: null
DEBUG 2018-10-03 01:00:15.013 [cling-9] TransportStatus: ERROR_OCCURRED
DEBUG 2018-10-03 01:00:15.014 [cling-9] TransportState: STOPPED
DEBUG 2018-10-03 01:00:15.912 [cling-17] TransportStatus: OK
DEBUG 2018-10-03 01:00:19.256 [HTTPv2 Request Worker 4] Recognized media renderer "BRAVIA KDL-40W5500 
I think it would be quite cool if i could run scripts on my server using my TV remotecontrol :)

User avatar
squadjot
Moderator
Posts: 652
Joined: Fri Jun 01, 2012 4:24 am

Re: script_dir (UMS.conf setting)

Post by squadjot » Thu Oct 04, 2018 4:35 am

Ah, for some reason it does not work from my Sony W5500, but it (kinda) works from my Samsung J5510 TV.

In c:\ProgramData\UMS\UMS.conf i have:

Code: Select all

show_server_settings_folder = true
script_dir="c:\\ums_scripts"
In c:\ums_scripts\hello_world.bat i have:

Code: Select all

echo "Called" >> %~dp0log.txt
echo "Hello World!" > %~dp0hello_world.txt
echo The Batfile: %0 >> %~dp0hello_world.txt
echo Working dir: %cd% >> %~dp0hello_world.txt
So, from there i start UMS, and navigate to "Server Settings" folder where i can see a folder called "Scripts" and there i see my hello_world.bat.

With Samsung TV it runs the bat file, but for some reason it runs it 5 times instead of just one.

Would it be possible to make it launch the bat just one time?
And do you have any idea why does it not work from my SonyTV? (for some reason i don't see [no encoding] option on my Sony TV either , maybe it's related?)

User avatar
SubJunk
Lead Developer
Posts: 3235
Joined: Sun May 27, 2012 4:12 pm

Re: script_dir (UMS.conf setting)

Post by SubJunk » Thu Oct 04, 2018 9:44 am

I would guess it's to do with the formats the TV supports, since this is like a hack where we pretend to play a video, so I guess we are sending a fake video that one device supports but not another.
The 5 times thing is probably to do with threads and thread safety which is an issue we are working on lately, some things just happen multiple times because thread safety wasn't considered while writing the code

User avatar
squadjot
Moderator
Posts: 652
Joined: Fri Jun 01, 2012 4:24 am

Re: script_dir (UMS.conf setting)

Post by squadjot » Thu Oct 04, 2018 10:57 am

Ok, i found a setting that breaks it on SonyW5500

For some reason it does not work with

Code: Select all

KeepAspectRatio = true
If i comment it out, Sony TV thinks can stream the fake file (option).
If i leave it enabled i see [ffmpeg] after the filename.

Luckily i don't think the SonyW5500 config even need KeepAspectRatio = true, as long it has KeepAspectRatioTranscoding = true
I just tested with a cinema scope format file, and UMS applies black borders fine with just KeepAspectRatioTranscoding = true

Regarding the multiple calls, it's kinda unhandy but i can script my way out of that problem in the bat file.

Post Reply