Media scanner and html

hello,

i have been messing around with media scanner
and used an ajax call to /cls
unless i set datatype to jsnop
i get a cors error.
and if i use jsonp i never get anything but an error. as the data is not a correct jsonp format.
but i do get the data from the media scanner app.
i can see it in the data in the developer console of my browser.

my request

            $.ajax({
            url: "http://127.0.0.1:8000/cls",
            type: 'GET',
            dataType: 'jsonp',
            contentType: "application/json",
           
            success: function(data) {
            $("#info").html(typeof data);  
                },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                   $("#info").append(XMLHttpRequest + "  " + textStatus + "  " + errorThrown);  
                }

            });

I don’t think the scanner supports json encoding of the results. The results are output in a format that matches the traditional AMCP CINF command.

The code that handles the request for /cls can be seen at https://github.com/CasparCG/media-scanner/blob/master/src/app.js starting at line 21.

To get around the error use:
"C:\Program Files\CasparCG_Server_2.0.7\casparcg.exe" casparcg.config --disable-web-security
to run your CasparCG server.

I’m not sure if the official scanner supports it.
or how much :wink:
But if you use the NRK version

you get soome extra endpoints with do return info in JSON format

I use this all the time to get the medialist in a format more useable then the oldskool CLS command.

for instance localhost:8000/media gives you a media list in JSON format

Thanks for the help i will give your suggestions a try here in a while.

Privacy Policy   Terms of Service