/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SongLength.h" #include "wrapper/SidTuneMod.h" #include "wrapper/SidTuneWrapper.h" SongLengthFile SongLength::db; bool SongLength::initStatus = false; bool SongLength::init( const char* fileName ) { initStatus = db.init( fileName ); return initStatus; } bool SongLength::getItem( SidTuneWrapper* pSidLoader, int song, SongLengthDBitem& item ) { QString digest = pSidLoader->getMD5_Digest(); return db.getSongLength( digest, song, item ); } bool SongLength::getItem( const char* fileName, int song, SongLengthDBitem& item ) { bool success = false; try { SidTuneWrapper* pSidLoader = new SidTuneWrapper; if ( pSidLoader->open( fileName ) ) { QString digest = pSidLoader->getMD5_Digest(); success = db.getSongLength( digest, song, item ); } delete pSidLoader; } catch (...) { } return success; } bool SongLength::isAvailable() { return initStatus; } const char* SongLength::getErrorStr() { return db.getErrorStr(); } bool SongLength::getStatus() { return db.getStatus(); }