[svn r896] fixed channel_id, program_id types trunk
authorrenatofilho
Wed Jan 23 20:04:22 2008 +0000 (2008-01-23)
branchtrunk
changeset 8906b565181036e
parent 889 83851e17c385
child 891 0cc42675b88d
[svn r896] fixed channel_id, program_id types
gmyth/src/gmyth_epg.c
gmyth/src/gmyth_programinfo.c
gmyth/src/gmyth_programinfo.h
gmyth/src/gmyth_recorder.c
gmyth/src/gmyth_scheduler.c
gmyth/src/gmyth_scheduler.h
     1.1 --- a/gmyth/src/gmyth_epg.c	Tue Jan 15 17:44:34 2008 +0000
     1.2 +++ b/gmyth/src/gmyth_epg.c	Wed Jan 23 20:04:22 2008 +0000
     1.3 @@ -311,7 +311,7 @@
     1.4  
     1.5          GMythProgramInfo *p = gmyth_program_info_new();
     1.6  
     1.7 -        p->chanid = g_string_new(row[0]);
     1.8 +        p->xx_channel_id = (int) g_ascii_strtoull (row[0], NULL, 10);
     1.9  
    1.10          p->startts = gmyth_util_string_to_time_val(row[1]);
    1.11          p->endts = gmyth_util_string_to_time_val(row[2]);
    1.12 @@ -340,7 +340,7 @@
    1.13          p->chancommfree = g_ascii_strtoull(row[11], NULL, 10);
    1.14          p->chanOutputFilters = g_string_new(row[12]);
    1.15          p->seriesid = g_string_new(row[13]);
    1.16 -        p->programid = g_string_new(row[14]);
    1.17 +        p->xx_program_id = g_string_new(row[14]);
    1.18          p->year = g_string_new(row[15]);
    1.19          p->stars = g_ascii_strtod(row[16], NULL);
    1.20  
     2.1 --- a/gmyth/src/gmyth_programinfo.c	Tue Jan 15 17:44:34 2008 +0000
     2.2 +++ b/gmyth/src/gmyth_programinfo.c	Wed Jan 23 20:04:22 2008 +0000
     2.3 @@ -107,11 +107,6 @@
     2.4  {
     2.5      GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object);
     2.6  
     2.7 -    if (gmyth_program_info->chanid != NULL) {
     2.8 -        g_string_free(gmyth_program_info->chanid, TRUE);
     2.9 -        gmyth_program_info->chanid = NULL;
    2.10 -    }
    2.11 -
    2.12      /** The program start time. */
    2.13      g_free(gmyth_program_info->startts);
    2.14  
    2.15 @@ -175,9 +170,9 @@
    2.16      }
    2.17  
    2.18      /** The program unique id. */
    2.19 -    if (gmyth_program_info->programid != NULL) {
    2.20 -        g_string_free(gmyth_program_info->programid, TRUE);
    2.21 -        gmyth_program_info->programid = NULL;
    2.22 +    if (gmyth_program_info->xx_program_id != NULL) {
    2.23 +        g_string_free (gmyth_program_info->xx_program_id, TRUE);
    2.24 +        gmyth_program_info->xx_program_id = NULL;
    2.25      }
    2.26  
    2.27      if (gmyth_program_info->catType != NULL) {
    2.28 @@ -273,7 +268,7 @@
    2.29      gmyth_string_list_append_string(slist, prog->subtitle); /* 1 */
    2.30      gmyth_string_list_append_string(slist, prog->description);  /* 2 */
    2.31      gmyth_string_list_append_string(slist, prog->category); /* 3 */
    2.32 -    gmyth_string_list_append_string(slist, prog->chanid);   /* 4 */
    2.33 +    gmyth_string_list_append_int (slist, prog->xx_channel_id);   /* 4 */
    2.34      gmyth_string_list_append_string(slist, prog->chanstr);  /* 5 */
    2.35      gmyth_string_list_append_string(slist, prog->chansign); /* 6 */
    2.36      gmyth_string_list_append_string(slist, prog->channame); /* 7 */
    2.37 @@ -326,7 +321,7 @@
    2.38      gmyth_string_list_append_string(slist, prog->chanOutputFilters);    /* 32 
    2.39                                                                           */
    2.40      gmyth_string_list_append_string(slist, prog->seriesid); /* 33 */
    2.41 -    gmyth_string_list_append_string(slist, prog->programid);    /* 34 */
    2.42 +    gmyth_string_list_append_string(slist, prog->xx_program_id);    /* 34 */
    2.43      gmyth_string_list_append_char_array(slist, ""); /* 35 */
    2.44      gmyth_string_list_append_int(slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0);   /* 36 
    2.45       */// DATETIME_TO_LIST(lastmodified)
    2.46 @@ -367,7 +362,7 @@
    2.47      prog->subtitle = gmyth_string_list_get_string(slist, pos + 1);
    2.48      prog->description = gmyth_string_list_get_string(slist, pos + 2);
    2.49      prog->category = gmyth_string_list_get_string(slist, pos + 3);
    2.50 -    prog->chanid = gmyth_string_list_get_string(slist, pos + 4);
    2.51 +    prog->xx_channel_id = gmyth_string_list_get_int (slist, pos + 4);
    2.52      prog->channame = gmyth_string_list_get_string(slist, pos + 5);
    2.53      prog->chanstr = gmyth_string_list_get_string(slist, pos + 6);
    2.54      prog->chansign = gmyth_string_list_get_string(slist, pos + 7);
    2.55 @@ -375,12 +370,11 @@
    2.56  
    2.57      prog->filesize = gmyth_string_list_get_int64(slist, pos + 9);
    2.58  
    2.59 -    gmyth_debug("Prog info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s, %d ]\n",
    2.60 +    gmyth_debug("Prog info: [ %s, %s, %s, %s, %s, %s, %s, %s, %d ]\n",
    2.61                  gmyth_program_info_non_null_value(prog->title),
    2.62                  gmyth_program_info_non_null_value(prog->subtitle),
    2.63                  gmyth_program_info_non_null_value(prog->description),
    2.64                  gmyth_program_info_non_null_value(prog->category),
    2.65 -                gmyth_program_info_non_null_value(prog->chanid),
    2.66                  gmyth_program_info_non_null_value(prog->channame),
    2.67                  gmyth_program_info_non_null_value(prog->chanstr),
    2.68                  gmyth_program_info_non_null_value(prog->chansign),
    2.69 @@ -419,7 +413,7 @@
    2.70      prog->chanOutputFilters =
    2.71          gmyth_string_list_get_string(slist, pos + 32);
    2.72      prog->seriesid = gmyth_string_list_get_string(slist, pos + 33);
    2.73 -    prog->programid = gmyth_string_list_get_string(slist, pos + 34);
    2.74 +    prog->xx_program_id = gmyth_string_list_get_string(slist, pos + 34);
    2.75      gmyth_string_list_get_string(slist, pos + 35);
    2.76      prog->lastmodified = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 36)))->str);   // DATETIME_TO_LIST(lastmodified)
    2.77      gmyth_string_list_get_int(slist, pos + 37); // FLOAT_TO_LIST(stars)
    2.78 @@ -490,16 +484,15 @@
    2.79      prog->channame = gmyth_string_list_get_string(slist, 6);
    2.80      prog->chansign = gmyth_string_list_get_string(slist, 7);
    2.81      prog->chanstr = gmyth_string_list_get_string(slist, 8);
    2.82 -    prog->chanid = gmyth_string_list_get_string(slist, 9);
    2.83 +    prog->xx_channel_id = gmyth_string_list_get_int (slist, 9);
    2.84      prog->filesize = gmyth_string_list_get_int64(slist, 10);
    2.85  
    2.86      gmyth_debug
    2.87 -        ("NEXT program info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s ]\n",
    2.88 +        ("NEXT program info: [ %s, %s, %s, %s, %s, %s, %s, %s ]\n",
    2.89           gmyth_program_info_non_null_value(prog->title),
    2.90           gmyth_program_info_non_null_value(prog->subtitle),
    2.91           gmyth_program_info_non_null_value(prog->description),
    2.92           gmyth_program_info_non_null_value(prog->category),
    2.93 -         gmyth_program_info_non_null_value(prog->chanid),
    2.94           gmyth_program_info_non_null_value(prog->channame),
    2.95           gmyth_program_info_non_null_value(prog->chanstr),
    2.96           gmyth_program_info_non_null_value(prog->chansign),
    2.97 @@ -527,7 +520,7 @@
    2.98  {
    2.99      return
   2.100          g_strdup_printf
   2.101 -        ("Title: %s, Subtitle: %s, Description: %s, Category: %s, Channel ID: %s, "
   2.102 +        ("Title: %s, Subtitle: %s, Description: %s, Category: %s, Channel ID: %d, "
   2.103           "Channel Name: %s, Chan str: %s, Channel Sign: %s, Path Name: %s, File Size: %lld, \n"
   2.104           "Start TS: %s, End TS: %s, Duplicate: %d, Shareable: %d, Find ID: %d, Hostname: %s, "
   2.105           "Source ID: %d, Vard ID: %d, Input ID: %d, Rec Priority: %d, Reactivate: %d, \n"
   2.106 @@ -539,7 +532,7 @@
   2.107           gmyth_program_info_non_null_value(prog->subtitle),
   2.108           gmyth_program_info_non_null_value(prog->description),
   2.109           gmyth_program_info_non_null_value(prog->category),
   2.110 -         gmyth_program_info_non_null_value(prog->chanid),
   2.111 +         prog->xx_channel_id,
   2.112           gmyth_program_info_non_null_value(prog->channame),
   2.113           gmyth_program_info_non_null_value(prog->chanstr),
   2.114           gmyth_program_info_non_null_value(prog->chansign),
   2.115 @@ -557,7 +550,7 @@
   2.116           prog->chancommfree,
   2.117           gmyth_program_info_non_null_value(prog->chanOutputFilters),
   2.118           gmyth_program_info_non_null_value(prog->seriesid),
   2.119 -         gmyth_program_info_non_null_value(prog->programid),
   2.120 +         gmyth_program_info_non_null_value(prog->xx_program_id),
   2.121           gmyth_util_time_to_string_from_time_val(prog->lastmodified),
   2.122           gmyth_util_time_to_string_from_time_val(prog->originalAirDate),
   2.123           prog->hasAirDate,
     3.1 --- a/gmyth/src/gmyth_programinfo.h	Tue Jan 15 17:44:34 2008 +0000
     3.2 +++ b/gmyth/src/gmyth_programinfo.h	Wed Jan 23 20:04:22 2008 +0000
     3.3 @@ -62,7 +62,7 @@
     3.4      GObject         parent;
     3.5  
     3.6      /** The channel unique ID. */
     3.7 -    GString        *chanid;
     3.8 +    gint            xx_channel_id;
     3.9      /** The program start time. */
    3.10      GTimeVal       *startts;
    3.11      /** The program end time. */
    3.12 @@ -90,7 +90,7 @@
    3.13  
    3.14      GString        *seriesid;
    3.15      /** The program unique id. */
    3.16 -    GString        *programid;
    3.17 +    GString        *xx_program_id;
    3.18      GString        *catType;
    3.19  
    3.20      GString        *sortTitle;
     4.1 --- a/gmyth/src/gmyth_recorder.c	Tue Jan 15 17:44:34 2008 +0000
     4.2 +++ b/gmyth/src/gmyth_recorder.c	Wed Jan 23 20:04:22 2008 +0000
     4.3 @@ -917,7 +917,7 @@
     4.4      gmyth_string_list_append_string(str_list, tmp_str);
     4.5      gmyth_string_list_append_char_array(str_list, "GET_NEXT_PROGRAM_INFO");
     4.6      gmyth_string_list_append_string(str_list, actual_proginfo->channame);
     4.7 -    gmyth_string_list_append_string(str_list, actual_proginfo->chanid);
     4.8 +    gmyth_string_list_append_int(str_list, actual_proginfo->xx_channel_id);
     4.9      gmyth_string_list_append_int(str_list, direction);
    4.10      gmyth_string_list_append_char_array(str_list, date);
    4.11  
     5.1 --- a/gmyth/src/gmyth_scheduler.c	Tue Jan 15 17:44:34 2008 +0000
     5.2 +++ b/gmyth/src/gmyth_scheduler.c	Wed Jan 23 20:04:22 2008 +0000
     5.3 @@ -31,6 +31,7 @@
     5.4  
     5.5  #include <assert.h>
     5.6  
     5.7 +#include <glib.h>
     5.8  #include <glib/gprintf.h>
     5.9  
    5.10  #include "gmyth_scheduler.h"
    5.11 @@ -244,8 +245,8 @@
    5.12  
    5.13              schedule->schedule_id =
    5.14                  (guint) g_ascii_strtoull(row[0], NULL, 10);
    5.15 -            schedule->program_id = g_string_new (row[1]);
    5.16 -            schedule->channel_id = g_string_new (row[2]);
    5.17 +            schedule->xx_program_id = g_string_new (row[1]);
    5.18 +            schedule->xx_channel_id = (gint) g_ascii_strtoull (row[2], NULL, 10);
    5.19  
    5.20              /*
    5.21               * generate a time_t from a time and a date db field 
    5.22 @@ -331,9 +332,8 @@
    5.23              record = g_new0(RecordedInfo, 1);
    5.24  
    5.25              record->record_id = (guint) g_ascii_strtoull(row[0], NULL, 10);
    5.26 -            record->program_id =
    5.27 -                (guint) g_ascii_strtoull(row[1], NULL, 10);
    5.28 -            record->channel_id = g_string_new (row[2]);
    5.29 +            record->xx_program_id = g_string_new (row[1]);
    5.30 +            record->xx_channel_id = (gint) g_ascii_strtoull(row[2], NULL, 10);
    5.31              record->start_time = gmyth_util_string_to_time_val(row[3]);
    5.32              record->end_time = gmyth_util_string_to_time_val(row[5]);
    5.33  
    5.34 @@ -390,8 +390,8 @@
    5.35          if (row != NULL) {
    5.36              record = g_new0(RecordedInfo, 1);
    5.37              record->record_id = (guint) g_ascii_strtoull(row[0], NULL, 10);
    5.38 -            record->program_id = (guint) g_ascii_strtoull(row[1], NULL, 10);
    5.39 -            record->channel_id = g_string_new (row[2]);
    5.40 +            record->xx_program_id = g_string_new (row[1]);
    5.41 +            record->xx_channel_id = (gint) g_ascii_strtoull(row[2], NULL, 10);
    5.42              record->start_time = gmyth_util_string_to_time_val(row[3]);
    5.43              record->end_time = gmyth_util_string_to_time_val(row[5]);
    5.44              record->title = g_string_new(row[7]);
    5.45 @@ -442,8 +442,8 @@
    5.46      ScheduleInfo *info;
    5.47  
    5.48      info = g_new0 (ScheduleInfo, 1);
    5.49 -    info->program_id = g_string_new (program->programid->str);
    5.50 -    info->channel_id = g_string_new (program->chanid->str);
    5.51 +    info->xx_program_id = g_string_new (program->xx_program_id->str);
    5.52 +    info->xx_channel_id = program->xx_channel_id;
    5.53      info->start_time = g_new0 (GTimeVal, 1);
    5.54      *info->start_time = *program->startts;
    5.55      info->end_time = g_new0 (GTimeVal, 1);
    5.56 @@ -483,7 +483,7 @@
    5.57      gchar          *station = NULL;
    5.58      gulong          rec_id;
    5.59  
    5.60 -    assert(scheduler);
    5.61 +    g_return_val_if_fail (IS_GMYTH_SCHEDULER (scheduler), FALSE);
    5.62  
    5.63      if (scheduler->msqlquery == NULL) {
    5.64          g_warning("[%s] Scheduler db connection not initialized",
    5.65 @@ -499,8 +499,8 @@
    5.66      // Retrieves the station info
    5.67      query_str =
    5.68          g_strdup_printf
    5.69 -        ("SELECT callsign FROM channel WHERE chanid = \"%s\";",
    5.70 -         schedule_info->channel_id->str);
    5.71 +        ("SELECT callsign FROM channel WHERE chanid = %d;",
    5.72 +         schedule_info->xx_channel_id);
    5.73      msql_res =
    5.74          gmyth_query_process_statement(scheduler->msqlquery, query_str);
    5.75      if (msql_res == NULL) {
    5.76 @@ -517,8 +517,8 @@
    5.77      g_free(query_str);
    5.78  
    5.79      // _set_value (field, value, id);
    5.80 -    _set_value(scheduler->msqlquery, "chanid",
    5.81 -               schedule_info->channel_id->str, rec_id);
    5.82 +    _set_int_value(scheduler->msqlquery, "chanid",
    5.83 +                   schedule_info->xx_channel_id, rec_id);
    5.84      _set_value(scheduler->msqlquery, "station", station, rec_id);
    5.85      _set_value(scheduler->msqlquery, "title", schedule_info->title->str,
    5.86                 rec_id);
    5.87 @@ -546,8 +546,10 @@
    5.88      // (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528),
    5.89      // rec_id);
    5.90  
    5.91 -    _set_value(scheduler->msqlquery, "seriesid",
    5.92 -               schedule_info->seriesid->str, rec_id);
    5.93 +    if (schedule_info->seriesid)
    5.94 +       _set_value(scheduler->msqlquery, "seriesid",
    5.95 +                  schedule_info->seriesid->str, rec_id);
    5.96 + 
    5.97      _set_value(scheduler->msqlquery, "parentid", "0", rec_id);
    5.98      _set_value(scheduler->msqlquery, "search", "0", rec_id);
    5.99  
   5.100 @@ -811,7 +813,7 @@
   5.101          if (msql_row) {
   5.102              proginfo = gmyth_program_info_new();
   5.103  
   5.104 -            proginfo->chanid = g_string_new(msql_row[0]);
   5.105 +            proginfo->xx_channel_id = (gint) g_ascii_strtoull (msql_row[0], NULL, 10);
   5.106              proginfo->recstartts = gmyth_util_string_to_time_val(msql_row[1]);
   5.107              proginfo->recendts = gmyth_util_string_to_time_val(msql_row[2]);
   5.108  
   5.109 @@ -825,7 +827,7 @@
   5.110              proginfo->chancommfree = (gint) g_ascii_strtoull(msql_row[9], NULL, 10);
   5.111              proginfo->chanOutputFilters = g_string_new(msql_row[10]);
   5.112              proginfo->seriesid = g_string_new(msql_row[11]);
   5.113 -            proginfo->programid = g_string_new(msql_row[12]);
   5.114 +            proginfo->xx_program_id = g_string_new(msql_row[12]);
   5.115              proginfo->filesize = g_ascii_strtoull(msql_row[13], NULL, 10);
   5.116  
   5.117              proginfo->lastmodified = gmyth_util_string_to_time_val(msql_row[14]);
   5.118 @@ -959,7 +961,7 @@
   5.119          if (msql_row) {
   5.120              proginfo = gmyth_program_info_new();
   5.121  
   5.122 -            proginfo->chanid = g_string_new(msql_row[0]);
   5.123 +            proginfo->xx_channel_id = (gint) g_ascii_strtoull (msql_row[0], NULL, 10);
   5.124              proginfo->startts =
   5.125                  gmyth_util_string_to_time_val(msql_row[23]);
   5.126              proginfo->endts = gmyth_util_string_to_time_val(msql_row[24]);
   5.127 @@ -978,7 +980,7 @@
   5.128                  (gint) g_ascii_strtoull(msql_row[9], NULL, 10);
   5.129              proginfo->chanOutputFilters = g_string_new(msql_row[10]);
   5.130              proginfo->seriesid = g_string_new(msql_row[11]);
   5.131 -            proginfo->programid = g_string_new(msql_row[12]);
   5.132 +            proginfo->xx_program_id = g_string_new(msql_row[12]);
   5.133              proginfo->filesize = g_ascii_strtoull(msql_row[13], NULL, 10);
   5.134  
   5.135              proginfo->lastmodified =
   5.136 @@ -1042,7 +1044,7 @@
   5.137          gmyth_string_list_append_string(slist, program->subtitle);     /* 1 */
   5.138          gmyth_string_list_append_string(slist, program->description);  /* 2 */
   5.139          gmyth_string_list_append_string(slist, program->category);     /* 3 */
   5.140 -        gmyth_string_list_append_string(slist, program->chanid);       /* 4 */
   5.141 +        gmyth_string_list_append_int(slist, program->xx_channel_id);   /* 4 */
   5.142          gmyth_string_list_append_string(slist, program->chanstr);      /* 5 */
   5.143          gmyth_string_list_append_string(slist, program->chansign);     /* 6 */
   5.144          gmyth_string_list_append_string(slist, program->channame);     /* 7 */
   5.145 @@ -1098,7 +1100,7 @@
   5.146          gmyth_string_list_append_int(slist, program->chancommfree);         /* 31 */
   5.147          gmyth_string_list_append_string(slist, program->chanOutputFilters); /* 32 */
   5.148          gmyth_string_list_append_string(slist, program->seriesid);          /* 33 */
   5.149 -        gmyth_string_list_append_string(slist, program->programid);         /* 34 */
   5.150 +        gmyth_string_list_append_string(slist, program->xx_program_id);     /* 34 */
   5.151  
   5.152          gmyth_string_list_append_int(slist,
   5.153                                       program->lastmodified != NULL ?
   5.154 @@ -1170,8 +1172,10 @@
   5.155  void
   5.156  gmyth_recorded_info_free(RecordedInfo * info)
   5.157  {
   5.158 -    if (info->channel_id)
   5.159 -        g_string_free (info->channel_id, TRUE);
   5.160 +    g_return_if_fail (info != NULL);
   5.161 +
   5.162 +    if (info->xx_program_id)
   5.163 +        g_string_free (info->xx_program_id, TRUE);
   5.164  
   5.165      if (info->title != NULL)
   5.166          g_string_free(info->title, TRUE);
   5.167 @@ -1220,8 +1224,8 @@
   5.168  
   5.169      g_return_if_fail(info != NULL);
   5.170  
   5.171 -    if (info->channel_id)
   5.172 -        g_string_free (info->channel_id, TRUE);
   5.173 +    if (info->xx_program_id)
   5.174 +        g_string_free (info->xx_program_id, TRUE);
   5.175  
   5.176      if (info->title != NULL)
   5.177          g_string_free(info->title, TRUE);
     6.1 --- a/gmyth/src/gmyth_scheduler.h	Tue Jan 15 17:44:34 2008 +0000
     6.2 +++ b/gmyth/src/gmyth_scheduler.h	Wed Jan 23 20:04:22 2008 +0000
     6.3 @@ -99,8 +99,8 @@
     6.4  
     6.5  typedef struct {
     6.6      guint           schedule_id;
     6.7 -    GString        *program_id;
     6.8 -    GString        *channel_id;
     6.9 +    gint            xx_channel_id;
    6.10 +    GString        *xx_program_id;
    6.11  
    6.12      GTimeVal       *start_time;
    6.13      GTimeVal       *end_time;
    6.14 @@ -119,8 +119,8 @@
    6.15  
    6.16  typedef struct {
    6.17      guint           record_id;
    6.18 -    guint           program_id;
    6.19 -    GString        *channel_id;
    6.20 +    gint            xx_channel_id;
    6.21 +    GString        *xx_program_id;
    6.22  
    6.23      GTimeVal       *start_time;
    6.24      GTimeVal       *end_time;