# HG changeset patch # User ali@juiblex.co.uk # Date 1260745357 0 # Node ID 70e24f6fea25913ec7141d1c1af23a0ad5d50be9 # Parent 0399d9ea8b7b3f748b2b8b7cd919636c4ff25953 Better messages in gmyth-ls diff -r 0399d9ea8b7b -r 70e24f6fea25 gmyth/samples/gmyth_ls.c --- a/gmyth/samples/gmyth_ls.c Sun Dec 13 22:42:34 2009 +0000 +++ b/gmyth/samples/gmyth_ls.c Sun Dec 13 23:02:37 2009 +0000 @@ -118,7 +118,8 @@ GMythScheduler *scheduler; GList *list, *iter; - gint res = 0; + gint res = 0, + count = 0; g_return_val_if_fail(options != NULL, FALSE); g_return_val_if_fail(options->b_info != NULL, FALSE); @@ -128,26 +129,19 @@ if (gmyth_scheduler_connect_with_timeout(scheduler, options->b_info, 10) == FALSE) { - g_warning("Could not connect to backend db"); + g_print("Could not connect to database server.\n"); g_object_unref(scheduler); return FALSE; } res = gmyth_scheduler_get_recorded_list(scheduler, &list); - if (res < 0) { - gmyth_scheduler_disconnect(scheduler); - g_object_unref(scheduler); - g_warning("Could not retrieve recorded list"); - return FALSE; - } gmyth_scheduler_disconnect(scheduler); + g_object_unref(scheduler); - if (res == 0) { - g_print("None file was found in the backend.\n"); - gmyth_scheduler_disconnect(scheduler); - g_object_unref(scheduler); - return TRUE; + if (res < 0) { + g_print("Could not retrieve list of recorded programs.\n"); + return FALSE; } iter = list; @@ -156,17 +150,18 @@ if (gmyth_util_file_exists (options->b_info, recorded_info->basename->str)) { + count++; g_print("%s\n", recorded_info->basename->str); } gmyth_recorded_info_free(recorded_info); iter = g_list_next(iter); } + if (!count) + g_print("No recorded programs.\n"); + g_list_free(list); - gmyth_scheduler_disconnect(scheduler); - g_object_unref(scheduler); - return TRUE; }