Skip to content

Commit e64ea39

Browse files
committed
Checking sizes
1 parent 320e41e commit e64ea39

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/lib/api/api.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,20 @@ export class SongAPI {
179179

180180
return search.recordings[0];
181181
}
182-
182+
183183
private async querySongCoverArt(song: MBRecordingSearchResult): Promise<string | undefined> {
184184
for(let i = 0; i < song.releases.length && i < 5; i++) {
185185
const rel = song.releases[i];
186+
const sizes = ["-small", "-250", "-500", ""]
186187

187188
try {
188-
const url = `${COVERARCH}/release/${rel.id}/front`;
189-
const image = await this.httpGet(url);
189+
for(const size of sizes) {
190+
const url = `${COVERARCH}/release/${rel.id}/front${size}`;
191+
const image = await this.httpGet(url);
190192

191-
if(image.ok)
192-
return url;
193+
if(image.ok)
194+
return url;
195+
}
193196
} catch {
194197

195198
}

0 commit comments

Comments
 (0)