core/tags/album: Immediately retry query on 503 error

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-07-04 20:52:09 -04:00
parent 2ea5104d42
commit b4218833c5
1 changed files with 11 additions and 11 deletions

View File

@ -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, &param); do {
metadata = mb5_query_query(mb5, "release", "", "", 1, &query,
&param);
result = mb5_query_get_lastresult(mb5); result = mb5_query_get_lastresult(mb5);
if (result != 0) { if (result != 0) {
mb5_query_get_lasterrormessage(mb5, error, sizeof(error)); mb5_query_get_lasterrormessage(mb5, error, sizeof(error));
g_printf("MusicBrainz: %s\n", 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)