[svn r531] Some fixes in the scheduling trunk
authormelunko
Wed Apr 11 21:20:44 2007 +0100 (2007-04-11)
branchtrunk
changeset 526c65fa0ad8e5a
parent 525 d616e308f6b6
child 527 eebe6df8aa11
[svn r531] Some fixes in the scheduling
gmyth/src/gmyth_query.c
gmyth/src/gmyth_query.h
gmyth/src/gmyth_scheduler.c
     1.1 --- a/gmyth/src/gmyth_query.c	Wed Apr 11 19:34:21 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_query.c	Wed Apr 11 21:20:44 2007 +0100
     1.3 @@ -214,8 +214,6 @@
     1.4  MYSQL_RES*
     1.5  gmyth_query_process_statement (GMythQuery *gmyth_query, char *stmt_str)
     1.6  {
     1.7 -    MYSQL_RES *res_set;
     1.8 -    
     1.9      assert(gmyth_query);
    1.10      
    1.11      gmyth_debug ("[%s] Running mysql query %s", __FUNCTION__, stmt_str);
    1.12 @@ -230,15 +228,7 @@
    1.13      }
    1.14  
    1.15      /* the statement succeeded; determine whether it returned data */
    1.16 -    res_set = mysql_store_result (gmyth_query->conn);
    1.17 -    if (res_set) {
    1.18 -        return res_set;
    1.19 -    } else if (mysql_field_count (gmyth_query->conn) == 0) {
    1.20 -        gmyth_debug ("%lu rows affected\n",
    1.21 -                (unsigned long) mysql_affected_rows (gmyth_query->conn));
    1.22 -    } else {
    1.23 -        gmyth_query_print_error (gmyth_query->conn, "Could not retrieve result set");
    1.24 -    }
    1.25 -    
    1.26 -    return NULL;
    1.27 +    return mysql_store_result (gmyth_query->conn);
    1.28  }
    1.29 +
    1.30 +
     2.1 --- a/gmyth/src/gmyth_query.h	Wed Apr 11 19:34:21 2007 +0100
     2.2 +++ b/gmyth/src/gmyth_query.h	Wed Apr 11 21:20:44 2007 +0100
     2.3 @@ -77,8 +77,8 @@
     2.4  gboolean    gmyth_query_connect (GMythQuery *gmyth_query,
     2.5                                   GMythBackendInfo *backend_info);
     2.6  gboolean    gmyth_query_connect_with_timeout (GMythQuery *gmyth_query,
     2.7 -	                                          GMythBackendInfo *backend_info,
     2.8 -                                              guint timeout);
     2.9 +                                 GMythBackendInfo *backend_info,
    2.10 +                                 guint timeout);
    2.11  gboolean    gmyth_query_disconnect (GMythQuery *gmyth_query);
    2.12  
    2.13  G_END_DECLS
     3.1 --- a/gmyth/src/gmyth_scheduler.c	Wed Apr 11 19:34:21 2007 +0100
     3.2 +++ b/gmyth/src/gmyth_scheduler.c	Wed Apr 11 21:20:44 2007 +0100
     3.3 @@ -259,7 +259,6 @@
     3.4  
     3.5      mysql_free_result (msql_res);
     3.6      g_string_free(query_str, TRUE);
     3.7 -    g_free(date_time);
     3.8  
     3.9      return (*schedule_list == NULL) ? 0 : g_list_length (*schedule_list);
    3.10  }
    3.11 @@ -368,13 +367,14 @@
    3.12          "1, %d, \"%s\", %d, "	//autocommflag, findday, findtime, findid
    3.13          "5, 0, 29, 1, "			//search, autotranscode, transcoder, tsdefault
    3.14          "0, 0, 0, 0 );",		//autouserjob1, autouserjob2, autouserjob3, autouserjob4
    3.15 -        schedule_info->record_id, schedule_info->channel_id,
    3.16 -        gmyth_util_time_to_string_only_time( schedule_info->start_time ),
    3.17 -        gmyth_util_time_to_string_only_date( schedule_info->start_time ),
    3.18 -        gmyth_util_time_to_string_only_date( schedule_info->start_time ),
    3.19 -        gmyth_util_time_to_string_only_date( schedule_info->end_time ),
    3.20 -        schedule_info->title->str, //title
    3.21 -        schedule_info->channel_id,//station
    3.22 +        schedule_info->record_id, /* record id */
    3.23 +        schedule_info->channel_id, /* channel id */
    3.24 +        gmyth_util_time_to_string_only_time( schedule_info->start_time ), /* start time */
    3.25 +        gmyth_util_time_to_string_only_date( schedule_info->start_time ), /* start date */
    3.26 +        gmyth_util_time_to_string_only_time( schedule_info->end_time ), /* end time */
    3.27 +        gmyth_util_time_to_string_only_date( schedule_info->end_time ), /* end date */
    3.28 +        schedule_info->title->str, /* title */
    3.29 +        schedule_info->channel_id,/* station */
    3.30          (gmyth_util_time_val_to_date( schedule_info->start_time ))->tm_wday, //findday
    3.31          gmyth_util_time_to_string_only_time( schedule_info->start_time ), //findtime
    3.32          (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528)//findid
    3.33 @@ -430,11 +430,6 @@
    3.34  
    3.35      msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str);
    3.36  
    3.37 -    if (msql_res == NULL) {
    3.38 -        g_warning ("[%s] Error while trying to delete a schedule in the database", __FUNCTION__);
    3.39 -        return FALSE;
    3.40 -    }
    3.41 -
    3.42      update_backend(scheduler, record_id);// Notify the backend of the changes
    3.43      
    3.44      mysql_free_result (msql_res);
    3.45 @@ -468,6 +463,8 @@
    3.46      g_string_printf (query_str, 
    3.47      	"DELETE FROM recorded WHERE recordid=%d", record_id);
    3.48  
    3.49 +    // FIXME: Mythtv implementation runs also: DELETE FROM oldfind WHERE recordid = x
    3.50 +
    3.51      msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str);
    3.52  
    3.53      update_backend(scheduler, record_id);// Notify the backend of the changes
    3.54 @@ -616,8 +613,8 @@
    3.55      gmyth_string_list_append_string (strlist, datastr);
    3.56  
    3.57      socket = gmyth_socket_new ();
    3.58 -    if (gmyth_socket_connect (socket, scheduler->backend_info->hostname,
    3.59 -			    scheduler->backend_info->port)) {
    3.60 +    if (gmyth_socket_connect_to_backend (socket, scheduler->backend_info->hostname,
    3.61 +			    scheduler->backend_info->port, TRUE)) {
    3.62          gmyth_socket_sendreceive_stringlist (socket, strlist);
    3.63      } else {
    3.64          g_warning ("[%s] Connection to backend failed!", __FUNCTION__);