Hi, do you think it would be possible to output the staticstics in JSON or any other format, that is more modern then ancient XML? It's pain in the butt to deserialize that thing in PHP...
It is possible. XML just simplier to output, no need to watch over commas and brackets.
So, could you please add JSON support? XML may be easier to generate, but it is outdated and noone really uses it anymore...
It's not outdated. Java, Tomcat, OO, LiO, MSO and many others using it. And nginx-rtmp too.
As for request - I want make any promises.
IMHO it is, but hey, I don't want to argue... And if you find a while to add the JSON support, it would be really appreciated (not just by me)...
I have a converter written by myself, it works like proxy and returns JSON,
it's in PHP. Anyone interested?
22 sie 2015 16:19 "Jacob Sycha" [email protected] napisał(a):
IMHO it is, but hey, I don't want to argue... And if you find a while to
add the JSON support, it would be really appreciated (not just by me)...—
Reply to this email directly or view it on GitHub
https://github.com/arut/nginx-rtmp-module/issues/669#issuecomment-133708321
.
Not easy, as you can see on:
https://github.com/arut/nginx-rtmp-module/blob/master/ngx_rtmp_stat_module.c#L436
XML format is "hardcoded" every where in the file, it's not a conversion (with libxml2 for instance).
If you use Php, convert XML to JSON is as simple as:
$xml = simplexml_load_file('http://127.0.0.1/stat');
$json = json_encode($xml);
Isn’t hardcoding in API a bit contraproductive?
From: Thomas Decaux [mailto:[email protected]]
Sent: Wednesday, September 2, 2015 10:21 AM
To: arut/nginx-rtmp-module
Cc: Jacob Sycha
Subject: Re: [nginx-rtmp-module] Statistics in JSON format (#669)
Not easy, as you can see on:
https://github.com/arut/nginx-rtmp-module/blob/master/ngx_rtmp_stat_module.c#L436
XML format is "hardcoded" every where in the file, it's not a conversion (with libxml2 for instance).
If you use Php, convert XML to JSON is as simple as:
$xml = simplexml_load_file('http://127.0.0.1/stat');
$json = json_encode($xml);
—
Reply to this email directly or view it on GitHub https://github.com/arut/nginx-rtmp-module/issues/669#issuecomment-136974050 . https://github.com/notifications/beacon/ABdnmFDiPR59MHaTihNvHmZnxy_6EOdAks5otqjvgaJpZM4FudZ8.gif
I just have PHP script which handles xml->json for me making all arrays looks good. I tried 2-codelines-solution but it returned ugly JSON sometimes.
@JacobCZ if you want JSON then you're more than welcome to submit a PR. Asking the devs to do it and telling them that their coding style isn't great isn't the best way to get things done :-)
I’m not telling them such thing, I’m just noting, that XML might not be the best way to go theese days ;) Unfortunatelly, I don’t do C, so PR is not an option for me... But I found a XML to JSON library for PHP, so it’s not such a problem for me...
@misiek08 can you share you "bridge" please? :)
$xml = simplexml_load_file('http://127.0.0.1/stat');
$json = json_encode($xml);
$xml = simplexml_load_file('http://127.0.0.1/stat');
$xmlj = json_encode($xml);
$data = json_decode($xmlj, true);
@winlin +1
po 21. 9. 2015 v 8:52 odesílatel winlin [email protected] napsal:
JSON is modern data format, maybe u can try srs, all api data are in JSON.
—
Reply to this email directly or view it on GitHub
https://github.com/arut/nginx-rtmp-module/issues/669#issuecomment-141892854
.
@winlinvip looks cool, but advertising in other repo? Man that's a dick move...
Advertising in other repo just IS bad. It doesn’t matter that it’s opensource or even based on te original project…
From: winlin [mailto:[email protected]]
Sent: Tuesday, September 22, 2015 9:20 AM
To: arut/nginx-rtmp-module [email protected]
Cc: Jacob Sycha [email protected]
Subject: Re: [nginx-rtmp-module] Statistics in JSON format (#669)
In a word, welcome to migrate from greate nginx-rtmp to great SRS~
:)
—
Reply to this email directly or view it on GitHub https://github.com/arut/nginx-rtmp-module/issues/669#issuecomment-142200622 . https://github.com/notifications/beacon/ABdnmLflcuEkzwnLburOSWXKyZrBVJoiks5o0PiCgaJpZM4FudZ8.gif
anyway, I dont understand chinese ^^
@winlin if you need to spam, at least spam in english...
On Sun, 4 Oct 2015 02:01 winlin [email protected] wrote:
Anyway, please love what you love~
原来非中国人也一样愚钝不化、胶柱鼓瑟、冥顽不灵、门户之见、一叶蔽目、先入为主、舍本逐末,谁的代码不是用英文写的?谁的wiki不是提供英文版?谁分发的RTMP、HLS、HDS、DASH只能中国人看得懂?
—
Reply to this email directly or view it on GitHub
https://github.com/arut/nginx-rtmp-module/issues/669#issuecomment-145300019
.
I solved this server side using the nginx XSLT module and a xml2json stylesheet i found here.
The see how, check out this commit: https://github.com/espizo/simple-nginx-rtmp/commit/d4705612500368fb77cff0cb7d6584d64ce7e03f
i've added json support for the stat page https://github.com/arut/nginx-rtmp-module/pull/815
please test & give feedback. forgive me if the source sucks, have not coded C in a while ;)
Most helpful comment
I solved this server side using the nginx XSLT module and a xml2json stylesheet i found here.
The see how, check out this commit: https://github.com/espizo/simple-nginx-rtmp/commit/d4705612500368fb77cff0cb7d6584d64ce7e03f