[svn r292] GObject format to the GMythProgramInfo, new actions such as GET_PROGRAM_INFO and GET_CURRENT_RECORDER.
1.1 --- a/gmyth/src/gmyth_common.c Mon Jan 22 21:22:55 2007 +0000
1.2 +++ b/gmyth/src/gmyth_common.c Tue Jan 23 21:37:27 2007 +0000
1.3 @@ -104,6 +104,6 @@
1.4 free_program_data(gpointer data, gpointer user_data)
1.5 {
1.6 if(data)
1.7 - g_free((GMythProgramInfo*) data);
1.8 + g_object_unref((GMythProgramInfo*) data);
1.9 }
1.10
2.1 --- a/gmyth/src/gmyth_common.h Mon Jan 22 21:22:55 2007 +0000
2.2 +++ b/gmyth/src/gmyth_common.h Tue Jan 23 21:37:27 2007 +0000
2.3 @@ -31,6 +31,8 @@
2.4 #include <glib.h>
2.5 #include <time.h>
2.6
2.7 +#include "gmyth_programinfo.h"
2.8 +
2.9 G_BEGIN_DECLS
2.10
2.11 /**
2.12 @@ -39,118 +41,13 @@
2.13 */
2.14 typedef struct {
2.15 /** The channel ID in backend database */
2.16 - int channel_ID;
2.17 + gint channel_ID;
2.18
2.19 /** The channel name in backend database */
2.20 GString *channel_name;
2.21
2.22 } GMythChannelInfo;
2.23
2.24 -
2.25 -/**
2.26 - * The GMythProgramInfo structure represents a program information
2.27 - * stored in the database. It could be a program from the EPG data,
2.28 - * a program scheduled to be recorded, or a program already recorded.
2.29 - */
2.30 -typedef struct {
2.31 -
2.32 - /** The channel unique ID. */
2.33 - GString *chanid;
2.34 -
2.35 - /** The program start time. */
2.36 - GTimeVal* startts;
2.37 - /** The program end time. */
2.38 - GTimeVal* endts;
2.39 - /** The recording schedule start time. */
2.40 - GTimeVal* recstartts;
2.41 - /** The recording schedule end time */
2.42 - GTimeVal* recendts;
2.43 -
2.44 - /** The program title. */
2.45 - GString *title;
2.46 - /** The program subtitle. */
2.47 - GString *subtitle;
2.48 - /** The program description. */
2.49 - GString *description;
2.50 - /** The program category. */
2.51 - GString *category;
2.52 -
2.53 - GString *chanstr;
2.54 - GString *chansign;
2.55 - /** The associated channel name. */
2.56 - GString *channame;
2.57 - int chancommfree;
2.58 - GString *chanOutputFilters;
2.59 -
2.60 - GString *seriesid;
2.61 - /** The program unique id. */
2.62 - GString *programid;
2.63 - GString * catType;
2.64 -
2.65 - GString * sortTitle;
2.66 -
2.67 - /** A flag informing if the program has video or not. */
2.68 - gboolean isVideo;
2.69 - int lenMins;
2.70 -
2.71 - GString *year;
2.72 - double stars;
2.73 - int repeat;
2.74 -
2.75 - GTimeVal* originalAirDate;
2.76 - GTimeVal* lastmodified;
2.77 - GTimeVal* lastInUseTime;
2.78 -
2.79 - gboolean hasAirDate;
2.80 -
2.81 - int spread;
2.82 - int startCol;
2.83 -
2.84 -// enum RecStatusType recstatus;
2.85 -// enum RecStatusType oldrecstatus;
2.86 -// enum RecStatusType savedrecstatus;
2.87 - int recpriority2;
2.88 - int reactivate;
2.89 -
2.90 - int recordid;
2.91 - int parentid;
2.92 - //enum RecordingType rectype;
2.93 - //enum RecordingDupInType dupin;
2.94 - //enum RecordingDupMethodType dupmethod;
2.95 -
2.96 - /** The backend video source id associated to this program.*/
2.97 - int sourceid;
2.98 - /** the backend input id associated to this program.*/
2.99 - int inputid;
2.100 - /** The backend card id associated to this program.*/
2.101 - int cardid;
2.102 - gboolean shareable;
2.103 - gboolean duplicate;
2.104 -
2.105 - GString * schedulerid;
2.106 - int findid;
2.107 -
2.108 - int programflags;
2.109 - int transcoder;
2.110 -
2.111 - //proginfo->spread = -1;
2.112 - //proginfo->programflags = proginfo->getProgramFlags();
2.113 -
2.114 - GString *recgroup;
2.115 - GString *playgroup;
2.116 - int recpriority;
2.117 -
2.118 - /** The file size of the recorded program.*/
2.119 - long long filesize;
2.120 - /** The file name of the recorded program.*/
2.121 - GString *pathname;
2.122 - GString *hostname;
2.123 -
2.124 - /* AvailableStatusType availableStatus;*/
2.125 -
2.126 -} GMythProgramInfo;
2.127 -
2.128 -
2.129 void gmyth_free_channel_list(GList *list);
2.130 void gmyth_free_program_list(GList *list);
2.131
3.1 --- a/gmyth/src/gmyth_epg.c Mon Jan 22 21:22:55 2007 +0000
3.2 +++ b/gmyth/src/gmyth_epg.c Tue Jan 23 21:37:27 2007 +0000
3.3 @@ -36,6 +36,7 @@
3.4 #include <assert.h>
3.5
3.6 #include "gmyth_epg.h"
3.7 +#include "gmyth_programinfo.h"
3.8 #include "gmyth_util.h"
3.9 #include "gmyth_debug.h"
3.10
3.11 @@ -240,7 +241,7 @@
3.12 (*proglist) = NULL;
3.13 while ((row = mysql_fetch_row (res_set)) != NULL) {
3.14
3.15 - GMythProgramInfo *p = g_new0 (GMythProgramInfo, 1);
3.16 + GMythProgramInfo *p = gmyth_program_info_new ();
3.17 p->chanid = g_string_new (row[0]);
3.18
3.19 p->startts = gmyth_util_string_to_time_val (row[1]);
4.1 --- a/gmyth/src/gmyth_programinfo.c Mon Jan 22 21:22:55 2007 +0000
4.2 +++ b/gmyth/src/gmyth_programinfo.c Tue Jan 23 21:37:27 2007 +0000
4.3 @@ -31,7 +31,148 @@
4.4 #include "config.h"
4.5 #endif
4.6
4.7 +#include <stdlib.h>
4.8 +#include <string.h>
4.9 +#include <assert.h>
4.10 +
4.11 #include "gmyth_programinfo.h"
4.12 +#include "gmyth_util.h"
4.13 +#include "gmyth_debug.h"
4.14 +
4.15 +static void gmyth_program_info_class_init (GMythProgramInfoClass *klass);
4.16 +static void gmyth_program_info_init (GMythProgramInfo *object);
4.17 +
4.18 +static void gmyth_program_info_dispose (GObject *object);
4.19 +static void gmyth_program_info_finalize (GObject *object);
4.20 +
4.21 +G_DEFINE_TYPE(GMythProgramInfo, gmyth_program_info, G_TYPE_OBJECT)
4.22 +
4.23 +static void
4.24 +gmyth_program_info_class_init (GMythProgramInfoClass *klass)
4.25 +{
4.26 + GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
4.27 +
4.28 + gobject_class->dispose = gmyth_program_info_dispose;
4.29 + gobject_class->finalize = gmyth_program_info_finalize;
4.30 +}
4.31 +
4.32 +static void
4.33 +gmyth_program_info_init (GMythProgramInfo *gmyth_program_info)
4.34 +{
4.35 +
4.36 + gmyth_program_info->chanid = NULL;
4.37 +
4.38 + /** The program start time. */
4.39 + gmyth_program_info->startts = NULL;
4.40 + /** The program end time. */
4.41 + gmyth_program_info->endts = NULL;
4.42 + /** The recording schedule start time. */
4.43 + gmyth_program_info->recstartts = NULL;
4.44 + /** The recording schedule end time */
4.45 + gmyth_program_info->recendts = NULL;
4.46 +
4.47 + /** The program title. */
4.48 + gmyth_program_info->title = NULL;
4.49 + /** The program subtitle. */
4.50 + gmyth_program_info->subtitle = NULL;
4.51 + /** The program description. */
4.52 + gmyth_program_info->description = NULL;
4.53 + /** The program category. */
4.54 + gmyth_program_info->category = NULL;
4.55 +
4.56 + gmyth_program_info->chanstr = NULL;
4.57 + gmyth_program_info->chansign = NULL;
4.58 + /** The associated channel name. */
4.59 + gmyth_program_info->channame = NULL;
4.60 + gmyth_program_info->chancommfree = 0;
4.61 + gmyth_program_info->chanOutputFilters = NULL;
4.62 +
4.63 + gmyth_program_info->seriesid = NULL;
4.64 + /** The program unique id. */
4.65 + gmyth_program_info->programid = NULL;
4.66 + gmyth_program_info->catType = NULL;
4.67 +
4.68 + gmyth_program_info->sortTitle = NULL;
4.69 +
4.70 + /** A flag informing if the program has video or not. */
4.71 + gmyth_program_info->isVideo = FALSE;
4.72 + gmyth_program_info->lenMins = 0;
4.73 +
4.74 + gmyth_program_info->year = NULL;
4.75 + gmyth_program_info->stars = 0.0f;
4.76 + gmyth_program_info->repeat = 0;
4.77 +
4.78 + gmyth_program_info->originalAirDate = NULL;
4.79 + gmyth_program_info->lastmodified = NULL;
4.80 + gmyth_program_info->lastInUseTime = NULL;
4.81 +
4.82 + gmyth_program_info->hasAirDate = FALSE;
4.83 +
4.84 + gmyth_program_info->spread = 0;
4.85 + gmyth_program_info->startCol = 0;
4.86 +
4.87 + gmyth_program_info->recpriority2 = 0;
4.88 + gmyth_program_info->reactivate = 0;
4.89 +
4.90 + gmyth_program_info->recordid = 0;
4.91 + gmyth_program_info->parentid = 0;
4.92 +
4.93 + /** The backend video source id associated to this program.*/
4.94 + gmyth_program_info->sourceid = 0;
4.95 + /** the backend input id associated to this program.*/
4.96 + gmyth_program_info->inputid = 0;
4.97 + /** The backend card id associated to this program.*/
4.98 + gmyth_program_info->cardid = 0;
4.99 + gmyth_program_info->shareable = FALSE;
4.100 + gmyth_program_info->duplicate = FALSE;
4.101 +
4.102 + gmyth_program_info->schedulerid = NULL;
4.103 + gmyth_program_info->findid = 0;
4.104 +
4.105 + gmyth_program_info->programflags = 0;
4.106 + gmyth_program_info->transcoder = 0;
4.107 +
4.108 + gmyth_program_info->recgroup = NULL;
4.109 + gmyth_program_info->playgroup = NULL;
4.110 + gmyth_program_info->recpriority = 0;
4.111 +
4.112 + /** The file size of the recorded program.*/
4.113 + gmyth_program_info->filesize = -1;
4.114 +
4.115 + /** The file name of the recorded program.*/
4.116 + gmyth_program_info->pathname = NULL;
4.117 + gmyth_program_info->hostname = NULL;
4.118 +
4.119 +}
4.120 +
4.121 +static void
4.122 +gmyth_program_info_dispose (GObject *object)
4.123 +{
4.124 + GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object);
4.125 +
4.126 + G_OBJECT_CLASS (gmyth_program_info_parent_class)->dispose (object);
4.127 +}
4.128 +
4.129 +static void
4.130 +gmyth_program_info_finalize (GObject *object)
4.131 +{
4.132 + g_signal_handlers_destroy (object);
4.133 +
4.134 + G_OBJECT_CLASS (gmyth_program_info_parent_class)->finalize (object);
4.135 +}
4.136 +
4.137 +/**
4.138 + * Creates a new instance of GMythProgramInfo.
4.139 + *
4.140 + * @return a new instance of GMythProgramInfo.
4.141 + */
4.142 +GMythProgramInfo*
4.143 +gmyth_program_info_new (void)
4.144 +{
4.145 + GMythProgramInfo *program_info = GMYTH_PROGRAM_INFO (g_object_new(GMYTH_PROGRAM_INFO_TYPE, NULL));
4.146 +
4.147 + return program_info;
4.148 +}
4.149
4.150 GMythStringList*
4.151 gmyth_program_info_to_string_list (GMythProgramInfo *prog, GMythStringList *slist)
4.152 @@ -85,7 +226,54 @@
4.153 }
4.154
4.155 GMythProgramInfo*
4.156 -gmyth_program_info_from_string_list ()
4.157 +gmyth_program_info_from_string_list ( GMythStringList *slist )
4.158 {
4.159 - return NULL;
4.160 + GMythProgramInfo *prog = gmyth_program_info_new();
4.161 +
4.162 + g_return_val_if_fail (slist != NULL, NULL);
4.163 +
4.164 + prog->title = gmyth_string_list_read_string (slist);
4.165 + prog->subtitle = gmyth_string_list_read_string (slist);
4.166 + prog->description = gmyth_string_list_read_string (slist);
4.167 + prog->category = gmyth_string_list_read_string (slist);
4.168 + prog->chanid = gmyth_string_list_read_string (slist);
4.169 + prog->chanstr = gmyth_string_list_read_string (slist);
4.170 + prog->chansign = gmyth_string_list_read_string (slist);
4.171 + prog->channame = gmyth_string_list_read_string (slist);
4.172 + prog->pathname = gmyth_string_list_read_string (slist);
4.173 + prog->filesize = gmyth_string_list_read_int64 (slist);
4.174 +
4.175 + gmyth_string_list_read_int (slist); //DATETIME_TO_LIST(startts)
4.176 + gmyth_string_list_read_int (slist); //DATETIME_TO_LIST(endts)
4.177 + prog->duplicate = gmyth_string_list_read_int (slist);
4.178 + prog->shareable = gmyth_string_list_read_int (slist);
4.179 + prog->findid = gmyth_string_list_read_int (slist);
4.180 + prog->hostname = gmyth_string_list_read_string (slist);
4.181 + prog->sourceid = gmyth_string_list_read_int (slist);
4.182 + prog->cardid = gmyth_string_list_read_int (slist);
4.183 + prog->inputid = gmyth_string_list_read_int (slist);
4.184 + prog->recpriority = gmyth_string_list_read_int (slist);
4.185 + gmyth_string_list_read_int (slist);
4.186 + prog->recordid = gmyth_string_list_read_int (slist, prog->recordid);
4.187 + gmyth_string_list_read_int (slist);
4.188 + gmyth_string_list_read_int (slist);
4.189 + gmyth_string_list_read_int (slist);
4.190 + gmyth_string_list_read_int (slist); //DATETIME_TO_LIST(recstartts)
4.191 + gmyth_string_list_read_int (slist); //DATETIME_TO_LIST(recendts)
4.192 + prog->repeat = gmyth_string_list_read_int (slist);
4.193 + prog->programflags = gmyth_string_list_read_int (slist);
4.194 + prog->recgroup = gmyth_string_list_read_string (slist); //prog->(recgroup != "") ? recgroup : "Default")
4.195 + prog->chancommfree = gmyth_string_list_read_int (slist);
4.196 + prog->chanOutputFilters = gmyth_string_list_read_string (slist);
4.197 + prog->seriesid = gmyth_string_list_read_string (slist);
4.198 + prog->programid = gmyth_string_list_read_string (slist);
4.199 + gmyth_string_list_read_int (slist); //DATETIME_TO_LIST(lastmodified)
4.200 + gmyth_string_list_read_int (slist); //FLOAT_TO_LIST(stars)
4.201 + gmyth_string_list_read_int (slist); //DATETIME_TO_LIST(QDateTime(originalAirDate))
4.202 + prog->hasAirDate = gmyth_string_list_read_int (slist);
4.203 + prog->playgroup = gmyth_string_list_read_char_array (slist); //prog->(playgroup != "") ? playgroup : "Default")
4.204 + prog->recpriority2 = gmyth_string_list_read_int (slist);
4.205 +
4.206 + return prog;
4.207 }
4.208 +
5.1 --- a/gmyth/src/gmyth_programinfo.h Mon Jan 22 21:22:55 2007 +0000
5.2 +++ b/gmyth/src/gmyth_programinfo.h Tue Jan 23 21:37:27 2007 +0000
5.3 @@ -1,11 +1,161 @@
5.4 +/**
5.5 + * GMyth Library
5.6 + *
5.7 + * @file gmyth/gmyth_common.h
5.8 + *
5.9 + * @brief <p> This file contains basic common functions for the gmyth library.
5.10 + *
5.11 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
5.12 + * @author Leonardo Sobral Cunha <leonardo.cunha@indt.org.br>
5.13 + *
5.14 + *//*
5.15 + *
5.16 + * This program is free software; you can redistribute it and/or modify
5.17 + * it under the terms of the GNU Lesser General Public License as published by
5.18 + * the Free Software Foundation; either version 2 of the License, or
5.19 + * (at your option) any later version.
5.20 + *
5.21 + * This program is distributed in the hope that it will be useful,
5.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.24 + * GNU General Public License for more details.
5.25 + *
5.26 + * You should have received a copy of the GNU Lesser General Public License
5.27 + * along with this program; if not, write to the Free Software
5.28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5.29 + */
5.30
5.31 #ifndef _GMYTH_PROGRAMINFO_H
5.32 #define _GMYTH_PROGRAMINFO_H
5.33
5.34 +#include <glib.h>
5.35 +#include <glib-object.h>
5.36 +
5.37 #include "gmyth_stringlist.h"
5.38 -#include "gmyth_common.h"
5.39
5.40 -GMythStringList* gmyth_program_info_to_string_list (GMythProgramInfo *prog, GMythStringList *slist);
5.41 -GMythProgramInfo* gmyth_program_info_from_string_list ();
5.42 +G_BEGIN_DECLS
5.43
5.44 -#endif
5.45 +#define GMYTH_PROGRAM_INFO_TYPE (gmyth_program_info_get_type ())
5.46 +#define GMYTH_PROGRAM_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_PROGRAM_INFO_TYPE, GMythProgramInfo))
5.47 +#define GMYTH_PROGRAM_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_PROGRAM_INFO_TYPE, GMythProgramInfoClass))
5.48 +#define IS_GMYTH_PROGRAM_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_PROGRAM_INFO_TYPE))
5.49 +#define IS_GMYTH_PROGRAM_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_PROGRAM_INFO_TYPE))
5.50 +#define GMYTH_PROGRAM_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_PROGRAM_INFO_TYPE, GMythProgramInfoClass))
5.51 +
5.52 +typedef struct _GMythProgramInfo GMythProgramInfo;
5.53 +typedef struct _GMythProgramInfoClass GMythProgramInfoClass;
5.54 +
5.55 +struct _GMythProgramInfoClass
5.56 +{
5.57 + GObjectClass parent_class;
5.58 +
5.59 + /* callbacks */
5.60 +};
5.61 +
5.62 +/**
5.63 + * The GMythProgramInfo structure represents a program information
5.64 + * stored in the database. It could be a program from the EPG data,
5.65 + * a program scheduled to be recorded, or a program already recorded.
5.66 + */
5.67 +struct _GMythProgramInfo
5.68 +{
5.69 + GObject parent;
5.70 +
5.71 + /** The channel unique ID. */
5.72 + GString *chanid;
5.73 +
5.74 + /** The program start time. */
5.75 + GTimeVal* startts;
5.76 + /** The program end time. */
5.77 + GTimeVal* endts;
5.78 + /** The recording schedule start time. */
5.79 + GTimeVal* recstartts;
5.80 + /** The recording schedule end time */
5.81 + GTimeVal* recendts;
5.82 +
5.83 + /** The program title. */
5.84 + GString *title;
5.85 + /** The program subtitle. */
5.86 + GString *subtitle;
5.87 + /** The program description. */
5.88 + GString *description;
5.89 + /** The program category. */
5.90 + GString *category;
5.91 +
5.92 + GString *chanstr;
5.93 + GString *chansign;
5.94 + /** The associated channel name. */
5.95 + GString *channame;
5.96 + gint chancommfree;
5.97 + GString *chanOutputFilters;
5.98 +
5.99 + GString *seriesid;
5.100 + /** The program unique id. */
5.101 + GString *programid;
5.102 + GString * catType;
5.103 +
5.104 + GString * sortTitle;
5.105 +
5.106 + /** A flag informing if the program has video or not. */
5.107 + gboolean isVideo;
5.108 + gint lenMins;
5.109 +
5.110 + GString *year;
5.111 + gdouble stars;
5.112 + gint repeat;
5.113 +
5.114 + GTimeVal* originalAirDate;
5.115 + GTimeVal* lastmodified;
5.116 + GTimeVal* lastInUseTime;
5.117 +
5.118 + gboolean hasAirDate;
5.119 +
5.120 + gint spread;
5.121 + gint startCol;
5.122 +
5.123 + gint recpriority2;
5.124 + gint reactivate;
5.125 +
5.126 + gint recordid;
5.127 + gint parentid;
5.128 +
5.129 + /** The backend video source id associated to this program.*/
5.130 + gint sourceid;
5.131 + /** the backend input id associated to this program.*/
5.132 + gint inputid;
5.133 + /** The backend card id associated to this program.*/
5.134 + gint cardid;
5.135 + gboolean shareable;
5.136 + gboolean duplicate;
5.137 +
5.138 + GString * schedulerid;
5.139 + gint findid;
5.140 +
5.141 + gint programflags;
5.142 + gint transcoder;
5.143 +
5.144 + GString *recgroup;
5.145 + GString *playgroup;
5.146 + gint recpriority;
5.147 +
5.148 + /** The file size of the recorded program.*/
5.149 + gint64 filesize;
5.150 +
5.151 + /** The file name of the recorded program.*/
5.152 + GString *pathname;
5.153 + GString *hostname;
5.154 +
5.155 + /* AvailableStatusType availableStatus;*/
5.156 +
5.157 +};
5.158 +
5.159 +GType gmyth_program_info_type (void);
5.160 +
5.161 +GMythProgramInfo* gmyth_program_info_new (void);
5.162 +
5.163 +GMythStringList* gmyth_program_info_to_string_list (GMythProgramInfo *prog, GMythStringList *slist);
5.164 +GMythProgramInfo* gmyth_program_info_from_string_list (GMythStringList *slist);
5.165 +
5.166 +G_END_DECLS
5.167 +
5.168 +#endif /*_GMYTH_PROGRAMINFO_H*/
6.1 --- a/gmyth/src/gmyth_recorder.c Mon Jan 22 21:22:55 2007 +0000
6.2 +++ b/gmyth/src/gmyth_recorder.c Tue Jan 23 21:37:27 2007 +0000
6.3 @@ -79,13 +79,13 @@
6.4 {
6.5 g_signal_handlers_destroy (object);
6.6
6.7 - GMythRecorder *recorder = GMYTH_RECORDER(object);
6.8 + GMythRecorder *recorder = GMYTH_RECORDER(object);
6.9
6.10 gmyth_debug ("[%s] Closing control socket", __FUNCTION__);
6.11 gmyth_socket_close_connection(recorder->myth_socket);
6.12 g_object_unref (recorder->myth_socket);
6.13
6.14 - G_OBJECT_CLASS (gmyth_recorder_parent_class)->finalize (object);
6.15 + G_OBJECT_CLASS (gmyth_recorder_parent_class)->finalize (object);
6.16 }
6.17
6.18 /** Creates a new instance of GMythRecorder.
6.19 @@ -428,6 +428,52 @@
6.20
6.21 }
6.22
6.23 +/**
6.24 + * Requests the actual program info from the MythTV backend server.
6.25 + *
6.26 + * @param recorder The GMythRecorder instance.
6.27 + * @return The actual program info.
6.28 + */
6.29 +GMythProgramInfo *
6.30 +gmyth_recorder_get_current_program_info ( GMythRecorder *recorder )
6.31 +{
6.32 + GMythStringList *str_list;
6.33 + GMythProgramInfo *program_info = gmyth_program_info_new();
6.34 + GString *tmp_str = g_string_new( GMYTHTV_RECORDER_HEADER );
6.35 +
6.36 + str_list = gmyth_string_list_new ();
6.37 +
6.38 + g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
6.39 +
6.40 + gmyth_string_list_append_string (str_list, tmp_str);
6.41 +
6.42 + if ( recorder->myth_socket->mythtv_version >= 26 )
6.43 + gmyth_string_list_append_string (str_list, g_string_new ("GET_CURRENT_RECORDING"));
6.44 + else
6.45 + gmyth_string_list_append_string (str_list, g_string_new ("GET_PROGRAM_INFO"));
6.46 +
6.47 + gmyth_socket_sendreceive_stringlist (recorder->myth_socket, str_list);
6.48 +
6.49 + g_string_free (tmp_str, TRUE);
6.50 +
6.51 + if (str_list == NULL) {
6.52 + g_warning ("[%s] GET_PROGRAM_INFO request returned. Error getting program info, string list equals to NULL!", __FUNCTION__);
6.53 + return FALSE;
6.54 + }
6.55 +
6.56 + program_info = gmyth_program_info_from_string_list( str_list );
6.57 +
6.58 + if ( NULL == program_info ) {
6.59 + g_warning ("[%s] GET_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!", __FUNCTION__);
6.60 + g_object_unref (program_info);
6.61 + return NULL;
6.62 + }
6.63 +
6.64 + g_object_unref (str_list);
6.65 + return program_info;
6.66 +
6.67 +}
6.68 +
6.69 gint64
6.70 gmyth_recorder_get_file_position ( GMythRecorder *recorder )
6.71 {
7.1 --- a/gmyth/src/gmyth_recorder.h Mon Jan 22 21:22:55 2007 +0000
7.2 +++ b/gmyth/src/gmyth_recorder.h Tue Jan 23 21:37:27 2007 +0000
7.3 @@ -31,6 +31,7 @@
7.4 #include <glib-object.h>
7.5
7.6 #include "gmyth_socket.h"
7.7 +#include "gmyth_programinfo.h"
7.8
7.9 #include <stdio.h>
7.10 #include <stdlib.h>
7.11 @@ -67,9 +68,9 @@
7.12 /* socket descriptor */
7.13 GMythSocket *myth_socket;
7.14
7.15 - int recorder_num;
7.16 + gint recorder_num;
7.17 GString *hostname;
7.18 - int port;
7.19 + gint port;
7.20 };
7.21
7.22
7.23 @@ -95,6 +96,8 @@
7.24 const gchar* channel);
7.25
7.26 gboolean gmyth_recorder_pause_recording ( GMythRecorder *recorder );
7.27 +
7.28 +GMythProgramInfo *gmyth_recorder_get_current_program_info ( GMythRecorder *recorder );
7.29
7.30 gint64 gmyth_recorder_get_file_position ( GMythRecorder *recorder );
7.31
8.1 --- a/gmyth/src/gmyth_uri.c Mon Jan 22 21:22:55 2007 +0000
8.2 +++ b/gmyth/src/gmyth_uri.c Tue Jan 23 21:37:27 2007 +0000
8.3 @@ -345,6 +345,8 @@
8.4
8.5 g_return_val_if_fail( uri != NULL && uri->uri != NULL && uri->uri->str != NULL, FALSE );
8.6
8.7 + gmyth_debug( "This URI is a LiveTV recording..." );
8.8 +
8.9 return ( g_strstr_len( uri->uri->str, strlen( uri->uri->str ), "/?" ) != NULL );
8.10
8.11 }
9.1 --- a/gmyth/src/gmyth_util.c Mon Jan 22 21:22:55 2007 +0000
9.2 +++ b/gmyth/src/gmyth_util.c Tue Jan 23 21:37:27 2007 +0000
9.3 @@ -428,7 +428,7 @@
9.4 GMythStringList *slist;
9.5 GMythProgramInfo *program;
9.6
9.7 - program = g_new0 (GMythProgramInfo, 1);
9.8 + program = gmyth_program_info_new();
9.9 program->pathname = g_string_new (filename);
9.10
9.11 slist = gmyth_string_list_new ();
9.12 @@ -455,7 +455,6 @@
9.13
9.14 #if !GLIB_CHECK_VERSION (2, 10, 0)
9.15
9.16 -
9.17 /* Hacked from glib 2.10 <gtime.c> */
9.18
9.19 static time_t