# HG changeset patch # User renatofilho # Date 1201118662 0 # Node ID 6b565181036efbeafefc9bc136da8687f90a6739 # Parent 83851e17c385c993cc3b44b38c1aef99c21b5016 [svn r896] fixed channel_id, program_id types diff -r 83851e17c385 -r 6b565181036e gmyth/src/gmyth_epg.c --- a/gmyth/src/gmyth_epg.c Tue Jan 15 17:44:34 2008 +0000 +++ b/gmyth/src/gmyth_epg.c Wed Jan 23 20:04:22 2008 +0000 @@ -311,7 +311,7 @@ GMythProgramInfo *p = gmyth_program_info_new(); - p->chanid = g_string_new(row[0]); + p->xx_channel_id = (int) g_ascii_strtoull (row[0], NULL, 10); p->startts = gmyth_util_string_to_time_val(row[1]); p->endts = gmyth_util_string_to_time_val(row[2]); @@ -340,7 +340,7 @@ p->chancommfree = g_ascii_strtoull(row[11], NULL, 10); p->chanOutputFilters = g_string_new(row[12]); p->seriesid = g_string_new(row[13]); - p->programid = g_string_new(row[14]); + p->xx_program_id = g_string_new(row[14]); p->year = g_string_new(row[15]); p->stars = g_ascii_strtod(row[16], NULL); diff -r 83851e17c385 -r 6b565181036e gmyth/src/gmyth_programinfo.c --- a/gmyth/src/gmyth_programinfo.c Tue Jan 15 17:44:34 2008 +0000 +++ b/gmyth/src/gmyth_programinfo.c Wed Jan 23 20:04:22 2008 +0000 @@ -107,11 +107,6 @@ { GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object); - if (gmyth_program_info->chanid != NULL) { - g_string_free(gmyth_program_info->chanid, TRUE); - gmyth_program_info->chanid = NULL; - } - /** The program start time. */ g_free(gmyth_program_info->startts); @@ -175,9 +170,9 @@ } /** The program unique id. */ - if (gmyth_program_info->programid != NULL) { - g_string_free(gmyth_program_info->programid, TRUE); - gmyth_program_info->programid = NULL; + if (gmyth_program_info->xx_program_id != NULL) { + g_string_free (gmyth_program_info->xx_program_id, TRUE); + gmyth_program_info->xx_program_id = NULL; } if (gmyth_program_info->catType != NULL) { @@ -273,7 +268,7 @@ gmyth_string_list_append_string(slist, prog->subtitle); /* 1 */ gmyth_string_list_append_string(slist, prog->description); /* 2 */ gmyth_string_list_append_string(slist, prog->category); /* 3 */ - gmyth_string_list_append_string(slist, prog->chanid); /* 4 */ + gmyth_string_list_append_int (slist, prog->xx_channel_id); /* 4 */ gmyth_string_list_append_string(slist, prog->chanstr); /* 5 */ gmyth_string_list_append_string(slist, prog->chansign); /* 6 */ gmyth_string_list_append_string(slist, prog->channame); /* 7 */ @@ -326,7 +321,7 @@ gmyth_string_list_append_string(slist, prog->chanOutputFilters); /* 32 */ gmyth_string_list_append_string(slist, prog->seriesid); /* 33 */ - gmyth_string_list_append_string(slist, prog->programid); /* 34 */ + gmyth_string_list_append_string(slist, prog->xx_program_id); /* 34 */ gmyth_string_list_append_char_array(slist, ""); /* 35 */ gmyth_string_list_append_int(slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0); /* 36 */// DATETIME_TO_LIST(lastmodified) @@ -367,7 +362,7 @@ prog->subtitle = gmyth_string_list_get_string(slist, pos + 1); prog->description = gmyth_string_list_get_string(slist, pos + 2); prog->category = gmyth_string_list_get_string(slist, pos + 3); - prog->chanid = gmyth_string_list_get_string(slist, pos + 4); + prog->xx_channel_id = gmyth_string_list_get_int (slist, pos + 4); prog->channame = gmyth_string_list_get_string(slist, pos + 5); prog->chanstr = gmyth_string_list_get_string(slist, pos + 6); prog->chansign = gmyth_string_list_get_string(slist, pos + 7); @@ -375,12 +370,11 @@ prog->filesize = gmyth_string_list_get_int64(slist, pos + 9); - gmyth_debug("Prog info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s, %d ]\n", + gmyth_debug("Prog info: [ %s, %s, %s, %s, %s, %s, %s, %s, %d ]\n", gmyth_program_info_non_null_value(prog->title), gmyth_program_info_non_null_value(prog->subtitle), gmyth_program_info_non_null_value(prog->description), gmyth_program_info_non_null_value(prog->category), - gmyth_program_info_non_null_value(prog->chanid), gmyth_program_info_non_null_value(prog->channame), gmyth_program_info_non_null_value(prog->chanstr), gmyth_program_info_non_null_value(prog->chansign), @@ -419,7 +413,7 @@ prog->chanOutputFilters = gmyth_string_list_get_string(slist, pos + 32); prog->seriesid = gmyth_string_list_get_string(slist, pos + 33); - prog->programid = gmyth_string_list_get_string(slist, pos + 34); + prog->xx_program_id = gmyth_string_list_get_string(slist, pos + 34); gmyth_string_list_get_string(slist, pos + 35); 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) gmyth_string_list_get_int(slist, pos + 37); // FLOAT_TO_LIST(stars) @@ -490,16 +484,15 @@ prog->channame = gmyth_string_list_get_string(slist, 6); prog->chansign = gmyth_string_list_get_string(slist, 7); prog->chanstr = gmyth_string_list_get_string(slist, 8); - prog->chanid = gmyth_string_list_get_string(slist, 9); + prog->xx_channel_id = gmyth_string_list_get_int (slist, 9); prog->filesize = gmyth_string_list_get_int64(slist, 10); gmyth_debug - ("NEXT program info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s ]\n", + ("NEXT program info: [ %s, %s, %s, %s, %s, %s, %s, %s ]\n", gmyth_program_info_non_null_value(prog->title), gmyth_program_info_non_null_value(prog->subtitle), gmyth_program_info_non_null_value(prog->description), gmyth_program_info_non_null_value(prog->category), - gmyth_program_info_non_null_value(prog->chanid), gmyth_program_info_non_null_value(prog->channame), gmyth_program_info_non_null_value(prog->chanstr), gmyth_program_info_non_null_value(prog->chansign), @@ -527,7 +520,7 @@ { return g_strdup_printf - ("Title: %s, Subtitle: %s, Description: %s, Category: %s, Channel ID: %s, " + ("Title: %s, Subtitle: %s, Description: %s, Category: %s, Channel ID: %d, " "Channel Name: %s, Chan str: %s, Channel Sign: %s, Path Name: %s, File Size: %lld, \n" "Start TS: %s, End TS: %s, Duplicate: %d, Shareable: %d, Find ID: %d, Hostname: %s, " "Source ID: %d, Vard ID: %d, Input ID: %d, Rec Priority: %d, Reactivate: %d, \n" @@ -539,7 +532,7 @@ gmyth_program_info_non_null_value(prog->subtitle), gmyth_program_info_non_null_value(prog->description), gmyth_program_info_non_null_value(prog->category), - gmyth_program_info_non_null_value(prog->chanid), + prog->xx_channel_id, gmyth_program_info_non_null_value(prog->channame), gmyth_program_info_non_null_value(prog->chanstr), gmyth_program_info_non_null_value(prog->chansign), @@ -557,7 +550,7 @@ prog->chancommfree, gmyth_program_info_non_null_value(prog->chanOutputFilters), gmyth_program_info_non_null_value(prog->seriesid), - gmyth_program_info_non_null_value(prog->programid), + gmyth_program_info_non_null_value(prog->xx_program_id), gmyth_util_time_to_string_from_time_val(prog->lastmodified), gmyth_util_time_to_string_from_time_val(prog->originalAirDate), prog->hasAirDate, diff -r 83851e17c385 -r 6b565181036e gmyth/src/gmyth_programinfo.h --- a/gmyth/src/gmyth_programinfo.h Tue Jan 15 17:44:34 2008 +0000 +++ b/gmyth/src/gmyth_programinfo.h Wed Jan 23 20:04:22 2008 +0000 @@ -62,7 +62,7 @@ GObject parent; /** The channel unique ID. */ - GString *chanid; + gint xx_channel_id; /** The program start time. */ GTimeVal *startts; /** The program end time. */ @@ -90,7 +90,7 @@ GString *seriesid; /** The program unique id. */ - GString *programid; + GString *xx_program_id; GString *catType; GString *sortTitle; diff -r 83851e17c385 -r 6b565181036e gmyth/src/gmyth_recorder.c --- a/gmyth/src/gmyth_recorder.c Tue Jan 15 17:44:34 2008 +0000 +++ b/gmyth/src/gmyth_recorder.c Wed Jan 23 20:04:22 2008 +0000 @@ -917,7 +917,7 @@ gmyth_string_list_append_string(str_list, tmp_str); gmyth_string_list_append_char_array(str_list, "GET_NEXT_PROGRAM_INFO"); gmyth_string_list_append_string(str_list, actual_proginfo->channame); - gmyth_string_list_append_string(str_list, actual_proginfo->chanid); + gmyth_string_list_append_int(str_list, actual_proginfo->xx_channel_id); gmyth_string_list_append_int(str_list, direction); gmyth_string_list_append_char_array(str_list, date); diff -r 83851e17c385 -r 6b565181036e gmyth/src/gmyth_scheduler.c --- a/gmyth/src/gmyth_scheduler.c Tue Jan 15 17:44:34 2008 +0000 +++ b/gmyth/src/gmyth_scheduler.c Wed Jan 23 20:04:22 2008 +0000 @@ -31,6 +31,7 @@ #include +#include #include #include "gmyth_scheduler.h" @@ -244,8 +245,8 @@ schedule->schedule_id = (guint) g_ascii_strtoull(row[0], NULL, 10); - schedule->program_id = g_string_new (row[1]); - schedule->channel_id = g_string_new (row[2]); + schedule->xx_program_id = g_string_new (row[1]); + schedule->xx_channel_id = (gint) g_ascii_strtoull (row[2], NULL, 10); /* * generate a time_t from a time and a date db field @@ -331,9 +332,8 @@ record = g_new0(RecordedInfo, 1); record->record_id = (guint) g_ascii_strtoull(row[0], NULL, 10); - record->program_id = - (guint) g_ascii_strtoull(row[1], NULL, 10); - record->channel_id = g_string_new (row[2]); + record->xx_program_id = g_string_new (row[1]); + record->xx_channel_id = (gint) g_ascii_strtoull(row[2], NULL, 10); record->start_time = gmyth_util_string_to_time_val(row[3]); record->end_time = gmyth_util_string_to_time_val(row[5]); @@ -390,8 +390,8 @@ if (row != NULL) { record = g_new0(RecordedInfo, 1); record->record_id = (guint) g_ascii_strtoull(row[0], NULL, 10); - record->program_id = (guint) g_ascii_strtoull(row[1], NULL, 10); - record->channel_id = g_string_new (row[2]); + record->xx_program_id = g_string_new (row[1]); + record->xx_channel_id = (gint) g_ascii_strtoull(row[2], NULL, 10); record->start_time = gmyth_util_string_to_time_val(row[3]); record->end_time = gmyth_util_string_to_time_val(row[5]); record->title = g_string_new(row[7]); @@ -442,8 +442,8 @@ ScheduleInfo *info; info = g_new0 (ScheduleInfo, 1); - info->program_id = g_string_new (program->programid->str); - info->channel_id = g_string_new (program->chanid->str); + info->xx_program_id = g_string_new (program->xx_program_id->str); + info->xx_channel_id = program->xx_channel_id; info->start_time = g_new0 (GTimeVal, 1); *info->start_time = *program->startts; info->end_time = g_new0 (GTimeVal, 1); @@ -483,7 +483,7 @@ gchar *station = NULL; gulong rec_id; - assert(scheduler); + g_return_val_if_fail (IS_GMYTH_SCHEDULER (scheduler), FALSE); if (scheduler->msqlquery == NULL) { g_warning("[%s] Scheduler db connection not initialized", @@ -499,8 +499,8 @@ // Retrieves the station info query_str = g_strdup_printf - ("SELECT callsign FROM channel WHERE chanid = \"%s\";", - schedule_info->channel_id->str); + ("SELECT callsign FROM channel WHERE chanid = %d;", + schedule_info->xx_channel_id); msql_res = gmyth_query_process_statement(scheduler->msqlquery, query_str); if (msql_res == NULL) { @@ -517,8 +517,8 @@ g_free(query_str); // _set_value (field, value, id); - _set_value(scheduler->msqlquery, "chanid", - schedule_info->channel_id->str, rec_id); + _set_int_value(scheduler->msqlquery, "chanid", + schedule_info->xx_channel_id, rec_id); _set_value(scheduler->msqlquery, "station", station, rec_id); _set_value(scheduler->msqlquery, "title", schedule_info->title->str, rec_id); @@ -546,8 +546,10 @@ // (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528), // rec_id); - _set_value(scheduler->msqlquery, "seriesid", - schedule_info->seriesid->str, rec_id); + if (schedule_info->seriesid) + _set_value(scheduler->msqlquery, "seriesid", + schedule_info->seriesid->str, rec_id); + _set_value(scheduler->msqlquery, "parentid", "0", rec_id); _set_value(scheduler->msqlquery, "search", "0", rec_id); @@ -811,7 +813,7 @@ if (msql_row) { proginfo = gmyth_program_info_new(); - proginfo->chanid = g_string_new(msql_row[0]); + proginfo->xx_channel_id = (gint) g_ascii_strtoull (msql_row[0], NULL, 10); proginfo->recstartts = gmyth_util_string_to_time_val(msql_row[1]); proginfo->recendts = gmyth_util_string_to_time_val(msql_row[2]); @@ -825,7 +827,7 @@ proginfo->chancommfree = (gint) g_ascii_strtoull(msql_row[9], NULL, 10); proginfo->chanOutputFilters = g_string_new(msql_row[10]); proginfo->seriesid = g_string_new(msql_row[11]); - proginfo->programid = g_string_new(msql_row[12]); + proginfo->xx_program_id = g_string_new(msql_row[12]); proginfo->filesize = g_ascii_strtoull(msql_row[13], NULL, 10); proginfo->lastmodified = gmyth_util_string_to_time_val(msql_row[14]); @@ -959,7 +961,7 @@ if (msql_row) { proginfo = gmyth_program_info_new(); - proginfo->chanid = g_string_new(msql_row[0]); + proginfo->xx_channel_id = (gint) g_ascii_strtoull (msql_row[0], NULL, 10); proginfo->startts = gmyth_util_string_to_time_val(msql_row[23]); proginfo->endts = gmyth_util_string_to_time_val(msql_row[24]); @@ -978,7 +980,7 @@ (gint) g_ascii_strtoull(msql_row[9], NULL, 10); proginfo->chanOutputFilters = g_string_new(msql_row[10]); proginfo->seriesid = g_string_new(msql_row[11]); - proginfo->programid = g_string_new(msql_row[12]); + proginfo->xx_program_id = g_string_new(msql_row[12]); proginfo->filesize = g_ascii_strtoull(msql_row[13], NULL, 10); proginfo->lastmodified = @@ -1042,7 +1044,7 @@ gmyth_string_list_append_string(slist, program->subtitle); /* 1 */ gmyth_string_list_append_string(slist, program->description); /* 2 */ gmyth_string_list_append_string(slist, program->category); /* 3 */ - gmyth_string_list_append_string(slist, program->chanid); /* 4 */ + gmyth_string_list_append_int(slist, program->xx_channel_id); /* 4 */ gmyth_string_list_append_string(slist, program->chanstr); /* 5 */ gmyth_string_list_append_string(slist, program->chansign); /* 6 */ gmyth_string_list_append_string(slist, program->channame); /* 7 */ @@ -1098,7 +1100,7 @@ gmyth_string_list_append_int(slist, program->chancommfree); /* 31 */ gmyth_string_list_append_string(slist, program->chanOutputFilters); /* 32 */ gmyth_string_list_append_string(slist, program->seriesid); /* 33 */ - gmyth_string_list_append_string(slist, program->programid); /* 34 */ + gmyth_string_list_append_string(slist, program->xx_program_id); /* 34 */ gmyth_string_list_append_int(slist, program->lastmodified != NULL ? @@ -1170,8 +1172,10 @@ void gmyth_recorded_info_free(RecordedInfo * info) { - if (info->channel_id) - g_string_free (info->channel_id, TRUE); + g_return_if_fail (info != NULL); + + if (info->xx_program_id) + g_string_free (info->xx_program_id, TRUE); if (info->title != NULL) g_string_free(info->title, TRUE); @@ -1220,8 +1224,8 @@ g_return_if_fail(info != NULL); - if (info->channel_id) - g_string_free (info->channel_id, TRUE); + if (info->xx_program_id) + g_string_free (info->xx_program_id, TRUE); if (info->title != NULL) g_string_free(info->title, TRUE); diff -r 83851e17c385 -r 6b565181036e gmyth/src/gmyth_scheduler.h --- a/gmyth/src/gmyth_scheduler.h Tue Jan 15 17:44:34 2008 +0000 +++ b/gmyth/src/gmyth_scheduler.h Wed Jan 23 20:04:22 2008 +0000 @@ -99,8 +99,8 @@ typedef struct { guint schedule_id; - GString *program_id; - GString *channel_id; + gint xx_channel_id; + GString *xx_program_id; GTimeVal *start_time; GTimeVal *end_time; @@ -119,8 +119,8 @@ typedef struct { guint record_id; - guint program_id; - GString *channel_id; + gint xx_channel_id; + GString *xx_program_id; GTimeVal *start_time; GTimeVal *end_time;