gmyth/src/gmyth_scheduler.c
branchtrunk
changeset 836 fb7baa0b3d2d
parent 819 1627de49faa2
child 841 25fb81d23ef5
     1.1 --- a/gmyth/src/gmyth_scheduler.c	Wed Aug 22 14:07:49 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_scheduler.c	Thu Aug 30 13:46:59 2007 +0100
     1.3 @@ -219,7 +219,7 @@
     1.4  
     1.5      g_string_printf(query_str,
     1.6                      "SELECT recordid,programid,chanid,starttime,startdate,"
     1.7 -                    "endtime,enddate,title,subtitle,description,category FROM record;");
     1.8 +                    "endtime,enddate,title,subtitle,description,category,type,parentid FROM record;");
     1.9  
    1.10      if (scheduler->msqlquery == NULL) {
    1.11          g_warning("[%s] Scheduler db connection not initialized",
    1.12 @@ -240,6 +240,7 @@
    1.13  
    1.14          while ((row = mysql_fetch_row(msql_res)) != NULL) {
    1.15              schedule = g_new0(ScheduleInfo, 1);
    1.16 +            gint type = 0;
    1.17  
    1.18              schedule->schedule_id =
    1.19                  (guint) g_ascii_strtoull(row[0], NULL, 10);
    1.20 @@ -267,6 +268,15 @@
    1.21              schedule->subtitle = g_string_new(row[8]);
    1.22              schedule->description = g_string_new(row[9]);
    1.23              schedule->category = g_string_new(row[10]);
    1.24 +            type = g_ascii_strtoull (row[11], NULL, 10);
    1.25 +            if (type == 4) {
    1.26 +                schedule->type = GMYTH_SCHEDULE_ALL_OCCURRENCES;
    1.27 +            } else if (type == 1) {
    1.28 +                schedule->type = GMYTH_SCHEDULE_ONE_OCCURRENCE;
    1.29 +            } else if (type == 8) {
    1.30 +                schedule->type = GMYTH_SCHEDULE_EXCEPTION;
    1.31 +                schedule->parentid = (gint) g_ascii_strtoull (row[12], NULL, 10);
    1.32 +            }
    1.33  
    1.34              (*schedule_list) = g_list_append(*(schedule_list), schedule);
    1.35          }
    1.36 @@ -505,7 +515,7 @@
    1.37          _set_int_value(scheduler->msqlquery, "type", 1, rec_id);
    1.38      } else if (type == GMYTH_SCHEDULE_EXCEPTION) {
    1.39          _set_int_value(scheduler->msqlquery, "type", 8, rec_id);
    1.40 -	_set_int_value(scheduler->msqlquery, "parentid", schedule_info->parentid,
    1.41 +        _set_int_value(scheduler->msqlquery, "parentid", schedule_info->parentid,
    1.42  		       rec_id);
    1.43      }
    1.44  
    1.45 @@ -535,9 +545,7 @@
    1.46  
    1.47      schedule_info->schedule_id = rec_id;
    1.48  
    1.49 -    /*
    1.50 -     * Notify the backend of changes 
    1.51 -     */
    1.52 +    /* Notify the backend of changes */
    1.53      return update_backend(scheduler, rec_id);
    1.54  }
    1.55