# HG changeset patch # User melunko # Date 1176322844 -3600 # Node ID c65fa0ad8e5afe457b7d30695c63ff357c241ce5 # Parent d616e308f6b6de105b6979de3fd02d1e27b8eff1 [svn r531] Some fixes in the scheduling diff -r d616e308f6b6 -r c65fa0ad8e5a gmyth/src/gmyth_query.c --- a/gmyth/src/gmyth_query.c Wed Apr 11 19:34:21 2007 +0100 +++ b/gmyth/src/gmyth_query.c Wed Apr 11 21:20:44 2007 +0100 @@ -214,8 +214,6 @@ MYSQL_RES* gmyth_query_process_statement (GMythQuery *gmyth_query, char *stmt_str) { - MYSQL_RES *res_set; - assert(gmyth_query); gmyth_debug ("[%s] Running mysql query %s", __FUNCTION__, stmt_str); @@ -230,15 +228,7 @@ } /* the statement succeeded; determine whether it returned data */ - res_set = mysql_store_result (gmyth_query->conn); - if (res_set) { - return res_set; - } else if (mysql_field_count (gmyth_query->conn) == 0) { - gmyth_debug ("%lu rows affected\n", - (unsigned long) mysql_affected_rows (gmyth_query->conn)); - } else { - gmyth_query_print_error (gmyth_query->conn, "Could not retrieve result set"); - } - - return NULL; + return mysql_store_result (gmyth_query->conn); } + + diff -r d616e308f6b6 -r c65fa0ad8e5a gmyth/src/gmyth_query.h --- a/gmyth/src/gmyth_query.h Wed Apr 11 19:34:21 2007 +0100 +++ b/gmyth/src/gmyth_query.h Wed Apr 11 21:20:44 2007 +0100 @@ -77,8 +77,8 @@ gboolean gmyth_query_connect (GMythQuery *gmyth_query, GMythBackendInfo *backend_info); gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query, - GMythBackendInfo *backend_info, - guint timeout); + GMythBackendInfo *backend_info, + guint timeout); gboolean gmyth_query_disconnect (GMythQuery *gmyth_query); G_END_DECLS diff -r d616e308f6b6 -r c65fa0ad8e5a gmyth/src/gmyth_scheduler.c --- a/gmyth/src/gmyth_scheduler.c Wed Apr 11 19:34:21 2007 +0100 +++ b/gmyth/src/gmyth_scheduler.c Wed Apr 11 21:20:44 2007 +0100 @@ -259,7 +259,6 @@ mysql_free_result (msql_res); g_string_free(query_str, TRUE); - g_free(date_time); return (*schedule_list == NULL) ? 0 : g_list_length (*schedule_list); } @@ -368,13 +367,14 @@ "1, %d, \"%s\", %d, " //autocommflag, findday, findtime, findid "5, 0, 29, 1, " //search, autotranscode, transcoder, tsdefault "0, 0, 0, 0 );", //autouserjob1, autouserjob2, autouserjob3, autouserjob4 - schedule_info->record_id, schedule_info->channel_id, - gmyth_util_time_to_string_only_time( schedule_info->start_time ), - gmyth_util_time_to_string_only_date( schedule_info->start_time ), - gmyth_util_time_to_string_only_date( schedule_info->start_time ), - gmyth_util_time_to_string_only_date( schedule_info->end_time ), - schedule_info->title->str, //title - schedule_info->channel_id,//station + schedule_info->record_id, /* record id */ + schedule_info->channel_id, /* channel id */ + gmyth_util_time_to_string_only_time( schedule_info->start_time ), /* start time */ + gmyth_util_time_to_string_only_date( schedule_info->start_time ), /* start date */ + gmyth_util_time_to_string_only_time( schedule_info->end_time ), /* end time */ + gmyth_util_time_to_string_only_date( schedule_info->end_time ), /* end date */ + schedule_info->title->str, /* title */ + schedule_info->channel_id,/* station */ (gmyth_util_time_val_to_date( schedule_info->start_time ))->tm_wday, //findday gmyth_util_time_to_string_only_time( schedule_info->start_time ), //findtime (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528)//findid @@ -430,11 +430,6 @@ msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str); - if (msql_res == NULL) { - g_warning ("[%s] Error while trying to delete a schedule in the database", __FUNCTION__); - return FALSE; - } - update_backend(scheduler, record_id);// Notify the backend of the changes mysql_free_result (msql_res); @@ -468,6 +463,8 @@ g_string_printf (query_str, "DELETE FROM recorded WHERE recordid=%d", record_id); + // FIXME: Mythtv implementation runs also: DELETE FROM oldfind WHERE recordid = x + msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str); update_backend(scheduler, record_id);// Notify the backend of the changes @@ -616,8 +613,8 @@ gmyth_string_list_append_string (strlist, datastr); socket = gmyth_socket_new (); - if (gmyth_socket_connect (socket, scheduler->backend_info->hostname, - scheduler->backend_info->port)) { + if (gmyth_socket_connect_to_backend (socket, scheduler->backend_info->hostname, + scheduler->backend_info->port, TRUE)) { gmyth_socket_sendreceive_stringlist (socket, strlist); } else { g_warning ("[%s] Connection to backend failed!", __FUNCTION__);