[xiph-commits] r19105 - in branches/dir.xiph.org: . api api/experimental docs

dm8tbr at svn.xiph.org dm8tbr at svn.xiph.org
Sun Mar 2 04:46:24 PST 2014


Author: dm8tbr
Date: 2014-03-02 04:46:24 -0800 (Sun, 02 Mar 2014)
New Revision: 19105

Added:
   branches/dir.xiph.org/api/
   branches/dir.xiph.org/api/experimental/
   branches/dir.xiph.org/api/experimental/.cgi
   branches/dir.xiph.org/api/experimental/full.cgi
   branches/dir.xiph.org/api/experimental/tags.cgi
   branches/dir.xiph.org/api/favicon.ico
   branches/dir.xiph.org/api/inc
   branches/dir.xiph.org/api/index.cgi
Modified:
   branches/dir.xiph.org/docs/documentation.txt
Log:
experimental JSON API of yp-directory of icecast.org


Added: branches/dir.xiph.org/api/experimental/.cgi
===================================================================
--- branches/dir.xiph.org/api/experimental/.cgi	                        (rev 0)
+++ branches/dir.xiph.org/api/experimental/.cgi	2014-03-02 12:46:24 UTC (rev 19105)
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo Content-Type: text/plain
+echo 
+
+ls -1 /var/www/api.dir.xiph.org/experimental/ | sed -e 's/\..*$//'


Property changes on: branches/dir.xiph.org/api/experimental/.cgi
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/dir.xiph.org/api/experimental/full.cgi
===================================================================
--- branches/dir.xiph.org/api/experimental/full.cgi	                        (rev 0)
+++ branches/dir.xiph.org/api/experimental/full.cgi	2014-03-02 12:46:24 UTC (rev 19105)
@@ -0,0 +1,11 @@
+#!/bin/bash
+echo Content-Type: application/json
+echo API-revision: 00001
+#echo Content-Type: text/html
+echo
+#QUERY="SELECT json_array(stream_name, description, url, listeners, media_type_id, bitrate) AS '' FROM mountpoint WHERE media_type_id = 107 ; "
+QUERY="SELECT CONCAT(json_object(m.stream_name AS stream_name, s.listen_url AS listen_url, m.media_type_id AS media_type_id, m.bitrate AS bitrate, m.channels as channels, m.samplerate as samplerate, GROUP_CONCAT(t.tag_name SEPARATOR ' ') AS genre, m.current_song as current_song), ',') AS ''  FROM mountpoint AS m  INNER JOIN server  AS s ON m.id = s.mountpoint_id  INNER JOIN mountpoints_tags AS mt ON mt.mountpoint_id = m.id  INNER JOIN tag AS t ON mt.tag_id = t.id WHERE s.listeners >1 OR s.listen_url NOT LIKE 'http://%.radionomy.com:80/%' GROUP BY s.id ORDER BY m.listeners DESC ;"
+
+echo [
+echo $QUERY| mysql -udir_xiph_org -p5wCjLEVmAJnmM dir_xiph_org
+echo ]


Property changes on: branches/dir.xiph.org/api/experimental/full.cgi
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/dir.xiph.org/api/experimental/tags.cgi
===================================================================
--- branches/dir.xiph.org/api/experimental/tags.cgi	                        (rev 0)
+++ branches/dir.xiph.org/api/experimental/tags.cgi	2014-03-02 12:46:24 UTC (rev 19105)
@@ -0,0 +1,12 @@
+#!/bin/bash
+echo Content-Type: application/json
+echo API-revision: 00001
+#echo Content-Type: text/html
+echo
+#QUERY="SELECT json_array(stream_name, description, url, listeners, media_type_id, bitrate) AS '' FROM mountpoint WHERE media_type_id = 107 ; "
+#QUERY="SELECT CONCAT(json_object(m.stream_name AS stream_name, s.listen_url AS listen_url, m.media_type_id AS media_type_id, m.bitrate AS bitrate, m.channels as channels, m.samplerate as samplerate, GROUP_CONCAT(t.tag_name SEPARATOR ' ') AS genre, m.current_song as current_song), ',') AS ''  FROM mountpoint AS m  INNER JOIN server  AS s ON m.id = s.mountpoint_id  INNER JOIN mountpoints_tags AS mt ON mt.mountpoint_id = m.id  INNER JOIN tag AS t ON mt.tag_id = t.id WHERE s.listeners >1 OR s.listen_url NOT LIKE 'http://%.radionomy.com:80/%' GROUP BY s.id ORDER BY m.listeners DESC ;"
+QUERY="SELECT CONCAT(json_object(t.tag_name AS tag_name, tc.tag_usage AS tag_usage), ',')  AS '' FROM tag_cloud AS tc INNER JOIN tag AS t ON tc.tag_id = t.id ORDER BY tc.tag_usage DESC LIMIT 100;"
+
+echo [
+echo $QUERY| mysql -udir_xiph_org -p5wCjLEVmAJnmM dir_xiph_org
+echo ]


