branches/gmyth-0.1b/tests/gmyth_test_epg.c
author morphbr
Sat Feb 10 20:01:54 2007 +0000 (2007-02-10)
branchtrunk
changeset 349 7005e696052c
permissions -rw-r--r--
[svn r351] - Bug fix in gmyth_util.c: included support for time without seconds in gmyth_util_string_to_time_val_fmt (XML format from backend)
- Bug fix in gmyth_http.c: fixed bug when there are no channels
- gmyth_vlc.c/h: included support to specify a port when connecting to VLC
- tests: fixed vlc test file regarding the fix above
created script to compile http test app
     1 
     2 #include "gmyth_backendinfo.h"
     3 #include "gmyth_epg.h"
     4 
     5 static gboolean
     6 test_epg_connection (GMythBackendInfo *backend_info)
     7 {
     8     GMythEPG *epg = gmyth_epg_new ();
     9     gboolean res = FALSE;
    10 
    11     res = gmyth_epg_connect (epg, backend_info);
    12 
    13     gmyth_epg_disconnect (epg);
    14     g_object_unref (epg);
    15 
    16     return res; 
    17 }
    18 
    19 
    20 static gboolean
    21 test_epg_get_channels (GMythBackendInfo *backend_info)
    22 {
    23     GMythEPG *epg = gmyth_epg_new ();
    24     GList *clist;
    25     gint i, length;
    26 
    27     if (!gmyth_epg_connect (epg, backend_info)) {
    28         return FALSE;
    29     }
    30 
    31     length = gmyth_epg_get_channel_list (epg, &clist);
    32     g_print ("==== %d channels found in the EPG ====\n", length);
    33     for (i=0; i<length; i++) {
    34         GMythChannelInfo *channel_info = (GMythChannelInfo*) g_list_nth_data (clist, i);
    35 
    36         gmyth_channel_info_print(channel_info);
    37     }
    38 
    39     g_list_free (clist);
    40     gmyth_epg_disconnect (epg);
    41     g_object_unref (epg);
    42 }
    43 
    44 int
    45 main (int args, const char **argv)
    46 {
    47     const char* uri = argv[1];
    48 
    49     GMythBackendInfo *backend_info;
    50     g_type_init ();
    51     g_thread_init (NULL);
    52 
    53     backend_info = gmyth_backend_info_new_with_uri (argv[1]);
    54 
    55     test_epg_connection (backend_info);
    56     test_epg_get_channels (backend_info);
    57 
    58     return 0;
    59 }
    60