1.1 --- a/gmyth/src/gmyth_scheduler.c Tue Mar 06 14:06:16 2007 +0000
1.2 +++ b/gmyth/src/gmyth_scheduler.c Tue Mar 06 14:17:04 2007 +0000
1.3 @@ -105,13 +105,13 @@
1.4 {
1.5 GMythScheduler *scheduler = GMYTH_SCHEDULER (object);
1.6
1.7 - if (scheduler->backend_info) {
1.8 - g_object_unref (scheduler->backend_info);
1.9 + if (scheduler->backend_info) {
1.10 + g_object_unref (scheduler->backend_info);
1.11 scheduler->backend_info = NULL;
1.12 }
1.13
1.14 - if (scheduler->msqlquery) {
1.15 - g_object_unref (scheduler->msqlquery);
1.16 + if (scheduler->msqlquery) {
1.17 + g_object_unref (scheduler->msqlquery);
1.18 scheduler->msqlquery = NULL;
1.19 }
1.20
1.21 @@ -264,7 +264,7 @@
1.22 schedule->category = g_string_new (row[10]);
1.23
1.24 (*schedule_list) = g_list_append (*(schedule_list), schedule);
1.25 - }
1.26 + }
1.27 }
1.28
1.29 mysql_free_result (msql_res);
1.30 @@ -326,7 +326,7 @@
1.31 record->basename = g_string_new (row[12]);
1.32
1.33 (*recorded_list) = g_list_append ((*recorded_list), record);
1.34 - }
1.35 + }
1.36 }
1.37
1.38 mysql_free_result (msql_res);
1.39 @@ -387,7 +387,7 @@
1.40 schedule_info->channel_id,//station
1.41 (gmyth_util_time_val_to_date( schedule_info->start_time ))->tm_wday, //findday
1.42 gmyth_util_time_to_string_only_time( schedule_info->start_time ), //findtime
1.43 - (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528)//findid
1.44 + (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528)//findid
1.45 );
1.46
1.47 gmyth_debug ( "Sending query to MySQL = %s.", query_str->str );
1.48 @@ -441,8 +441,8 @@
1.49 msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str);
1.50
1.51 if (msql_res == NULL) {
1.52 - g_warning ("[%s] Error while trying to delete a schedule in the database", __FUNCTION__);
1.53 - return FALSE;
1.54 + g_warning ("[%s] Error while trying to delete a schedule in the database", __FUNCTION__);
1.55 + return FALSE;
1.56 }
1.57
1.58 update_backend(scheduler, record_id);// Notify the backend of the changes
1.59 @@ -530,58 +530,54 @@
1.60 msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str);
1.61
1.62 if (msql_res /*&& query.size() > 0*/) {
1.63 -
1.64 - MYSQL_ROW msql_row = mysql_fetch_row (msql_res);
1.65 - if (msql_row) {
1.66 + MYSQL_ROW msql_row = mysql_fetch_row (msql_res);
1.67 + if (msql_row) {
1.68 + proginfo = gmyth_program_info_new();
1.69
1.70 - proginfo = gmyth_program_info_new();
1.71 -
1.72 - proginfo->chanid = g_string_new (msql_row[0]);
1.73 - proginfo->startts = gmyth_util_string_to_time_val (msql_row[23]);
1.74 - proginfo->endts = gmyth_util_string_to_time_val (msql_row[24]);
1.75 - proginfo->recstartts = gmyth_util_string_to_time_val (msql_row[1]);
1.76 - proginfo->recendts = gmyth_util_string_to_time_val (msql_row[2]);
1.77 - proginfo->title = g_string_new (msql_row[3]);
1.78 - proginfo->subtitle = g_string_new (msql_row[4]);
1.79 - proginfo->description = g_string_new (msql_row[5]);
1.80 + proginfo->chanid = g_string_new (msql_row[0]);
1.81 + proginfo->startts = gmyth_util_string_to_time_val (msql_row[23]);
1.82 + proginfo->endts = gmyth_util_string_to_time_val (msql_row[24]);
1.83 + proginfo->recstartts = gmyth_util_string_to_time_val (msql_row[1]);
1.84 + proginfo->recendts = gmyth_util_string_to_time_val (msql_row[2]);
1.85 + proginfo->title = g_string_new (msql_row[3]);
1.86 + proginfo->subtitle = g_string_new (msql_row[4]);
1.87 + proginfo->description = g_string_new (msql_row[5]);
1.88
1.89 - proginfo->chanstr = g_string_new (msql_row[6]);
1.90 - proginfo->chansign = g_string_new (msql_row[7]);
1.91 - proginfo->channame = g_string_new (msql_row[0]);
1.92 - proginfo->chancommfree = (gint) g_ascii_strtoull (msql_row[9], NULL, 10);
1.93 - proginfo->chanOutputFilters = g_string_new (msql_row[10]);
1.94 - proginfo->seriesid = g_string_new (msql_row[11]);
1.95 - proginfo->programid = g_string_new (msql_row[12]);
1.96 - proginfo->filesize = g_ascii_strtoull (msql_row[13], NULL, 10);
1.97 -
1.98 - proginfo->lastmodified = gmyth_util_string_to_time_val (msql_row[14]);
1.99 -
1.100 - proginfo->stars = g_ascii_strtod (msql_row[15], NULL);
1.101 - proginfo->repeat = (gint) g_ascii_strtoull (msql_row[16], NULL, 10);
1.102 -
1.103 - if (msql_row[17] == NULL) {
1.104 - proginfo->originalAirDate = 0;
1.105 - proginfo->hasAirDate = FALSE;
1.106 - } else {
1.107 - proginfo->originalAirDate = gmyth_util_string_to_time_val (msql_row[17]);
1.108 - proginfo->hasAirDate = TRUE;
1.109 - }
1.110 -
1.111 - proginfo->hostname = g_string_new (msql_row[18]);
1.112 - proginfo->recordid = (gint) g_ascii_strtoull (msql_row[19], NULL, 10);
1.113 - proginfo->transcoder = (gint) g_ascii_strtoull (msql_row[20], NULL, 10);
1.114 + proginfo->chanstr = g_string_new (msql_row[6]);
1.115 + proginfo->chansign = g_string_new (msql_row[7]);
1.116 + proginfo->channame = g_string_new (msql_row[0]);
1.117 + proginfo->chancommfree = (gint) g_ascii_strtoull (msql_row[9], NULL, 10);
1.118 + proginfo->chanOutputFilters = g_string_new (msql_row[10]);
1.119 + proginfo->seriesid = g_string_new (msql_row[11]);
1.120 + proginfo->programid = g_string_new (msql_row[12]);
1.121 + proginfo->filesize = g_ascii_strtoull (msql_row[13], NULL, 10);
1.122
1.123 - //proginfo->spread = -1;
1.124 - ////proginfo->programflags = proginfo->getProgramFlags();
1.125 -
1.126 - proginfo->recgroup = g_string_new (msql_row[26]);
1.127 - proginfo->playgroup = g_string_new (msql_row[21]);
1.128 - proginfo->recpriority = (gint) g_ascii_strtoull (msql_row[22], NULL, 10);
1.129 + proginfo->lastmodified = gmyth_util_string_to_time_val (msql_row[14]);
1.130 + proginfo->stars = g_ascii_strtod (msql_row[15], NULL);
1.131 + proginfo->repeat = (gint) g_ascii_strtoull (msql_row[16], NULL, 10);
1.132
1.133 - proginfo->pathname = g_string_new (msql_row[25]);
1.134 + if (msql_row[17] == NULL) {
1.135 + proginfo->originalAirDate = 0;
1.136 + proginfo->hasAirDate = FALSE;
1.137 + } else {
1.138 + proginfo->originalAirDate = gmyth_util_string_to_time_val (msql_row[17]);
1.139 + proginfo->hasAirDate = TRUE;
1.140 + }
1.141
1.142 - gmyth_debug ("One program info loaded from mysql database\n");
1.143 - }
1.144 + proginfo->hostname = g_string_new (msql_row[18]);
1.145 + proginfo->recordid = (gint) g_ascii_strtoull (msql_row[19], NULL, 10);
1.146 + proginfo->transcoder = (gint) g_ascii_strtoull (msql_row[20], NULL, 10);
1.147 + //proginfo->spread = -1;
1.148 + //proginfo->programflags = proginfo->getProgramFlags();
1.149 +
1.150 + proginfo->recgroup = g_string_new (msql_row[26]);
1.151 + proginfo->playgroup = g_string_new (msql_row[21]);
1.152 + proginfo->recpriority = (gint) g_ascii_strtoull (msql_row[22], NULL, 10);
1.153 +
1.154 + proginfo->pathname = g_string_new (msql_row[25]);
1.155 +
1.156 + gmyth_debug ("One program info loaded from mysql database\n");
1.157 + }
1.158 }
1.159
1.160 mysql_free_result (msql_res);
2.1 --- a/gmyth/src/gmyth_scheduler.h Tue Mar 06 14:06:16 2007 +0000
2.2 +++ b/gmyth/src/gmyth_scheduler.h Tue Mar 06 14:17:04 2007 +0000
2.3 @@ -98,18 +98,18 @@
2.4 };
2.5
2.6 typedef struct {
2.7 - guint record_id;
2.8 - guint program_id;
2.9 - guint channel_id;
2.10 -
2.11 + guint record_id;
2.12 + guint program_id;
2.13 + guint channel_id;
2.14 +
2.15 GTimeVal *start_time;
2.16 - GTimeVal *end_time;
2.17 -
2.18 - GString *title;
2.19 - GString *subtitle;
2.20 - GString *description;
2.21 - GString *category;
2.22 -
2.23 + GTimeVal *end_time;
2.24 +
2.25 + GString *title;
2.26 + GString *subtitle;
2.27 + GString *description;
2.28 + GString *category;
2.29 +
2.30 } ScheduleInfo;
2.31
2.32 typedef struct {