[Icecast] Request: Time Stamped Dump-Files

gARetH baBB hick.icecast at gink.org
Fri Feb 24 17:07:19 UTC 2006


On Fri, 24 Feb 2006, lars.kindermann at freenet.de wrote:

> I urgently need a feature to save the dump-files in splitted timestamped 
> chunks or - much better - named accordingly to the stream metadata.

I'm not 100% convinced this is what you *actually* want, but this patch is 
what I use to time stamp dump files - perhaps it is.

As you can see it's diffed against 2.2-kh11b, but I don't know if it will 
patch against the very recent releases (official or kh).


diff -u -r icecast-2.2-kh11b/src/source.c icecast-2.2-kh11b_/src/source.c
--- icecast-2.2-kh11b/src/source.c	2005-06-18 14:26:04.000000000 +0100
+++ icecast-2.2-kh11b_/src/source.c	2005-06-23 17:37:26.000000000 +0100
@@ -650,15 +650,22 @@
     char *str;
     mount_proxy *mountinfo;
 
+    time_t now = global.time;
+    struct tm local;
+    char buffer[PATH_MAX];
+
     thread_mutex_lock (&source->lock);
 
     if (source->dumpfilename != NULL)
     {
-        source->dumpfile = fopen (source->dumpfilename, "ab");
+        localtime_r (&now, &local);
+        strftime (buffer, sizeof (buffer), source->dumpfilename, &local);
+    
+        source->dumpfile = fopen (buffer, "ab");
         if (source->dumpfile == NULL)
         {
             WARN2("Cannot open dump file \"%s\" for appending: %s, disabling.",
-                    source->dumpfilename, strerror(errno));
+                    buffer, strerror(errno));
         }
     }
 



More information about the Icecast mailing list