16#include "config-musicbrainz.h"
17#ifdef HAVE_MUSICBRAINZ5
18#include "musicbrainz/musicbrainzlookup.h"
28 Cache::lookup(
const TrackOffsetList &offsetList,
const Config& c )
30 QString cddbId = CDDB::trackOffsetListToId(offsetList);
32 qCDebug(LIBKCDDB) <<
"Looking up " << cddbId <<
" in CDDB cache";
36 infoList << CDDB::cacheFiles(offsetList, c);
37#ifdef HAVE_MUSICBRAINZ5
38 infoList << MusicBrainzLookup::cacheFiles(offsetList, c);
45 Cache::store(
const TrackOffsetList& offsetList,
const CDInfoList& list,
const Config& c)
47 for (
const CDInfo &info : list) {
48 store(offsetList, info, c);
53 Cache::store(
const TrackOffsetList& offsetList,
const CDInfo& info,
const Config& c)
61 if (discids.
count() > 2)
63 for (
const QString &newid : discids) {
64 CDInfo newInfo = info;
66 store(offsetList, newInfo, c);
75 CDInfo newInfo = info;
90 qCWarning(LIBKCDDB) <<
"Unknown source " << source <<
" for CDInfo";
93 QString id = CDDB::trackOffsetListToId(offsetList);
98 const QStringList cacheLocations = c.cacheLocations();
100 if (!cacheLocations.
isEmpty()) {
101 cacheDir = cacheLocations.
first() + cacheDir;
105 if (!
dir.exists(cacheDir))
107 if (!
dir.mkpath(cacheDir))
109 qCWarning(LIBKCDDB) <<
"Couldn't create cache directory " << cacheDir;
114 qCDebug(LIBKCDDB) <<
"Storing " << cacheFile <<
" in CDDB cache";
120#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
121 ts.setCodec(
"UTF-8");
123 ts << newInfo.toString();
127 qDebug() <<
"There's no cache dir defined, not storing it";
KIOCORE_EXPORT QString dir(const QString &fileClass)
qsizetype count() const const
bool isEmpty() const const
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:56:20 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.