core/tags/album: Immediately retry query on 503 error
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
2ea5104d42
commit
b4218833c5
|
@ -89,12 +89,15 @@ static void __album_query_releaseid(struct album *album, Mb5Query *mb5)
|
||||||
else
|
else
|
||||||
param = g_strdup_printf("release:\"%s\"", album->al_name);
|
param = g_strdup_printf("release:\"%s\"", album->al_name);
|
||||||
|
|
||||||
metadata = mb5_query_query(mb5, "release", "", "", 1, &query, ¶m);
|
do {
|
||||||
result = mb5_query_get_lastresult(mb5);
|
metadata = mb5_query_query(mb5, "release", "", "", 1, &query,
|
||||||
if (result != 0) {
|
¶m);
|
||||||
mb5_query_get_lasterrormessage(mb5, error, sizeof(error));
|
result = mb5_query_get_lastresult(mb5);
|
||||||
g_printf("MusicBrainz: %s\n", error);
|
if (result != 0) {
|
||||||
}
|
mb5_query_get_lasterrormessage(mb5, error, sizeof(error));
|
||||||
|
g_printf("MusicBrainz: %s\n", error);
|
||||||
|
}
|
||||||
|
} while (result == 503);
|
||||||
|
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
__album_foreach_fetch(album, metadata);
|
__album_foreach_fetch(album, metadata);
|
||||||
|
@ -107,20 +110,17 @@ static void __album_query_releaseid(struct album *album, Mb5Query *mb5)
|
||||||
static bool __album_fetch_artwork(struct album *album)
|
static bool __album_fetch_artwork(struct album *album)
|
||||||
{
|
{
|
||||||
Mb5Query *mb5;
|
Mb5Query *mb5;
|
||||||
bool ret;
|
|
||||||
|
|
||||||
if (album_artwork_exists(album))
|
if (album_artwork_exists(album))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
mb5 = mb5_query_new(OCARINA_NAME, NULL, 0);
|
mb5 = mb5_query_new(OCARINA_NAME, NULL, 0);
|
||||||
if (!mb5)
|
if (!mb5)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
__album_query_releaseid(album, mb5);
|
__album_query_releaseid(album, mb5);
|
||||||
|
|
||||||
ret = mb5_query_get_lasthttpcode(mb5) != 503;
|
|
||||||
mb5_query_delete(mb5);
|
mb5_query_delete(mb5);
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *__album_key(const gchar *name, unsigned int year)
|
static gchar *__album_key(const gchar *name, unsigned int year)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user