Пример #1
0
    void
  Cache::store(const CDInfo& info)
  {
    Config c;
    c.readConfig();

    QString cacheDir = c.cacheLocations().first();
    QDir d(cacheDir);
    if (!d.exists())
      d.mkdir(cacheDir);

    // The same entry can contain several discids (separated by a ','),
    // so we save the entry to all of them
    QStringList discids = QStringList::split(',', info.id);
    for (QStringList::Iterator it = discids.begin(); it != discids.end(); ++it)
    {
      QString cacheFile = fileName(info.category, *it, cacheDir);

      kdDebug(60010) << "Storing " << cacheFile << " in CDDB cache" << endl;

      QFile f(cacheFile);
      if ( f.open(IO_WriteOnly) )
      {
        QTextStream ts(&f);
        ts.setEncoding(QTextStream::UnicodeUTF8);
        ts << info.toString();
        f.close();
      }
    }
  }
Пример #2
0
  void Submit::makeDiskData( const CDInfo& cdInfo, const TrackOffsetList& offsetList )
  {
    unsigned numTracks = cdInfo.trackInfoList.count();

    diskData_ += "# xmcd\n";
    diskData_ += "#\n";
    diskData_ += "# Track frame offsets:\n";

    for (uint i=0; i < numTracks; i++)
      diskData_ += QString("#\t%1\n").arg(offsetList[i]);

    int l = offsetList[numTracks+1]/75;
    diskData_ += QString("# Disc length: %1 seconds\n").arg(l);

    diskData_ += cdInfo.toString(true);

    kdDebug(60010) << "diskData_ == " << diskData_ << endl;
  }