cosmetic changes to the fileAddDate option
This commit is contained in:
parent
b6b181d5fb
commit
6253785062
|
@ -1,4 +1,4 @@
|
|||
.TH darkice.cfg 5 "August 20, 2002" "DarkIce" "DarkIce live audio streamer"
|
||||
.TH darkice.cfg 5 "February 9, 2003" "DarkIce" "DarkIce live audio streamer"
|
||||
.SH NAME
|
||||
darkice.cfg \- configuration file for darkice
|
||||
.SH DESCRIPTION
|
||||
|
@ -158,8 +158,8 @@ server to this local file.
|
|||
.TP
|
||||
.I fileAddDate
|
||||
"yes" or "no" if you want to automaticaly insert a date string in
|
||||
the file name before his extension or at the end of file name if file name
|
||||
doens't have an extension.
|
||||
the localDumpFile name before its extension or at the end of file name if
|
||||
no extension present
|
||||
.TP
|
||||
.I lowpass
|
||||
Lowpass filter setting for the lame encoder. If not set or set to 0,
|
||||
|
@ -264,8 +264,8 @@ server to this local file.
|
|||
.TP
|
||||
.I fileAddDate
|
||||
"yes" or "no" if you want to automaticaly insert a date string in
|
||||
the file name before his extension or at the end of file name if file name
|
||||
doens't have an extension.
|
||||
the localDumpFile name before its extension or at the end of file name if
|
||||
no extension present
|
||||
.PP
|
||||
.B [shoutcast-x]
|
||||
|
||||
|
@ -359,8 +359,8 @@ server to this local file.
|
|||
.TP
|
||||
.I fileAddDate
|
||||
"yes" or "no" if you want to automaticaly insert a date string in
|
||||
the file name before his extension or at the end of file name if file name
|
||||
doens't have an extension.
|
||||
the localDumpFile name before its extension or at the end of file name if
|
||||
no extension present
|
||||
.PP
|
||||
.B [file-x]
|
||||
|
||||
|
|
|
@ -292,9 +292,9 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
|
||||
// check for and create the local dump file if needed
|
||||
if ( localDumpName != 0 ) {
|
||||
|
||||
if (fileAddDate)
|
||||
if ( fileAddDate ) {
|
||||
localDumpName = Util::fileAddDate(localDumpName);
|
||||
}
|
||||
|
||||
localDumpFile = new FileSink( localDumpName);
|
||||
if ( !localDumpFile->exists() ) {
|
||||
|
@ -304,6 +304,9 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
localDumpFile = 0;
|
||||
}
|
||||
}
|
||||
if ( fileAddDate ) {
|
||||
delete[] localDumpFile;
|
||||
}
|
||||
}
|
||||
// streaming related stuff
|
||||
audioOuts[u].socket = new TcpSocket( server, port);
|
||||
|
@ -455,9 +458,9 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
|
||||
// check for and create the local dump file if needed
|
||||
if ( localDumpName != 0 ) {
|
||||
|
||||
if (fileAddDate)
|
||||
if ( fileAddDate ) {
|
||||
localDumpName = Util::fileAddDate(localDumpName);
|
||||
}
|
||||
|
||||
localDumpFile = new FileSink( localDumpName);
|
||||
if ( !localDumpFile->exists() ) {
|
||||
|
@ -467,7 +470,11 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
localDumpFile = 0;
|
||||
}
|
||||
}
|
||||
if ( fileAddDate ) {
|
||||
delete[] localDumpName;
|
||||
}
|
||||
}
|
||||
|
||||
// streaming related stuff
|
||||
audioOuts[u].socket = new TcpSocket( server, port);
|
||||
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
|
||||
|
@ -649,16 +656,15 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
str = cs->get("fileAddDate");
|
||||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||
|
||||
|
||||
localDumpName = cs->get( "localDumpFile");
|
||||
|
||||
// go on and create the things
|
||||
|
||||
// check for and create the local dump file if needed
|
||||
if ( localDumpName != 0 ) {
|
||||
|
||||
if (fileAddDate)
|
||||
if ( fileAddDate ) {
|
||||
localDumpName = Util::fileAddDate(localDumpName);
|
||||
}
|
||||
|
||||
localDumpFile = new FileSink( localDumpName);
|
||||
if ( !localDumpFile->exists() ) {
|
||||
|
@ -668,6 +674,9 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
localDumpFile = 0;
|
||||
}
|
||||
}
|
||||
if ( fileAddDate ) {
|
||||
delete[] localDumpFile;
|
||||
}
|
||||
}
|
||||
|
||||
// streaming related stuff
|
||||
|
@ -987,6 +996,9 @@ DarkIce :: run ( void ) throw ( Exception )
|
|||
$Source$
|
||||
|
||||
$Log$
|
||||
Revision 1.34 2003/02/09 12:57:36 darkeye
|
||||
cosmetic changes to the fileAddDate option
|
||||
|
||||
Revision 1.33 2002/11/20 16:52:05 wandereq
|
||||
added fileAddDate function
|
||||
|
||||
|
|
|
@ -267,9 +267,8 @@ Util :: strToD( const char * str ) throw ( Exception )
|
|||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* insert date between 2 string pointers
|
||||
* add current date to a file name, before the file extension (if any)
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
char *
|
||||
Util :: fileAddDate ( const char * str ) throw ( Exception )
|
||||
{
|
||||
|
@ -283,25 +282,26 @@ Util :: fileAddDate ( const char * str ) throw ( Exception )
|
|||
throw Exception( __FILE__, __LINE__, "no str");
|
||||
}
|
||||
|
||||
|
||||
strdate = new char[128];
|
||||
now = time(NULL);
|
||||
strftime( strdate, 128, "[%m-%d-%Y-%H-%M-%S]", localtime (&now));
|
||||
|
||||
last = strrchr (str,'.');
|
||||
if (last == NULL)
|
||||
// search for the part before the extension of the file name
|
||||
if ( !(last = strrchr( str, '.')) ) {
|
||||
last = (char *) str + strlen( str);
|
||||
}
|
||||
|
||||
size = strlen( str) + strlen( strdate) + 1;
|
||||
|
||||
s = new char [size];
|
||||
|
||||
memcpy( s, str, strlen (str)-strlen(last));
|
||||
memcpy( s + strlen(str) - strlen(last), strdate, strlen (strdate));
|
||||
memcpy (s + strlen(str) - strlen(last) + strlen(strdate), last,strlen(last));
|
||||
memcpy( s + strlen(str) - strlen(last) + strlen(strdate),
|
||||
last,
|
||||
strlen(last));
|
||||
s[size-1] = '\0';
|
||||
|
||||
delete strdate;
|
||||
delete[] strdate;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -493,6 +493,9 @@ Util :: conv16 ( unsigned char * pcmBuffer,
|
|||
$Source$
|
||||
|
||||
$Log$
|
||||
Revision 1.12 2003/02/09 12:57:36 darkeye
|
||||
cosmetic changes to the fileAddDate option
|
||||
|
||||
Revision 1.11 2002/12/22 01:20:32 darkeye
|
||||
time.h include file was missing
|
||||
|
||||
|
|
|
@ -203,14 +203,14 @@ class Util
|
|||
strToD ( const char * str ) throw ( Exception );
|
||||
|
||||
/**
|
||||
* Add a date to a string
|
||||
* Add current date to a file name, before the file extension (if any)
|
||||
*
|
||||
* @param str the string to convert (file name).
|
||||
* @return the new string with the date appended before
|
||||
* extension of the file name
|
||||
* extension of the file name. the string has to be
|
||||
* deleted with delete[] after it is not needed
|
||||
* @exception Exception
|
||||
*/
|
||||
|
||||
static char *
|
||||
fileAddDate ( const char * str ) throw ( Exception );
|
||||
|
||||
|
@ -319,6 +319,9 @@ class Util
|
|||
$Source$
|
||||
|
||||
$Log$
|
||||
Revision 1.9 2003/02/09 12:57:36 darkeye
|
||||
cosmetic changes to the fileAddDate option
|
||||
|
||||
Revision 1.8 2002/11/20 16:52:08 wandereq
|
||||
added fileAddDate function
|
||||
|
||||
|
|
Loading…
Reference in New Issue