Exemple #1
0
GlyrFetcherInfo * get_plugin_info(void)
{
    GlyrFetcherInfo * head = NULL;
    GlyrFetcherInfo * prev_fetcher = NULL;
    for(GList * elem0 = r_getFList(); elem0; elem0 = elem0->next)
    {
        MetaDataFetcher * fetch = elem0->data;
        GlyrFetcherInfo  * finfo = g_malloc0(sizeof(GlyrFetcherInfo));

        GlyrSourceInfo * prev_source = NULL;
        for(GList * elem1 = r_getSList(); elem1; elem1 = elem1->next)
        {
            MetaDataSource * source = elem1->data;
            if(source && source->type == fetch->type)
            {
                GlyrSourceInfo  * sinfos = g_malloc0(sizeof(GlyrSourceInfo));

                sinfos->quality = source->quality;
                sinfos->speed   = source->speed;
                sinfos->key     = source->key;
                sinfos->type    = source->type;
                sinfos->lang_aware = source->lang_aware;
                sinfos->name    = g_strdup(source->name);

                if(prev_source != NULL)
                {
                    prev_source->next = sinfos;
                    sinfos->prev = prev_source;
                }
                else
                {
                    finfo->head = sinfos;
                }
                prev_source = sinfos;
            }
        }

        if(prev_fetcher != NULL)
        {
            prev_fetcher->next = finfo;
            finfo->prev = prev_fetcher;
        }
        else
        {
            head = finfo;
        }

        prev_fetcher = finfo;

        finfo->name = g_strdup(fetch->name);
        finfo->type = fetch->type;
	finfo->reqs = fetch->reqs;
    }
    return head;
}
Exemple #2
0
static GLYR_DATA_TYPE get_data_type_from_query(GlyrQuery *query)
{
    GLYR_DATA_TYPE type = GLYR_TYPE_UNKNOWN;
    for(GList *elem = r_getFList(); elem != NULL; elem = elem->next) {
        MetaDataFetcher *fetcher = elem->data;
        if(fetcher != NULL && fetcher->type == query->type) {
            type = fetcher->default_data_type;
            break;
        }
    }
    return type;
}