adjustments due to changed API

This commit is contained in:
Martchus 2015-09-22 15:41:18 +02:00
parent b911784d28
commit f74be38936
2 changed files with 16 additions and 14 deletions

View File

@ -92,21 +92,20 @@ void FfmpegLauncher::nextSong()
infoIni.parse(infoFile);
// read length scope, only possible if track number known because the track number is used for mapping
if(m_watcher.trackNumber()) {
try {
const auto &lengthScope = infoIni.data().at("length");
for(const auto &entry : lengthScope) {
try {
if(stringToNumber<unsigned int>(entry.first) == m_watcher.trackNumber()) {
// length entry for this track
length = QString::fromLocal8Bit(entry.second.data());
break;
for(auto &scope : infoIni.data()) {
if(scope.first == "length") {
for(const auto &entry : scope.second) {
try {
if(stringToNumber<unsigned int>(entry.first) == m_watcher.trackNumber()) {
// length entry for this track
length = QString::fromLocal8Bit(entry.second.data());
break;
}
} catch( const ConversionException &) {
cerr << "Warning: Ignoring non-numeric key \"" << entry.first << "\" in info.ini." << endl;
}
} catch( const ConversionException &) {
cerr << "Warning: Ignoring non-numeric key \"" << entry.first << "\" in info.ini." << endl;
}
}
} catch(const out_of_range &) {
// no length for the current track specified
}
}
} catch(const ios_base::failure &) {

View File

@ -52,7 +52,7 @@ int main(int argc, char *argv[])
parser.parseArgs(argc, argv);
} catch (const Failure &e) {
cerr << "Unable to parse arguments: " << e.what() << endl;
return 2;
return 1;
}
try {
if(recordArg.isPresent()) {
@ -80,9 +80,12 @@ int main(int argc, char *argv[])
}
// enter app loop
return app.exec();
} else {
cerr << "No operation specified." << endl;
return 2;
}
} catch(const runtime_error &e) {
cerr << "Fatal error: " << e.what() << endl;
return 3;
}
}