|
From: <ren...@us...> - 2007-12-21 14:07:51
|
Revision: 892
http://gmyth.svn.sourceforge.net/gmyth/?rev=892&view=rev
Author: renatofilho
Date: 2007-12-21 06:07:54 -0800 (Fri, 21 Dec 2007)
Log Message:
-----------
create help function: gmyth_scheduler_add_schedule_program
Modified Paths:
--------------
trunk/gmyth/debian/changelog
trunk/gmyth/src/gmyth_common.h
trunk/gmyth/src/gmyth_epg.c
trunk/gmyth/src/gmyth_scheduler.c
trunk/gmyth/src/gmyth_scheduler.h
Modified: trunk/gmyth/debian/changelog
===================================================================
--- trunk/gmyth/debian/changelog 2007-11-21 15:14:05 UTC (rev 891)
+++ trunk/gmyth/debian/changelog 2007-12-21 14:07:54 UTC (rev 892)
@@ -1,4 +1,4 @@
-gmyth (0.4.1-indt1) unstable; urgency=low
+gmyth (0.4.2-chinook-indt1) unstable; urgency=low
* Patch from Tim Philipp to fix debian/control libcurl dependency
Modified: trunk/gmyth/src/gmyth_common.h
===================================================================
--- trunk/gmyth/src/gmyth_common.h 2007-11-21 15:14:05 UTC (rev 891)
+++ trunk/gmyth/src/gmyth_common.h 2007-12-21 14:07:54 UTC (rev 892)
@@ -34,10 +34,10 @@
#include "gmyth_programinfo.h"
G_BEGIN_DECLS
-/**
- * The GMythChannelInfo structure represents the channel information
- * stored in the backend database.
- */
+ /**
+ * The GMythChannelInfo structure represents the channel information
+ * stored in the backend database.
+ */
typedef struct {
/** The channel ID in backend database */
gint channel_ID;
@@ -50,7 +50,6 @@
/** The channel icon path in the backend database */
GString *channel_icon;
-
} GMythChannelInfo;
void gmyth_free_channel_list (GList *list);
Modified: trunk/gmyth/src/gmyth_epg.c
===================================================================
--- trunk/gmyth/src/gmyth_epg.c 2007-11-21 15:14:05 UTC (rev 891)
+++ trunk/gmyth/src/gmyth_epg.c 2007-12-21 14:07:54 UTC (rev 892)
@@ -266,10 +266,17 @@
" channel.name, program.previouslyshown, channel.commfree, "
" channel.outputfilters, program.seriesid, program.programid, "
" program.airdate, program.stars, program.originalairdate, "
- " program.category_type, oldrecstatus.recordid, "
+ " program.category_type, record.recordid, "
" oldrecstatus.rectype, oldrecstatus.recstatus, "
- " oldrecstatus.findid " "FROM program "
+ " oldrecstatus.findid "
+ "FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
+ "LEFT JOIN record ON "
+ " program.chanid = record.chanid AND "
+ " DATE (program.starttime) = record.startdate AND "
+ " TIME (program.starttime) = record.starttime AND "
+ " DATE (program.endtime) = record.enddate AND "
+ " TIME (program.endtime) = record.endtime "
"LEFT JOIN oldrecorded AS oldrecstatus ON "
" program.title = oldrecstatus.title AND "
" channel.callsign = oldrecstatus.station AND "
@@ -321,6 +328,7 @@
p->lastmodified->tv_sec = p->startts->tv_sec;
p->lastmodified->tv_usec = p->startts->tv_usec;
+
p->title = g_string_new(row[3]);
p->subtitle = g_string_new(row[4]);
p->description = g_string_new(row[5]);
@@ -345,6 +353,8 @@
}
p->catType = g_string_new(row[18]);
+ if (row[19] != NULL)
+ p->recordid = g_ascii_strtoull(row[19], NULL, 10);
*proglist = g_list_append(*proglist, p);
Modified: trunk/gmyth/src/gmyth_scheduler.c
===================================================================
--- trunk/gmyth/src/gmyth_scheduler.c 2007-11-21 15:14:05 UTC (rev 891)
+++ trunk/gmyth/src/gmyth_scheduler.c 2007-12-21 14:07:54 UTC (rev 892)
@@ -219,7 +219,7 @@
g_string_printf(query_str,
"SELECT recordid,programid,chanid,starttime,startdate,"
- "endtime,enddate,title,subtitle,description,category,type,parentid FROM record;");
+ "endtime,enddate,title,subtitle,description,category,type,parentid,seriesid FROM record;");
if (scheduler->msqlquery == NULL) {
g_warning("[%s] Scheduler db connection not initialized",
@@ -244,10 +244,8 @@
schedule->schedule_id =
(guint) g_ascii_strtoull(row[0], NULL, 10);
- schedule->program_id =
- (guint) g_ascii_strtoull(row[1], NULL, 10);
- schedule->channel_id =
- (guint) g_ascii_strtoull(row[2], NULL, 10);
+ schedule->program_id = g_string_new (row[1]);
+ schedule->channel_id = g_string_new (row[2]);
/*
* generate a time_t from a time and a date db field
@@ -278,6 +276,8 @@
schedule->parentid = (gint) g_ascii_strtoull (row[12], NULL, 10);
}
+ schedule->seriesid = g_string_new (row[13]);
+
(*schedule_list) = g_list_append(*(schedule_list), schedule);
}
}
@@ -307,7 +307,7 @@
g_string_printf(query_str,
"SELECT recordid,programid,chanid,starttime,progstart,"
"endtime,progend,title,subtitle,description,category,"
- "filesize,basename FROM recorded WHERE recgroup != 'LiveTV'");
+ "filesize,basename,seriesid FROM recorded WHERE recgroup != 'LiveTV'");
if (scheduler->msqlquery == NULL) {
g_warning("[%s] Scheduler db connection not initialized",
@@ -333,9 +333,7 @@
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 =
- (guint) g_ascii_strtoull(row[2], NULL, 10);
-
+ record->channel_id = g_string_new (row[2]);
record->start_time = gmyth_util_string_to_time_val(row[3]);
record->end_time = gmyth_util_string_to_time_val(row[5]);
@@ -345,6 +343,7 @@
record->category = g_string_new(row[10]);
record->filesize = g_ascii_strtoull(row[11], NULL, 10);
record->basename = g_string_new(row[12]);
+ record->seriesid = g_string_new(row[13]);
(*recorded_list) = g_list_append((*recorded_list), record);
}
@@ -369,7 +368,7 @@
g_string_printf(query_str,
"SELECT recordid,programid,chanid,starttime,progstart,"
"endtime,progend,title,subtitle,description,category,"
- "filesize,basename FROM recorded "
+ "filesize,basename,seriesid FROM recorded "
"WHERE recgroup != 'LiveTV' AND basename = '%s'", basename);
if (scheduler->msqlquery == NULL) {
@@ -392,7 +391,7 @@
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 = (guint) g_ascii_strtoull(row[2], NULL, 10);
+ record->channel_id = g_string_new (row[2]);
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]);
@@ -401,6 +400,7 @@
record->category = g_string_new(row[10]);
record->filesize = g_ascii_strtoull(row[11], NULL, 10);
record->basename = g_string_new(row[12]);
+ record->seriesid = g_string_new(row[13]);
}
}
@@ -434,6 +434,46 @@
g_free(str_value);
}
+ScheduleInfo*
+gmyth_scheduler_add_schedule_program (GMythScheduler * scheduler,
+ GMythProgramInfo *program,
+ GMythScheduleType type)
+{
+ 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->start_time = g_new0 (GTimeVal, 1);
+ *info->start_time = *program->startts;
+ info->end_time = g_new0 (GTimeVal, 1);
+ *info->end_time = *program->endts;
+ info->seriesid = g_string_new (program->seriesid->str);
+ info->title = g_string_new (program->title->str);
+ info->subtitle = g_string_new (program->subtitle->str);
+ info->description = g_string_new (program->description->str);
+ info->category = g_string_new (program->category->str);
+ info->type = type;
+
+ if (gmyth_scheduler_add_schedule_full (scheduler, info, type))
+ {
+ if (!program->recstartts)
+ program->recstartts = g_new0 (GTimeVal, 1);
+ *program->recstartts = *info->start_time;
+
+ if (!program->recendts)
+ program->recendts = g_new0 (GTimeVal, 1);
+ *program->recendts = *info->end_time;
+
+ program->recordid = info->schedule_id;
+ return info;
+ }
+
+ gmyth_schedule_info_free (info);
+ return NULL;
+}
+
+
gboolean
gmyth_scheduler_add_schedule_full (GMythScheduler * scheduler,
ScheduleInfo * schedule_info, GMythScheduleType type)
@@ -459,8 +499,8 @@
// Retrieves the station info
query_str =
g_strdup_printf
- ("SELECT callsign FROM channel WHERE chanid = \"%d\";",
- schedule_info->channel_id);
+ ("SELECT callsign FROM channel WHERE chanid = \"%s\";",
+ schedule_info->channel_id->str);
msql_res =
gmyth_query_process_statement(scheduler->msqlquery, query_str);
if (msql_res == NULL) {
@@ -477,8 +517,8 @@
g_free(query_str);
// _set_value (field, value, id);
- _set_int_value(scheduler->msqlquery, "chanid",
- schedule_info->channel_id, rec_id);
+ _set_value(scheduler->msqlquery, "chanid",
+ schedule_info->channel_id->str, rec_id);
_set_value(scheduler->msqlquery, "station", station, rec_id);
_set_value(scheduler->msqlquery, "title", schedule_info->title->str,
rec_id);
@@ -506,6 +546,8 @@
// (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528),
// rec_id);
+ _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);
@@ -1128,6 +1170,9 @@
void
gmyth_recorded_info_free(RecordedInfo * info)
{
+ if (info->channel_id)
+ g_string_free (info->channel_id, TRUE);
+
if (info->title != NULL)
g_string_free(info->title, TRUE);
@@ -1175,6 +1220,9 @@
g_return_if_fail(info != NULL);
+ if (info->channel_id)
+ g_string_free (info->channel_id, TRUE);
+
if (info->title != NULL)
g_string_free(info->title, TRUE);
Modified: trunk/gmyth/src/gmyth_scheduler.h
===================================================================
--- trunk/gmyth/src/gmyth_scheduler.h 2007-11-21 15:14:05 UTC (rev 891)
+++ trunk/gmyth/src/gmyth_scheduler.h 2007-12-21 14:07:54 UTC (rev 892)
@@ -99,12 +99,13 @@
typedef struct {
guint schedule_id;
- guint program_id;
- guint channel_id;
+ GString *program_id;
+ GString *channel_id;
GTimeVal *start_time;
GTimeVal *end_time;
+ GString *seriesid;
GString *title;
GString *subtitle;
GString *description;
@@ -119,11 +120,12 @@
typedef struct {
guint record_id;
guint program_id;
- guint channel_id;
+ GString *channel_id;
GTimeVal *start_time;
GTimeVal *end_time;
+ GString *seriesid;
GString *title;
GString *subtitle;
GString *description;
@@ -162,6 +164,9 @@
GMythProgramInfo* gmyth_scheduler_get_recorded (GMythScheduler * scheduler,
GString * channel,
GTimeVal * starttime);
+ScheduleInfo* gmyth_scheduler_add_schedule_program (GMythScheduler * scheduler,
+ GMythProgramInfo *program,
+ GMythScheduleType type);
gint gmyth_scheduler_add_schedule (GMythScheduler * scheduler,
ScheduleInfo * schedule_info);
gboolean gmyth_scheduler_add_schedule_full (GMythScheduler * scheduler,
@@ -170,7 +175,7 @@
gboolean gmyth_scheduler_add_exception (GMythScheduler *scheduler,
gint schedule_id,
ScheduleInfo *exception_info);
-gint gmyth_scheduler_delete_schedule (GMythScheduler * scheduler,
+gboolean gmyth_scheduler_delete_schedule (GMythScheduler * scheduler,
gint record_id);
gint gmyth_scheduler_delete_recorded (GMythScheduler * scheduler,
gint record_id);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|