static GList *relations_generated_parse(cb_object *capo) { GList *result_list = NULL; GList *temple_list = NULL; if(capo->s->title && capo->s->album) { temple_list = g_list_prepend(temple_list, "Musicbrainz Recording:http://musicbrainz.org/search?query=\"${title}\"+AND+artist%3A\"${artist}\"+AND+release%3A\"${album}\"&type=recording&advanced=1"); } if(capo->s->album) { temple_list = g_list_prepend(temple_list, "Musicbrainz Album:http://musicbrainz.org/search?query=\"${album}\"+AND+artist%3A\"${artist}\"&type=release&advanced=1"); temple_list = g_list_prepend(temple_list, "Wikipedia Album:http://en.wikipedia.org/wiki/Special:Search/${album}(${artist})"); } temple_list = g_list_prepend(temple_list, "Musicbrainz Artist:http://musicbrainz.org/search?query=\"${artist}\"&type=artist"); temple_list = g_list_prepend(temple_list, "Wikipedia Artist:http://en.wikipedia.org/wiki/Special:Search/${artist}"); temple_list = g_list_prepend(temple_list, "Lastfm Page:http://last.fm/music/${artist}"); for(GList *elem = temple_list; elem; elem = elem->next) { gchar *result_url = prepare_url(elem->data, capo->s, TRUE); if(result_url != NULL) { GlyrMemCache *result = DL_init(); result->data = result_url; result->size = strlen(result_url); result->dsrc = g_strdup(OFFLINE_PROVIDER); result->prov = g_strdup("generated"); result->type = GLYR_TYPE_RELATION; update_md5sum(result); result_list = g_list_prepend(result_list, result); } } g_list_free(temple_list); return result_list; }
static GList * async_dl_callback(cb_object * capo, void * userptr, bool * stop_download, gint * add_item) { if(capo->cache != NULL && userptr != NULL) { /* Sanitize this */ struct callback_save_struct * saver = userptr; GHashTable * prov_url_table = saver->table; capo->cache->is_image = true; if(prov_url_table != NULL) { GlyrMemCache * old_cache = g_hash_table_lookup(prov_url_table,capo->cache->dsrc); GLYR_ERROR response = GLYRE_OK; if(old_cache != NULL) { update_md5sum(capo->cache); if(is_in_result_list(capo->cache,saver->results) == FALSE) { capo->cache->prov = (old_cache->prov!=NULL) ? g_strdup(old_cache->prov) : NULL; capo->cache->img_format = (old_cache->img_format) ? g_strdup(old_cache->img_format) : NULL; if(capo->cache->type == GLYR_TYPE_NOIDEA) { capo->cache->type = saver->type; } if(capo->s->callback.download != NULL) { response = capo->s->callback.download(capo->cache,capo->s); } *add_item = (response != GLYRE_SKIP && response != GLYRE_STOP_PRE); } else { capo->s->itemctr--; *add_item = FALSE; } } if(response == GLYRE_STOP_POST || response == GLYRE_STOP_PRE) { *stop_download = TRUE; } } else { glyr_message(-1,NULL,"glyr: Warn: Hashtable is empty im image_callback!\n"); } } return NULL; }