applied fileDateFormat patch, closes #8
This commit is contained in:
parent
ed22b57ef0
commit
2b2ae392e0
|
@ -25,7 +25,7 @@ with contributions by:
|
||||||
Nicholas J. Humfrey <njh@ecs.soton.ac.uk>
|
Nicholas J. Humfrey <njh@ecs.soton.ac.uk>
|
||||||
Joel Ebel <jbebel@ncsu.edu>
|
Joel Ebel <jbebel@ncsu.edu>
|
||||||
<jochen2@users.sourceforge.net>
|
<jochen2@users.sourceforge.net>
|
||||||
Alexander Vlasov <zulu@galaradio.com>
|
Alexander Vlasov <zulu@galaradio.com>
|
||||||
Mariusz Mazur <mmazur@kernel.pl>
|
Mariusz Mazur <mmazur@kernel.pl>
|
||||||
<derrick@csociety.org>
|
dsk <derrick@csociety.org>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
DarkIce next release
|
DarkIce next release
|
||||||
|
|
||||||
|
o added user-defined date formatting for the fileAddDate options,
|
||||||
|
thanks to dsk <derrick@csociety.org>
|
||||||
o added logging facility - [file-X] targets will cut the saved file
|
o added logging facility - [file-X] targets will cut the saved file
|
||||||
and rename it as needed when darkice recieves the SIGUSR1 signal
|
and rename it as needed when darkice recieves the SIGUSR1 signal
|
||||||
o added default configuration file handling - if no configuration file
|
o added default configuration file handling - if no configuration file
|
||||||
|
@ -8,7 +10,7 @@ DarkIce next release
|
||||||
thanks to Alexander Vlasov <zulu@galaradio.com> and
|
thanks to Alexander Vlasov <zulu@galaradio.com> and
|
||||||
Mariusz Mazur <mmazur@kernel.pl>
|
Mariusz Mazur <mmazur@kernel.pl>
|
||||||
o fix to enable file dump feature using ogg vorbis.
|
o fix to enable file dump feature using ogg vorbis.
|
||||||
thanks to <derrick@csociety.org>
|
thanks to dsk <derrick@csociety.org>
|
||||||
|
|
||||||
|
|
||||||
19-05-2006 DarkIce 0.17.1 released
|
19-05-2006 DarkIce 0.17.1 released
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH darkice 1 "January 14, 2007" "DarkIce" "DarkIce live audio streamer"
|
.TH darkice 1 "February 25, 2007" "DarkIce" "DarkIce live audio streamer"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
darkice \- an icecast / shoutcast live audio streamer
|
darkice \- an icecast / shoutcast live audio streamer
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -99,9 +99,9 @@ Developed with contributions by
|
||||||
Nicholas J. Humfrey <njh@ecs.soton.ac.uk>
|
Nicholas J. Humfrey <njh@ecs.soton.ac.uk>
|
||||||
Joel Ebel <jbebel@ncsu.edu>
|
Joel Ebel <jbebel@ncsu.edu>
|
||||||
<jochen2@users.sourceforge.net>
|
<jochen2@users.sourceforge.net>
|
||||||
Alexander Vlasov <zulu@galaradio.com>
|
Alexander Vlasov <zulu@galaradio.com>
|
||||||
Mariusz Mazur <mmazur@kernel.pl>
|
Mariusz Mazur <mmazur@kernel.pl>
|
||||||
<derrick@csociety.org>
|
dsk <derrick@csociety.org>
|
||||||
|
|
||||||
.SH LINKS
|
.SH LINKS
|
||||||
Project homepage:
|
Project homepage:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH darkice.cfg 5 "January 14, 2007" "DarkIce" "DarkIce live audio streamer"
|
.TH darkice.cfg 5 "February 25, 2007" "DarkIce" "DarkIce live audio streamer"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
darkice.cfg \- configuration file for darkice
|
darkice.cfg \- configuration file for darkice
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
@ -181,6 +181,12 @@ server to this local file.
|
||||||
the localDumpFile name before its extension or at the end of file name if
|
the localDumpFile name before its extension or at the end of file name if
|
||||||
no extension present
|
no extension present
|
||||||
.TP
|
.TP
|
||||||
|
.I fileDateFormat
|
||||||
|
The date format to use for appending the date to the dump file name.
|
||||||
|
Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime()
|
||||||
|
can be used, see the strftime man page for details. Only applicable is
|
||||||
|
fileAddDate is "true".
|
||||||
|
.TP
|
||||||
.I lowpass
|
.I lowpass
|
||||||
Lowpass filter setting for the lame encoder, in Hz. Frequencies above
|
Lowpass filter setting for the lame encoder, in Hz. Frequencies above
|
||||||
the specified value will be cut.
|
the specified value will be cut.
|
||||||
|
@ -295,6 +301,12 @@ server to this local file.
|
||||||
the localDumpFile name before its extension or at the end of file name if
|
the localDumpFile name before its extension or at the end of file name if
|
||||||
no extension present
|
no extension present
|
||||||
.TP
|
.TP
|
||||||
|
.I fileDateFormat
|
||||||
|
The date format to use for appending the date to the dump file name.
|
||||||
|
Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime()
|
||||||
|
can be used, see the strftime man page for details. Only applicable is
|
||||||
|
fileAddDate is "true".
|
||||||
|
.TP
|
||||||
.I lowpass
|
.I lowpass
|
||||||
Lowpass filter setting for the lame encoder, in Hz. Frequencies above
|
Lowpass filter setting for the lame encoder, in Hz. Frequencies above
|
||||||
the specified value will be cut.
|
the specified value will be cut.
|
||||||
|
@ -406,6 +418,12 @@ server to this local file.
|
||||||
"yes" or "no" if you want to automaticaly insert a date string in
|
"yes" or "no" if you want to automaticaly insert a date string in
|
||||||
the localDumpFile name before its extension or at the end of file name if
|
the localDumpFile name before its extension or at the end of file name if
|
||||||
no extension present
|
no extension present
|
||||||
|
.TP
|
||||||
|
.I fileDateFormat
|
||||||
|
The date format to use for appending the date to the dump file name.
|
||||||
|
Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime()
|
||||||
|
can be used, see the strftime man page for details. Only applicable is
|
||||||
|
fileAddDate is "true".
|
||||||
.PP
|
.PP
|
||||||
.B [file-x]
|
.B [file-x]
|
||||||
|
|
||||||
|
|
|
@ -240,6 +240,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
const char * localDumpName = 0;
|
const char * localDumpName = 0;
|
||||||
FileSink * localDumpFile = 0;
|
FileSink * localDumpFile = 0;
|
||||||
bool fileAddDate = false;
|
bool fileAddDate = false;
|
||||||
|
const char * fileDateFormat = 0;
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
@ -306,6 +307,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
highpass = str ? Util::strToL( str) : 0;
|
highpass = str ? Util::strToL( str) : 0;
|
||||||
str = cs->get("fileAddDate");
|
str = cs->get("fileAddDate");
|
||||||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
fileDateFormat = cs->get("fileDateFormat");
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
|
||||||
|
@ -314,7 +316,13 @@ 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 ) {
|
if ( fileAddDate ) {
|
||||||
localDumpName = Util::fileAddDate(localDumpName);
|
if (fileDateFormat == 0) {
|
||||||
|
localDumpName = Util::fileAddDate(localDumpName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localDumpName = Util::fileAddDate( localDumpName,
|
||||||
|
fileDateFormat );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localDumpFile = new FileSink( stream, localDumpName);
|
localDumpFile = new FileSink( stream, localDumpName);
|
||||||
|
@ -432,6 +440,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
const char * localDumpName = 0;
|
const char * localDumpName = 0;
|
||||||
FileSink * localDumpFile = 0;
|
FileSink * localDumpFile = 0;
|
||||||
bool fileAddDate = false;
|
bool fileAddDate = false;
|
||||||
|
const char * fileDateFormat = 0;
|
||||||
|
|
||||||
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") ) {
|
||||||
|
@ -508,6 +517,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
highpass = str ? Util::strToL( str) : 0;
|
highpass = str ? Util::strToL( str) : 0;
|
||||||
str = cs->get( "fileAddDate");
|
str = cs->get( "fileAddDate");
|
||||||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
fileDateFormat = cs->get( "fileDateFormat");
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
|
||||||
|
@ -516,7 +526,13 @@ DarkIce :: configIceCast2 ( 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 ) {
|
if ( fileAddDate ) {
|
||||||
localDumpName = Util::fileAddDate(localDumpName);
|
if (fileDateFormat == 0) {
|
||||||
|
localDumpName = Util::fileAddDate(localDumpName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localDumpName = Util::fileAddDate( localDumpName,
|
||||||
|
fileDateFormat );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localDumpFile = new FileSink( stream, localDumpName);
|
localDumpFile = new FileSink( stream, localDumpName);
|
||||||
|
@ -689,6 +705,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
const char * localDumpName = 0;
|
const char * localDumpName = 0;
|
||||||
FileSink * localDumpFile = 0;
|
FileSink * localDumpFile = 0;
|
||||||
bool fileAddDate = false;
|
bool fileAddDate = false;
|
||||||
|
const char * fileDateFormat = 0;
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
@ -751,6 +768,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
icq = cs->get( "icq");
|
icq = cs->get( "icq");
|
||||||
str = cs->get("fileAddDate");
|
str = cs->get("fileAddDate");
|
||||||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
fileDateFormat = cs->get( "fileDateFormat");
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
|
||||||
|
@ -759,7 +777,13 @@ DarkIce :: configShoutCast ( 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 ) {
|
if ( fileAddDate ) {
|
||||||
localDumpName = Util::fileAddDate(localDumpName);
|
if (fileDateFormat == 0) {
|
||||||
|
localDumpName = Util::fileAddDate(localDumpName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localDumpName = Util::fileAddDate( localDumpName,
|
||||||
|
fileDateFormat );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localDumpFile = new FileSink( stream, localDumpName);
|
localDumpFile = new FileSink( stream, localDumpName);
|
||||||
|
@ -841,6 +865,8 @@ DarkIce :: configFileCast ( const Config & config )
|
||||||
unsigned int sampleRate = 0;
|
unsigned int sampleRate = 0;
|
||||||
int lowpass = 0;
|
int lowpass = 0;
|
||||||
int highpass = 0;
|
int highpass = 0;
|
||||||
|
bool fileAddDate = false;
|
||||||
|
const char * fileDateFormat = 0;
|
||||||
|
|
||||||
format = cs->getForSure( "format", " missing in section ", stream);
|
format = cs->getForSure( "format", " missing in section ", stream);
|
||||||
if ( !Util::strEq( format, "vorbis")
|
if ( !Util::strEq( format, "vorbis")
|
||||||
|
@ -856,6 +882,11 @@ DarkIce :: configFileCast ( const Config & config )
|
||||||
targetFileName = cs->getForSure( "fileName",
|
targetFileName = cs->getForSure( "fileName",
|
||||||
" missing in section ",
|
" missing in section ",
|
||||||
stream);
|
stream);
|
||||||
|
|
||||||
|
str = cs->get( "fileAddDate");
|
||||||
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
|
fileDateFormat = cs->get( "fileDateFormat");
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
|
||||||
|
@ -907,6 +938,16 @@ DarkIce :: configFileCast ( const Config & config )
|
||||||
// go on and create the things
|
// go on and create the things
|
||||||
|
|
||||||
// the underlying file
|
// the underlying file
|
||||||
|
if ( fileAddDate ) {
|
||||||
|
if (fileDateFormat == 0) {
|
||||||
|
targetFileName = Util::fileAddDate( targetFileName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
targetFileName = Util::fileAddDate( targetFileName,
|
||||||
|
fileDateFormat );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileSink * targetFile = new FileSink( stream, targetFileName);
|
FileSink * targetFile = new FileSink( stream, targetFileName);
|
||||||
if ( !targetFile->exists() ) {
|
if ( !targetFile->exists() ) {
|
||||||
if ( !targetFile->create() ) {
|
if ( !targetFile->create() ) {
|
||||||
|
|
|
@ -267,25 +267,27 @@ Util :: strToD( const char * str ) throw ( Exception )
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* add current date to a file name, before the file extension (if any)
|
* add current date to a file name, before the file extension (if any)
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
char *
|
char *
|
||||||
Util :: fileAddDate ( const char * str ) throw ( Exception )
|
Util :: fileAddDate ( const char * str,
|
||||||
|
const char * format ) throw ( Exception )
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
char * s;
|
char * s;
|
||||||
char * strdate;
|
char * strdate;
|
||||||
char * last;
|
char * last;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
||||||
if ( !str ) {
|
if ( !str ) {
|
||||||
throw Exception( __FILE__, __LINE__, "no str");
|
throw Exception( __FILE__, __LINE__, "no str");
|
||||||
}
|
}
|
||||||
|
|
||||||
strdate = new char[128];
|
strdate = new char[128];
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
strftime( strdate, 128, "[%m-%d-%Y-%H-%M-%S]", localtime (&now));
|
strftime( strdate, 128, format, localtime (&now));
|
||||||
|
|
||||||
// search for the part before the extension of the file name
|
// search for the part before the extension of the file name
|
||||||
if ( !(last = strrchr( str, '.')) ) {
|
if ( !(last = strrchr( str, '.')) ) {
|
||||||
|
|
|
@ -215,7 +215,8 @@ class Util
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
fileAddDate ( const char * str ) throw ( Exception );
|
fileAddDate ( const char * str,
|
||||||
|
const char * format = "[%m-%d-%Y-%H-%M-%S]" ) throw ( Exception );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string into base64 encoding.
|
* Convert a string into base64 encoding.
|
||||||
|
|
Loading…
Reference in New Issue