[svn r308] A lot of improvements related SET_CHANNEL messages.
1.1 --- a/gmyth/src/gmyth_backendinfo.c Thu Jan 25 21:40:30 2007 +0000
1.2 +++ b/gmyth/src/gmyth_backendinfo.c Fri Jan 26 19:08:17 2007 +0000
1.3 @@ -59,6 +59,7 @@
1.4 backend_info->password = NULL;
1.5 backend_info->db_name = NULL;
1.6 backend_info->port = -1;
1.7 + backend_info->uri = NULL;
1.8 }
1.9
1.10 static void
1.11 @@ -77,6 +78,12 @@
1.12 backend_info->db_name = NULL;
1.13 backend_info->port = -1;
1.14
1.15 + if ( backend_info->uri != NULL )
1.16 + {
1.17 + g_object_unref(backend_info->uri);
1.18 + backend_info->uri = NULL;
1.19 + }
1.20 +
1.21 G_OBJECT_CLASS (gmyth_backend_info_parent_class)->dispose (object);
1.22 }
1.23
1.24 @@ -107,6 +114,9 @@
1.25 {
1.26 GMythBackendInfo *backend_info =
1.27 GMYTH_BACKEND_INFO (g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
1.28 +
1.29 + backend_info->uri = gmyth_uri_new_with_value(
1.30 + g_strdup_printf( "myth://%s:%s@%s:%d/?%s", username, password, hostname, port, db_name ) );
1.31
1.32 gmyth_backend_info_set_hostname (backend_info, hostname);
1.33 gmyth_backend_info_set_username (backend_info, username);
1.34 @@ -123,17 +133,18 @@
1.35 GMythBackendInfo *backend_info =
1.36 GMYTH_BACKEND_INFO (g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
1.37
1.38 - GMythURI* uri = gmyth_uri_new_with_value( uri_str );
1.39 + backend_info->uri = gmyth_uri_new_with_value( uri_str );
1.40
1.41 - gchar** path_parts = g_strsplit( gmyth_uri_get_path( uri ), "&", -1 );
1.42 + gchar** path_parts = g_strsplit( gmyth_uri_get_path( backend_info->uri ), "&", -1 );
1.43
1.44 - gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host (uri ) );
1.45 - gmyth_backend_info_set_username (backend_info, gmyth_uri_get_user( uri ) );
1.46 - gmyth_backend_info_set_password (backend_info, gmyth_uri_get_password( uri ) );
1.47 + gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host ( backend_info->uri ) );
1.48 + gmyth_backend_info_set_username (backend_info, gmyth_uri_get_user( backend_info->uri ) );
1.49 + gmyth_backend_info_set_password (backend_info, gmyth_uri_get_password( backend_info->uri ) );
1.50 /* gets the path info to database name, from the URI, and removes the trash chars */
1.51 gmyth_backend_info_set_db_name (backend_info, path_parts != NULL && path_parts[0] != NULL
1.52 - && strlen( path_parts[0] ) > 0 ? g_strstrip( g_strdelimit( path_parts[0], "/?", ' ' ) ) : gmyth_uri_get_path( uri ) );
1.53 - gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port( uri ) );
1.54 + && strlen( path_parts[0] ) > 0 ? g_strstrip( g_strdup( g_strdelimit( path_parts[0], "/?", ' ' ) ) )
1.55 + : gmyth_uri_get_path( backend_info->uri ) );
1.56 + gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port( backend_info->uri ) );
1.57
1.58 g_strfreev( path_parts );
1.59
1.60 @@ -230,3 +241,18 @@
1.61 return backend_info->port;
1.62 }
1.63
1.64 +const GMythURI*
1.65 +gmyth_backend_info_get_uri (GMythBackendInfo *backend_info)
1.66 +{
1.67 +
1.68 + if ( NULL == backend_info->uri )
1.69 + {
1.70 + backend_info->uri = gmyth_uri_new_with_value(
1.71 + g_strdup_printf( "myth://%s:%s@%s:%d/?%s", backend_info->username, backend_info->password,
1.72 + backend_info->hostname, backend_info->port, backend_info->db_name ) );
1.73 + }
1.74 +
1.75 + return backend_info->uri;
1.76 +}
1.77 +
1.78 +
2.1 --- a/gmyth/src/gmyth_backendinfo.h Thu Jan 25 21:40:30 2007 +0000
2.2 +++ b/gmyth/src/gmyth_backendinfo.h Fri Jan 26 19:08:17 2007 +0000
2.3 @@ -29,6 +29,8 @@
2.4
2.5 #include <glib-object.h>
2.6
2.7 +#include "gmyth_uri.h"
2.8 +
2.9 G_BEGIN_DECLS
2.10
2.11 #define GMYTH_BACKEND_INFO_TYPE (gmyth_backend_info_get_type ())
2.12 @@ -60,6 +62,8 @@
2.13 gchar *db_name;
2.14 gint port;
2.15 gchar *path;
2.16 +
2.17 + GMythURI* uri;
2.18 };
2.19
2.20
2.21 @@ -87,6 +91,10 @@
2.22 const gchar* gmyth_backend_info_get_db_name (GMythBackendInfo *backend_info);
2.23 gint gmyth_backend_info_get_port (GMythBackendInfo *backend_info);
2.24
2.25 +const GMythURI* gmyth_backend_info_get_uri (GMythBackendInfo *backend_info);
2.26 +
2.27 +/*const gchar* gmyth_backend_info_get_full_uri (GMythBackendInfo *backend_info);*/
2.28 +
2.29 G_END_DECLS
2.30
2.31 #endif /* __GMYTH_BACKEND_INFO_H__ */
3.1 --- a/gmyth/src/gmyth_common.c Thu Jan 25 21:40:30 2007 +0000
3.2 +++ b/gmyth/src/gmyth_common.c Fri Jan 26 19:08:17 2007 +0000
3.3 @@ -79,8 +79,9 @@
3.4 {
3.5 if ( channel_info != NULL )
3.6 {
3.7 - gmyth_debug("ChannelInfo (Name, ID) = (%s, %d)\n",
3.8 - channel_info->channel_name->str, channel_info->channel_ID);
3.9 + gmyth_debug("ChannelInfo (Name, Num, ID) = (%s, %s, %d)\n",
3.10 + channel_info->channel_name->str, channel_info->channel_num->str,
3.11 + channel_info->channel_ID);
3.12 }
3.13 }
3.14
3.15 @@ -90,7 +91,7 @@
3.16
3.17 if ( program_info != NULL ) {
3.18
3.19 - gmyth_debug("ProgramInfo\n\tTitle = %s\n\t"
3.20 + gmyth_debug( "ProgramInfo\n\tTitle = %s\n\t"
3.21 "Description = %s\n\t"
3.22 "Start time= %s\t"
3.23 "End time = %s\n"
3.24 @@ -101,7 +102,7 @@
3.25 gmyth_util_time_to_string_from_time_val(program_info->startts),
3.26 gmyth_util_time_to_string_from_time_val(program_info->endts),
3.27 program_info->pathname->str,
3.28 - program_info->filesize);
3.29 + program_info->filesize );
3.30
3.31 }
3.32
4.1 --- a/gmyth/src/gmyth_common.h Thu Jan 25 21:40:30 2007 +0000
4.2 +++ b/gmyth/src/gmyth_common.h Fri Jan 26 19:08:17 2007 +0000
4.3 @@ -43,6 +43,8 @@
4.4 /** The channel ID in backend database */
4.5 gint channel_ID;
4.6
4.7 + GString* channel_num;
4.8 +
4.9 /** The channel name in backend database */
4.10 GString *channel_name;
4.11
5.1 --- a/gmyth/src/gmyth_epg.c Thu Jan 25 21:40:30 2007 +0000
5.2 +++ b/gmyth/src/gmyth_epg.c Fri Jan 26 19:08:17 2007 +0000
5.3 @@ -148,7 +148,7 @@
5.4 assert(gmyth_epg);
5.5
5.6 msql_res = gmyth_query_process_statement (gmyth_epg->sqlquery,
5.7 - "SELECT chanid,name FROM channel;");
5.8 + "SELECT chanid, channum, name FROM channel;");
5.9
5.10 (*glist_ptr) = NULL;
5.11
5.12 @@ -163,11 +163,10 @@
5.13
5.14 channel_info = g_new0(GMythChannelInfo, 1);
5.15 channel_info->channel_ID = g_ascii_strtoull (row[0], NULL, 10);
5.16 - channel_info->channel_name = g_string_new (row[1]);
5.17 + channel_info->channel_num = g_string_new (row[1]);
5.18 + channel_info->channel_name = g_string_new (row[2]);
5.19
5.20 -#if 0
5.21 gmyth_channel_info_print(channel_info);
5.22 -#endif
5.23
5.24 (*glist_ptr) = g_list_append ((*glist_ptr), channel_info);
5.25 }
6.1 --- a/gmyth/src/gmyth_livetv.c Thu Jan 25 21:40:30 2007 +0000
6.2 +++ b/gmyth/src/gmyth_livetv.c Fri Jan 26 19:08:17 2007 +0000
6.3 @@ -33,6 +33,7 @@
6.4 #include "gmyth_remote_util.h"
6.5 #include "gmyth_tvchain.h"
6.6 #include "gmyth_socket.h"
6.7 +#include "gmyth_backendinfo.h"
6.8 #include "gmyth_debug.h"
6.9
6.10 #include "gmyth_file_transfer.h"
6.11 @@ -74,6 +75,8 @@
6.12 livetv->recorder = NULL;
6.13 livetv->tvchain = NULL;
6.14 livetv->proginfo = NULL;
6.15 + livetv->uri = NULL;
6.16 +
6.17 }
6.18
6.19 static void
6.20 @@ -120,6 +123,12 @@
6.21 g_object_unref (livetv->backend_info);
6.22 livetv->backend_info = NULL;
6.23 }
6.24 +
6.25 + if ( livetv->uri != NULL )
6.26 + {
6.27 + g_object_unref (livetv->uri);
6.28 + livetv->uri = NULL;
6.29 + }
6.30
6.31 G_OBJECT_CLASS ( gmyth_livetv_parent_class )->finalize ( object );
6.32 }
6.33 @@ -252,8 +261,22 @@
6.34
6.35 }
6.36
6.37 +
6.38 +/*
6.39 +static gchar*
6.40 +gmyth_livetv_create_remote_url( GMythLiveTV *livetv )
6.41 +{
6.42 + gchar *uri = g_strdup("");
6.43 + gmyth_backend_info_get_remote_h
6.44 +
6.45 + //gmyth_backend(livetv->backend_info)
6.46 +
6.47 + return uri;
6.48 +}
6.49 +*/
6.50 +
6.51 static gboolean
6.52 -gmyth_livetv_setup_recorder ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info )
6.53 +gmyth_livetv_setup_recorder_channel_name ( GMythLiveTV *livetv, gchar* channel, GMythBackendInfo *backend_info )
6.54 {
6.55 gboolean res = TRUE;
6.56
6.57 @@ -328,7 +351,7 @@
6.58 /* IS_RECORDING again, just like the MythTV backend does... */
6.59 gmyth_recorder_is_recording (livetv->recorder);
6.60
6.61 - if ( channel != -1 )
6.62 + if ( channel != NULL )
6.63 {
6.64 /* Pauses remote encoder. */
6.65 res = gmyth_recorder_pause_recording(livetv->recorder);
6.66 @@ -338,11 +361,11 @@
6.67 goto error;
6.68 }
6.69
6.70 - if ( gmyth_recorder_check_channel( livetv->recorder, channel ) )
6.71 + if ( gmyth_recorder_check_channel_name( livetv->recorder, channel ) )
6.72 {
6.73 - if ( gmyth_recorder_set_channel( livetv->recorder, channel ) )
6.74 + if ( gmyth_recorder_set_channel_name( livetv->recorder, channel ) )
6.75 {
6.76 - g_print( "[%s] Channel changed!!! abc1 [%d].\n", __FUNCTION__, channel );
6.77 + g_print( "[%s] Channel changed!!! [%s].\n", __FUNCTION__, channel );
6.78 }
6.79 }
6.80
6.81 @@ -361,39 +384,43 @@
6.82 return FALSE;
6.83 }
6.84 /* prints program info data text */
6.85 + gmyth_debug( "New ProgramInfo...\n" );
6.86 gmyth_program_info_print( prog_info );
6.87 /* DEBUG message */
6.88 + gmyth_debug( "Old ProgramInfo...\n" );
6.89 + gmyth_program_info_print( livetv->proginfo );
6.90 +
6.91 + /* check if the program chain could be obtained from the MythTV protocol message */
6.92 + if ( prog_info != NULL )
6.93 + {
6.94 + livetv->proginfo = prog_info;
6.95 + } else {
6.96 +
6.97 + /* check for the program info in the TV program chain could be obtained
6.98 + from the MythTV MySQL database */
6.99
6.100 - // Reload all TV chain from Mysql database.
6.101 - gmyth_tvchain_reload_all (livetv->tvchain);
6.102 -
6.103 - if ( livetv->tvchain == NULL ) {
6.104 - res = FALSE;
6.105 - goto error;
6.106 + /* Reload all TV chain from Mysql database. */
6.107 + gmyth_tvchain_reload_all (livetv->tvchain);
6.108 +
6.109 + if ( livetv->tvchain == NULL ) {
6.110 + res = FALSE;
6.111 + goto error;
6.112 + }
6.113 +
6.114 + /* Get program info from database using chanid and starttime */
6.115 + livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, tvchain_curr_index++ );
6.116 + if ( livetv->proginfo == NULL ) {
6.117 + g_warning ("[%s] LiveTV not successfully started.\n", __FUNCTION__ );
6.118 + res = FALSE;
6.119 + goto error;
6.120 + } else {
6.121 + res = TRUE;
6.122 + gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n", livetv->proginfo->pathname->str );
6.123 + }
6.124 +
6.125 }
6.126
6.127 - // Get program info from database using chanid and starttime
6.128 - livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, tvchain_curr_index++ );
6.129 - if ( livetv->proginfo == NULL ) {
6.130 - g_warning ("[%s] LiveTV not successfully started.\n", __FUNCTION__ );
6.131 - res = FALSE;
6.132 - goto error;
6.133 - } else {
6.134 - res = TRUE;
6.135 - gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n", livetv->proginfo->pathname->str );
6.136 - }
6.137 -
6.138 - if ( res == TRUE) {
6.139 - /* loop finished, set the max tries variable to zero again... */
6.140 - gint wait_to_transfer = GMYTHTV_TRANSFER_MAX_WAITS;
6.141 -
6.142 - g_usleep (200);
6.143 -
6.144 - while (wait_to_transfer-- > 0 &&
6.145 - (gmyth_recorder_is_recording (livetv->recorder) == FALSE))
6.146 - g_usleep (1000);
6.147 - }
6.148 -
6.149 + livetv->uri = gmyth_backend_info_get_uri( backend_info );
6.150
6.151 g_static_mutex_unlock( &lock );
6.152
6.153 @@ -440,6 +467,13 @@
6.154
6.155 }
6.156
6.157 +static gboolean
6.158 +gmyth_livetv_setup_recorder ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info )
6.159 +{
6.160 + return gmyth_livetv_setup_recorder_channel_name ( livetv, ( channel != -1 ) ?
6.161 + g_strdup_printf( "%d", channel ) : NULL, backend_info );
6.162 +}
6.163 +
6.164 gboolean
6.165 gmyth_livetv_channel_setup ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info )
6.166 {
6.167 @@ -447,6 +481,12 @@
6.168 }
6.169
6.170 gboolean
6.171 +gmyth_livetv_channel_name_setup ( GMythLiveTV *livetv, gchar* channel, GMythBackendInfo *backend_info )
6.172 +{
6.173 + return gmyth_livetv_setup_recorder_channel_name ( livetv, channel, backend_info );
6.174 +}
6.175 +
6.176 +gboolean
6.177 gmyth_livetv_setup ( GMythLiveTV *livetv, GMythBackendInfo *backend_info )
6.178 {
6.179 return gmyth_livetv_setup_recorder ( livetv, -1, backend_info );
6.180 @@ -480,9 +520,10 @@
6.181
6.182 if ( prog_info != NULL ) {
6.183 res = TRUE;
6.184 + livetv->proginfo = prog_info;
6.185 gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK, program info changed.");
6.186 } else {
6.187 - g_warning ("LiveTV not successfully started on the next program chain.\n", __FUNCTION__ );
6.188 + g_warning ("[%s] LiveTV not successfully started on the next program chain.\n", __FUNCTION__ );
6.189 res = FALSE;
6.190 goto error;
6.191 }
6.192 @@ -521,24 +562,27 @@
6.193 GMythFileTransfer *
6.194 gmyth_livetv_create_file_transfer( GMythLiveTV *livetv )
6.195 {
6.196 - GMythURI* uri = NULL;
6.197 + //GMythURI* uri = NULL;
6.198
6.199 - if ( NULL == livetv || NULL == livetv->proginfo )
6.200 + if ( NULL == livetv )
6.201 goto done;
6.202
6.203 if ( !livetv->setup_done )
6.204 {
6.205 gmyth_debug( "Error: You must do the LiveTV setup, just before generating the FileTransfer from LiveTV source!" );
6.206 goto done;
6.207 - }
6.208 -
6.209 - gmyth_debug( "URI path = %s.\n", livetv->proginfo->pathname->str );
6.210 + }
6.211 +
6.212 + if ( livetv->proginfo != NULL )
6.213 + gmyth_debug( "URI path = %s.\n", livetv->proginfo->pathname->str );
6.214 + else
6.215 + gmyth_debug( "URI path = %s.\n", livetv->uri->uri->str );
6.216
6.217 g_static_mutex_lock( &lock );
6.218
6.219 if ( livetv->file_transfer != NULL )
6.220 {
6.221 - gmyth_file_transfer_close( livetv->file_transfer );
6.222 + /*gmyth_file_transfer_close( livetv->file_transfer );*/
6.223 g_object_unref( livetv->file_transfer );
6.224 livetv->file_transfer = NULL;
6.225 }
6.226 @@ -551,14 +595,25 @@
6.227 goto done;
6.228 }
6.229
6.230 - uri = gmyth_uri_new_with_value( livetv->proginfo->pathname->str );
6.231 - if ( NULL == uri )
6.232 + if ( livetv->uri != NULL )
6.233 + {
6.234 + if ( livetv->uri->path != NULL )
6.235 + {
6.236 + g_string_free( livetv->uri->path, FALSE );
6.237 + livetv->uri->path = NULL;
6.238 + }
6.239 + livetv->uri->path = g_string_new( g_strrstr( livetv->proginfo->pathname->str, "/" ) );
6.240 + } else {
6.241 + livetv->uri = gmyth_uri_new_with_value( livetv->proginfo->pathname->str );
6.242 + }
6.243 +
6.244 + if ( NULL == livetv->uri )
6.245 {
6.246 gmyth_debug( "Couldn't parse the URI to start LiveTV! [ uri = %s ]", livetv->proginfo->pathname->str );
6.247 goto done;
6.248 }
6.249
6.250 - if ( !gmyth_file_transfer_open( livetv->file_transfer, uri != NULL ? gmyth_uri_get_path(uri) :
6.251 + if ( !gmyth_file_transfer_open( livetv->file_transfer, livetv->uri != NULL ? gmyth_uri_get_path(livetv->uri) :
6.252 livetv->proginfo->pathname->str ) )
6.253 {
6.254 gmyth_debug( "Error: couldn't open the FileTransfer from LiveTV source!" );
6.255 @@ -570,11 +625,13 @@
6.256 g_static_mutex_unlock( &lock );
6.257
6.258 done:
6.259 + /*
6.260 if ( uri != NULL )
6.261 {
6.262 g_object_unref( uri );
6.263 uri = NULL;
6.264 - }
6.265 + }
6.266 + */
6.267
6.268 return livetv->file_transfer;
6.269
7.1 --- a/gmyth/src/gmyth_livetv.h Thu Jan 25 21:40:30 2007 +0000
7.2 +++ b/gmyth/src/gmyth_livetv.h Fri Jan 26 19:08:17 2007 +0000
7.3 @@ -72,6 +72,7 @@
7.4 GMythFileTransfer *file_transfer;
7.5
7.6 GMythMonitorHandler *monitor;
7.7 + GMythURI *uri;
7.8
7.9 gboolean is_livetv;
7.10 gboolean setup_done;
7.11 @@ -87,6 +88,7 @@
7.12
7.13 gboolean gmyth_livetv_setup (GMythLiveTV *livetv, GMythBackendInfo *backend_info);
7.14 gboolean gmyth_livetv_channel_setup ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info );
7.15 +gboolean gmyth_livetv_channel_name_setup ( GMythLiveTV *livetv, gchar* channel, GMythBackendInfo *backend_info );
7.16 gboolean gmyth_livetv_next_program_chain ( GMythLiveTV *livetv );
7.17
7.18 GMythFileTransfer *gmyth_livetv_create_file_transfer( GMythLiveTV *livetv );
8.1 --- a/gmyth/src/gmyth_programinfo.c Thu Jan 25 21:40:30 2007 +0000
8.2 +++ b/gmyth/src/gmyth_programinfo.c Fri Jan 26 19:08:17 2007 +0000
8.3 @@ -403,37 +403,42 @@
8.4 prog->channame = gmyth_string_list_get_string (slist, 7);
8.5 prog->pathname = gmyth_string_list_get_string (slist, 8);
8.6 prog->filesize = gmyth_string_list_get_int64 (slist, 9);
8.7 + gmyth_string_list_get_int64 (slist, 10);
8.8
8.9 - prog->startts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 10) ); //DATETIME_TO_LIST(startts)
8.10 - prog->endts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 11) ); //DATETIME_TO_LIST(endts)
8.11 - prog->duplicate = gmyth_string_list_get_int (slist, 12);
8.12 - prog->shareable = gmyth_string_list_get_int (slist, 13);
8.13 - prog->findid = gmyth_string_list_get_int (slist, 14);
8.14 - prog->hostname = gmyth_string_list_get_string (slist, 15);
8.15 - prog->sourceid = gmyth_string_list_get_int (slist, 16);
8.16 - prog->cardid = gmyth_string_list_get_int (slist, 17);
8.17 - prog->inputid = gmyth_string_list_get_int (slist, 18);
8.18 - prog->recpriority = gmyth_string_list_get_int (slist, 19);
8.19 - prog->reactivate = gmyth_string_list_get_int (slist, 20);
8.20 - prog->recordid = gmyth_string_list_get_int (slist, 21);
8.21 - gmyth_string_list_get_int (slist, 22);
8.22 + prog->startts = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat(
8.23 + (time_t)gmyth_string_list_get_int (slist, 11) ))->str ); //DATETIME_TO_LIST(startts)
8.24 + prog->endts = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat(
8.25 + (time_t)gmyth_string_list_get_int (slist, 12) ))->str ); //DATETIME_TO_LIST(endts)
8.26 + prog->duplicate = gmyth_string_list_get_int (slist, 13);
8.27 + prog->shareable = gmyth_string_list_get_int (slist, 14);
8.28 + prog->findid = gmyth_string_list_get_int (slist, 15);
8.29 + prog->hostname = gmyth_string_list_get_string (slist, 16);
8.30 + prog->sourceid = gmyth_string_list_get_int (slist, 17);
8.31 + prog->cardid = gmyth_string_list_get_int (slist, 18);
8.32 + prog->inputid = gmyth_string_list_get_int (slist, 19);
8.33 + prog->recpriority = gmyth_string_list_get_int (slist, 20);
8.34 + prog->reactivate = gmyth_string_list_get_int (slist, 21);
8.35 + prog->recordid = gmyth_string_list_get_int (slist, 22);
8.36 gmyth_string_list_get_int (slist, 23);
8.37 gmyth_string_list_get_int (slist, 24);
8.38 - prog->recstartts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 25) ); //DATETIME_TO_LIST(recstartts)
8.39 - prog->recendts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 26) ); //DATETIME_TO_LIST(recendts)
8.40 - prog->repeat = gmyth_string_list_get_int (slist, 27);
8.41 - prog->programflags = gmyth_string_list_get_int (slist, 28);
8.42 - prog->recgroup = gmyth_string_list_get_string (slist, 29); //prog->(recgroup != "") ? recgroup : "Default")
8.43 - prog->chancommfree = gmyth_string_list_get_int (slist, 30);
8.44 - prog->chanOutputFilters = gmyth_string_list_get_string (slist, 31);
8.45 - prog->seriesid = gmyth_string_list_get_string (slist, 32);
8.46 - prog->programid = gmyth_string_list_get_string (slist, 33);
8.47 - prog->lastmodified = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 34) ); //DATETIME_TO_LIST(lastmodified)
8.48 - gmyth_string_list_get_int (slist, 35); //FLOAT_TO_LIST(stars)
8.49 - prog->originalAirDate = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 36) ); //DATETIME_TO_LIST(QDateTime(originalAirDate))
8.50 - prog->hasAirDate = gmyth_string_list_get_int (slist, 37);
8.51 - prog->playgroup = gmyth_string_list_get_string (slist, 38); //prog->(playgroup != "") ? playgroup : "Default")
8.52 - prog->recpriority2 = gmyth_string_list_get_int (slist, 39);
8.53 + gmyth_string_list_get_int (slist, 25);
8.54 + prog->recstartts = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat(
8.55 + (time_t)gmyth_string_list_get_int (slist, 26) ))->str ); //DATETIME_TO_LIST(recstartts)
8.56 + prog->recendts = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat(
8.57 + (time_t)gmyth_string_list_get_int (slist, 27) ))->str ); //DATETIME_TO_LIST(recendts)
8.58 + prog->repeat = gmyth_string_list_get_int (slist, 28);
8.59 + prog->programflags = gmyth_string_list_get_int (slist, 29);
8.60 + prog->recgroup = gmyth_string_list_get_string (slist, 30); //prog->(recgroup != "") ? recgroup : "Default")
8.61 + prog->chancommfree = gmyth_string_list_get_int (slist, 31);
8.62 + prog->chanOutputFilters = gmyth_string_list_get_string (slist, 32);
8.63 + prog->seriesid = gmyth_string_list_get_string (slist, 33);
8.64 + prog->programid = gmyth_string_list_get_string (slist, 34);
8.65 + prog->lastmodified = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 35) ); //DATETIME_TO_LIST(lastmodified)
8.66 + gmyth_string_list_get_int (slist, 36); //FLOAT_TO_LIST(stars)
8.67 + prog->originalAirDate = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 37) ); //DATETIME_TO_LIST(QDateTime(originalAirDate))
8.68 + prog->hasAirDate = gmyth_string_list_get_int (slist, 38);
8.69 + prog->playgroup = gmyth_string_list_get_string (slist, 39); //prog->(playgroup != "") ? playgroup : "Default")
8.70 + prog->recpriority2 = gmyth_string_list_get_int (slist, 40);
8.71
8.72 return prog;
8.73 }
9.1 --- a/gmyth/src/gmyth_recorder.c Thu Jan 25 21:40:30 2007 +0000
9.2 +++ b/gmyth/src/gmyth_recorder.c Fri Jan 26 19:08:17 2007 +0000
9.3 @@ -258,16 +258,16 @@
9.4 * certain channel actually exists.
9.5 *
9.6 * @param recorder The GMythRecorder instance.
9.7 - * @param channel The new channel to be checked.
9.8 + * @param channel The new channel to be checked (string format).
9.9 * @return true if success, false if any error happens.
9.10 */
9.11 gboolean
9.12 -gmyth_recorder_check_channel (GMythRecorder *recorder, gint channel)
9.13 +gmyth_recorder_check_channel_name (GMythRecorder *recorder, gchar* channel)
9.14 {
9.15 GMythStringList *str_list;
9.16 GString *tmp_str = g_string_new( GMYTHTV_RECORDER_HEADER );
9.17
9.18 - gmyth_debug ("[%s] SET_CHANNEL with channel = %d", __FUNCTION__, channel);
9.19 + gmyth_debug ("[%s] CHECK_CHANNEL with channel = %s", __FUNCTION__, channel);
9.20
9.21 str_list = gmyth_string_list_new ();
9.22
9.23 @@ -275,7 +275,7 @@
9.24
9.25 gmyth_string_list_append_string (str_list, tmp_str);
9.26 gmyth_string_list_append_string (str_list, g_string_new ("CHECK_CHANNEL"));
9.27 - gmyth_string_list_append_int (str_list, channel);
9.28 + gmyth_string_list_append_char_array (str_list, channel);
9.29
9.30 gmyth_socket_sendreceive_stringlist (recorder->myth_socket, str_list);
9.31
9.32 @@ -298,6 +298,19 @@
9.33
9.34 }
9.35
9.36 +/** Send a CHECK_CHANNEL command request to the backend, in order to find if a
9.37 + * certain channel actually exists.
9.38 + *
9.39 + * @param recorder The GMythRecorder instance.
9.40 + * @param channel The new channel to be checked (decimal integer value).
9.41 + * @return true if success, false if any error happens.
9.42 + */
9.43 +gboolean
9.44 +gmyth_recorder_check_channel (GMythRecorder *recorder, gint channel)
9.45 +{
9.46 + return gmyth_recorder_check_channel_name( recorder, g_strdup_printf( "%d", channel ) );
9.47 +}
9.48 +
9.49 /** Send a SET_CHANNEL command request to the backend, to start streaming on another
9.50 * TV content channel.
9.51 *
10.1 --- a/gmyth/src/gmyth_recorder.h Thu Jan 25 21:40:30 2007 +0000
10.2 +++ b/gmyth/src/gmyth_recorder.h Fri Jan 26 19:08:17 2007 +0000
10.3 @@ -89,6 +89,8 @@
10.4
10.5 gboolean gmyth_recorder_check_channel (GMythRecorder *recorder, gint channel);
10.6
10.7 +gboolean gmyth_recorder_check_channel_name (GMythRecorder *recorder, gchar* channel);
10.8 +
10.9 gboolean gmyth_recorder_set_channel (GMythRecorder *recorder,
10.10 gint channel);
10.11
11.1 --- a/gmyth/src/gmyth_tvchain.c Thu Jan 25 21:40:30 2007 +0000
11.2 +++ b/gmyth/src/gmyth_tvchain.c Fri Jan 26 19:08:17 2007 +0000
11.3 @@ -383,7 +383,7 @@
11.4 if (proginfo) {
11.5 proginfo->pathname = g_string_prepend (proginfo->pathname, entry->hostprefix->str);
11.6 } else {
11.7 - g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %lld) failed!", entry->chanid->str, entry->starttime);
11.8 + g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %lld) failed!", entry->chanid->str, entry->starttime->tv_sec);
11.9 }
11.10
11.11 return proginfo;
12.1 --- a/gmyth/src/gmyth_uri.c Thu Jan 25 21:40:30 2007 +0000
12.2 +++ b/gmyth/src/gmyth_uri.c Fri Jan 26 19:08:17 2007 +0000
12.3 @@ -216,12 +216,14 @@
12.4 gint colonIdx;
12.5 gint shashIdx;
12.6 gint eIdx;
12.7 - gchar *host;
12.8 + gchar *host;
12.9 gint eblacketIdx;
12.10 gint hostLen;
12.11 gint sharpIdx;
12.12 + /*
12.13 gint questionIdx;
12.14 gint queryLen;
12.15 + */
12.16
12.17 uriLen = strlen(value);
12.18 uri->uri = g_string_new( value );
12.19 @@ -355,10 +357,10 @@
12.20
12.21 }
12.22
12.23 -gint
12.24 -gmyth_uri_get_channel_num( GMythURI* uri )
12.25 +gchar*
12.26 +gmyth_uri_get_channel_name( GMythURI* uri )
12.27 {
12.28 - gint channel = -1;
12.29 + gchar* channel = NULL;
12.30
12.31 g_return_val_if_fail( uri != NULL && uri->uri != NULL && uri->uri->str != NULL, FALSE );
12.32
12.33 @@ -366,23 +368,37 @@
12.34
12.35 if ( channel_query != NULL )
12.36 {
12.37 - gmyth_debug( "Channel is in the following URI segment: %s", channel_query );
12.38 + gmyth_debug( "TV Channel is in the following URI segment: %s", channel_query );
12.39
12.40 gchar **chan_key_value = g_strsplit( gmyth_uri_get_query( uri ), "=", 2 );
12.41
12.42 - gmyth_debug( "Channel tuple is [ %s, %s ]", chan_key_value[0], chan_key_value[1] );
12.43 -
12.44 + /* gmyth_debug( "Channel tuple is [ %s, %s ]", chan_key_value[0], chan_key_value[1] ); */
12.45 +
12.46 if ( chan_key_value[1] != NULL )
12.47 {
12.48 - channel = g_ascii_strtoull( chan_key_value[1], NULL, 10 );
12.49 + channel = g_strdup( chan_key_value[1] );
12.50 }
12.51 -
12.52 - if ( chan_key_value )
12.53 +
12.54 + if ( chan_key_value != NULL )
12.55 g_strfreev( chan_key_value );
12.56 }
12.57
12.58 - gmyth_debug( "Got channel decimal value from the URI: %d", channel );
12.59 -
12.60 + gmyth_debug( "Got channel decimal value from the URI: %s", channel );
12.61 +
12.62 return channel;
12.63
12.64 }
12.65 +
12.66 +gint
12.67 +gmyth_uri_get_channel_num( GMythURI* uri )
12.68 +{
12.69 + gchar *channel_name = gmyth_uri_get_channel_name( uri );
12.70 +
12.71 + if ( channel_name != NULL )
12.72 + {
12.73 + return g_ascii_strtoull( channel_name, NULL, 10 );
12.74 + }
12.75 +
12.76 + return -1;
12.77 +
12.78 +}
13.1 --- a/gmyth/src/gmyth_uri.h Thu Jan 25 21:40:30 2007 +0000
13.2 +++ b/gmyth/src/gmyth_uri.h Fri Jan 26 19:08:17 2007 +0000
13.3 @@ -108,6 +108,7 @@
13.4 gboolean gmyth_uri_is_equals ( GMythURI* uri1, GMythURI* uri2 );
13.5 gboolean gmyth_uri_is_livetv ( GMythURI* uri );
13.6 gint gmyth_uri_get_channel_num( GMythURI* uri );
13.7 +gchar* gmyth_uri_get_channel_name( GMythURI* uri );
13.8
13.9
13.10 #define gmyth_uri_get_host(urip) ( urip->host != NULL ? urip->host->str : "" )