All pastes #988286 Raw Edit

Zeug

public text v1 · immutable
#988286 ·published 2008-04-17 13:20 UTC
rendered paste body
bool CollectionManager::setupCollection( QString collectionPath )
{
  QDir collection( collectionPath );
  QString entry;
  QDirIterator it(collection, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks );

[...]

    QTextStream out( &database );
    QDataStream indexstream( &index );

    while( it.hasNext() ) {
      entry = it.next();
      //entry = it.filePath();
      //qDebug()<<entry;
      if( it.fileInfo().isFile() && ( entry.endsWith( ".mp3", Qt::CaseInsensitive ) || entry.endsWith( ".ogg", Qt::CaseInsensitive ) ) ) {
        indexstream << database.pos(); // expensive?
        //qDebug() << database.pos();
        out << it.filePath();
        out << "\n";
        out.flush();
        songcount++;
      }
    }
    qDebug() << "I found" << songcount << "songs in the collection.";
    // TODO 0.0.1: tests show that songs with umlauts are missing
    indexstream << songcount;
  }

[...]