[xiph-commits] r8365 - in trunk/icecast2yp: sql src

oddsock at motherfish-iii.xiph.org oddsock at motherfish-iii.xiph.org
Fri Dec 10 13:46:00 PST 2004


Author: oddsock
Date: 2004-12-10 13:45:59 -0800 (Fri, 10 Dec 2004)
New Revision: 8365

Modified:
   trunk/icecast2yp/sql/reset_db.sql
   trunk/icecast2yp/src/yp_cgi.c
   trunk/icecast2yp/src/yp_routines.c
   trunk/icecast2yp/src/yp_routines.h
Log:
add server sub type for ogg streams of differing types (vorbis/theora)


Modified: trunk/icecast2yp/sql/reset_db.sql
===================================================================
--- trunk/icecast2yp/sql/reset_db.sql	2004-12-10 17:27:06 UTC (rev 8364)
+++ trunk/icecast2yp/sql/reset_db.sql	2004-12-10 21:45:59 UTC (rev 8365)
@@ -1,4 +1,3 @@
-use icecast2_yp;
 DROP TABLE if exists server_details;
 DROP TABLE if exists servers_touch;
 DROP TABLE if exists servers;
@@ -40,6 +39,7 @@
   listen_url varchar(200) default NULL,
   playlist_id mediumint(9) default NULL,
   server_type varchar(25) default NULL,
+  server_subtype varchar(255) default NULL,
   bitrate varchar(25) default NULL,
   listeners int(11) default NULL,
   channels varchar(25) default NULL,

Modified: trunk/icecast2yp/src/yp_cgi.c
===================================================================
--- trunk/icecast2yp/src/yp_cgi.c	2004-12-10 17:27:06 UTC (rev 8364)
+++ trunk/icecast2yp/src/yp_cgi.c	2004-12-10 21:45:59 UTC (rev 8365)
@@ -14,6 +14,7 @@
 	char	listing_ip[255];
 	char	server_name[101];
 	char	server_type[26];
+	char	server_subtype[255];
 	char	bitrate[26];
 	char	desc[256];
 	char	st[256];
@@ -32,12 +33,13 @@
 	int	use_listingIP = 0;
 
 
-	setErrorType(LM_ERROR);
+	setErrorType(LM_DEBUG);
 	setLogFile(YP_LOGDIR"yp_cgi.log");
 	memset(error, '\000', sizeof(error));
 	memset(listing_ip, '\000', sizeof(listing_ip));
 	memset(server_name, '\000', sizeof(server_name));
 	memset(server_type, '\000', sizeof(server_type));
+	memset(server_subtype, '\000', sizeof(server_subtype));
 	memset(bitrate, '\000', sizeof(bitrate));
 	memset(desc, '\000', sizeof(desc));
 	memset(genre, '\000', sizeof(genre));
@@ -183,6 +185,16 @@
 				}
 			}
 		}
