function readwebsoundratingsmanage(filename,filepath,mode)

%   readwebsoundratingsmanage

%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      
if nargin <3
    modefehler
    return
end

newdbstatus=0;
if mode==0
   modefehler
   return

% directory mode   
elseif mode==11
	cd (filepath);
	filelist=dir(filepath);
    filelistsize=size(filelist);
   
   
   
        [sourcefilename,sourcefilepath]=uigetfile('*.txt','Datenbank auswählen (cancel zum Neuanlegen!) :');
		if isequal(sourcefilename,0) | isequal(sourcefilepath,0)
            newdbstatus = 1;
            [newfilename,newfilepath]=uiputfile('*.rdb','Bitte benennen Sie die neue Datenbank (*.rdb):');
		    if isempty(findstr(newfilename,'.rdb'))
                newfilename=[newfilenmae,'.rdb'];
		    end
            
            writenewsounddb(newfilename,newfilepath,filelist(filezaehler).name);
            sourcefilename=newfilename;
            sourcefilepath=newfilepath;
        end
		
        


      
	% Schleife für Files
   for filezaehler=3:filelistsize(1)
      readwebsoundratings(sourcefilepath,sourcefilename,filelist(filezaehler).name);
   end
   ok
   
% batchfile mode   
elseif mode==12
   filemat=batchfiletomat(filename,filepath);
   filematgroessevec=size(filemat);
   filematgroesse=filematgroessevec(2);
   
   
   
    [sourcefilename,sourcefilepath]=uigetfile('*.rdb','Datenbank auswählen (cancel zum Neuanlegen!) :');
	if isequal(sourcefilename,0) | isequal(sourcefilepath,0)
        newdbstatus = 1;
        [newfilename,newfilepath]=uiputfile('*.rdb','Bitte benennen Sie die neue Datenbank (*.rdb):');
	    if isempty(findstr(newfilename,'.rdb'))
                newfilename=[newfilenmae,'.rdb'];
	    end
        writenewsounddb(newfilename,newfilepath,filemat{l});
        sourcefilename=newfilename;
        sourcefilepath=newfilepath;     
	end
        
        
        
   for l=1:filematgroesse   
   readwebsoundratings(sourcefilepath,sourcefilename,filemat{l});
   end
   ok
      
% single file mode   
elseif mode==2
    [sourcefilename,sourcefilepath]=uigetfile('*.rdb','Datenbank auswählen (cancel zum Neuanlegen!) :');
	if isequal(sourcefilename,0) | isequal(sourcefilepath,0)
        newdbstatus = 1;
        [newfilename,newfilepath]=uiputfile('*.rdb','Bitte benennen Sie die neue Datenbank (*.rdb):');
	    if isempty(findstr(newfilename,'.rdb'))
                newfilename=[newfilename,'.rdb'];
	    end
        writenewsounddb(newfilename,newfilepath,filepath,filename);
        sourcefilename=newfilename;
        sourcefilepath=newfilepath;     
	end
    
    readwebsoundratings(sourcefilepath,sourcefilename,filepath,filename);
	ok
  
end

return