Beispiel #1
0
static GList * guitartabs_chordie_parse (cb_object * capo)
{
    GList * result_list = NULL;
    gchar * search_begin = strstr (capo->cache->data,RESULTS_BEGIN);
    if (search_begin != NULL)
    {
        gchar * search_ending = strstr (search_begin,RESULTS_ENDIN);
        if (search_ending != NULL)
        {
            gchar * node  = search_begin;
            gsize nodelen = (sizeof NODE) - 1;
            while (continue_search (g_list_length (result_list),capo->s) && (node = strstr (node + nodelen, NODE) ) != NULL && node >= search_begin && node <= search_ending)
            {
                gchar * url = get_search_value (node,NODE,"\" ");
                if (url != NULL)
                {
                    gchar * name_value = get_search_value (node,"\">","</a>");
                    if (check_title_value (capo->s, name_value) == TRUE)
                    {
                        gchar * content_url = g_strdup_printf ("%s%s",BASE_URL,url);
                        GlyrMemCache * result = parse_result_page (capo->s,content_url);
                        if (result != NULL)
                        {
                            result_list = g_list_prepend (result_list,result);
                        }
                        g_free (content_url);
                    }
                    g_free (name_value);
                    g_free (url);
                }
            }
        }
    }
    return result_list;
}
Beispiel #2
0
static GList * lyrics_lyricswiki_parse(cb_object * capo)
{
    GList * result_list = NULL;
    if(strstr(capo->cache->data,NOT_FOUND) == NULL && lv_cmp_content(strstr(capo->cache->data,"<artist>"),strstr(capo->cache->data,"<song>"),capo))
    {
        gchar * wiki_page_url = get_search_value(capo->cache->data,"<url>","</url>");
        if(wiki_page_url != NULL)
        {
            GlyrMemCache * new_cache = download_single(wiki_page_url,capo->s,NULL);
            if(new_cache != NULL)
            {
                result_list = parse_result_page(capo->s,new_cache);
                DL_free(new_cache);
            }
            g_free(wiki_page_url);
        }
    }
    return result_list;
}