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]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -463,7 +463,7 @@ genre           = live
 | 
			
		|||
public          = no
 | 
			
		||||
remoteDumpFile  = /tmp/server-dump.mp3
 | 
			
		||||
localDumpFile   = /tmp/encoder-dump.mp3
 | 
			
		||||
fileAddDate	= no
 | 
			
		||||
fileAddDate     = no
 | 
			
		||||
.fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -220,7 +220,7 @@ DarkIce :: configIceCast (  const Config      & config,
 | 
			
		|||
        int                         highpass        = 0;
 | 
			
		||||
        const char                * localDumpName   = 0;
 | 
			
		||||
        FileSink                  * localDumpFile   = 0;
 | 
			
		||||
	bool			    fileAddDate     = false;
 | 
			
		||||
        bool                        fileAddDate     = false;
 | 
			
		||||
 | 
			
		||||
        str         = cs->get( "sampleRate");
 | 
			
		||||
        sampleRate  = str ? Util::strToL( str) : dsp->getSampleRate();
 | 
			
		||||
| 
						 | 
				
			
			@ -283,8 +283,8 @@ DarkIce :: configIceCast (  const Config      & config,
 | 
			
		|||
        lowpass     = str ? Util::strToL( str) : 0;
 | 
			
		||||
        str         = cs->get( "highpass");
 | 
			
		||||
        highpass    = str ? Util::strToL( str) : 0;
 | 
			
		||||
	str	    = cs->get("fileAddDate");
 | 
			
		||||
	fileAddDate = 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");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -292,10 +292,10 @@ DarkIce :: configIceCast (  const Config      & config,
 | 
			
		|||
 | 
			
		||||
        // check for and create the local dump file if needed
 | 
			
		||||
        if ( localDumpName != 0 ) {
 | 
			
		||||
	
 | 
			
		||||
	    if (fileAddDate)
 | 
			
		||||
		localDumpName = Util::fileAddDate(localDumpName);
 | 
			
		||||
		
 | 
			
		||||
            if ( fileAddDate ) {
 | 
			
		||||
                localDumpName = Util::fileAddDate(localDumpName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            localDumpFile = new FileSink( localDumpName);
 | 
			
		||||
            if ( !localDumpFile->exists() ) {
 | 
			
		||||
                if ( !localDumpFile->create() ) {
 | 
			
		||||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			@ -381,7 +384,7 @@ DarkIce :: configIceCast2 (  const Config      & config,
 | 
			
		|||
        bool                        isPublic        = false;
 | 
			
		||||
        const char                * localDumpName   = 0;
 | 
			
		||||
        FileSink                  * localDumpFile   = 0;
 | 
			
		||||
	bool                        fileAddDate     = false;
 | 
			
		||||
        bool                        fileAddDate     = false;
 | 
			
		||||
 | 
			
		||||
        str         = cs->getForSure( "format", " missing in section ", stream);
 | 
			
		||||
        if ( Util::strEq( str, "vorbis") ) {
 | 
			
		||||
| 
						 | 
				
			
			@ -446,8 +449,8 @@ DarkIce :: configIceCast2 (  const Config      & config,
 | 
			
		|||
        genre       = cs->get( "genre");
 | 
			
		||||
        str         = cs->get( "public");
 | 
			
		||||
        isPublic    = str ? (Util::strEq( str, "yes") ? true : false) : false;
 | 
			
		||||
	str	    = cs->get("fileAddDate");
 | 
			
		||||
	fileAddDate = 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");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -455,10 +458,10 @@ DarkIce :: configIceCast2 (  const Config      & config,
 | 
			
		|||
 | 
			
		||||
        // check for and create the local dump file if needed
 | 
			
		||||
        if ( localDumpName != 0 ) {
 | 
			
		||||
	
 | 
			
		||||
	    if (fileAddDate)
 | 
			
		||||
		localDumpName = Util::fileAddDate(localDumpName);
 | 
			
		||||
		
 | 
			
		||||
            if ( fileAddDate ) {
 | 
			
		||||
                localDumpName = Util::fileAddDate(localDumpName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            localDumpFile = new FileSink( localDumpName);
 | 
			
		||||
            if ( !localDumpFile->exists() ) {
 | 
			
		||||
                if ( !localDumpFile->create() ) {
 | 
			
		||||
| 
						 | 
				
			
			@ -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(),
 | 
			
		||||
| 
						 | 
				
			
			@ -585,7 +592,7 @@ DarkIce :: configShoutCast (    const Config      & config,
 | 
			
		|||
        const char                * icq             = 0;
 | 
			
		||||
        const char                * localDumpName   = 0;
 | 
			
		||||
        FileSink                  * localDumpFile   = 0;
 | 
			
		||||
	bool                        fileAddDate     = false;
 | 
			
		||||
        bool                        fileAddDate     = false;
 | 
			
		||||
 | 
			
		||||
        str         = cs->get( "sampleRate");
 | 
			
		||||
        sampleRate  = str ? Util::strToL( str) : dsp->getSampleRate();
 | 
			
		||||
| 
						 | 
				
			
			@ -646,20 +653,19 @@ DarkIce :: configShoutCast (    const Config      & config,
 | 
			
		|||
        irc         = cs->get( "irc");
 | 
			
		||||
        aim         = cs->get( "aim");
 | 
			
		||||
        icq         = cs->get( "icq");
 | 
			
		||||
	str	    = cs->get("fileAddDate");
 | 
			
		||||
	fileAddDate = 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");
 | 
			
		||||
 | 
			
		||||
        // go on and create the things
 | 
			
		||||
 | 
			
		||||
        // check for and create the local dump file if needed
 | 
			
		||||
        if ( localDumpName != 0 ) {
 | 
			
		||||
	
 | 
			
		||||
	    if (fileAddDate)
 | 
			
		||||
		localDumpName = Util::fileAddDate(localDumpName);
 | 
			
		||||
		
 | 
			
		||||
            if ( fileAddDate ) {
 | 
			
		||||
                localDumpName = Util::fileAddDate(localDumpName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            localDumpFile = new FileSink( localDumpName);
 | 
			
		||||
            if ( !localDumpFile->exists() ) {
 | 
			
		||||
                if ( !localDumpFile->create() ) {
 | 
			
		||||
| 
						 | 
				
			
			@ -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,41 +267,41 @@ 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 )
 | 
			
		||||
Util :: fileAddDate ( const char * str )                    throw ( Exception )
 | 
			
		||||
{
 | 
			
		||||
    unsigned int 	size;
 | 
			
		||||
    char		* s;
 | 
			
		||||
    char		* strdate;
 | 
			
		||||
    char 		* last;
 | 
			
		||||
    time_t		now;
 | 
			
		||||
    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;   
 | 
			
		||||
    now     = time(NULL);    
 | 
			
		||||
    strftime( strdate, 128, "[%m-%d-%Y-%H-%M-%S]", localtime (&now));
 | 
			
		||||
 | 
			
		||||
    // 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));
 | 
			
		||||
    s[size-1] = '\0';
 | 
			
		||||
 | 
			
		||||
    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,16 +203,16 @@ 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 );
 | 
			
		||||
        static char *
 | 
			
		||||
        fileAddDate ( const char * str )            throw ( Exception );
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         *  Convert a string into base64 encoding.
 | 
			
		||||
| 
						 | 
				
			
			@ -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