added fileAddDate function
This commit is contained in:
parent
126224db09
commit
6eba725b50
|
@ -156,6 +156,11 @@ Dump the same mp3 data sent to the
|
||||||
.B IceCast
|
.B IceCast
|
||||||
server to this local file.
|
server to this local file.
|
||||||
.TP
|
.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.
|
||||||
|
.TP
|
||||||
.I lowpass
|
.I lowpass
|
||||||
Lowpass filter setting for the lame encoder. If not set or set to 0,
|
Lowpass filter setting for the lame encoder. If not set or set to 0,
|
||||||
the encoder's default behaviour is used. If set to -1, the filter is
|
the encoder's default behaviour is used. If set to -1, the filter is
|
||||||
|
@ -256,7 +261,11 @@ Genre of the stream
|
||||||
Dump the same Ogg Vorbis data sent to the
|
Dump the same Ogg Vorbis data sent to the
|
||||||
.B IceCast2
|
.B IceCast2
|
||||||
server to this local file.
|
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.
|
||||||
.PP
|
.PP
|
||||||
.B [shoutcast-x]
|
.B [shoutcast-x]
|
||||||
|
|
||||||
|
@ -347,7 +356,11 @@ disabled.
|
||||||
Dump the same mp3 data sent to the
|
Dump the same mp3 data sent to the
|
||||||
.B ShoutCast
|
.B ShoutCast
|
||||||
server to this local file.
|
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.
|
||||||
.PP
|
.PP
|
||||||
.B [file-x]
|
.B [file-x]
|
||||||
|
|
||||||
|
@ -450,6 +463,7 @@ genre = live
|
||||||
public = no
|
public = no
|
||||||
remoteDumpFile = /tmp/server-dump.mp3
|
remoteDumpFile = /tmp/server-dump.mp3
|
||||||
localDumpFile = /tmp/encoder-dump.mp3
|
localDumpFile = /tmp/encoder-dump.mp3
|
||||||
|
fileAddDate = no
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
int highpass = 0;
|
int highpass = 0;
|
||||||
const char * localDumpName = 0;
|
const char * localDumpName = 0;
|
||||||
FileSink * localDumpFile = 0;
|
FileSink * localDumpFile = 0;
|
||||||
|
bool fileAddDate = false;
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
@ -282,6 +283,8 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
lowpass = str ? Util::strToL( str) : 0;
|
lowpass = str ? Util::strToL( str) : 0;
|
||||||
str = cs->get( "highpass");
|
str = cs->get( "highpass");
|
||||||
highpass = str ? Util::strToL( str) : 0;
|
highpass = str ? Util::strToL( str) : 0;
|
||||||
|
str = cs->get("fileAddDate");
|
||||||
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
|
||||||
|
@ -289,6 +292,10 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
|
|
||||||
// check for and create the local dump file if needed
|
// check for and create the local dump file if needed
|
||||||
if ( localDumpName != 0 ) {
|
if ( localDumpName != 0 ) {
|
||||||
|
|
||||||
|
if (fileAddDate)
|
||||||
|
localDumpName = Util::fileAddDate(localDumpName);
|
||||||
|
|
||||||
localDumpFile = new FileSink( localDumpName);
|
localDumpFile = new FileSink( localDumpName);
|
||||||
if ( !localDumpFile->exists() ) {
|
if ( !localDumpFile->exists() ) {
|
||||||
if ( !localDumpFile->create() ) {
|
if ( !localDumpFile->create() ) {
|
||||||
|
@ -298,7 +305,6 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
audioOuts[u].socket = new TcpSocket( server, port);
|
audioOuts[u].socket = new TcpSocket( server, port);
|
||||||
audioOuts[u].server = new IceCast( audioOuts[u].socket.get(),
|
audioOuts[u].server = new IceCast( audioOuts[u].socket.get(),
|
||||||
|
@ -375,6 +381,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
bool isPublic = false;
|
bool isPublic = false;
|
||||||
const char * localDumpName = 0;
|
const char * localDumpName = 0;
|
||||||
FileSink * localDumpFile = 0;
|
FileSink * localDumpFile = 0;
|
||||||
|
bool fileAddDate = false;
|
||||||
|
|
||||||
str = cs->getForSure( "format", " missing in section ", stream);
|
str = cs->getForSure( "format", " missing in section ", stream);
|
||||||
if ( Util::strEq( str, "vorbis") ) {
|
if ( Util::strEq( str, "vorbis") ) {
|
||||||
|
@ -439,12 +446,19 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
genre = cs->get( "genre");
|
genre = cs->get( "genre");
|
||||||
str = cs->get( "public");
|
str = cs->get( "public");
|
||||||
isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
str = cs->get("fileAddDate");
|
||||||
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
|
||||||
// go on and create the things
|
// go on and create the things
|
||||||
|
|
||||||
// check for and create the local dump file if needed
|
// check for and create the local dump file if needed
|
||||||
if ( localDumpName != 0 ) {
|
if ( localDumpName != 0 ) {
|
||||||
|
|
||||||
|
if (fileAddDate)
|
||||||
|
localDumpName = Util::fileAddDate(localDumpName);
|
||||||
|
|
||||||
localDumpFile = new FileSink( localDumpName);
|
localDumpFile = new FileSink( localDumpName);
|
||||||
if ( !localDumpFile->exists() ) {
|
if ( !localDumpFile->exists() ) {
|
||||||
if ( !localDumpFile->create() ) {
|
if ( !localDumpFile->create() ) {
|
||||||
|
@ -454,7 +468,6 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
audioOuts[u].socket = new TcpSocket( server, port);
|
audioOuts[u].socket = new TcpSocket( server, port);
|
||||||
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
|
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
|
||||||
|
@ -572,6 +585,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
const char * icq = 0;
|
const char * icq = 0;
|
||||||
const char * localDumpName = 0;
|
const char * localDumpName = 0;
|
||||||
FileSink * localDumpFile = 0;
|
FileSink * localDumpFile = 0;
|
||||||
|
bool fileAddDate = false;
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
@ -632,12 +646,20 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
irc = cs->get( "irc");
|
irc = cs->get( "irc");
|
||||||
aim = cs->get( "aim");
|
aim = cs->get( "aim");
|
||||||
icq = cs->get( "icq");
|
icq = cs->get( "icq");
|
||||||
|
str = cs->get("fileAddDate");
|
||||||
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
|
||||||
// go on and create the things
|
// go on and create the things
|
||||||
|
|
||||||
// check for and create the local dump file if needed
|
// check for and create the local dump file if needed
|
||||||
if ( localDumpName != 0 ) {
|
if ( localDumpName != 0 ) {
|
||||||
|
|
||||||
|
if (fileAddDate)
|
||||||
|
localDumpName = Util::fileAddDate(localDumpName);
|
||||||
|
|
||||||
localDumpFile = new FileSink( localDumpName);
|
localDumpFile = new FileSink( localDumpName);
|
||||||
if ( !localDumpFile->exists() ) {
|
if ( !localDumpFile->exists() ) {
|
||||||
if ( !localDumpFile->create() ) {
|
if ( !localDumpFile->create() ) {
|
||||||
|
@ -965,6 +987,9 @@ DarkIce :: run ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.33 2002/11/20 16:52:05 wandereq
|
||||||
|
added fileAddDate function
|
||||||
|
|
||||||
Revision 1.32 2002/10/19 12:24:55 darkeye
|
Revision 1.32 2002/10/19 12:24:55 darkeye
|
||||||
anged internals so that now each encoding/server connection is
|
anged internals so that now each encoding/server connection is
|
||||||
a separate thread
|
a separate thread
|
||||||
|
|
|
@ -260,6 +260,44 @@ Util :: strToD( const char * str ) throw ( Exception )
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* insert date between 2 string pointers
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
char *
|
||||||
|
Util :: fileAddDate ( const char * str ) throw ( Exception )
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
char * s;
|
||||||
|
char * strdate;
|
||||||
|
char * last;
|
||||||
|
time_t now;
|
||||||
|
|
||||||
|
if ( !str ) {
|
||||||
|
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)
|
||||||
|
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));
|
||||||
|
s[size-1]='\0';
|
||||||
|
|
||||||
|
delete strdate;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Convert an unsigned char buffer holding 8 or 16 bit PCM values with
|
* Convert an unsigned char buffer holding 8 or 16 bit PCM values with
|
||||||
|
@ -449,6 +487,9 @@ Util :: conv16 ( unsigned char * pcmBuffer,
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.10 2002/11/20 16:52:07 wandereq
|
||||||
|
added fileAddDate function
|
||||||
|
|
||||||
Revision 1.9 2002/08/20 18:39:14 darkeye
|
Revision 1.9 2002/08/20 18:39:14 darkeye
|
||||||
added HTTP Basic authentication for icecast2 logins
|
added HTTP Basic authentication for icecast2 logins
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,18 @@ class Util
|
||||||
static double
|
static double
|
||||||
strToD ( const char * str ) throw ( Exception );
|
strToD ( const char * str ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a date to a string
|
||||||
|
*
|
||||||
|
* @param str the string to convert (file name).
|
||||||
|
* @return the new string with the date appended before
|
||||||
|
* extension of the file name
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char *
|
||||||
|
fileAddDate ( const char * str) throw ( Exception );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string into base64 encoding.
|
* Convert a string into base64 encoding.
|
||||||
* base64 is described in RFC 2045, section 6.8
|
* base64 is described in RFC 2045, section 6.8
|
||||||
|
@ -307,6 +319,9 @@ class Util
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.8 2002/11/20 16:52:08 wandereq
|
||||||
|
added fileAddDate function
|
||||||
|
|
||||||
Revision 1.7 2002/08/20 18:39:14 darkeye
|
Revision 1.7 2002/08/20 18:39:14 darkeye
|
||||||
added HTTP Basic authentication for icecast2 logins
|
added HTTP Basic authentication for icecast2 logins
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue