[svn r842] Added some more fields at ScheduleInfo structure trunk
authormelunko
Thu Aug 30 13:46:59 2007 +0100 (2007-08-30)
branchtrunk
changeset 836fb7baa0b3d2d
parent 835 36720270b368
child 837 6b3c7c0b32ad
[svn r842] Added some more fields at ScheduleInfo structure
gmyth/src/gmyth_scheduler.c
gmyth/src/gmyth_scheduler.h
     1.1 --- a/gmyth/src/gmyth_scheduler.c	Thu Aug 30 12:51:31 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  
     2.1 --- a/gmyth/src/gmyth_scheduler.h	Thu Aug 30 12:51:31 2007 +0100
     2.2 +++ b/gmyth/src/gmyth_scheduler.h	Thu Aug 30 13:46:59 2007 +0100
     2.3 @@ -110,6 +110,8 @@
     2.4      GString        *description;
     2.5      GString        *category;
     2.6  
     2.7 +    GMythScheduleType type;
     2.8 +
     2.9      gint parentid;
    2.10  
    2.11  } ScheduleInfo;