94 d->cdInfoList.clear();
95 d->trackOffsetList = trackOffsetList;
97 if ( trackOffsetList.
count() <= 1 )
99 qCDebug(LIBKCDDB) <<
"Lookup called with empty offset list";
100 return NoRecordFound;
103 if ( d->config.cacheLookupEnabled() )
105 d->cdInfoList = Cache::lookup( trackOffsetList, config() );
107 qCDebug(LIBKCDDB) <<
"Found " << d->cdInfoList.count() <<
" hit(s)";
109 if ( !d->cdInfoList.isEmpty() )
111 if ( !blockingMode() )
118 Result r = NoRecordFound;
121 delete d->cdInfoLookup;
122 d->cdInfoLookup =
nullptr;
123 qDeleteAll(d->pendingLookups);
124 d->pendingLookups.clear();
126 if ( blockingMode() )
128#ifdef HAVE_MUSICBRAINZ5
129 if ( d->config.musicBrainzLookupEnabled() )
131 d->cdInfoLookup =
new MusicBrainzLookup();
133 r = d->cdInfoLookup->lookup( d->config.hostname(),
134 d->config.port(), trackOffsetList );
138 d->cdInfoList = d->cdInfoLookup->lookupResponse();
139 Cache::store( d->trackOffsetList, d->cdInfoList, config() );
144 delete d->cdInfoLookup;
145 d->cdInfoLookup =
nullptr;
149 if ( d->config.freedbLookupEnabled() )
151 Lookup::Transport t = ( Lookup::Transport )d->config.freedbLookupTransport();
152 if( Lookup::CDDBP == t )
153 d->cdInfoLookup =
new SyncCDDBPLookup();
155 d->cdInfoLookup =
new SyncHTTPLookup();
157 r = d->cdInfoLookup->lookup( d->config.hostname(),
158 d->config.port(), trackOffsetList );
162 d->cdInfoList = d->cdInfoLookup->lookupResponse();
163 Cache::store( d->trackOffsetList, d->cdInfoList, config() );
168 delete d->cdInfoLookup;
169 d->cdInfoLookup =
nullptr;
176#ifdef HAVE_MUSICBRAINZ5
177 if ( d->config.musicBrainzLookupEnabled() )
179 AsyncMusicBrainzLookup*
lookup =
new AsyncMusicBrainzLookup();
183 d->pendingLookups.append(
lookup );
187 if ( d->config.freedbLookupEnabled() )
189 Lookup::Transport t = ( Lookup::Transport )d->config.freedbLookupTransport();
191 if( Lookup::CDDBP == t )
193 AsyncCDDBPLookup*
lookup =
new AsyncCDDBPLookup();
197 d->pendingLookups.append(
lookup );
201 AsyncHTTPLookup*
lookup =
new AsyncHTTPLookup();
205 d->pendingLookups.append(
lookup );
209 return runPendingLookups();
216 if ( d->cdInfoLookup && Success == r )
218 d->cdInfoList = d->cdInfoLookup->lookupResponse();
219 Cache::store( d->trackOffsetList, d->cdInfoList, config() );
222 d->cdInfoList.clear();
224 if ( d->cdInfoLookup )
226 d->cdInfoLookup->deleteLater();
227 d->cdInfoLookup =
nullptr;
233 qDeleteAll( d->pendingLookups );
234 d->pendingLookups.clear();
260 for (
int i=0; i < offsetList.
count(); i++)
262 if(last >= offsetList[i])
264 last = offsetList[i];
270 delete d->cdInfoSubmit;
272 QString from = d->config.emailAddress();
274 QString hostname = d->config.httpSubmitServer();
275 uint port = d->config.httpSubmitPort();
277 if ( blockingMode() )
278 d->cdInfoSubmit =
new SyncHTTPSubmit(from, hostname, port);
281 d->cdInfoSubmit =
new AsyncHTTPSubmit(from, hostname, port);
282 connect(
static_cast<AsyncHTTPSubmit *
>( d->cdInfoSubmit ),
283 &AsyncHTTPSubmit::finished,
287 Result r = d->cdInfoSubmit->submit( cdInfo, offsetList );
289 if ( blockingMode() )
291 delete d->cdInfoSubmit;
292 d->cdInfoSubmit =
nullptr;