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); infoIni.parse(infoFile);
// read length scope, only possible if track number known because the track number is used for mapping // read length scope, only possible if track number known because the track number is used for mapping
if(m_watcher.trackNumber()) { if(m_watcher.trackNumber()) {
try { for(auto &scope : infoIni.data()) {
const auto &lengthScope = infoIni.data().at("length"); if(scope.first == "length") {
for(const auto &entry : lengthScope) { for(const auto &entry : scope.second) {
try { try {
if(stringToNumber<unsigned int>(entry.first) == m_watcher.trackNumber()) { if(stringToNumber<unsigned int>(entry.first) == m_watcher.trackNumber()) {
// length entry for this track // length entry for this track
length = QString::fromLocal8Bit(entry.second.data()); length = QString::fromLocal8Bit(entry.second.data());
break; 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 &) { } catch(const ios_base::failure &) {

View File

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