Fix server information window
[gmpc.git] / test / DiscoGS / test.c
blobbf99a49873945e7fd3a26bff36ebad2aae30d481
1 #include <glib.h>
2 #include <gtk/gtk.h>
3 #include "plugin.h"
5 extern gmpcPlugin discogs_plugin;
6 typedef gpointer _config_obj;
7 config_obj *config = NULL;
8 GmpcMetaWatcher *gmw = NULL;
9 MpdObj *connection = NULL;
10 void pixbuf_cache_invalidate_pixbuf_entry(const gchar *url)
14 void show_error_message(void)
18 void gmpc_meta_watcher_data_changed (GmpcMetaWatcher * self, mpd_Song * song, MetaDataType type, MetaDataResult result, MetaData * met)
21 gboolean
22 gmpc_meta_watcher_match_data (MetaDataType type, mpd_Song * song1, mpd_Song * song2)
24 return TRUE;
26 void playlist3_show_error_message(const char *message, int el)
30 /**
31 * Dummy config system
33 int cfg_get_single_value_as_int_with_default(config_obj *config, const gchar *a, const gchar *b, int def)
35 return def;
37 char * cfg_get_single_value_as_string_with_default(config_obj *config, const gchar *a, const gchar *b, const gchar* def)
39 return g_strdup(def);
41 char *cfg_get_single_value_as_string(config_obj *config, const gchar *a, const gchar *b)
43 return NULL;
45 void cfg_set_single_value_as_string(config_obj *config, const gchar *a, const gchar *b, const gchar *def)
49 void cfg_set_single_value_as_int(config_obj * cfg, const char *class,
50 const char *key, int value)
54 static int queries = 4;
55 void callback(GList *list, gpointer data)
57 GMainLoop *lop = (GMainLoop *)data;
58 printf("got result\n");
59 if(list)
61 GList *iter;
62 for(iter = g_list_first(list); iter != NULL; iter = g_list_next(iter))
64 MetaData *m = iter->data;
65 if(meta_data_is_uri(m))
67 const char *uri = meta_data_get_uri(m);
68 printf("uri: %s\n", uri);
71 g_list_foreach(list, meta_data_free, NULL);
72 g_list_free(list);
74 queries--;
75 printf("done\n");
76 if(queries ==0) {
77 g_idle_add(g_main_loop_quit,lop);
81 int main (int argc, char **argv)
83 GMainLoop *l = NULL;
84 g_type_init_with_debug_flags(G_TYPE_DEBUG_MASK);
85 if(!g_thread_supported())
86 g_thread_init(NULL);
87 l = g_main_loop_new(NULL, TRUE);
89 mpd_Song *song = mpd_newSong();
90 song->artist = g_strdup("Eric Clapton");
91 song->album = g_strdup("Unplugged");
92 discogs_plugin.metadata->get_metadata(song, META_ALBUM_ART, callback, l);
93 discogs_plugin.metadata->get_metadata(song, META_ARTIST_ART, callback, l);
94 mpd_freeSong(song);
95 song = mpd_newSong();
96 song->artist = g_strdup("Appnottoaf");
97 song->album = g_strdup("grabba");
98 discogs_plugin.metadata->get_metadata(song, META_ALBUM_ART, callback, l);
99 discogs_plugin.metadata->get_metadata(song, META_ARTIST_ART, callback, l);
100 mpd_freeSong(song);
102 g_main_loop_run(l);
103 gmpc_easy_async_quit();
104 g_main_loop_unref(l);
105 xmlCleanupParser();
106 return EXIT_SUCCESS;