1.1 --- a/gmyth/src/gmyth_backendinfo.h Thu Jun 14 20:40:47 2007 +0100
1.2 +++ b/gmyth/src/gmyth_backendinfo.h Tue Jun 19 22:01:13 2007 +0100
1.3 @@ -34,12 +34,19 @@
1.4 #include "gmyth_uri.h"
1.5
1.6 G_BEGIN_DECLS
1.7 -#define GMYTH_BACKEND_INFO_TYPE (gmyth_backend_info_get_type ())
1.8 -#define GMYTH_BACKEND_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfo))
1.9 -#define GMYTH_BACKEND_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfoClass))
1.10 -#define IS_GMYTH_BACKEND_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_BACKEND_INFO_TYPE))
1.11 -#define IS_GMYTH_BACKEND_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_BACKEND_INFO_TYPE))
1.12 -#define GMYTH_BACKEND_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfoClass))
1.13 +#define GMYTH_BACKEND_INFO_TYPE \
1.14 + (gmyth_backend_info_get_type ())
1.15 +#define GMYTH_BACKEND_INFO(obj) \
1.16 + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfo))
1.17 +#define GMYTH_BACKEND_INFO_CLASS(klass) \
1.18 + (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfoClass))
1.19 +#define IS_GMYTH_BACKEND_INFO(obj) \
1.20 + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_BACKEND_INFO_TYPE))
1.21 +#define IS_GMYTH_BACKEND_INFO_CLASS(klass) \
1.22 + (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_BACKEND_INFO_TYPE))
1.23 +#define GMYTH_BACKEND_INFO_GET_CLASS(obj) \
1.24 + (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_BACKEND_INFO_TYPE, GMythBackendInfoClass))
1.25 +
1.26 typedef struct _GMythBackendInfo GMythBackendInfo;
1.27 typedef struct _GMythBackendInfoClass GMythBackendInfoClass;
1.28
1.29 @@ -56,7 +63,6 @@
1.30
1.31 struct _GMythBackendInfo {
1.32 GObject parent;
1.33 -
1.34 /** The backend hostname or ip address. */
1.35 gchar *hostname;
1.36 /** The username to connect to the mysql server. */
1.37 @@ -69,54 +75,36 @@
1.38 gint port;
1.39 /** The backend status port for http connection */
1.40 gint status_port;
1.41 - // gchar *path;
1.42 -
1.43 - // GMythURI* uri;
1.44 };
1.45
1.46
1.47 -GType gmyth_backend_info_get_type(void);
1.48 -GMythBackendInfo *gmyth_backend_info_new(void);
1.49 -GMythBackendInfo *gmyth_backend_info_new_full(const gchar * hostname,
1.50 - const gchar * username,
1.51 - const gchar * password,
1.52 - const gchar * db_name,
1.53 - gint port);
1.54 -GMythBackendInfo *gmyth_backend_info_new_with_uri(const gchar * uri_str);
1.55 -void gmyth_backend_info_set_hostname(GMythBackendInfo *
1.56 - backend_info,
1.57 - const gchar * hostname);
1.58 -void gmyth_backend_info_set_username(GMythBackendInfo *
1.59 - backend_info,
1.60 - const gchar * username);
1.61 -void gmyth_backend_info_set_password(GMythBackendInfo *
1.62 - backend_info,
1.63 - const gchar * password);
1.64 -void gmyth_backend_info_set_db_name(GMythBackendInfo *
1.65 - backend_info,
1.66 - const gchar * db_name);
1.67 -void gmyth_backend_info_set_port(GMythBackendInfo *
1.68 - backend_info, gint port);
1.69 -void gmyth_backend_info_set_status_port(GMythBackendInfo *
1.70 - backend_info,
1.71 - gint port);
1.72 -
1.73 -const gchar *gmyth_backend_info_get_hostname(GMythBackendInfo *
1.74 - backend_info);
1.75 -const gchar *gmyth_backend_info_get_username(GMythBackendInfo *
1.76 - backend_info);
1.77 -const gchar *gmyth_backend_info_get_password(GMythBackendInfo *
1.78 - backend_info);
1.79 -const gchar *gmyth_backend_info_get_db_name(GMythBackendInfo *
1.80 - backend_info);
1.81 -gint gmyth_backend_info_get_port(GMythBackendInfo *
1.82 - backend_info);
1.83 -
1.84 -GMythURI *gmyth_backend_info_get_uri(GMythBackendInfo *
1.85 - backend_info);
1.86 -
1.87 -gboolean gmyth_backend_info_is_local_file(GMythBackendInfo *
1.88 - backend_info);
1.89 +GType gmyth_backend_info_get_type (void) G_GNUC_CONST;;
1.90 +GMythBackendInfo* gmyth_backend_info_new (void);
1.91 +GMythBackendInfo* gmyth_backend_info_new_full (const gchar *hostname,
1.92 + const gchar *username,
1.93 + const gchar *password,
1.94 + const gchar *db_name,
1.95 + gint port);
1.96 +GMythBackendInfo* gmyth_backend_info_new_with_uri (const gchar *uri_str);
1.97 +void gmyth_backend_info_set_hostname (GMythBackendInfo *backend_info,
1.98 + const gchar *hostname);
1.99 +void gmyth_backend_info_set_username (GMythBackendInfo *backend_info,
1.100 + const gchar *username);
1.101 +void gmyth_backend_info_set_password (GMythBackendInfo *backend_info,
1.102 + const gchar *password);
1.103 +void gmyth_backend_info_set_db_name (GMythBackendInfo *backend_info,
1.104 + const gchar *db_name);
1.105 +void gmyth_backend_info_set_port (GMythBackendInfo *backend_info,
1.106 + gint port);
1.107 +void gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info,
1.108 + gint port);
1.109 +const gchar* gmyth_backend_info_get_hostname (GMythBackendInfo *backend_info);
1.110 +const gchar* gmyth_backend_info_get_username (GMythBackendInfo *backend_info);
1.111 +const gchar* gmyth_backend_info_get_password (GMythBackendInfo *backend_info);
1.112 +const gchar* gmyth_backend_info_get_db_name (GMythBackendInfo *backend_info);
1.113 +gint gmyth_backend_info_get_port (GMythBackendInfo *backend_info);
1.114 +GMythURI* gmyth_backend_info_get_uri (GMythBackendInfo *backend_info);
1.115 +gboolean gmyth_backend_info_is_local_file (GMythBackendInfo *backend_info);
1.116
1.117 G_END_DECLS
1.118 #endif /* __GMYTH_BACKEND_INFO_H__ */
2.1 --- a/gmyth/src/gmyth_common.h Thu Jun 14 20:40:47 2007 +0100
2.2 +++ b/gmyth/src/gmyth_common.h Tue Jun 19 22:01:13 2007 +0100
2.3 @@ -53,14 +53,11 @@
2.4
2.5 } GMythChannelInfo;
2.6
2.7 -void gmyth_free_channel_list(GList * list);
2.8 -void gmyth_free_program_list(GList * list);
2.9 -
2.10 -void gmyth_channel_info_free(GMythChannelInfo * channel_info);
2.11 -
2.12 -
2.13 -void gmyth_channel_info_print(GMythChannelInfo * channel_info);
2.14 -void gmyth_program_info_print(GMythProgramInfo * program_info);
2.15 +void gmyth_free_channel_list (GList *list);
2.16 +void gmyth_free_program_list (GList *list);
2.17 +void gmyth_channel_info_free (GMythChannelInfo *channel_info);
2.18 +void gmyth_channel_info_print (GMythChannelInfo *channel_info);
2.19 +void gmyth_program_info_print (GMythProgramInfo *program_info);
2.20
2.21 G_END_DECLS
2.22 #endif /* GMYTH_COMMON_H_ */
3.1 --- a/gmyth/src/gmyth_epg.h Thu Jun 14 20:40:47 2007 +0100
3.2 +++ b/gmyth/src/gmyth_epg.h Tue Jun 19 22:01:13 2007 +0100
3.3 @@ -60,31 +60,26 @@
3.4 GMythBackendInfo *backend_info;
3.5 };
3.6
3.7 -GType gmyth_epg_get_type(void);
3.8 -
3.9 -GMythEPG *gmyth_epg_new(void);
3.10 -
3.11 -gboolean gmyth_epg_connect(GMythEPG * gmyth_epg,
3.12 - GMythBackendInfo * backend_info);
3.13 -gboolean gmyth_epg_disconnect(GMythEPG * gmyth_epg);
3.14 -
3.15 -gint gmyth_epg_get_channel_list(GMythEPG * gmyth_epg,
3.16 - GList ** glist_ptr);
3.17 -gint gmyth_epg_get_program_list(GMythEPG * gmyth_epg,
3.18 - GList ** proglist,
3.19 - const gint chanNum,
3.20 - GTimeVal * starttime,
3.21 - GTimeVal * endtime);
3.22 -
3.23 -GMythChannelInfo *gmyth_epg_get_channel_info(GMythEPG * gmyth_epg,
3.24 - gint channel_id);
3.25 -
3.26 -
3.27 -gboolean gmyth_epg_channel_has_icon(GMythEPG * gmyth_epg,
3.28 - GMythChannelInfo * channel);
3.29 -gboolean gmyth_epg_channel_get_icon(GMythEPG * gmyth_epg,
3.30 - GMythChannelInfo * channel,
3.31 - guint8 ** data, guint * length);
3.32 +GType gmyth_epg_get_type (void) G_GNUC_CONST;;
3.33 +GMythEPG* gmyth_epg_new (void);
3.34 +gboolean gmyth_epg_connect (GMythEPG *gmyth_epg,
3.35 + GMythBackendInfo *backend_info);
3.36 +gboolean gmyth_epg_disconnect (GMythEPG *gmyth_epg);
3.37 +gint gmyth_epg_get_channel_list (GMythEPG *gmyth_epg,
3.38 + GList **glist_ptr);
3.39 +gint gmyth_epg_get_program_list (GMythEPG *gmyth_epg,
3.40 + GList **proglist,
3.41 + gint chanNum,
3.42 + GTimeVal *starttime,
3.43 + GTimeVal *endtime);
3.44 +GMythChannelInfo*gmyth_epg_get_channel_info (GMythEPG *gmyth_epg,
3.45 + gint channel_id);
3.46 +gboolean gmyth_epg_channel_has_icon (GMythEPG *gmyth_epg,
3.47 + GMythChannelInfo *channel);
3.48 +gboolean gmyth_epg_channel_get_icon (GMythEPG *gmyth_epg,
3.49 + GMythChannelInfo *channel,
3.50 + guint8 **data,
3.51 + guint *length);
3.52
3.53 G_END_DECLS
3.54 #endif /* GMYTH_EPG_H_ */
4.1 --- a/gmyth/src/gmyth_file.h Thu Jun 14 20:40:47 2007 +0100
4.2 +++ b/gmyth/src/gmyth_file.h Tue Jun 19 22:01:13 2007 +0100
4.3 @@ -48,7 +48,8 @@
4.4 #define IS_GMYTH_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_FILE_TYPE))
4.5 #define IS_GMYTH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TYPE))
4.6 #define GMYTH_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TYPE, GMythFileClass))
4.7 - typedef enum {
4.8 +
4.9 +typedef enum {
4.10 GMYTH_FILE_READ_OK = 0,
4.11 GMYTH_FILE_READ_NEXT_PROG_CHAIN = 1,
4.12 GMYTH_FILE_READ_ERROR = 2,
4.13 @@ -68,23 +69,22 @@
4.14 GObjectClass parent_class;
4.15 };
4.16
4.17 -GType gmyth_file_get_type(void);
4.18 -GMythFile *gmyth_file_new(GMythBackendInfo * backend_info);
4.19 -gchar *gmyth_file_get_file_name(GMythFile * file);
4.20 -void gmyth_file_set_file_name(GMythFile * file,
4.21 - const gchar * filename);
4.22 -gboolean gmyth_file_setup(GMythFile * file, const gchar * filename);
4.23 -void gmyth_file_close(GMythFile * file);
4.24 -gboolean gmyth_file_is_open(GMythFile * file);
4.25 -
4.26 -guint64 gmyth_file_get_filesize(GMythFile * file);
4.27 -void gmyth_file_set_filesize(GMythFile * file,
4.28 - guint64 filesize);
4.29 -
4.30 -gint64 gmyth_file_get_offset(GMythFile * file);
4.31 -void gmyth_file_set_offset(GMythFile * file, gint64 offset);
4.32 -
4.33 -gchar *gmyth_file_get_uri(GMythFile * file);
4.34 +GType gmyth_file_get_type (void);
4.35 +GMythFile *gmyth_file_new (GMythBackendInfo *backend_info);
4.36 +gchar *gmyth_file_get_file_name (GMythFile *file);
4.37 +void gmyth_file_set_file_name (GMythFile *file,
4.38 + const gchar *filename);
4.39 +gboolean gmyth_file_setup (GMythFile *file,
4.40 + const gchar *filename);
4.41 +void gmyth_file_close (GMythFile *file);
4.42 +gboolean gmyth_file_is_open (GMythFile *file);
4.43 +guint64 gmyth_file_get_filesize (GMythFile *file);
4.44 +void gmyth_file_set_filesize (GMythFile *file,
4.45 + guint64 filesize);
4.46 +gint64 gmyth_file_get_offset (GMythFile *file);
4.47 +void gmyth_file_set_offset (GMythFile *file,
4.48 + gint64 offset);
4.49 +gchar *gmyth_file_get_uri (GMythFile *file);
4.50
4.51 G_END_DECLS
4.52 #endif /* __GMYTH_FILE_H__ */
5.1 --- a/gmyth/src/gmyth_scheduler.c Thu Jun 14 20:40:47 2007 +0100
5.2 +++ b/gmyth/src/gmyth_scheduler.c Tue Jun 19 22:01:13 2007 +0100
5.3 @@ -347,6 +347,61 @@
5.4 return (*recorded_list == NULL) ? 0 : g_list_length(*recorded_list);
5.5 }
5.6
5.7 +RecordedInfo*
5.8 +gmyth_scheduler_get_recorded_info (GMythScheduler *scheduler,
5.9 + gint record_id)
5.10 +{
5.11 + RecordedInfo *record;
5.12 + MYSQL_RES *msql_res;
5.13 + GString *query_str = g_string_new("");
5.14 +
5.15 + assert(scheduler);
5.16 +
5.17 + g_string_printf(query_str,
5.18 + "SELECT recordid,programid,chanid,starttime,progstart,"
5.19 + "endtime,progend,title,subtitle,description,category,"
5.20 + "filesize,basename FROM recorded "
5.21 + "WHERE recgroup != 'LiveTV' AND recordid = %d", record_id);
5.22 +
5.23 + if (scheduler->msqlquery == NULL) {
5.24 + g_warning("[%s] Scheduler db connection not initialized",
5.25 + __FUNCTION__);
5.26 + return -1;
5.27 + }
5.28 +
5.29 + msql_res =
5.30 + gmyth_query_process_statement(scheduler->msqlquery,
5.31 + query_str->str);
5.32 +
5.33 + if (msql_res == NULL) {
5.34 + g_warning("DB retrieval of recording list failed");
5.35 + return -1;
5.36 + } else {
5.37 + MYSQL_ROW row;
5.38 + row = mysql_fetch_row(msql_res);
5.39 + if (row != NULL) {
5.40 + record = g_new0(RecordedInfo, 1);
5.41 + record->record_id = (guint) g_ascii_strtoull(row[0], NULL, 10);
5.42 + record->program_id = (guint) g_ascii_strtoull(row[1], NULL, 10);
5.43 + record->channel_id = (guint) g_ascii_strtoull(row[2], NULL, 10);
5.44 + record->start_time = gmyth_util_string_to_time_val(row[3]);
5.45 + record->end_time = gmyth_util_string_to_time_val(row[5]);
5.46 + record->title = g_string_new(row[7]);
5.47 + record->subtitle = g_string_new(row[8]);
5.48 + record->description = g_string_new(row[9]);
5.49 + record->category = g_string_new(row[10]);
5.50 + record->filesize = g_ascii_strtoull(row[11], NULL, 10);
5.51 + record->basename = g_string_new(row[12]);
5.52 + }
5.53 + }
5.54 +
5.55 + mysql_free_result(msql_res);
5.56 + g_string_free(query_str, TRUE);
5.57 +
5.58 + return record;
5.59 +}
5.60 +
5.61 +
5.62 static void
5.63 _set_value(GMythQuery * myth_query, char *field, gchar * value,
5.64 gint rec_id)
6.1 --- a/gmyth/src/gmyth_scheduler.h Thu Jun 14 20:40:47 2007 +0100
6.2 +++ b/gmyth/src/gmyth_scheduler.h Tue Jun 19 22:01:13 2007 +0100
6.3 @@ -130,47 +130,37 @@
6.4 } RecordedInfo;
6.5
6.6
6.7 -GType gmyth_scheduler_get_type(void);
6.8 +GType gmyth_scheduler_get_type (void);
6.9
6.10 -GMythScheduler *gmyth_scheduler_new();
6.11 -gboolean gmyth_scheduler_connect(GMythScheduler * scheduler,
6.12 - GMythBackendInfo * backend_info);
6.13 -gboolean gmyth_scheduler_connect_with_timeout(GMythScheduler *
6.14 - scheduler,
6.15 - GMythBackendInfo *
6.16 - backend_info,
6.17 +GMythScheduler *gmyth_scheduler_new (void);
6.18 +gboolean gmyth_scheduler_connect (GMythScheduler * scheduler,
6.19 + GMythBackendInfo * backend_info);
6.20 +gboolean gmyth_scheduler_connect_with_timeout(GMythScheduler * scheduler,
6.21 + GMythBackendInfo * backend_info,
6.22 guint timeout);
6.23 -gboolean gmyth_scheduler_disconnect(GMythScheduler * scheduler);
6.24 -
6.25 -gint gmyth_scheduler_get_schedule_list(GMythScheduler *
6.26 - scheduler,
6.27 - GList ** sched_list);
6.28 -gint gmyth_scheduler_get_recorded_list(GMythScheduler *
6.29 - scheduler,
6.30 - GList ** rec_list);
6.31 -
6.32 -GMythProgramInfo *gmyth_scheduler_get_recorded(GMythScheduler * scheduler,
6.33 - GString * channel,
6.34 - GTimeVal * starttime);
6.35 -
6.36 -gint gmyth_scheduler_add_schedule(GMythScheduler * scheduler,
6.37 - ScheduleInfo * schedule_info);
6.38 -
6.39 -gint gmyth_scheduler_delete_schedule(GMythScheduler * scheduler,
6.40 - gint record_id);
6.41 -gint gmyth_scheduler_delete_recorded(GMythScheduler * scheduler,
6.42 - gint record_id);
6.43 -
6.44 -void gmyth_scheduler_recorded_info_get_preview(RecordedInfo *
6.45 - info,
6.46 - GByteArray *
6.47 - data);
6.48 -
6.49 -void gmyth_recorded_info_free(RecordedInfo * info);
6.50 -void gmyth_schedule_info_free(ScheduleInfo * info);
6.51 -
6.52 -void gmyth_recorded_info_list_free(GList * list);
6.53 -void gmyth_schedule_info_list_free(GList * list);
6.54 +gboolean gmyth_scheduler_disconnect (GMythScheduler * scheduler);
6.55 +gint gmyth_scheduler_get_schedule_list (GMythScheduler * scheduler,
6.56 + GList ** sched_list);
6.57 +gint gmyth_scheduler_get_recorded_list (GMythScheduler * scheduler,
6.58 + GList ** rec_list);
6.59 +RecordedInfo* gmyth_scheduler_get_recorded_info (GMythScheduler *scheduler,
6.60 + gint record_id);
6.61 +GMythProgramInfo *gmyth_scheduler_get_recorded (GMythScheduler * scheduler,
6.62 + GString * channel,
6.63 + GTimeVal * starttime);
6.64 +gint gmyth_scheduler_add_schedule (GMythScheduler * scheduler,
6.65 + ScheduleInfo * schedule_info);
6.66 +gint gmyth_scheduler_delete_schedule (GMythScheduler * scheduler,
6.67 + gint record_id);
6.68 +gint gmyth_scheduler_delete_recorded (GMythScheduler * scheduler,
6.69 + gint record_id);
6.70 +void gmyth_scheduler_recorded_info_get_preview
6.71 + (RecordedInfo * info,
6.72 + GByteArray * data);
6.73 +void gmyth_recorded_info_free (RecordedInfo * info);
6.74 +void gmyth_schedule_info_free (ScheduleInfo * info);
6.75 +void gmyth_recorded_info_list_free (GList * list);
6.76 +void gmyth_schedule_info_list_free (GList * list);
6.77
6.78 G_END_DECLS
6.79 #endif /* __GMYTH_SCHEDULER_H__ */