1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/branches/gmyth-0.1b/tests/gmyth_test_recordings.c Wed Feb 07 20:39:10 2007 +0000
1.3 @@ -0,0 +1,59 @@
1.4 +#include <glib-object.h>
1.5 +
1.6 +#include "gmyth_uri.h"
1.7 +#include "gmyth_backendinfo.h"
1.8 +#include "gmyth_scheduler.h"
1.9 +#include "gmyth_epg.h"
1.10 +#include "gmyth_common.h"
1.11 +
1.12 +static gboolean
1.13 +test_recording_list (GMythBackendInfo *backend_info)
1.14 +{
1.15 + GList *list = NULL;
1.16 + gint length = 0;
1.17 + GMythScheduler *scheduler = gmyth_scheduler_new ();
1.18 +
1.19 + if (gmyth_scheduler_connect_with_timeout (scheduler,
1.20 + backend_info, 10) == TRUE) {
1.21 + g_debug ("===== Scheduler connection success =====");
1.22 + } else {
1.23 + g_debug ("===== Scheduler connection failed =====");
1.24 + return FALSE;
1.25 + }
1.26 +
1.27 + length = gmyth_scheduler_get_recorded_list (scheduler, &list);
1.28 +
1.29 + g_debug ("===== %d Recordings found =====\n", length);
1.30 + length--;
1.31 + while (length >= 0) {
1.32 + RecordedInfo *record = (RecordedInfo*) g_list_nth_data (list, length);
1.33 + if (record == 0) {
1.34 + g_debug ("===== Recorded list returned NULL pointer =====\n");
1.35 + length--;
1.36 + continue;
1.37 + }
1.38 + g_debug ("===== Record id = %d =====\n", record->record_id);
1.39 + g_debug ("===== Record name = %s =====\n", (record ? record->basename->str : "NULL"));
1.40 + length--;
1.41 + }
1.42 +
1.43 + gmyth_scheduler_disconnect (scheduler);
1.44 +
1.45 +}
1.46 +
1.47 +int
1.48 +main (int args, const char **argv)
1.49 +{
1.50 + const char* uri = argv[1];
1.51 +
1.52 + GMythBackendInfo *backend_info;
1.53 + g_type_init ();
1.54 +
1.55 + backend_info = gmyth_backend_info_new_with_uri (argv[1]);
1.56 +
1.57 + test_recording_list (backend_info);
1.58 +}
1.59 +
1.60 +
1.61 +
1.62 +