+		if (cgi_param("stype") != NULL) {
+			Log(LOG_DEBUG, "Getting Server SubType");
+			if (strlen(cgi_param("stype")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("stype"));
+				if (ptmp) {
+					strncpy(server_subtype, ptmp, sizeof(server_subtype)-1);
+					free(ptmp);
+				}
+			}
+		}
 		if (cgi_param("b") != NULL) {
 			Log(LOG_DEBUG, "Getting Bitrate");
 			if (strlen(cgi_param("b")) > 0) {
@@ -336,7 +348,7 @@
 			}
 			Log(LOG_DEBUG, "Going to Add Server");
 			memset(sid, '\000', sizeof(sid));
-			ret = addServer(server_name, genre, cluster_password, desc, url, listenurl, server_type, bitrate, listing_ip, sid, samplerate, channels, error);
+			ret = addServer(server_name, genre, cluster_password, desc, url, listenurl, server_type, server_subtype, bitrate, listing_ip, sid, samplerate, channels, error);
 			Log(LOG_DEBUG, "Done With Add Server");
 			if (ret == YP_ADDED) {
 				Log(LOG_DEBUG, "sending sid  of %s", sid);

Modified: trunk/icecast2yp/src/yp_routines.c
===================================================================
--- trunk/icecast2yp/src/yp_routines.c	2004-12-10 17:27:06 UTC (rev 8364)
+++ trunk/icecast2yp/src/yp_routines.c	2004-12-10 21:45:59 UTC (rev 8365)
@@ -511,7 +511,7 @@
 	return(1);
 }
 
-int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error)
+int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *server_subtype, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error)
 {
 	char	sql[2*8096];
 	int	i;
@@ -523,6 +523,7 @@
 	char	*desc_esc = NULL;
 	char	*url_esc = NULL;
 	char	*server_type_esc = NULL;
+	char	*server_subtype_esc = NULL;
 	char	*bitrate_esc = NULL;
 	char	*listenurl_esc = NULL;
 	char	*listeners_esc = NULL;
@@ -622,6 +623,8 @@
 	memset(desc_esc, '\000', strlen(desc)*2 + 1);
 	server_type_esc = malloc(strlen(server_type)*2 + 1);
 	memset(server_type_esc, '\000', strlen(server_type)*2 + 1);
+	server_subtype_esc = malloc(strlen(server_subtype)*2 + 1);
+	memset(server_subtype_esc, '\000', strlen(server_subtype)*2 + 1);
 	bitrate_esc = malloc(strlen(bitrate)*2 + 1);
 	memset(bitrate_esc, '\000', strlen(bitrate)*2 + 1);
 	listenurl_esc = malloc(strlen(listenurl)*2 + 1);
@@ -638,6 +641,7 @@
 	mysql_real_escape_string(&dbase, url_esc, url, strlen(url));
 	mysql_real_escape_string(&dbase, desc_esc, desc, strlen(desc));
 	mysql_real_escape_string(&dbase, server_type_esc, server_type, strlen(server_type));
+	mysql_real_escape_string(&dbase, server_subtype_esc, server_subtype, strlen(server_subtype));
 	mysql_real_escape_string(&dbase, bitrate_esc, bitrate, strlen(bitrate));
 	mysql_real_escape_string(&dbase, listenurl_esc, listenurl, strlen(listenurl));
 	mysql_real_escape_string(&dbase, samplerate_esc, samplerate, strlen(samplerate));
@@ -701,6 +705,7 @@
 			  listen_url,		\
 			  playlist_id,		\
 			  server_type,		\
+			  server_subtype,	\
 			  bitrate,		\
 			  listeners,		\
 			  samplerate,		\
@@ -718,9 +723,10 @@
 			  %s,			\
 			  '%s',			\
 			  '%s',			\
+			  '%s',			\
 			  0,			\
 			  '%s',			\
-			  '%s')", parent_id, server_name_esc, listing_ip, desc_esc, genre_esc, sid, cluster_password_esc, url_esc, "", listenurl_esc, cluster_id, server_type_esc, bitrate_esc, samplerate_esc, channels_esc);
+			  '%s')", parent_id, server_name_esc, listing_ip, desc_esc, genre_esc, sid, cluster_password_esc, url_esc, "", listenurl_esc, cluster_id, server_type_esc, server_subtype_esc, bitrate_esc, samplerate_esc, channels_esc);
 	Log(LOG_DEBUG, sql);
 	if (mysql_real_query(&dbase,sql,strlen(sql))) {
 		sprintf(error, "servers: %s", mysql_error(&dbase));
@@ -767,6 +773,9 @@
 	if (server_type_esc) {
 		free(server_type_esc);
 	}
+	if (server_subtype_esc) {
+		free(server_subtype_esc);
+	}
 	if (bitrate_esc) {
 		free(bitrate_esc);
 	}
@@ -796,6 +805,9 @@
 	if (server_type_esc) {
 		free(server_type_esc);
 	}
+	if (server_subtype_esc) {
+		free(server_subtype_esc);
+	}
 	if (bitrate_esc) {
 		free(bitrate_esc);
 	}

Modified: trunk/icecast2yp/src/yp_routines.h
===================================================================
--- trunk/icecast2yp/src/yp_routines.h	2004-12-10 17:27:06 UTC (rev 8364)
+++ trunk/icecast2yp/src/yp_routines.h	2004-12-10 21:45:59 UTC (rev 8365)
@@ -31,7 +31,7 @@
 double  GetCurrentTime();
 int genSID(char *sid, char *error);
 int connectToDB() ;
-int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error);
+int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *server_subtype, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error);
 int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *bitrate, char *server_name, char *error, int touchType);
 int removeServer(char *sid, char *removeip, char *cluster_password, char *error);
 void sendOK();



More information about the commits mailing list