Diff of /gen_playlist.c [000000] .. [e5b953]  Maximize  Restore

  Switch to side-by-side view

--- a
+++ b/gen_playlist.c
@@ -0,0 +1,100 @@
+/*
+***************************************************************************
+*
+* Author: Georg Ottinger
+*
+* Copyright (C) 2012 Georg Ottinger
+*
+* georg@otelo.or.at
+*
+***************************************************************************
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation version 2 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+***************************************************************************
+*
+* This version of GPL is at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+*
+***************************************************************************
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+#define PLAYLIST "/mnt/flash/www/playlist.m3u"
+#define INDEXFILE "/mnt/flash/www/index"
+
+
+int main()
+{
+	char line[100];
+	char *ip,*end;
+	FILE *fp;
+
+	fgets(line, 100, stdin);
+
+	ip = strchr(line, ':');
+
+	if(!ip)
+	{
+		fprintf(stderr,"No IPv4-Address found!\n");
+		return -1;
+	}
+
+	ip++;
+	
+	end=strchr(ip,' ');
+	if(end)
+	{
+		*end = 0;
+	} else {
+		fprintf(stderr,"Space not found!\n");
+		return -1;
+	}
+
+
+	printf("IP Addr: %s\n",ip);
+
+	fp = fopen(PLAYLIST,"w");
+	
+	if(!fp)
+	{
+		fprintf(stderr, "Couldn't open "PLAYLIST"!\n");
+		return -1;
+	}
+
+	fprintf(fp,"#EXTINF:-1,(01:00) OggStreamer - Live\n");
+	fprintf(fp,"http://%s:3000/stream.ogg\n",ip);
+
+	fclose(fp);
+
+
+	system("cp "INDEXFILE".header "INDEXFILE".html");
+	
+	fp = fopen(INDEXFILE".html","a");
+
+	if(!fp)
+	{
+		fprintf(stderr, "Couldn't open "INDEXFILE".html!\n");
+		return -1;
+	}
+
+	fprintf(fp, "%s",ip);
+
+	fclose(fp);
+
+	system("cat "INDEXFILE".footer >>"INDEXFILE".html");
+
+}
+