comparison runner/main.cpp @ 117:5be4995f4029

Tests (and minor resulting fixes) for remote file download
author Chris Cannam
date Wed, 08 Oct 2014 13:14:39 +0100
parents 1c0799754670
children dcecd6997214
comparison
equal deleted inserted replaced
116:1c0799754670 117:5be4995f4029
352 QStringList 352 QStringList
353 expandPlaylists(QStringList sources) 353 expandPlaylists(QStringList sources)
354 { 354 {
355 QStringList expanded; 355 QStringList expanded;
356 foreach (QString path, sources) { 356 foreach (QString path, sources) {
357 cerr << "expandPlaylists: looking at " << path << endl;
358 if (QFileInfo(path).suffix().toLower() == "m3u") { 357 if (QFileInfo(path).suffix().toLower() == "m3u") {
359 ProgressPrinter retrievalProgress("Opening playlist file..."); 358 ProgressPrinter retrievalProgress("Opening playlist file...");
360 FileSource source(path, &retrievalProgress); 359 FileSource source(path, &retrievalProgress);
361 if (!source.isAvailable()) { 360 if (!source.isAvailable()) {
362 cerr << "ERROR: File or URL \"" << path.toStdString() 361 // Don't fail or throw an exception here, just keep
363 << "\" could not be located" << endl; 362 // the file in the list -- it will be tested again
364 throw FileNotFound(path); 363 // when adding it as a source and that's the proper
364 // time to fail. All we're concluding here is that it
365 // isn't a valid playlist
366 expanded.push_back(path);
367 continue;
365 } 368 }
366 source.waitForData(); 369 source.waitForData();
367 PlaylistFileReader reader(source); 370 PlaylistFileReader reader(source);
368 if (reader.isOK()) { 371 if (reader.isOK()) {
369 vector<QString> files = reader.load(); 372 vector<QString> files = reader.load();
726 } 729 }
727 } 730 }
728 } 731 }
729 732
730 sources = expandPlaylists(sources); 733 sources = expandPlaylists(sources);
731 734
732 bool good = true; 735 bool good = true;
733 QSet<QString> badSources; 736 QSet<QString> badSources;
734 737
735 for (QStringList::const_iterator i = sources.begin(); 738 for (QStringList::const_iterator i = sources.begin();
736 i != sources.end(); ++i) { 739 i != sources.end(); ++i) {