Property changes on: branches/dir.xiph.org/api/experimental/tags.cgi
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/dir.xiph.org/api/favicon.ico
===================================================================
Added: branches/dir.xiph.org/api/inc
===================================================================
--- branches/dir.xiph.org/api/inc	                        (rev 0)
+++ branches/dir.xiph.org/api/inc	2014-03-02 12:46:24 UTC (rev 19105)
@@ -0,0 +1 @@
+link /var/www/dir.xiph.org/inc/
\ No newline at end of file


Property changes on: branches/dir.xiph.org/api/inc
___________________________________________________________________
Added: svn:special
   + *

Added: branches/dir.xiph.org/api/index.cgi
===================================================================
--- branches/dir.xiph.org/api/index.cgi	                        (rev 0)
+++ branches/dir.xiph.org/api/index.cgi	2014-03-02 12:46:24 UTC (rev 19105)
@@ -0,0 +1,7 @@
+#!/bin/bash
+echo Content-Type: application/json
+#echo Content-Type: text/html
+echo
+QUERY="SELECT json_array(stream_name, description, url, listeners, media_type_id, bitrate) AS '' FROM mountpoint WHERE media_type_id = 107 ; "
+QUERY="SELECT json_object(m.stream_name AS stream_name, s.listen_url AS listen_url, m.media_type_id AS media_type_id, m.bitrate AS bitrate, m.channels as channels, m.samplerate as samplerate, GROUP_CONCAT(t.tag_name SEPARATOR ' ') AS genre, m.current_song as current_song) AS ''  FROM mountpoint AS m  INNER JOIN server  AS s ON m.id = s.mountpoint_id  INNER JOIN mountpoints_tags AS mt ON mt.mountpoint_id = m.id  INNER JOIN tag AS t ON mt.tag_id = t.id WHERE s.listeners >1 OR s.listen_url NOT LIKE 'http://%.radionomy.com:80/%' GROUP BY s.id ORDER BY m.listeners DESC ;"
+echo $QUERY| mysql -udir_xiph_org -p5wCjLEVmAJnmM dir_xiph_org


Property changes on: branches/dir.xiph.org/api/index.cgi
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/dir.xiph.org/docs/documentation.txt
===================================================================
--- branches/dir.xiph.org/docs/documentation.txt	2014-03-01 18:21:43 UTC (rev 19104)
+++ branches/dir.xiph.org/docs/documentation.txt	2014-03-02 12:46:24 UTC (rev 19105)
@@ -37,6 +37,12 @@
 cd /var/www/dir.xiph.org/
 svn co http://svn.xiph.org/websites/common/
 
+#EXPERIMENTAL JSON API
+#compile, install, activate json modules in mysql: lib_mysqludf_json.so
+ln -s /var/www/dir.xiph.org/api /var/www/api.dir.xiph.org
+#The proof of concept is intentionally done as bash-script-cgi to be unsuitable for production use and requiring a proper rewrite.
+#Contributions are welcome. Use icecast-dev at xiph.org mailing list and https://trac.xiph.org/ticket/1958 for discussion.
+
 notes:
  * if output is blank, make sure c_templates is writeable and you have run the php scripts in cron at least once!
 



More information about the commits mailing list