diff -r 000000000000 -r 6d7b5baf170b branches/gmyth-0.1b/tests/gmyth_test_recordings.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/branches/gmyth-0.1b/tests/gmyth_test_recordings.c Wed Feb 14 22:24:39 2007 +0000 @@ -0,0 +1,59 @@ +#include + +#include "gmyth_uri.h" +#include "gmyth_backendinfo.h" +#include "gmyth_scheduler.h" +#include "gmyth_epg.h" +#include "gmyth_common.h" + +static gboolean +test_recording_list (GMythBackendInfo *backend_info) +{ + GList *list = NULL; + gint length = 0; + GMythScheduler *scheduler = gmyth_scheduler_new (); + + if (gmyth_scheduler_connect_with_timeout (scheduler, + backend_info, 10) == TRUE) { + g_debug ("===== Scheduler connection success ====="); + } else { + g_debug ("===== Scheduler connection failed ====="); + return FALSE; + } + + length = gmyth_scheduler_get_recorded_list (scheduler, &list); + + g_debug ("===== %d Recordings found =====\n", length); + length--; + while (length >= 0) { + RecordedInfo *record = (RecordedInfo*) g_list_nth_data (list, length); + if (record == 0) { + g_debug ("===== Recorded list returned NULL pointer =====\n"); + length--; + continue; + } + g_debug ("===== Record id = %d =====\n", record->record_id); + g_debug ("===== Record name = %s =====\n", (record ? record->basename->str : "NULL")); + length--; + } + + gmyth_scheduler_disconnect (scheduler); + +} + +int +main (int args, const char **argv) +{ + const char* uri = argv[1]; + + GMythBackendInfo *backend_info; + g_type_init (); + + backend_info = gmyth_backend_info_new_with_uri (argv[1]); + + test_recording_list (backend_info); +} + + + +