[svn r756] fixed indent using GNU Style trunk
authorrenatofilho
Thu Jun 14 18:19:52 2007 +0100 (2007-06-14)
branchtrunk
changeset 750312d6bc514f3
parent 749 fb471f7af20b
child 751 3cf3c6019e3b
[svn r756] fixed indent using GNU Style
gmyth/samples/gmyth_cat.c
gmyth/samples/gmyth_ls.c
gmyth/samples/gmyth_upnp_search.c
gmyth/src/gmyth.h
gmyth/src/gmyth_backendinfo.c
gmyth/src/gmyth_backendinfo.h
gmyth/src/gmyth_common.c
gmyth/src/gmyth_common.h
gmyth/src/gmyth_debug.c
gmyth/src/gmyth_debug.h
gmyth/src/gmyth_epg.c
gmyth/src/gmyth_epg.h
gmyth/src/gmyth_file.c
gmyth/src/gmyth_file.h
gmyth/src/gmyth_file_local.c
gmyth/src/gmyth_file_local.h
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_file_transfer.h
gmyth/src/gmyth_http.c
gmyth/src/gmyth_http.h
gmyth/src/gmyth_jobqueue.c
gmyth/src/gmyth_jobqueue.h
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_livetv.h
gmyth/src/gmyth_monitor_handler.c
gmyth/src/gmyth_monitor_handler.h
gmyth/src/gmyth_programinfo.c
gmyth/src/gmyth_programinfo.h
gmyth/src/gmyth_query.c
gmyth/src/gmyth_query.h
gmyth/src/gmyth_recorder.c
gmyth/src/gmyth_recorder.h
gmyth/src/gmyth_recprofile.c
gmyth/src/gmyth_recprofile.h
gmyth/src/gmyth_remote_util.c
gmyth/src/gmyth_remote_util.h
gmyth/src/gmyth_scheduler.c
gmyth/src/gmyth_scheduler.h
gmyth/src/gmyth_socket.c
gmyth/src/gmyth_socket.h
gmyth/src/gmyth_stringlist.c
gmyth/src/gmyth_stringlist.h
gmyth/src/gmyth_transcoder.c
gmyth/src/gmyth_transcoder.h
gmyth/src/gmyth_tvchain.c
gmyth/src/gmyth_tvchain.h
gmyth/src/gmyth_uri.c
gmyth/src/gmyth_uri.h
gmyth/src/gmyth_util.c
gmyth/src/gmyth_util.h
gmyth/src/gmyth_vlc.c
gmyth/src/gmyth_vlc.h
gmyth/tests/gmyth_test_connection.c
gmyth/tests/gmyth_test_epg.c
gmyth/tests/gmyth_test_file_download.c
gmyth/tests/gmyth_test_filelocal.c
gmyth/tests/gmyth_test_filetransfer.c
gmyth/tests/gmyth_test_http.c
gmyth/tests/gmyth_test_livetv.c
gmyth/tests/gmyth_test_monitor_handler.c
gmyth/tests/gmyth_test_program_info.c
gmyth/tests/gmyth_test_recorder.c
gmyth/tests/gmyth_test_recordings.c
gmyth/tests/gmyth_test_stringlist.c
gmyth/tests/gmyth_test_transcode.c
gmyth/tests/gmyth_test_tvchain.c
gmyth/tests/gmyth_test_vlc.c
gmyth/tests/main.c
     1.1 --- a/gmyth/samples/gmyth_cat.c	Wed Jun 13 18:18:42 2007 +0100
     1.2 +++ b/gmyth/samples/gmyth_cat.c	Thu Jun 14 18:19:52 2007 +0100
     1.3 @@ -12,235 +12,241 @@
     1.4  #include "gmyth_util.h"
     1.5  #include "gmyth_common.h"
     1.6  
     1.7 -typedef struct {
     1.8 -    GMythBackendInfo *b_info;
     1.9 -    char* filename;
    1.10 -    char* channel;
    1.11 +typedef struct
    1.12 +{
    1.13 +  GMythBackendInfo *b_info;
    1.14 +  char *filename;
    1.15 +  char *channel;
    1.16  } cat_options_t;
    1.17  
    1.18 -static cat_options_t*
    1.19 -_cat_options_new ()
    1.20 +static cat_options_t *
    1.21 +_cat_options_new()
    1.22  {
    1.23 -    cat_options_t *options = g_new0 (cat_options_t, 1);
    1.24 -    options->b_info = gmyth_backend_info_new ();
    1.25 +  cat_options_t *options = g_new0(cat_options_t, 1);
    1.26 +  options->b_info = gmyth_backend_info_new();
    1.27  
    1.28 -    return options;
    1.29 +  return options;
    1.30  }
    1.31  
    1.32  static void
    1.33 -_cat_options_free (cat_options_t *options)
    1.34 +_cat_options_free(cat_options_t * options)
    1.35  {
    1.36 -    g_return_if_fail (options != NULL);
    1.37 +  g_return_if_fail(options != NULL);
    1.38  
    1.39 -    if (options->b_info)
    1.40 -        g_object_unref (options->b_info);
    1.41 -    g_free (options->filename);
    1.42 -    g_free (options->channel);
    1.43 +  if (options->b_info)
    1.44 +	g_object_unref(options->b_info);
    1.45 +  g_free(options->filename);
    1.46 +  g_free(options->channel);
    1.47  }
    1.48  
    1.49  static gboolean
    1.50 -_parse_args (int argc, char *argv[], cat_options_t *options)
    1.51 +_parse_args(int argc, char *argv[], cat_options_t * options)
    1.52  {
    1.53 -    GError *error = NULL;
    1.54 -    GOptionContext *context;
    1.55 +  GError *error = NULL;
    1.56 +  GOptionContext *context;
    1.57  
    1.58 -    gchar *host_ip = NULL;
    1.59 -    gint   host_port = 0;
    1.60 -    gchar *filename = NULL;
    1.61 -    gchar *channel = NULL;
    1.62 +  gchar *host_ip = NULL;
    1.63 +  gint host_port = 0;
    1.64 +  gchar *filename = NULL;
    1.65 +  gchar *channel = NULL;
    1.66  
    1.67 -    GOptionEntry entries[] =
    1.68 -    {
    1.69 -        { "hostname", 'h', 0, G_OPTION_ARG_STRING, &host_ip, "Mythtv backend hostname or "
    1.70 -          "IP address", "IP_ADDRESS" },
    1.71 +  GOptionEntry entries[] = {
    1.72 +	{"hostname", 'h', 0, G_OPTION_ARG_STRING, &host_ip,
    1.73 +	 "Mythtv backend hostname or " "IP address", "IP_ADDRESS"},
    1.74  
    1.75 -        { "port", 'p', 0, G_OPTION_ARG_INT, &host_port, "Mythtv backend port", "PORT" },
    1.76 +	{"port", 'p', 0, G_OPTION_ARG_INT, &host_port, "Mythtv backend port",
    1.77 +	 "PORT"},
    1.78  
    1.79 -        { "filename", 'f', 0, G_OPTION_ARG_STRING, &filename, "Recorded file name available "
    1.80 -          "in the Mythtv backend", "FILE" },
    1.81 +	{"filename", 'f', 0, G_OPTION_ARG_STRING, &filename,
    1.82 +	 "Recorded file name available " "in the Mythtv backend", "FILE"},
    1.83  
    1.84 -        { "channel", 'c', 0, G_OPTION_ARG_STRING, &channel, "Mythtv channel number", "CHANNEL" },
    1.85 +	{"channel", 'c', 0, G_OPTION_ARG_STRING, &channel,
    1.86 +	 "Mythtv channel number", "CHANNEL"},
    1.87  
    1.88 -        { NULL }
    1.89 -    };
    1.90 +	{NULL}
    1.91 +  };
    1.92  
    1.93 -    g_return_val_if_fail (options != NULL, FALSE);
    1.94 +  g_return_val_if_fail(options != NULL, FALSE);
    1.95  
    1.96 -    context = g_option_context_new ("- loads a mythtv backend recorded file and prints "
    1.97 -                                    "it on the standard output\n");
    1.98 -    g_option_context_add_main_entries (context, entries, NULL);
    1.99 -    g_option_context_parse (context, &argc, &argv, &error);
   1.100 -    g_option_context_set_help_enabled (context, TRUE);
   1.101 +  context =
   1.102 +	g_option_context_new("- loads a mythtv backend recorded file and prints "
   1.103 +						 "it on the standard output\n");
   1.104 +  g_option_context_add_main_entries(context, entries, NULL);
   1.105 +  g_option_context_parse(context, &argc, &argv, &error);
   1.106 +  g_option_context_set_help_enabled(context, TRUE);
   1.107  
   1.108 -    g_option_context_free (context);
   1.109 +  g_option_context_free(context);
   1.110  
   1.111 -    if ((!host_ip) || (host_port == 0) ) {
   1.112 -        g_free (host_ip);
   1.113 -        g_free (filename);
   1.114 -        g_free (channel);
   1.115 -        return FALSE;
   1.116 -    }
   1.117 +  if ((!host_ip) || (host_port == 0))
   1.118 +	{
   1.119 +	  g_free(host_ip);
   1.120 +	  g_free(filename);
   1.121 +	  g_free(channel);
   1.122 +	  return FALSE;
   1.123 +	}
   1.124  
   1.125 -    gmyth_backend_info_set_hostname (options->b_info, host_ip);
   1.126 -    gmyth_backend_info_set_port (options->b_info, host_port);
   1.127 -    if (filename)
   1.128 -        options->filename = g_strdup (filename);
   1.129 -    if (channel)
   1.130 -        options->channel = g_strdup (channel);
   1.131 +  gmyth_backend_info_set_hostname(options->b_info, host_ip);
   1.132 +  gmyth_backend_info_set_port(options->b_info, host_port);
   1.133 +  if (filename)
   1.134 +	options->filename = g_strdup(filename);
   1.135 +  if (channel)
   1.136 +	options->channel = g_strdup(channel);
   1.137  
   1.138 -    g_free (host_ip);
   1.139 -    g_free (filename);
   1.140 -    g_free (channel);
   1.141 +  g_free(host_ip);
   1.142 +  g_free(filename);
   1.143 +  g_free(channel);
   1.144  
   1.145 -    return TRUE;
   1.146 +  return TRUE;
   1.147  }
   1.148  
   1.149  static gboolean
   1.150 -_cat_recorded_file (cat_options_t *options)
   1.151 +_cat_recorded_file(cat_options_t * options)
   1.152  {
   1.153 -    GArray *array = NULL;
   1.154 -    GMythFileTransfer *transfer;
   1.155 -    guint64 size = 0, total = 0;
   1.156 +  GArray *array = NULL;
   1.157 +  GMythFileTransfer *transfer;
   1.158 +  guint64 size = 0, total = 0;
   1.159  
   1.160 -    g_return_val_if_fail (options != NULL, FALSE);
   1.161 -    g_return_val_if_fail (options->b_info != NULL, FALSE);
   1.162 -    g_return_val_if_fail (options->filename != NULL, FALSE);
   1.163 +  g_return_val_if_fail(options != NULL, FALSE);
   1.164 +  g_return_val_if_fail(options->b_info != NULL, FALSE);
   1.165 +  g_return_val_if_fail(options->filename != NULL, FALSE);
   1.166  
   1.167 -    if (!gmyth_util_file_exists (options->b_info, options->filename))
   1.168 -    {
   1.169 -        g_printerr ("File %s was not found in the mythtv server\n", options->filename);
   1.170 -        return FALSE;
   1.171 -    }
   1.172 +  if (!gmyth_util_file_exists(options->b_info, options->filename))
   1.173 +	{
   1.174 +	  g_printerr("File %s was not found in the mythtv server\n",
   1.175 +				 options->filename);
   1.176 +	  return FALSE;
   1.177 +	}
   1.178  
   1.179 -    transfer = gmyth_file_transfer_new (options->b_info);
   1.180 -    if (!gmyth_file_transfer_open (transfer, options->filename))
   1.181 -    {
   1.182 -        g_printerr ("File %s could not be opened\n", options->filename);
   1.183 -        return FALSE;
   1.184 -    }
   1.185 +  transfer = gmyth_file_transfer_new(options->b_info);
   1.186 +  if (!gmyth_file_transfer_open(transfer, options->filename))
   1.187 +	{
   1.188 +	  g_printerr("File %s could not be opened\n", options->filename);
   1.189 +	  return FALSE;
   1.190 +	}
   1.191  
   1.192 -    size = gmyth_file_transfer_get_filesize (transfer);
   1.193 -    fprintf(stderr, "Size:%d\n", size);
   1.194 +  size = gmyth_file_transfer_get_filesize(transfer);
   1.195 +  fprintf(stderr, "Size:%d\n", size);
   1.196  
   1.197 -    array = g_array_new (FALSE, TRUE, sizeof(gchar));
   1.198 +  array = g_array_new(FALSE, TRUE, sizeof(gchar));
   1.199  
   1.200 -    while (total != size)
   1.201 -    {
   1.202 -        GMythFileReadResult res;
   1.203 +  while (total != size)
   1.204 +	{
   1.205 +	  GMythFileReadResult res;
   1.206  
   1.207 -        res = gmyth_file_transfer_read (transfer, (GByteArray*)array,
   1.208 -                                       (size - total) > 64000 ? 64000 : (size - total),
   1.209 -                                       FALSE);
   1.210 -        if ((res != GMYTH_FILE_READ_OK) && (res != GMYTH_FILE_READ_EOF))
   1.211 -        {
   1.212 -           g_array_free (array, TRUE);
   1.213 -           g_printerr ("Error while reading the file: aborting!!\n");
   1.214 -           break;
   1.215 -        }
   1.216 +	  res = gmyth_file_transfer_read(transfer, (GByteArray *) array,
   1.217 +									 (size - total) >
   1.218 +									 64000 ? 64000 : (size - total), FALSE);
   1.219 +	  if ((res != GMYTH_FILE_READ_OK) && (res != GMYTH_FILE_READ_EOF))
   1.220 +		{
   1.221 +		  g_array_free(array, TRUE);
   1.222 +		  g_printerr("Error while reading the file: aborting!!\n");
   1.223 +		  break;
   1.224 +		}
   1.225  
   1.226 -        fwrite (array->data, array->len, 1, stdout);
   1.227 -        fflush (stdout);
   1.228 +	  fwrite(array->data, array->len, 1, stdout);
   1.229 +	  fflush(stdout);
   1.230  
   1.231 -        total += array->len;
   1.232 -        fprintf(stderr, "%d\n", total);
   1.233 -        g_array_remove_range (array, 0, array->len);
   1.234 -        //usleep(300000);
   1.235 -    }
   1.236 +	  total += array->len;
   1.237 +	  fprintf(stderr, "%d\n", total);
   1.238 +	  g_array_remove_range(array, 0, array->len);
   1.239 +	  //usleep(300000);
   1.240 +	}
   1.241  
   1.242 -    gmyth_file_transfer_close (transfer);
   1.243 -    g_array_free (array, TRUE);
   1.244 -    g_object_unref (transfer);
   1.245 +  gmyth_file_transfer_close(transfer);
   1.246 +  g_array_free(array, TRUE);
   1.247 +  g_object_unref(transfer);
   1.248  
   1.249 -    return TRUE;
   1.250 +  return TRUE;
   1.251  }
   1.252  
   1.253  static gboolean
   1.254 -_cat_channel (cat_options_t *options)
   1.255 +_cat_channel(cat_options_t * options)
   1.256  {
   1.257 -    GMythLiveTV * livetv = NULL;
   1.258 -    GMythFile *gmyth_file = NULL;
   1.259 -    GArray *array = NULL;
   1.260 +  GMythLiveTV *livetv = NULL;
   1.261 +  GMythFile *gmyth_file = NULL;
   1.262 +  GArray *array = NULL;
   1.263  
   1.264 -    gint file_transf_ret;
   1.265 +  gint file_transf_ret;
   1.266  
   1.267 -    g_return_val_if_fail (options != NULL, FALSE);
   1.268 -    g_return_val_if_fail (options->b_info != NULL, FALSE);
   1.269 -    g_return_val_if_fail (options->channel != NULL, FALSE);
   1.270 -    livetv = gmyth_livetv_new (options->b_info);
   1.271 +  g_return_val_if_fail(options != NULL, FALSE);
   1.272 +  g_return_val_if_fail(options->b_info != NULL, FALSE);
   1.273 +  g_return_val_if_fail(options->channel != NULL, FALSE);
   1.274 +  livetv = gmyth_livetv_new(options->b_info);
   1.275  
   1.276 -    if (gmyth_livetv_channel_name_setup (livetv, options->channel) == FALSE)
   1.277 -    {
   1.278 -        g_printerr ("Could not setup remote livetv");
   1.279 -        g_object_unref (livetv);
   1.280 -        return FALSE;
   1.281 -    }
   1.282 +  if (gmyth_livetv_channel_name_setup(livetv, options->channel) == FALSE)
   1.283 +	{
   1.284 +	  g_printerr("Could not setup remote livetv");
   1.285 +	  g_object_unref(livetv);
   1.286 +	  return FALSE;
   1.287 +	}
   1.288  
   1.289 -    gmyth_file = GMYTH_FILE( gmyth_livetv_create_file_transfer (livetv) );
   1.290 -    if (gmyth_file == NULL)
   1.291 -    {
   1.292 -        g_printerr ("Could not open livetv recording file for transfer");
   1.293 -        g_object_unref (livetv);
   1.294 -        return FALSE;
   1.295 -    }
   1.296 +  gmyth_file = GMYTH_FILE(gmyth_livetv_create_file_transfer(livetv));
   1.297 +  if (gmyth_file == NULL)
   1.298 +	{
   1.299 +	  g_printerr("Could not open livetv recording file for transfer");
   1.300 +	  g_object_unref(livetv);
   1.301 +	  return FALSE;
   1.302 +	}
   1.303  
   1.304 -    if (!gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(gmyth_file),
   1.305 -                                    livetv->uri != NULL ?
   1.306 -                                    gmyth_uri_get_path (livetv->uri) :
   1.307 -                                    livetv->proginfo->pathname->str))
   1.308 -    {
   1.309 +  if (!gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(gmyth_file),
   1.310 +								livetv->uri != NULL ?
   1.311 +								gmyth_uri_get_path(livetv->uri) :
   1.312 +								livetv->proginfo->pathname->str))
   1.313 +	{
   1.314  
   1.315 -        g_printerr ("Couldn't open MythTV. FileTransfer is NULL!\n");
   1.316 -        return FALSE;
   1.317 -    }
   1.318 +	  g_printerr("Couldn't open MythTV. FileTransfer is NULL!\n");
   1.319 +	  return FALSE;
   1.320 +	}
   1.321  
   1.322 -    array = g_array_new (FALSE, TRUE, sizeof(gchar));
   1.323 +  array = g_array_new(FALSE, TRUE, sizeof(gchar));
   1.324  
   1.325 -    while( ( ( file_transf_ret = gmyth_file_transfer_read
   1.326 -           (GMYTH_FILE_TRANSFER(gmyth_file),
   1.327 -            (GByteArray*)array, 64000, TRUE) ) == GMYTH_FILE_READ_OK ) ||
   1.328 -	    file_transf_ret == GMYTH_FILE_READ_NEXT_PROG_CHAIN )
   1.329 -    {
   1.330 +  while (((file_transf_ret = gmyth_file_transfer_read
   1.331 +		   (GMYTH_FILE_TRANSFER(gmyth_file),
   1.332 +			(GByteArray *) array, 64000, TRUE)) == GMYTH_FILE_READ_OK) ||
   1.333 +		 file_transf_ret == GMYTH_FILE_READ_NEXT_PROG_CHAIN)
   1.334 +	{
   1.335  
   1.336 -        fwrite (array->data, array->len, 1, stdout);
   1.337 -        fflush (stdout);
   1.338 -        g_array_remove_range (array, 0, array->len);
   1.339 +	  fwrite(array->data, array->len, 1, stdout);
   1.340 +	  fflush(stdout);
   1.341 +	  g_array_remove_range(array, 0, array->len);
   1.342  
   1.343 -	g_main_context_iteration( g_main_context_default(), FALSE );
   1.344 -    }
   1.345 +	  g_main_context_iteration(g_main_context_default(), FALSE);
   1.346 +	}
   1.347  
   1.348 -    g_array_free (array, TRUE);
   1.349 -    g_object_unref (gmyth_file);
   1.350 -    g_object_unref (livetv);
   1.351 +  g_array_free(array, TRUE);
   1.352 +  g_object_unref(gmyth_file);
   1.353 +  g_object_unref(livetv);
   1.354  
   1.355 -    return TRUE;
   1.356 +  return TRUE;
   1.357  }
   1.358  
   1.359  int
   1.360 -main (int argc, char *argv[])
   1.361 +main(int argc, char *argv[])
   1.362  {
   1.363 -    gboolean res = FALSE;
   1.364 -    cat_options_t *options;
   1.365 +  gboolean res = FALSE;
   1.366 +  cat_options_t *options;
   1.367  
   1.368 -    g_type_init ();
   1.369 -    if (!g_thread_supported()) g_thread_init (NULL);
   1.370 +  g_type_init();
   1.371 +  if (!g_thread_supported())
   1.372 +	g_thread_init(NULL);
   1.373  
   1.374 -    options = _cat_options_new ();
   1.375 -    res = _parse_args (argc, argv, options);
   1.376 -    if (!res) {
   1.377 -        g_printerr ("Argument invalid. Type --help\n");
   1.378 -        return 1;
   1.379 -    }
   1.380 +  options = _cat_options_new();
   1.381 +  res = _parse_args(argc, argv, options);
   1.382 +  if (!res)
   1.383 +	{
   1.384 +	  g_printerr("Argument invalid. Type --help\n");
   1.385 +	  return 1;
   1.386 +	}
   1.387  
   1.388 -    if (options->filename)
   1.389 -        res = _cat_recorded_file (options);
   1.390 -    else
   1.391 -        if (options->channel)
   1.392 -            res = _cat_channel (options);
   1.393 -        else
   1.394 -            g_printerr ("Argument invalid. You must specify --filename or --channel.\n"
   1.395 -                        "Type --help for more information.\n");
   1.396 +  if (options->filename)
   1.397 +	res = _cat_recorded_file(options);
   1.398 +  else if (options->channel)
   1.399 +	res = _cat_channel(options);
   1.400 +  else
   1.401 +	g_printerr("Argument invalid. You must specify --filename or --channel.\n"
   1.402 +			   "Type --help for more information.\n");
   1.403  
   1.404 -    _cat_options_free (options);
   1.405 +  _cat_options_free(options);
   1.406  
   1.407 -    return 0;
   1.408 +  return 0;
   1.409  }
     2.1 --- a/gmyth/samples/gmyth_ls.c	Wed Jun 13 18:18:42 2007 +0100
     2.2 +++ b/gmyth/samples/gmyth_ls.c	Thu Jun 14 18:19:52 2007 +0100
     2.3 @@ -11,209 +11,224 @@
     2.4  #include "gmyth_util.h"
     2.5  #include "gmyth_epg.h"
     2.6  
     2.7 -typedef struct {
     2.8 -    GMythBackendInfo *b_info;
     2.9 -    gboolean list_channels;
    2.10 +typedef struct
    2.11 +{
    2.12 +  GMythBackendInfo *b_info;
    2.13 +  gboolean list_channels;
    2.14  } ls_options_t;
    2.15  
    2.16 -static ls_options_t*
    2.17 -_ls_options_new ()
    2.18 +static ls_options_t *
    2.19 +_ls_options_new()
    2.20  {
    2.21 -    ls_options_t *options = g_new0 (ls_options_t, 1);
    2.22 -    options->b_info = gmyth_backend_info_new ();
    2.23 +  ls_options_t *options = g_new0(ls_options_t, 1);
    2.24 +  options->b_info = gmyth_backend_info_new();
    2.25  
    2.26 -    return options;
    2.27 +  return options;
    2.28  }
    2.29  
    2.30  static void
    2.31 -_ls_options_free (ls_options_t *options)
    2.32 +_ls_options_free(ls_options_t * options)
    2.33  {
    2.34 -    g_return_if_fail (options != NULL);
    2.35 +  g_return_if_fail(options != NULL);
    2.36  
    2.37 -    if (options->b_info)
    2.38 -        g_object_unref (options->b_info);
    2.39 +  if (options->b_info)
    2.40 +	g_object_unref(options->b_info);
    2.41  }
    2.42  
    2.43  static gboolean
    2.44 -_parse_args (int argc, char *argv[], ls_options_t *options)
    2.45 +_parse_args(int argc, char *argv[], ls_options_t * options)
    2.46  {
    2.47 -    GError *error = NULL;
    2.48 -    GOptionContext *context;
    2.49 +  GError *error = NULL;
    2.50 +  GOptionContext *context;
    2.51  
    2.52 -    gchar *host_ip = NULL;
    2.53 -    gint   host_port = 0;
    2.54 -    gboolean list_channels = FALSE;
    2.55 -    gchar *username = NULL;
    2.56 -    gchar *password = NULL;
    2.57 +  gchar *host_ip = NULL;
    2.58 +  gint host_port = 0;
    2.59 +  gboolean list_channels = FALSE;
    2.60 +  gchar *username = NULL;
    2.61 +  gchar *password = NULL;
    2.62  
    2.63 -    GOptionEntry entries[] =
    2.64 -    {
    2.65 -        { "hostname", 'h', 0, G_OPTION_ARG_STRING, &host_ip, "Mythtv backend hostname or "
    2.66 -          "IP address", "IP_ADDRESS" },
    2.67 +  GOptionEntry entries[] = {
    2.68 +	{"hostname", 'h', 0, G_OPTION_ARG_STRING, &host_ip,
    2.69 +	 "Mythtv backend hostname or " "IP address", "IP_ADDRESS"},
    2.70  
    2.71 -        { "port", 'p', 0, G_OPTION_ARG_INT, &host_port, "Mythtv backend port", "PORT" },
    2.72 +	{"port", 'p', 0, G_OPTION_ARG_INT, &host_port, "Mythtv backend port",
    2.73 +	 "PORT"},
    2.74  
    2.75 -        { "list_channels", 'c', 0, G_OPTION_ARG_NONE, &list_channels, "List channels", 
    2.76 -          "LIST_CHANNELS" },
    2.77 +	{"list_channels", 'c', 0, G_OPTION_ARG_NONE, &list_channels,
    2.78 +	 "List channels",
    2.79 +	 "LIST_CHANNELS"},
    2.80  
    2.81 -        { "username", 'u', 0, G_OPTION_ARG_STRING, &username, "Mysql database username. Default: mythtv"
    2.82 -          "Mysql user", "MYSQL_USER" },
    2.83 +	{"username", 'u', 0, G_OPTION_ARG_STRING, &username,
    2.84 +	 "Mysql database username. Default: mythtv" "Mysql user", "MYSQL_USER"},
    2.85  
    2.86 -        { "password", 'w', 0, G_OPTION_ARG_STRING, &password, "Mysql database password. Default: mythtv"
    2.87 -          "Mysql password", "MYSQL_PASSWD" },
    2.88 +	{"password", 'w', 0, G_OPTION_ARG_STRING, &password,
    2.89 +	 "Mysql database password. Default: mythtv" "Mysql password",
    2.90 +	 "MYSQL_PASSWD"},
    2.91  
    2.92 -        { NULL }
    2.93 -    };
    2.94 +	{NULL}
    2.95 +  };
    2.96  
    2.97 -    g_return_val_if_fail (options != NULL, FALSE);
    2.98 +  g_return_val_if_fail(options != NULL, FALSE);
    2.99  
   2.100 -    context = g_option_context_new ("- list recorded programs and channels from a mythtv backend\n");
   2.101 -    g_option_context_add_main_entries (context, entries, NULL);
   2.102 -    g_option_context_parse (context, &argc, &argv, &error);
   2.103 -    g_option_context_set_help_enabled (context, TRUE);
   2.104 +  context =
   2.105 +	g_option_context_new
   2.106 +	("- list recorded programs and channels from a mythtv backend\n");
   2.107 +  g_option_context_add_main_entries(context, entries, NULL);
   2.108 +  g_option_context_parse(context, &argc, &argv, &error);
   2.109 +  g_option_context_set_help_enabled(context, TRUE);
   2.110  
   2.111 -    g_option_context_free (context);
   2.112 +  g_option_context_free(context);
   2.113  
   2.114 -    if ((!host_ip) || (host_port == 0) ) {
   2.115 -        g_free (host_ip);
   2.116 -        return FALSE;
   2.117 -    }
   2.118 +  if ((!host_ip) || (host_port == 0))
   2.119 +	{
   2.120 +	  g_free(host_ip);
   2.121 +	  return FALSE;
   2.122 +	}
   2.123  
   2.124 -    gmyth_backend_info_set_hostname (options->b_info, host_ip);
   2.125 -    gmyth_backend_info_set_port (options->b_info, host_port);
   2.126 +  gmyth_backend_info_set_hostname(options->b_info, host_ip);
   2.127 +  gmyth_backend_info_set_port(options->b_info, host_port);
   2.128  
   2.129 -    if (username)
   2.130 -        gmyth_backend_info_set_username (options->b_info, username);
   2.131 -    else
   2.132 -        gmyth_backend_info_set_username (options->b_info, "mythtv");
   2.133 -        
   2.134 -    if (password)
   2.135 -        gmyth_backend_info_set_password (options->b_info, password);
   2.136 -    else 
   2.137 -        gmyth_backend_info_set_password (options->b_info, "mythtv");
   2.138 -        
   2.139 -    gmyth_backend_info_set_db_name (options->b_info, "mythconverg");
   2.140 +  if (username)
   2.141 +	gmyth_backend_info_set_username(options->b_info, username);
   2.142 +  else
   2.143 +	gmyth_backend_info_set_username(options->b_info, "mythtv");
   2.144  
   2.145 -    options->list_channels = list_channels;
   2.146 +  if (password)
   2.147 +	gmyth_backend_info_set_password(options->b_info, password);
   2.148 +  else
   2.149 +	gmyth_backend_info_set_password(options->b_info, "mythtv");
   2.150  
   2.151 -    g_free (host_ip);
   2.152 +  gmyth_backend_info_set_db_name(options->b_info, "mythconverg");
   2.153  
   2.154 -    return TRUE;
   2.155 +  options->list_channels = list_channels;
   2.156 +
   2.157 +  g_free(host_ip);
   2.158 +
   2.159 +  return TRUE;
   2.160  }
   2.161  
   2.162  static gboolean
   2.163 -_ls_recorded_files (ls_options_t *options)
   2.164 +_ls_recorded_files(ls_options_t * options)
   2.165  {
   2.166 -    GMythScheduler *scheduler;
   2.167 -    GList *list, *iter;
   2.168 -    gint res = 0;
   2.169 +  GMythScheduler *scheduler;
   2.170 +  GList *list, *iter;
   2.171 +  gint res = 0;
   2.172  
   2.173 -    g_return_val_if_fail (options != NULL, FALSE);
   2.174 -    g_return_val_if_fail (options->b_info != NULL, FALSE);
   2.175 +  g_return_val_if_fail(options != NULL, FALSE);
   2.176 +  g_return_val_if_fail(options->b_info != NULL, FALSE);
   2.177  
   2.178 -    scheduler = gmyth_scheduler_new ();
   2.179 +  scheduler = gmyth_scheduler_new();
   2.180  
   2.181 -    if(gmyth_scheduler_connect_with_timeout (scheduler,
   2.182 -                               options->b_info, 10)
   2.183 -         == FALSE) {
   2.184 -        g_warning ("Could not connect to backend db");
   2.185 -        g_object_unref (scheduler);
   2.186 -        return FALSE;
   2.187 -    }
   2.188 +  if (gmyth_scheduler_connect_with_timeout(scheduler,
   2.189 +										   options->b_info, 10) == FALSE)
   2.190 +	{
   2.191 +	  g_warning("Could not connect to backend db");
   2.192 +	  g_object_unref(scheduler);
   2.193 +	  return FALSE;
   2.194 +	}
   2.195  
   2.196 -    res = gmyth_scheduler_get_recorded_list(scheduler, &list);
   2.197 -    if (res < 0) {
   2.198 -        gmyth_scheduler_disconnect(scheduler);
   2.199 -        g_object_unref (scheduler);
   2.200 -        g_warning ("Could not retrieve recorded list");
   2.201 -        return FALSE;
   2.202 -    }
   2.203 -    
   2.204 -    gmyth_scheduler_disconnect(scheduler);
   2.205 +  res = gmyth_scheduler_get_recorded_list(scheduler, &list);
   2.206 +  if (res < 0)
   2.207 +	{
   2.208 +	  gmyth_scheduler_disconnect(scheduler);
   2.209 +	  g_object_unref(scheduler);
   2.210 +	  g_warning("Could not retrieve recorded list");
   2.211 +	  return FALSE;
   2.212 +	}
   2.213  
   2.214 -    if (res == 0) {
   2.215 -        g_print ("None file was found in the backend.\n");
   2.216 -        gmyth_scheduler_disconnect(scheduler);
   2.217 -        g_object_unref (scheduler);
   2.218 -        return TRUE;
   2.219 -    } 
   2.220 +  gmyth_scheduler_disconnect(scheduler);
   2.221  
   2.222 -    iter = list;
   2.223 -    while (iter) {
   2.224 -        RecordedInfo* recorded_info =  (RecordedInfo*) iter->data;
   2.225 +  if (res == 0)
   2.226 +	{
   2.227 +	  g_print("None file was found in the backend.\n");
   2.228 +	  gmyth_scheduler_disconnect(scheduler);
   2.229 +	  g_object_unref(scheduler);
   2.230 +	  return TRUE;
   2.231 +	}
   2.232  
   2.233 -        if (gmyth_util_file_exists (options->b_info, recorded_info->basename->str)) {
   2.234 -            g_print ("%s\n", recorded_info->basename->str);
   2.235 -        }
   2.236 -        gmyth_recorded_info_free (recorded_info);
   2.237 -        iter = g_list_next (iter);
   2.238 -    }
   2.239 +  iter = list;
   2.240 +  while (iter)
   2.241 +	{
   2.242 +	  RecordedInfo *recorded_info = (RecordedInfo *) iter->data;
   2.243  
   2.244 -    g_list_free(list);
   2.245 +	  if (gmyth_util_file_exists
   2.246 +		  (options->b_info, recorded_info->basename->str))
   2.247 +		{
   2.248 +		  g_print("%s\n", recorded_info->basename->str);
   2.249 +		}
   2.250 +	  gmyth_recorded_info_free(recorded_info);
   2.251 +	  iter = g_list_next(iter);
   2.252 +	}
   2.253  
   2.254 -    gmyth_scheduler_disconnect (scheduler);
   2.255 -    g_object_unref (scheduler);
   2.256 +  g_list_free(list);
   2.257  
   2.258 -    return TRUE;
   2.259 +  gmyth_scheduler_disconnect(scheduler);
   2.260 +  g_object_unref(scheduler);
   2.261 +
   2.262 +  return TRUE;
   2.263  }
   2.264  
   2.265  static gboolean
   2.266 -_ls_channels (ls_options_t *options)
   2.267 +_ls_channels(ls_options_t * options)
   2.268  {
   2.269 -    GMythEPG *epg;
   2.270 -    gint length;
   2.271 -    GList *clist, *ch;
   2.272 - 
   2.273 -    g_return_val_if_fail (options != NULL, FALSE);
   2.274 -    g_return_val_if_fail (options->b_info != NULL, FALSE);
   2.275 +  GMythEPG *epg;
   2.276 +  gint length;
   2.277 +  GList *clist, *ch;
   2.278  
   2.279 +  g_return_val_if_fail(options != NULL, FALSE);
   2.280 +  g_return_val_if_fail(options->b_info != NULL, FALSE);
   2.281  
   2.282 -    epg = gmyth_epg_new ();
   2.283 -    if (!gmyth_epg_connect (epg, options->b_info)) {
   2.284 -        g_object_unref (epg);
   2.285 -        return FALSE;
   2.286 -    }
   2.287  
   2.288 -    length = gmyth_epg_get_channel_list (epg, &clist);
   2.289 -    for (ch = clist; ch != NULL; ch = ch->next) {
   2.290 -        GMythChannelInfo *info = (GMythChannelInfo*) ch->data;
   2.291 +  epg = gmyth_epg_new();
   2.292 +  if (!gmyth_epg_connect(epg, options->b_info))
   2.293 +	{
   2.294 +	  g_object_unref(epg);
   2.295 +	  return FALSE;
   2.296 +	}
   2.297  
   2.298 -        if ((info->channel_name == NULL) || (info->channel_num == NULL)) {
   2.299 -            continue;
   2.300 -        }
   2.301 +  length = gmyth_epg_get_channel_list(epg, &clist);
   2.302 +  for (ch = clist; ch != NULL; ch = ch->next)
   2.303 +	{
   2.304 +	  GMythChannelInfo *info = (GMythChannelInfo *) ch->data;
   2.305  
   2.306 -        g_print ("%s\t\t%s\n", info->channel_num->str, info->channel_name->str);
   2.307 -    }
   2.308 +	  if ((info->channel_name == NULL) || (info->channel_num == NULL))
   2.309 +		{
   2.310 +		  continue;
   2.311 +		}
   2.312  
   2.313 -    gmyth_free_channel_list (clist);
   2.314 -    gmyth_epg_disconnect (epg);
   2.315 -    g_object_unref (epg);
   2.316 +	  g_print("%s\t\t%s\n", info->channel_num->str, info->channel_name->str);
   2.317 +	}
   2.318  
   2.319 -    return TRUE;
   2.320 +  gmyth_free_channel_list(clist);
   2.321 +  gmyth_epg_disconnect(epg);
   2.322 +  g_object_unref(epg);
   2.323 +
   2.324 +  return TRUE;
   2.325  }
   2.326  
   2.327  int
   2.328 -main (int argc, char *argv[])
   2.329 +main(int argc, char *argv[])
   2.330  {
   2.331 -    gboolean res = FALSE;
   2.332 -    ls_options_t *options;
   2.333 +  gboolean res = FALSE;
   2.334 +  ls_options_t *options;
   2.335  
   2.336 -    g_type_init ();
   2.337 -    g_thread_init (NULL);
   2.338 +  g_type_init();
   2.339 +  g_thread_init(NULL);
   2.340  
   2.341 -    options = _ls_options_new ();
   2.342 -    res = _parse_args (argc, argv, options);
   2.343 -    if (!res) {
   2.344 -        g_printerr ("Argument invalid. Type --help\n");
   2.345 -        return 1;
   2.346 -    }
   2.347 +  options = _ls_options_new();
   2.348 +  res = _parse_args(argc, argv, options);
   2.349 +  if (!res)
   2.350 +	{
   2.351 +	  g_printerr("Argument invalid. Type --help\n");
   2.352 +	  return 1;
   2.353 +	}
   2.354  
   2.355 -    if (options->list_channels)
   2.356 -        res = _ls_channels (options);
   2.357 -    else 
   2.358 -        res = _ls_recorded_files (options);
   2.359 +  if (options->list_channels)
   2.360 +	res = _ls_channels(options);
   2.361 +  else
   2.362 +	res = _ls_recorded_files(options);
   2.363  
   2.364 -    _ls_options_free (options);
   2.365 +  _ls_options_free(options);
   2.366  
   2.367 -    return 0;
   2.368 +  return 0;
   2.369  }
     3.1 --- a/gmyth/samples/gmyth_upnp_search.c	Wed Jun 13 18:18:42 2007 +0100
     3.2 +++ b/gmyth/samples/gmyth_upnp_search.c	Thu Jun 14 18:19:52 2007 +0100
     3.3 @@ -14,107 +14,111 @@
     3.4  #include "gmyth_util.h"
     3.5  #include "gmyth_common.h"
     3.6  
     3.7 -typedef struct {
     3.8 -    GMythBackendInfo *b_info;
     3.9 -    gchar* mythtv_id;
    3.10 +typedef struct
    3.11 +{
    3.12 +  GMythBackendInfo *b_info;
    3.13 +  gchar *mythtv_id;
    3.14  } gupnp_options_t;
    3.15  
    3.16 -static gupnp_options_t*
    3.17 -_gupnp_options_new ()
    3.18 +static gupnp_options_t *
    3.19 +_gupnp_options_new()
    3.20  {
    3.21 -    gupnp_options_t *options = g_new0 (gupnp_options_t, 1);
    3.22 -    options->b_info = gmyth_backend_info_new ();
    3.23 +  gupnp_options_t *options = g_new0(gupnp_options_t, 1);
    3.24 +  options->b_info = gmyth_backend_info_new();
    3.25  
    3.26 -    return options;
    3.27 +  return options;
    3.28  }
    3.29  
    3.30  static void
    3.31 -_gupnp_options_free (gupnp_options_t *options)
    3.32 +_gupnp_options_free(gupnp_options_t * options)
    3.33  {
    3.34 -    g_return_if_fail (options != NULL);
    3.35 +  g_return_if_fail(options != NULL);
    3.36  
    3.37 -    if (options->b_info)
    3.38 -        g_object_unref (options->b_info);
    3.39 -    g_free (options->mythtv_id);
    3.40 +  if (options->b_info)
    3.41 +	g_object_unref(options->b_info);
    3.42 +  g_free(options->mythtv_id);
    3.43  }
    3.44  
    3.45  static gboolean
    3.46 -_parse_args (int argc, char *argv[], gupnp_options_t *options)
    3.47 +_parse_args(int argc, char *argv[], gupnp_options_t * options)
    3.48  {
    3.49 -    GError *error = NULL;
    3.50 -    GOptionContext *context;
    3.51 +  GError *error = NULL;
    3.52 +  GOptionContext *context;
    3.53  
    3.54 -    gchar *mythtv_id = NULL;
    3.55 +  gchar *mythtv_id = NULL;
    3.56  
    3.57 -    GOptionEntry entries[] =
    3.58 -    {
    3.59 -        { "mythtvid", 'm', 0, G_OPTION_ARG_STRING, &mythtv_id, "MythTV UPnP service "
    3.60 -          "identifigupnpion", "UPNP_ID" },
    3.61 -    
    3.62 -        { NULL }
    3.63 -    };
    3.64 +  GOptionEntry entries[] = {
    3.65 +	{"mythtvid", 'm', 0, G_OPTION_ARG_STRING, &mythtv_id,
    3.66 +	 "MythTV UPnP service " "identifigupnpion", "UPNP_ID"},
    3.67  
    3.68 -    g_return_val_if_fail (options != NULL, FALSE);
    3.69 +	{NULL}
    3.70 +  };
    3.71  
    3.72 -    context = g_option_context_new ("- searches for a list of connected mythtv backend recorded "
    3.73 -    				    "file and prints it on the standard output\n");
    3.74 -    g_option_context_add_main_entries (context, entries, NULL);
    3.75 -    g_option_context_parse (context, &argc, &argv, &error);
    3.76 -    g_option_context_set_help_enabled (context, TRUE);
    3.77 +  g_return_val_if_fail(options != NULL, FALSE);
    3.78  
    3.79 -    g_option_context_free (context);
    3.80 +  context =
    3.81 +	g_option_context_new
    3.82 +	("- searches for a list of connected mythtv backend recorded "
    3.83 +	 "file and prints it on the standard output\n");
    3.84 +  g_option_context_add_main_entries(context, entries, NULL);
    3.85 +  g_option_context_parse(context, &argc, &argv, &error);
    3.86 +  g_option_context_set_help_enabled(context, TRUE);
    3.87  
    3.88 -    g_free (mythtv_id);
    3.89 +  g_option_context_free(context);
    3.90  
    3.91 -    return TRUE;
    3.92 +  g_free(mythtv_id);
    3.93 +
    3.94 +  return TRUE;
    3.95  }
    3.96  
    3.97  
    3.98  static void
    3.99 -_got_upnp_device( GMythUPnP *gupnp, GMythUPnPDeviceStatus status, gchar *udn )
   3.100 +_got_upnp_device(GMythUPnP * gupnp, GMythUPnPDeviceStatus status, gchar * udn)
   3.101  {
   3.102 -	g_debug( "Got Device !!! [%s, %s]", gmyth_upnp_device_status_to_string( status ), 
   3.103 -			udn );
   3.104 +  g_debug("Got Device !!! [%s, %s]",
   3.105 +		  gmyth_upnp_device_status_to_string(status), udn);
   3.106  }
   3.107  
   3.108  static gboolean
   3.109 -_gupnp_search_devices (gupnp_options_t *options)
   3.110 +_gupnp_search_devices(gupnp_options_t * options)
   3.111  {
   3.112 -    GList *upnp_servers = NULL;
   3.113 -    GMythUPnP *gupnp;
   3.114 -    GMythBackendInfo *backend_info = gmyth_backend_info_new();
   3.115 +  GList *upnp_servers = NULL;
   3.116 +  GMythUPnP *gupnp;
   3.117 +  GMythBackendInfo *backend_info = gmyth_backend_info_new();
   3.118  
   3.119 -    g_return_val_if_fail (options != NULL, FALSE);
   3.120 -    g_return_val_if_fail (options->b_info != NULL, FALSE);
   3.121 +  g_return_val_if_fail(options != NULL, FALSE);
   3.122 +  g_return_val_if_fail(options->b_info != NULL, FALSE);
   3.123  
   3.124 -    gupnp = gmyth_upnp_new( backend_info, _got_upnp_device );
   3.125 -    upnp_servers = gmyth_upnp_do_search_sync( gupnp );
   3.126 +  gupnp = gmyth_upnp_new(backend_info, _got_upnp_device);
   3.127 +  upnp_servers = gmyth_upnp_do_search_sync(gupnp);
   3.128  
   3.129 -    g_list_free (upnp_servers);
   3.130 -    g_object_unref (gupnp);
   3.131 +  g_list_free(upnp_servers);
   3.132 +  g_object_unref(gupnp);
   3.133  
   3.134 -    return TRUE;
   3.135 +  return TRUE;
   3.136  }
   3.137  
   3.138  int
   3.139 -main (int argc, char *argv[])
   3.140 +main(int argc, char *argv[])
   3.141  {
   3.142 -    gboolean res = FALSE;
   3.143 -    gupnp_options_t *options;
   3.144 +  gboolean res = FALSE;
   3.145 +  gupnp_options_t *options;
   3.146  
   3.147 -    g_type_init ();
   3.148 -    if (!g_thread_supported()) g_thread_init (NULL);
   3.149 +  g_type_init();
   3.150 +  if (!g_thread_supported())
   3.151 +	g_thread_init(NULL);
   3.152  
   3.153 -    options = _gupnp_options_new ();
   3.154 -    res = _parse_args (argc, argv, options);
   3.155 -    if (!res) {
   3.156 -        g_printerr ("Argument invalid. Type --help\n");
   3.157 -        return 1;
   3.158 -    }
   3.159 +  options = _gupnp_options_new();
   3.160 +  res = _parse_args(argc, argv, options);
   3.161 +  if (!res)
   3.162 +	{
   3.163 +	  g_printerr("Argument invalid. Type --help\n");
   3.164 +	  return 1;
   3.165 +	}
   3.166  
   3.167 -    res = _gupnp_search_devices (options);
   3.168 +  res = _gupnp_search_devices(options);
   3.169  
   3.170 -    _gupnp_options_free (options);
   3.171 +  _gupnp_options_free(options);
   3.172  
   3.173 -    return 0;
   3.174 +  return 0;
   3.175  }
     4.1 --- a/gmyth/src/gmyth.h	Wed Jun 13 18:18:42 2007 +0100
     4.2 +++ b/gmyth/src/gmyth.h	Thu Jun 14 18:19:52 2007 +0100
     4.3 @@ -7,22 +7,22 @@
     4.4   * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
     4.5   * @author Renato Filho <renato.filho@indt.org.br>
     4.6   *
     4.7 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              *//*
     4.8 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * 
     4.9 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * This program is free software; you can redistribute it and/or modify
    4.10 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * it under the terms of the GNU Lesser General Public License as published by
    4.11 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * the Free Software Foundation; either version 2 of the License, or
    4.12 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * (at your option) any later version.
    4.13 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
    4.14 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * This program is distributed in the hope that it will be useful,
    4.15 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.16 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.17 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * GNU General Public License for more details.
    4.18 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
    4.19 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * You should have received a copy of the GNU Lesser General Public License
    4.20 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * along with this program; if not, write to the Free Software
    4.21 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.22 -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
    4.23 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              *//*
    4.24 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * 
    4.25 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * This program is free software; you can redistribute it and/or modify
    4.26 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * it under the terms of the GNU Lesser General Public License as published by
    4.27 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * the Free Software Foundation; either version 2 of the License, or
    4.28 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * (at your option) any later version.
    4.29 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 *
    4.30 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * This program is distributed in the hope that it will be useful,
    4.31 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.32 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.33 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * GNU General Public License for more details.
    4.34 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 *
    4.35 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * You should have received a copy of the GNU Lesser General Public License
    4.36 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * along with this program; if not, write to the Free Software
    4.37 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.38 +																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																 */
    4.39  
    4.40  
    4.41  
     5.1 --- a/gmyth/src/gmyth_backendinfo.c	Wed Jun 13 18:18:42 2007 +0100
     5.2 +++ b/gmyth/src/gmyth_backendinfo.c	Thu Jun 14 18:19:52 2007 +0100
     5.3 @@ -34,60 +34,60 @@
     5.4  #include "gmyth_uri.h"
     5.5  #include "gmyth_debug.h"
     5.6  
     5.7 -static void gmyth_backend_info_class_init ( GMythBackendInfoClass * klass );
     5.8 -static void gmyth_backend_info_init ( GMythBackendInfo * object );
     5.9 +static void gmyth_backend_info_class_init(GMythBackendInfoClass * klass);
    5.10 +static void gmyth_backend_info_init(GMythBackendInfo * object);
    5.11  
    5.12 -static void gmyth_backend_info_dispose ( GObject * object );
    5.13 -static void gmyth_backend_info_finalize ( GObject * object );
    5.14 +static void gmyth_backend_info_dispose(GObject * object);
    5.15 +static void gmyth_backend_info_finalize(GObject * object);
    5.16  
    5.17 -G_DEFINE_TYPE ( GMythBackendInfo, gmyth_backend_info, G_TYPE_OBJECT )
    5.18 -     static void gmyth_backend_info_class_init ( GMythBackendInfoClass * klass )
    5.19 +G_DEFINE_TYPE(GMythBackendInfo, gmyth_backend_info, G_TYPE_OBJECT)
    5.20 +	 static void gmyth_backend_info_class_init(GMythBackendInfoClass * klass)
    5.21  {
    5.22 -    GObjectClass *gobject_class;
    5.23 +  GObjectClass *gobject_class;
    5.24  
    5.25 -    gobject_class = ( GObjectClass * ) klass;
    5.26 +  gobject_class = (GObjectClass *) klass;
    5.27  
    5.28 -    gobject_class->dispose = gmyth_backend_info_dispose;
    5.29 -    gobject_class->finalize = gmyth_backend_info_finalize;
    5.30 +  gobject_class->dispose = gmyth_backend_info_dispose;
    5.31 +  gobject_class->finalize = gmyth_backend_info_finalize;
    5.32  }
    5.33  
    5.34  static void
    5.35 -gmyth_backend_info_init ( GMythBackendInfo * backend_info )
    5.36 +gmyth_backend_info_init(GMythBackendInfo * backend_info)
    5.37  {
    5.38 -    backend_info->hostname = NULL;
    5.39 -    backend_info->username = NULL;
    5.40 -    backend_info->password = NULL;
    5.41 -    backend_info->db_name = NULL;
    5.42 -    backend_info->port = -1;
    5.43 -    backend_info->status_port = -1;
    5.44 +  backend_info->hostname = NULL;
    5.45 +  backend_info->username = NULL;
    5.46 +  backend_info->password = NULL;
    5.47 +  backend_info->db_name = NULL;
    5.48 +  backend_info->port = -1;
    5.49 +  backend_info->status_port = -1;
    5.50  }
    5.51  
    5.52  static void
    5.53 -gmyth_backend_info_dispose ( GObject * object )
    5.54 +gmyth_backend_info_dispose(GObject * object)
    5.55  {
    5.56 -    GMythBackendInfo *backend_info = GMYTH_BACKEND_INFO ( object );
    5.57 +  GMythBackendInfo *backend_info = GMYTH_BACKEND_INFO(object);
    5.58  
    5.59 -    g_free ( backend_info->hostname );
    5.60 -    g_free ( backend_info->username );
    5.61 -    g_free ( backend_info->password );
    5.62 -    g_free ( backend_info->db_name );
    5.63 +  g_free(backend_info->hostname);
    5.64 +  g_free(backend_info->username);
    5.65 +  g_free(backend_info->password);
    5.66 +  g_free(backend_info->db_name);
    5.67  
    5.68 -    backend_info->hostname = NULL;
    5.69 -    backend_info->username = NULL;
    5.70 -    backend_info->password = NULL;
    5.71 -    backend_info->db_name = NULL;
    5.72 -    backend_info->port = -1;
    5.73 -    backend_info->status_port = -1;
    5.74 +  backend_info->hostname = NULL;
    5.75 +  backend_info->username = NULL;
    5.76 +  backend_info->password = NULL;
    5.77 +  backend_info->db_name = NULL;
    5.78 +  backend_info->port = -1;
    5.79 +  backend_info->status_port = -1;
    5.80  
    5.81 -    G_OBJECT_CLASS ( gmyth_backend_info_parent_class )->dispose ( object );
    5.82 +  G_OBJECT_CLASS(gmyth_backend_info_parent_class)->dispose(object);
    5.83  }
    5.84  
    5.85  static void
    5.86 -gmyth_backend_info_finalize ( GObject * object )
    5.87 +gmyth_backend_info_finalize(GObject * object)
    5.88  {
    5.89 -    g_signal_handlers_destroy ( object );
    5.90 +  g_signal_handlers_destroy(object);
    5.91  
    5.92 -    G_OBJECT_CLASS ( gmyth_backend_info_parent_class )->finalize ( object );
    5.93 +  G_OBJECT_CLASS(gmyth_backend_info_parent_class)->finalize(object);
    5.94  }
    5.95  
    5.96  /** 
    5.97 @@ -96,12 +96,12 @@
    5.98   * @return a new instance of GMythBackendInfo.
    5.99   */
   5.100  GMythBackendInfo *
   5.101 -gmyth_backend_info_new (  )
   5.102 +gmyth_backend_info_new()
   5.103  {
   5.104 -    GMythBackendInfo *backend_info =
   5.105 -        GMYTH_BACKEND_INFO ( g_object_new ( GMYTH_BACKEND_INFO_TYPE, NULL ) );
   5.106 +  GMythBackendInfo *backend_info =
   5.107 +	GMYTH_BACKEND_INFO(g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
   5.108  
   5.109 -    return backend_info;
   5.110 +  return backend_info;
   5.111  }
   5.112  
   5.113  /** 
   5.114 @@ -117,20 +117,20 @@
   5.115   * @return a new instance of GMythBackendInfo.
   5.116   */
   5.117  GMythBackendInfo *
   5.118 -gmyth_backend_info_new_full ( const gchar * hostname, const gchar * username,
   5.119 -                              const gchar * password, const gchar * db_name,
   5.120 -                              gint port )
   5.121 +gmyth_backend_info_new_full(const gchar * hostname, const gchar * username,
   5.122 +							const gchar * password, const gchar * db_name,
   5.123 +							gint port)
   5.124  {
   5.125 -    GMythBackendInfo *backend_info =
   5.126 -        GMYTH_BACKEND_INFO ( g_object_new ( GMYTH_BACKEND_INFO_TYPE, NULL ) );
   5.127 +  GMythBackendInfo *backend_info =
   5.128 +	GMYTH_BACKEND_INFO(g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
   5.129  
   5.130 -    gmyth_backend_info_set_hostname ( backend_info, hostname );
   5.131 -    gmyth_backend_info_set_username ( backend_info, username );
   5.132 -    gmyth_backend_info_set_password ( backend_info, password );
   5.133 -    gmyth_backend_info_set_db_name ( backend_info, db_name );
   5.134 -    gmyth_backend_info_set_port ( backend_info, port );
   5.135 +  gmyth_backend_info_set_hostname(backend_info, hostname);
   5.136 +  gmyth_backend_info_set_username(backend_info, username);
   5.137 +  gmyth_backend_info_set_password(backend_info, password);
   5.138 +  gmyth_backend_info_set_db_name(backend_info, db_name);
   5.139 +  gmyth_backend_info_set_port(backend_info, port);
   5.140  
   5.141 -    return backend_info;
   5.142 +  return backend_info;
   5.143  }
   5.144  
   5.145  /** 
   5.146 @@ -142,151 +142,145 @@
   5.147   * @return a new instance of GMythBackendInfo.
   5.148   */
   5.149  GMythBackendInfo *
   5.150 -gmyth_backend_info_new_with_uri ( const gchar * uri_str )
   5.151 +gmyth_backend_info_new_with_uri(const gchar * uri_str)
   5.152  {
   5.153 -    GMythBackendInfo *backend_info =
   5.154 -        GMYTH_BACKEND_INFO ( g_object_new ( GMYTH_BACKEND_INFO_TYPE, NULL ) );
   5.155 +  GMythBackendInfo *backend_info =
   5.156 +	GMYTH_BACKEND_INFO(g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
   5.157  
   5.158 -    GMythURI *uri = gmyth_uri_new_with_value ( uri_str );
   5.159 +  GMythURI *uri = gmyth_uri_new_with_value(uri_str);
   5.160  
   5.161 -    gchar **path_parts = g_strsplit ( gmyth_uri_get_path ( uri ), "&", -1 );
   5.162 +  gchar **path_parts = g_strsplit(gmyth_uri_get_path(uri), "&", -1);
   5.163  
   5.164 -    gmyth_backend_info_set_hostname ( backend_info,
   5.165 -                                      gmyth_uri_get_host ( uri ) );
   5.166 -    gmyth_backend_info_set_username ( backend_info,
   5.167 -                                      gmyth_uri_get_user ( uri ) );
   5.168 -    gmyth_backend_info_set_password ( backend_info,
   5.169 -                                      gmyth_uri_get_password ( uri ) );
   5.170 +  gmyth_backend_info_set_hostname(backend_info, gmyth_uri_get_host(uri));
   5.171 +  gmyth_backend_info_set_username(backend_info, gmyth_uri_get_user(uri));
   5.172 +  gmyth_backend_info_set_password(backend_info, gmyth_uri_get_password(uri));
   5.173  
   5.174 -    /* gets the path info to database name, from the URI, and removes the trash chars */
   5.175 -    gmyth_backend_info_set_db_name ( backend_info, path_parts != NULL &&
   5.176 -                                     strlen ( path_parts[0] ) > 0 ?
   5.177 -                                     g_strstrip ( g_strdelimit
   5.178 -                                                  ( path_parts[0], "/?",
   5.179 -                                                    ' ' ) ) :
   5.180 -                                     gmyth_uri_get_path ( uri ) );
   5.181 + /* gets the path info to database name, from the URI, and removes the trash chars */
   5.182 +  gmyth_backend_info_set_db_name(backend_info, path_parts != NULL &&
   5.183 +								 strlen(path_parts[0]) > 0 ?
   5.184 +								 g_strstrip(g_strdelimit
   5.185 +											(path_parts[0], "/?",
   5.186 +											 ' ')) : gmyth_uri_get_path(uri));
   5.187  
   5.188 -    gmyth_backend_info_set_port ( backend_info, gmyth_uri_get_port ( uri ) );
   5.189 +  gmyth_backend_info_set_port(backend_info, gmyth_uri_get_port(uri));
   5.190  
   5.191 -    g_object_unref ( uri );
   5.192 -    g_strfreev ( path_parts );
   5.193 +  g_object_unref(uri);
   5.194 +  g_strfreev(path_parts);
   5.195  
   5.196 -    return backend_info;
   5.197 +  return backend_info;
   5.198  }
   5.199  
   5.200  void
   5.201 -gmyth_backend_info_set_hostname ( GMythBackendInfo * backend_info,
   5.202 -                                  const gchar * hostname )
   5.203 +gmyth_backend_info_set_hostname(GMythBackendInfo * backend_info,
   5.204 +								const gchar * hostname)
   5.205  {
   5.206 -    g_return_if_fail ( backend_info != NULL );
   5.207 +  g_return_if_fail(backend_info != NULL);
   5.208  
   5.209 -    if ( NULL == hostname || strlen ( hostname ) <= 0 )
   5.210 -    {
   5.211 -        gmyth_debug ( "Error trying to set a hostname equals to NULL." );
   5.212 -    }
   5.213 -    else
   5.214 -    {
   5.215 -        backend_info->hostname = g_strdup ( hostname );
   5.216 -    }
   5.217 +  if (NULL == hostname || strlen(hostname) <= 0)
   5.218 +	{
   5.219 +	  gmyth_debug("Error trying to set a hostname equals to NULL.");
   5.220 +	}
   5.221 +  else
   5.222 +	{
   5.223 +	  backend_info->hostname = g_strdup(hostname);
   5.224 +	}
   5.225  }
   5.226  
   5.227  void
   5.228 -gmyth_backend_info_set_username ( GMythBackendInfo * backend_info,
   5.229 -                                  const gchar * username )
   5.230 +gmyth_backend_info_set_username(GMythBackendInfo * backend_info,
   5.231 +								const gchar * username)
   5.232  {
   5.233 -    g_return_if_fail ( backend_info != NULL );
   5.234 +  g_return_if_fail(backend_info != NULL);
   5.235  
   5.236 -    backend_info->username = g_strdup ( username );
   5.237 +  backend_info->username = g_strdup(username);
   5.238  }
   5.239  
   5.240  void
   5.241 -gmyth_backend_info_set_password ( GMythBackendInfo * backend_info,
   5.242 -                                  const gchar * password )
   5.243 +gmyth_backend_info_set_password(GMythBackendInfo * backend_info,
   5.244 +								const gchar * password)
   5.245  {
   5.246 -    g_return_if_fail ( backend_info != NULL );
   5.247 +  g_return_if_fail(backend_info != NULL);
   5.248  
   5.249 -    backend_info->password = g_strdup ( password );
   5.250 +  backend_info->password = g_strdup(password);
   5.251  }
   5.252  
   5.253  void
   5.254 -gmyth_backend_info_set_db_name ( GMythBackendInfo * backend_info,
   5.255 -                                 const gchar * db_name )
   5.256 +gmyth_backend_info_set_db_name(GMythBackendInfo * backend_info,
   5.257 +							   const gchar * db_name)
   5.258  {
   5.259 -    g_return_if_fail ( backend_info != NULL );
   5.260 +  g_return_if_fail(backend_info != NULL);
   5.261  
   5.262 -    backend_info->db_name = g_strdup ( db_name );
   5.263 +  backend_info->db_name = g_strdup(db_name);
   5.264  }
   5.265  
   5.266  void
   5.267 -gmyth_backend_info_set_port ( GMythBackendInfo * backend_info, gint port )
   5.268 +gmyth_backend_info_set_port(GMythBackendInfo * backend_info, gint port)
   5.269  {
   5.270 -    g_return_if_fail ( backend_info != NULL );
   5.271 +  g_return_if_fail(backend_info != NULL);
   5.272  
   5.273 -    if ( port <= 0 )
   5.274 -    {
   5.275 -        gmyth_debug ( "Error trying to set a port less than 0." );
   5.276 -    }
   5.277 -    else
   5.278 -    {
   5.279 -        backend_info->port = port;
   5.280 -    }
   5.281 +  if (port <= 0)
   5.282 +	{
   5.283 +	  gmyth_debug("Error trying to set a port less than 0.");
   5.284 +	}
   5.285 +  else
   5.286 +	{
   5.287 +	  backend_info->port = port;
   5.288 +	}
   5.289  }
   5.290  
   5.291  void
   5.292 -gmyth_backend_info_set_status_port ( GMythBackendInfo * backend_info,
   5.293 -                                     gint port )
   5.294 +gmyth_backend_info_set_status_port(GMythBackendInfo * backend_info, gint port)
   5.295  {
   5.296 -    g_return_if_fail ( backend_info != NULL );
   5.297 +  g_return_if_fail(backend_info != NULL);
   5.298  
   5.299 -    if ( port <= 0 )
   5.300 -    {
   5.301 -        gmyth_debug
   5.302 -            ( "Error trying to set the status port to less than zero." );
   5.303 -    }
   5.304 -    else
   5.305 -    {
   5.306 -        backend_info->status_port = port;
   5.307 -    }
   5.308 +  if (port <= 0)
   5.309 +	{
   5.310 +	  gmyth_debug("Error trying to set the status port to less than zero.");
   5.311 +	}
   5.312 +  else
   5.313 +	{
   5.314 +	  backend_info->status_port = port;
   5.315 +	}
   5.316  }
   5.317  
   5.318  const gchar *
   5.319 -gmyth_backend_info_get_hostname ( GMythBackendInfo * backend_info )
   5.320 +gmyth_backend_info_get_hostname(GMythBackendInfo * backend_info)
   5.321  {
   5.322 -    g_return_val_if_fail ( backend_info != NULL, NULL );
   5.323 +  g_return_val_if_fail(backend_info != NULL, NULL);
   5.324  
   5.325 -    return backend_info->hostname;
   5.326 +  return backend_info->hostname;
   5.327  }
   5.328  
   5.329  const gchar *
   5.330 -gmyth_backend_info_get_username ( GMythBackendInfo * backend_info )
   5.331 +gmyth_backend_info_get_username(GMythBackendInfo * backend_info)
   5.332  {
   5.333 -    g_return_val_if_fail ( backend_info != NULL, NULL );
   5.334 +  g_return_val_if_fail(backend_info != NULL, NULL);
   5.335  
   5.336 -    return backend_info->username;
   5.337 +  return backend_info->username;
   5.338  }
   5.339  
   5.340  const gchar *
   5.341 -gmyth_backend_info_get_password ( GMythBackendInfo * backend_info )
   5.342 +gmyth_backend_info_get_password(GMythBackendInfo * backend_info)
   5.343  {
   5.344 -    g_return_val_if_fail ( backend_info != NULL, NULL );
   5.345 +  g_return_val_if_fail(backend_info != NULL, NULL);
   5.346  
   5.347 -    return backend_info->password;
   5.348 +  return backend_info->password;
   5.349  }
   5.350  
   5.351  const gchar *
   5.352 -gmyth_backend_info_get_db_name ( GMythBackendInfo * backend_info )
   5.353 +gmyth_backend_info_get_db_name(GMythBackendInfo * backend_info)
   5.354  {
   5.355 -    g_return_val_if_fail ( backend_info != NULL, NULL );
   5.356 +  g_return_val_if_fail(backend_info != NULL, NULL);
   5.357  
   5.358 -    return backend_info->db_name;
   5.359 +  return backend_info->db_name;
   5.360  }
   5.361  
   5.362  gint
   5.363 -gmyth_backend_info_get_port ( GMythBackendInfo * backend_info )
   5.364 +gmyth_backend_info_get_port(GMythBackendInfo * backend_info)
   5.365  {
   5.366 -    g_return_val_if_fail ( backend_info != NULL, -1 );
   5.367 +  g_return_val_if_fail(backend_info != NULL, -1);
   5.368  
   5.369 -    return backend_info->port;
   5.370 +  return backend_info->port;
   5.371  }
   5.372  
   5.373  /** 
   5.374 @@ -298,52 +292,50 @@
   5.375   * @return an instance of GMythURI, created from a GMythBackendInfo.
   5.376   */
   5.377  GMythURI *
   5.378 -gmyth_backend_info_get_uri ( GMythBackendInfo * backend_info )
   5.379 +gmyth_backend_info_get_uri(GMythBackendInfo * backend_info)
   5.380  {
   5.381 -    GMythURI *uri = NULL;
   5.382 -    gchar *uri_str = NULL;
   5.383 -    gchar *user_info = NULL;
   5.384 -    gchar *db_data = NULL;
   5.385 +  GMythURI *uri = NULL;
   5.386 +  gchar *uri_str = NULL;
   5.387 +  gchar *user_info = NULL;
   5.388 +  gchar *db_data = NULL;
   5.389  
   5.390 -    if ( ( backend_info->username != NULL
   5.391 -           && strlen ( backend_info->username ) > 0 ) )
   5.392 -        user_info =
   5.393 -            g_strdup_printf ( "%s:%s@", backend_info->username,
   5.394 -                              backend_info->password );
   5.395 +  if ((backend_info->username != NULL && strlen(backend_info->username) > 0))
   5.396 +	user_info =
   5.397 +	  g_strdup_printf("%s:%s@", backend_info->username,
   5.398 +					  backend_info->password);
   5.399  
   5.400 -    if ( backend_info->db_name != NULL && strlen ( backend_info->db_name ) > 0 )
   5.401 -    {
   5.402 -        if ( ( g_strrstr ( backend_info->db_name, "_" ) != NULL ) )
   5.403 -            db_data = g_strdup ( backend_info->db_name );
   5.404 -        else
   5.405 -            db_data = g_strdup_printf ( "?%s&", backend_info->db_name );
   5.406 -    }
   5.407 -    //else if ( ( ( g_strrstr( backend_info->path, "livetv" ) != NULL ) || 
   5.408 -    //            ( g_strrstr( backend_info->path, "/?" ) != NULL ) )
   5.409 +  if (backend_info->db_name != NULL && strlen(backend_info->db_name) > 0)
   5.410 +	{
   5.411 +	  if ((g_strrstr(backend_info->db_name, "_") != NULL))
   5.412 +		db_data = g_strdup(backend_info->db_name);
   5.413 +	  else
   5.414 +		db_data = g_strdup_printf("?%s&", backend_info->db_name);
   5.415 +	}
   5.416 + //else if ( ( ( g_strrstr( backend_info->path, "livetv" ) != NULL ) || 
   5.417 + //            ( g_strrstr( backend_info->path, "/?" ) != NULL ) )
   5.418  
   5.419 -    uri_str = g_strdup_printf ( "myth://%s%s:%d/%s", user_info != NULL
   5.420 -                                && strlen ( user_info ) > 0 ? user_info : "",
   5.421 -                                backend_info->hostname, backend_info->port,
   5.422 -                                db_data != NULL
   5.423 -                                && strlen ( db_data ) > 0 ? db_data : "" );
   5.424 -    uri = gmyth_uri_new_with_value ( uri_str );
   5.425 +  uri_str = g_strdup_printf("myth://%s%s:%d/%s", user_info != NULL
   5.426 +							&& strlen(user_info) > 0 ? user_info : "",
   5.427 +							backend_info->hostname, backend_info->port,
   5.428 +							db_data != NULL
   5.429 +							&& strlen(db_data) > 0 ? db_data : "");
   5.430 +  uri = gmyth_uri_new_with_value(uri_str);
   5.431  
   5.432 -    if ( user_info != NULL )
   5.433 -        g_free ( user_info );
   5.434 +  if (user_info != NULL)
   5.435 +	g_free(user_info);
   5.436  
   5.437 -    if ( db_data != NULL )
   5.438 -        g_free ( db_data );
   5.439 +  if (db_data != NULL)
   5.440 +	g_free(db_data);
   5.441  
   5.442 -    g_free ( uri_str );
   5.443 +  g_free(uri_str);
   5.444  
   5.445 -    return uri;
   5.446 +  return uri;
   5.447  }
   5.448  
   5.449  gboolean
   5.450 -gmyth_backend_info_is_local_file ( GMythBackendInfo * backend_info )
   5.451 +gmyth_backend_info_is_local_file(GMythBackendInfo * backend_info)
   5.452  {
   5.453 -    g_return_val_if_fail ( backend_info != NULL, FALSE );
   5.454 +  g_return_val_if_fail(backend_info != NULL, FALSE);
   5.455  
   5.456 -    return
   5.457 -        gmyth_uri_is_local_file ( gmyth_backend_info_get_uri ( backend_info ) );
   5.458 +  return gmyth_uri_is_local_file(gmyth_backend_info_get_uri(backend_info));
   5.459  }
     6.1 --- a/gmyth/src/gmyth_backendinfo.h	Wed Jun 13 18:18:42 2007 +0100
     6.2 +++ b/gmyth/src/gmyth_backendinfo.h	Thu Jun 14 18:19:52 2007 +0100
     6.3 @@ -44,67 +44,64 @@
     6.4  typedef struct _GMythBackendInfoClass GMythBackendInfoClass;
     6.5  
     6.6  struct _GMythBackendInfoClass
     6.7 -    {
     6.8 -        GObjectClass parent_class;
     6.9 +{
    6.10 +  GObjectClass parent_class;
    6.11  
    6.12 -        /* callbacks */
    6.13 -        /* no one for now */
    6.14 -    };
    6.15 + /* callbacks */
    6.16 + /* no one for now */
    6.17 +};
    6.18  
    6.19  struct _GMythBackendInfo
    6.20 -    {
    6.21 -        GObject parent;
    6.22 +{
    6.23 +  GObject parent;
    6.24  
    6.25 -    /** The backend hostname or ip address. */
    6.26 -        gchar *hostname;
    6.27 -    /** The username to connect to the mysql server. */
    6.28 -        gchar *username;
    6.29 -    /** The password to connect to the mysql server. */
    6.30 -        gchar *password;
    6.31 -    /** The mythtv's mysql database name. */
    6.32 -        gchar *db_name;
    6.33 -    /** The backend port. */
    6.34 -        gint port;
    6.35 -    /** The backend status port for http connection */
    6.36 -        gint status_port;
    6.37 -        //gchar *path;
    6.38 +	/** The backend hostname or ip address. */
    6.39 +  gchar *hostname;
    6.40 +	/** The username to connect to the mysql server. */
    6.41 +  gchar *username;
    6.42 +	/** The password to connect to the mysql server. */
    6.43 +  gchar *password;
    6.44 +	/** The mythtv's mysql database name. */
    6.45 +  gchar *db_name;
    6.46 +	/** The backend port. */
    6.47 +  gint port;
    6.48 +	/** The backend status port for http connection */
    6.49 +  gint status_port;
    6.50 + //gchar *path;
    6.51  
    6.52 -        //GMythURI* uri;
    6.53 -    };
    6.54 + //GMythURI* uri;
    6.55 +};
    6.56  
    6.57  
    6.58 -GType gmyth_backend_info_get_type ( void );
    6.59 -GMythBackendInfo *gmyth_backend_info_new ( void );
    6.60 -GMythBackendInfo *gmyth_backend_info_new_full ( const gchar * hostname,
    6.61 -                                                const gchar * username,
    6.62 -                                                const gchar * password,
    6.63 -                                                const gchar * db_name,
    6.64 -                                                gint port );
    6.65 -GMythBackendInfo *gmyth_backend_info_new_with_uri ( const gchar * uri_str );
    6.66 -void gmyth_backend_info_set_hostname ( GMythBackendInfo * backend_info,
    6.67 -                                       const gchar * hostname );
    6.68 -void gmyth_backend_info_set_username ( GMythBackendInfo * backend_info,
    6.69 -                                       const gchar * username );
    6.70 -void gmyth_backend_info_set_password ( GMythBackendInfo * backend_info,
    6.71 -                                       const gchar * password );
    6.72 -void gmyth_backend_info_set_db_name ( GMythBackendInfo * backend_info,
    6.73 -                                      const gchar * db_name );
    6.74 -void gmyth_backend_info_set_port ( GMythBackendInfo * backend_info, gint port );
    6.75 -void gmyth_backend_info_set_status_port ( GMythBackendInfo * backend_info,
    6.76 -                                          gint port );
    6.77 +GType gmyth_backend_info_get_type(void);
    6.78 +GMythBackendInfo *gmyth_backend_info_new(void);
    6.79 +GMythBackendInfo *gmyth_backend_info_new_full(const gchar * hostname,
    6.80 +											  const gchar * username,
    6.81 +											  const gchar * password,
    6.82 +											  const gchar * db_name,
    6.83 +											  gint port);
    6.84 +GMythBackendInfo *gmyth_backend_info_new_with_uri(const gchar * uri_str);
    6.85 +void gmyth_backend_info_set_hostname(GMythBackendInfo * backend_info,
    6.86 +									 const gchar * hostname);
    6.87 +void gmyth_backend_info_set_username(GMythBackendInfo * backend_info,
    6.88 +									 const gchar * username);
    6.89 +void gmyth_backend_info_set_password(GMythBackendInfo * backend_info,
    6.90 +									 const gchar * password);
    6.91 +void gmyth_backend_info_set_db_name(GMythBackendInfo * backend_info,
    6.92 +									const gchar * db_name);
    6.93 +void gmyth_backend_info_set_port(GMythBackendInfo * backend_info, gint port);
    6.94 +void gmyth_backend_info_set_status_port(GMythBackendInfo * backend_info,
    6.95 +										gint port);
    6.96  
    6.97 -const gchar *gmyth_backend_info_get_hostname ( GMythBackendInfo *
    6.98 -                                               backend_info );
    6.99 -const gchar *gmyth_backend_info_get_username ( GMythBackendInfo *
   6.100 -                                               backend_info );
   6.101 -const gchar *gmyth_backend_info_get_password ( GMythBackendInfo *
   6.102 -                                               backend_info );
   6.103 -const gchar *gmyth_backend_info_get_db_name ( GMythBackendInfo * backend_info );
   6.104 -gint gmyth_backend_info_get_port ( GMythBackendInfo * backend_info );
   6.105 +const gchar *gmyth_backend_info_get_hostname(GMythBackendInfo * backend_info);
   6.106 +const gchar *gmyth_backend_info_get_username(GMythBackendInfo * backend_info);
   6.107 +const gchar *gmyth_backend_info_get_password(GMythBackendInfo * backend_info);
   6.108 +const gchar *gmyth_backend_info_get_db_name(GMythBackendInfo * backend_info);
   6.109 +gint gmyth_backend_info_get_port(GMythBackendInfo * backend_info);
   6.110  
   6.111 -GMythURI *gmyth_backend_info_get_uri ( GMythBackendInfo * backend_info );
   6.112 +GMythURI *gmyth_backend_info_get_uri(GMythBackendInfo * backend_info);
   6.113  
   6.114 -gboolean gmyth_backend_info_is_local_file ( GMythBackendInfo * backend_info );
   6.115 +gboolean gmyth_backend_info_is_local_file(GMythBackendInfo * backend_info);
   6.116  
   6.117  G_END_DECLS
   6.118  #endif /* __GMYTH_BACKEND_INFO_H__ */
     7.1 --- a/gmyth/src/gmyth_common.c	Wed Jun 13 18:18:42 2007 +0100
     7.2 +++ b/gmyth/src/gmyth_common.c	Thu Jun 14 18:19:52 2007 +0100
     7.3 @@ -33,10 +33,10 @@
     7.4  #include "gmyth_debug.h"
     7.5  #include "gmyth_util.h"
     7.6  
     7.7 -static void free_channel_data ( gpointer data, gpointer user_data );
     7.8 -static void free_program_data ( gpointer data, gpointer user_data );
     7.9 +static void free_channel_data(gpointer data, gpointer user_data);
    7.10 +static void free_program_data(gpointer data, gpointer user_data);
    7.11  
    7.12 -    /** 
    7.13 +	/** 
    7.14  	 * Frees the memory allocated to the GMythChannelInfo objects inside list.
    7.15  	 * The list memory is also released by g_list_free(). If LIST is NULL it
    7.16  	 * simply returns.
    7.17 @@ -44,12 +44,12 @@
    7.18  	 * @param list the GList containing a list of GMythChannelInfo to free.
    7.19  	 */
    7.20  void
    7.21 -gmyth_free_channel_list ( GList * list )
    7.22 +gmyth_free_channel_list(GList * list)
    7.23  {
    7.24 -    g_return_if_fail ( list != NULL );
    7.25 +  g_return_if_fail(list != NULL);
    7.26  
    7.27 -    g_list_foreach ( list, free_channel_data, NULL );
    7.28 -    g_list_free ( list );
    7.29 +  g_list_foreach(list, free_channel_data, NULL);
    7.30 +  g_list_free(list);
    7.31  }
    7.32  
    7.33  /** 
    7.34 @@ -60,29 +60,29 @@
    7.35   * @param list the GList containing a list of GMythProgramInfo to free.
    7.36   */
    7.37  void
    7.38 -gmyth_free_program_list ( GList * list )
    7.39 +gmyth_free_program_list(GList * list)
    7.40  {
    7.41 -    g_return_if_fail ( list != NULL );
    7.42 +  g_return_if_fail(list != NULL);
    7.43  
    7.44 -    g_list_foreach ( list, free_program_data, NULL );
    7.45 -    g_list_free ( list );
    7.46 +  g_list_foreach(list, free_program_data, NULL);
    7.47 +  g_list_free(list);
    7.48  }
    7.49  
    7.50  void
    7.51 -gmyth_channel_info_free ( GMythChannelInfo * channel )
    7.52 +gmyth_channel_info_free(GMythChannelInfo * channel)
    7.53  {
    7.54 -    g_return_if_fail ( channel != NULL );
    7.55 +  g_return_if_fail(channel != NULL);
    7.56  
    7.57 -    if ( channel->channel_num )
    7.58 -        g_string_free ( channel->channel_num, TRUE );
    7.59 +  if (channel->channel_num)
    7.60 +	g_string_free(channel->channel_num, TRUE);
    7.61  
    7.62 -    if ( channel->channel_name )
    7.63 -        g_string_free ( channel->channel_name, TRUE );
    7.64 +  if (channel->channel_name)
    7.65 +	g_string_free(channel->channel_name, TRUE);
    7.66  
    7.67 -    if ( channel->channel_icon )
    7.68 -        g_string_free ( channel->channel_icon, TRUE );
    7.69 +  if (channel->channel_icon)
    7.70 +	g_string_free(channel->channel_icon, TRUE);
    7.71  
    7.72 -    g_free ( channel );
    7.73 +  g_free(channel);
    7.74  }
    7.75  
    7.76  /**
    7.77 @@ -90,20 +90,19 @@
    7.78   * @param channel_info the GMythChannelInfo instance
    7.79   */
    7.80  void
    7.81 -gmyth_channel_info_print ( GMythChannelInfo * channel_info )
    7.82 +gmyth_channel_info_print(GMythChannelInfo * channel_info)
    7.83  {
    7.84  #ifdef GMYTH_USE_DEBUG
    7.85 -    if ( channel_info != NULL )
    7.86 -    {
    7.87 -        g_return_if_fail ( channel_info->channel_name != NULL );
    7.88 -        g_return_if_fail ( channel_info->channel_num != NULL );
    7.89 +  if (channel_info != NULL)
    7.90 +	{
    7.91 +	  g_return_if_fail(channel_info->channel_name != NULL);
    7.92 +	  g_return_if_fail(channel_info->channel_num != NULL);
    7.93  
    7.94 -        gmyth_debug ( "ChannelInfo (Name, Num, ID) = (%s, %s, %d)",
    7.95 -                      channel_info->channel_name->str,
    7.96 -                      channel_info->channel_num->str,
    7.97 -                      channel_info->channel_ID );
    7.98 +	  gmyth_debug("ChannelInfo (Name, Num, ID) = (%s, %s, %d)",
    7.99 +				  channel_info->channel_name->str,
   7.100 +				  channel_info->channel_num->str, channel_info->channel_ID);
   7.101  
   7.102 -    }
   7.103 +	}
   7.104  #endif
   7.105  }
   7.106  
   7.107 @@ -112,42 +111,42 @@
   7.108   * @param channel_info the GMythProgramInfo instance
   7.109   */
   7.110  void
   7.111 -gmyth_program_info_print ( GMythProgramInfo * program_info )
   7.112 +gmyth_program_info_print(GMythProgramInfo * program_info)
   7.113  {
   7.114  #ifdef GMYTH_USE_DEBUG
   7.115 -    g_return_if_fail ( program_info );
   7.116 +  g_return_if_fail(program_info);
   7.117  
   7.118 -    gmyth_debug ( "ProgramInfo\n\tTitle = %s\n\t"
   7.119 -                  "Description = %s\n\t"
   7.120 -                  "Start time= %s\t"
   7.121 -                  "End time = %s\n"
   7.122 -                  "Path name = %s\n"
   7.123 -                  "File size = %lld\n",
   7.124 -                  program_info->title ? program_info->title->str : "NULL",
   7.125 -                  program_info->description ? program_info->description->
   7.126 -                  str : "NULL",
   7.127 -                  gmyth_util_time_to_string_from_time_val ( program_info->
   7.128 -                                                            startts ),
   7.129 -                  gmyth_util_time_to_string_from_time_val ( program_info->
   7.130 -                                                            endts ),
   7.131 -                  program_info->pathname ? program_info->pathname->str : "NULL",
   7.132 -                  program_info->filesize );
   7.133 +  gmyth_debug("ProgramInfo\n\tTitle = %s\n\t"
   7.134 +			  "Description = %s\n\t"
   7.135 +			  "Start time= %s\t"
   7.136 +			  "End time = %s\n"
   7.137 +			  "Path name = %s\n"
   7.138 +			  "File size = %lld\n",
   7.139 +			  program_info->title ? program_info->title->str : "NULL",
   7.140 +			  program_info->description ? program_info->description->
   7.141 +			  str : "NULL",
   7.142 +			  gmyth_util_time_to_string_from_time_val(program_info->
   7.143 +													  startts),
   7.144 +			  gmyth_util_time_to_string_from_time_val(program_info->
   7.145 +													  endts),
   7.146 +			  program_info->pathname ? program_info->pathname->str : "NULL",
   7.147 +			  program_info->filesize);
   7.148  #endif
   7.149  }
   7.150  
   7.151  static void
   7.152 -free_channel_data ( gpointer data, gpointer user_data )
   7.153 +free_channel_data(gpointer data, gpointer user_data)
   7.154  {
   7.155 -    /* Frees the GMythChannelInfo structure */
   7.156 -    GMythChannelInfo *channel = ( GMythChannelInfo * ) data;
   7.157 + /* Frees the GMythChannelInfo structure */
   7.158 +  GMythChannelInfo *channel = (GMythChannelInfo *) data;
   7.159  
   7.160 -    gmyth_channel_info_free ( channel );
   7.161 +  gmyth_channel_info_free(channel);
   7.162  }
   7.163  
   7.164  static void
   7.165 -free_program_data ( gpointer data, gpointer user_data )
   7.166 +free_program_data(gpointer data, gpointer user_data)
   7.167  {
   7.168 -    g_return_if_fail ( data != NULL );
   7.169 +  g_return_if_fail(data != NULL);
   7.170  
   7.171 -    g_object_unref ( ( GMythProgramInfo * ) data );
   7.172 +  g_object_unref((GMythProgramInfo *) data);
   7.173  }
     8.1 --- a/gmyth/src/gmyth_common.h	Wed Jun 13 18:18:42 2007 +0100
     8.2 +++ b/gmyth/src/gmyth_common.h	Thu Jun 14 18:19:52 2007 +0100
     8.3 @@ -38,30 +38,30 @@
     8.4   * The GMythChannelInfo structure represents the channel information
     8.5   * stored in the backend database.
     8.6   */
     8.7 -    typedef struct
     8.8 -    {
     8.9 -    /** The channel ID in backend database */
    8.10 -        gint channel_ID;
    8.11 +  typedef struct
    8.12 +{
    8.13 +	/** The channel ID in backend database */
    8.14 +  gint channel_ID;
    8.15  
    8.16 -    /** The channel number */
    8.17 -        GString *channel_num;
    8.18 +	/** The channel number */
    8.19 +  GString *channel_num;
    8.20  
    8.21 -    /** The channel name in backend database */
    8.22 -        GString *channel_name;
    8.23 +	/** The channel name in backend database */
    8.24 +  GString *channel_name;
    8.25  
    8.26 -    /** The channel icon path in the backend database */
    8.27 -        GString *channel_icon;
    8.28 +	/** The channel icon path in the backend database */
    8.29 +  GString *channel_icon;
    8.30  
    8.31 -    } GMythChannelInfo;
    8.32 +} GMythChannelInfo;
    8.33  
    8.34 -void gmyth_free_channel_list ( GList * list );
    8.35 -void gmyth_free_program_list ( GList * list );
    8.36 +void gmyth_free_channel_list(GList * list);
    8.37 +void gmyth_free_program_list(GList * list);
    8.38  
    8.39 -void gmyth_channel_info_free ( GMythChannelInfo * channel_info );
    8.40 +void gmyth_channel_info_free(GMythChannelInfo * channel_info);
    8.41  
    8.42  
    8.43 -void gmyth_channel_info_print ( GMythChannelInfo * channel_info );
    8.44 -void gmyth_program_info_print ( GMythProgramInfo * program_info );
    8.45 +void gmyth_channel_info_print(GMythChannelInfo * channel_info);
    8.46 +void gmyth_program_info_print(GMythProgramInfo * program_info);
    8.47  
    8.48  G_END_DECLS
    8.49  #endif /* GMYTH_COMMON_H_ */
     9.1 --- a/gmyth/src/gmyth_debug.c	Wed Jun 13 18:18:42 2007 +0100
     9.2 +++ b/gmyth/src/gmyth_debug.c	Thu Jun 14 18:19:52 2007 +0100
     9.3 @@ -30,25 +30,25 @@
     9.4  #include "gmyth_debug.h"
     9.5  
     9.6  void
     9.7 -gmyth_debug_real ( const char *func,
     9.8 -                   const char *file, const int line, gboolean newline,
     9.9 -                   const char *format, ... )
    9.10 +gmyth_debug_real(const char *func,
    9.11 +				 const char *file, const int line, gboolean newline,
    9.12 +				 const char *format, ...)
    9.13  {
    9.14 -    va_list args;
    9.15 -    char buffer[1025];
    9.16 -    char str_time[255];
    9.17 -    time_t the_time;
    9.18 +  va_list args;
    9.19 +  char buffer[1025];
    9.20 +  char str_time[255];
    9.21 +  time_t the_time;
    9.22  
    9.23 -    va_start ( args, format );
    9.24 +  va_start(args, format);
    9.25  
    9.26 -    g_vsnprintf ( buffer, 1024, format, args );
    9.27 +  g_vsnprintf(buffer, 1024, format, args);
    9.28  
    9.29 -    va_end ( args );
    9.30 +  va_end(args);
    9.31  
    9.32 -    time ( &the_time );
    9.33 -    strftime ( str_time, 254, "%H:%M:%S", localtime ( &the_time ) );
    9.34 +  time(&the_time);
    9.35 +  strftime(str_time, 254, "%H:%M:%S", localtime(&the_time));
    9.36  
    9.37 -    g_printerr ( newline ? "(%s) [%p] [%s] %s:%d: %s\n" :
    9.38 -                 "(%s) [%p] [%s] %s:%d: %s", str_time, g_thread_self (  ), func,
    9.39 -                 file, line, buffer );
    9.40 +  g_printerr(newline ? "(%s) [%p] [%s] %s:%d: %s\n" :
    9.41 +			 "(%s) [%p] [%s] %s:%d: %s", str_time, g_thread_self(), func,
    9.42 +			 file, line, buffer);
    9.43  }
    10.1 --- a/gmyth/src/gmyth_debug.h	Wed Jun 13 18:18:42 2007 +0100
    10.2 +++ b/gmyth/src/gmyth_debug.h	Thu Jun 14 18:19:52 2007 +0100
    10.3 @@ -36,11 +36,11 @@
    10.4  #else
    10.5  #define gmyth_debug(...)
    10.6  #endif
    10.7 -    void
    10.8 -gmyth_debug_real ( const char *func,
    10.9 -                   const char *file, int line, gboolean newline,
   10.10 -                   const char *format, ... )
   10.11 -G_GNUC_PRINTF ( 5, 6 );
   10.12 +  void
   10.13 +gmyth_debug_real(const char *func,
   10.14 +				 const char *file, int line, gboolean newline,
   10.15 +				 const char *format, ...)
   10.16 +G_GNUC_PRINTF(5, 6);
   10.17  
   10.18  G_END_DECLS
   10.19  #endif
    11.1 --- a/gmyth/src/gmyth_epg.c	Wed Jun 13 18:18:42 2007 +0100
    11.2 +++ b/gmyth/src/gmyth_epg.c	Thu Jun 14 18:19:52 2007 +0100
    11.3 @@ -8,22 +8,21 @@
    11.4   *
    11.5   * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    11.6   * @author Leonardo Sobral Cunha <leonardo.cunha@indt.org.br>
    11.7 + * 
    11.8 + * This program is free software; you can redistribute it and/or modify
    11.9 + * it under the terms of the GNU Lesser General Public License as published by
   11.10 + * the Free Software Foundation; either version 2 of the License, or
   11.11 + * (at your option) any later version.
   11.12   *
   11.13 -* 
   11.14 -* This program is free software; you can redistribute it and/or modify
   11.15 -* it under the terms of the GNU Lesser General Public License as published by
   11.16 -* the Free Software Foundation; either version 2 of the License, or
   11.17 -* (at your option) any later version.
   11.18 -*
   11.19 -* This program is distributed in the hope that it will be useful,
   11.20 -	* but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.21 -	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11.22 -	* GNU General Public License for more details.
   11.23 -	*
   11.24 -	* You should have received a copy of the GNU Lesser General Public License
   11.25 -	* along with this program; if not, write to the Free Software
   11.26 -	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.27 -	*/
   11.28 + * This program is distributed in the hope that it will be useful,
   11.29 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.30 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11.31 + * GNU General Public License for more details.
   11.32 + *
   11.33 + * You should have received a copy of the GNU Lesser General Public License
   11.34 + * along with this program; if not, write to the Free Software
   11.35 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.36 + */
   11.37  
   11.38  #ifdef HAVE_CONFIG_H
   11.39  #include "config.h"
   11.40 @@ -40,47 +39,47 @@
   11.41  #include "gmyth_file_transfer.h"
   11.42  #include "gmyth_debug.h"
   11.43  
   11.44 -static void gmyth_epg_class_init ( GMythEPGClass * klass );
   11.45 -static void gmyth_epg_init ( GMythEPG * object );
   11.46 +static void gmyth_epg_class_init(GMythEPGClass * klass);
   11.47 +static void gmyth_epg_init(GMythEPG * object);
   11.48  
   11.49 -static void gmyth_epg_dispose ( GObject * object );
   11.50 -static void gmyth_epg_finalize ( GObject * object );
   11.51 +static void gmyth_epg_dispose(GObject * object);
   11.52 +static void gmyth_epg_finalize(GObject * object);
   11.53  
   11.54 -G_DEFINE_TYPE ( GMythEPG, gmyth_epg, G_TYPE_OBJECT )
   11.55 -     static void gmyth_epg_class_init ( GMythEPGClass * klass )
   11.56 +G_DEFINE_TYPE(GMythEPG, gmyth_epg, G_TYPE_OBJECT)
   11.57 +	 static void gmyth_epg_class_init(GMythEPGClass * klass)
   11.58  {
   11.59 -    GObjectClass *gobject_class = G_OBJECT_CLASS ( klass );
   11.60 +  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
   11.61  
   11.62 -    gobject_class->dispose = gmyth_epg_dispose;
   11.63 -    gobject_class->finalize = gmyth_epg_finalize;
   11.64 +  gobject_class->dispose = gmyth_epg_dispose;
   11.65 +  gobject_class->finalize = gmyth_epg_finalize;
   11.66  }
   11.67  
   11.68  static void
   11.69 -gmyth_epg_init ( GMythEPG * gmyth_epg )
   11.70 +gmyth_epg_init(GMythEPG * gmyth_epg)
   11.71  {
   11.72  
   11.73  }
   11.74  
   11.75  static void
   11.76 -gmyth_epg_dispose ( GObject * object )
   11.77 +gmyth_epg_dispose(GObject * object)
   11.78  {
   11.79 -    GMythEPG *gmyth_epg = GMYTH_EPG ( object );
   11.80 +  GMythEPG *gmyth_epg = GMYTH_EPG(object);
   11.81  
   11.82 -    if ( gmyth_epg->sqlquery != NULL )
   11.83 -    {
   11.84 -        g_object_unref ( gmyth_epg->sqlquery );
   11.85 -        gmyth_epg->sqlquery = NULL;
   11.86 -    }
   11.87 +  if (gmyth_epg->sqlquery != NULL)
   11.88 +	{
   11.89 +	  g_object_unref(gmyth_epg->sqlquery);
   11.90 +	  gmyth_epg->sqlquery = NULL;
   11.91 +	}
   11.92  
   11.93 -    G_OBJECT_CLASS ( gmyth_epg_parent_class )->dispose ( object );
   11.94 +  G_OBJECT_CLASS(gmyth_epg_parent_class)->dispose(object);
   11.95  }
   11.96  
   11.97  static void
   11.98 -gmyth_epg_finalize ( GObject * object )
   11.99 +gmyth_epg_finalize(GObject * object)
  11.100  {
  11.101 -    g_signal_handlers_destroy ( object );
  11.102 +  g_signal_handlers_destroy(object);
  11.103  
  11.104 -    G_OBJECT_CLASS ( gmyth_epg_parent_class )->finalize ( object );
  11.105 +  G_OBJECT_CLASS(gmyth_epg_parent_class)->finalize(object);
  11.106  }
  11.107  
  11.108  /**
  11.109 @@ -89,11 +88,11 @@
  11.110   * @return a new instance of GMythEPG.
  11.111   */
  11.112  GMythEPG *
  11.113 -gmyth_epg_new ( void )
  11.114 +gmyth_epg_new(void)
  11.115  {
  11.116 -    GMythEPG *epg = GMYTH_EPG ( g_object_new ( GMYTH_EPG_TYPE, NULL ) );
  11.117 +  GMythEPG *epg = GMYTH_EPG(g_object_new(GMYTH_EPG_TYPE, NULL));
  11.118  
  11.119 -    return epg;
  11.120 +  return epg;
  11.121  }
  11.122  
  11.123  /** Connects to the Mysql database in the backend. The backend address
  11.124 @@ -103,26 +102,26 @@
  11.125   * @return true if connection was success, false if failed.
  11.126   */
  11.127  gboolean
  11.128 -gmyth_epg_connect ( GMythEPG * gmyth_epg, GMythBackendInfo * backend_info )
  11.129 +gmyth_epg_connect(GMythEPG * gmyth_epg, GMythBackendInfo * backend_info)
  11.130  {
  11.131 -    g_return_val_if_fail ( gmyth_epg != NULL, FALSE );
  11.132 +  g_return_val_if_fail(gmyth_epg != NULL, FALSE);
  11.133  
  11.134 -    if ( gmyth_epg->sqlquery == NULL )
  11.135 -    {
  11.136 -        gmyth_debug ( "[%s] Creating gmyth_query", __FUNCTION__ );
  11.137 -        gmyth_epg->sqlquery = gmyth_query_new (  );
  11.138 -    }
  11.139 +  if (gmyth_epg->sqlquery == NULL)
  11.140 +	{
  11.141 +	  gmyth_debug("[%s] Creating gmyth_query", __FUNCTION__);
  11.142 +	  gmyth_epg->sqlquery = gmyth_query_new();
  11.143 +	}
  11.144  
  11.145 -    if ( !gmyth_query_connect ( gmyth_epg->sqlquery, backend_info ) )
  11.146 -    {
  11.147 -        gmyth_debug ( "[%s] Error while connecting to db", __FUNCTION__ );
  11.148 -        return FALSE;
  11.149 -    }
  11.150 +  if (!gmyth_query_connect(gmyth_epg->sqlquery, backend_info))
  11.151 +	{
  11.152 +	  gmyth_debug("[%s] Error while connecting to db", __FUNCTION__);
  11.153 +	  return FALSE;
  11.154 +	}
  11.155  
  11.156 -    gmyth_epg->backend_info = backend_info;
  11.157 -    g_object_ref ( backend_info );
  11.158 +  gmyth_epg->backend_info = backend_info;
  11.159 +  g_object_ref(backend_info);
  11.160  
  11.161 -    return TRUE;
  11.162 +  return TRUE;
  11.163  }
  11.164  
  11.165  /** Disconnects from the Mysql database in the backend.
  11.166 @@ -131,24 +130,24 @@
  11.167   * @return true if disconnection was success, false if failed.
  11.168   */
  11.169  gboolean
  11.170 -gmyth_epg_disconnect ( GMythEPG * gmyth_epg )
  11.171 +gmyth_epg_disconnect(GMythEPG * gmyth_epg)
  11.172  {
  11.173 -    g_return_val_if_fail ( gmyth_epg != NULL, FALSE );
  11.174 +  g_return_val_if_fail(gmyth_epg != NULL, FALSE);
  11.175  
  11.176 -    if ( gmyth_epg->sqlquery != NULL )
  11.177 -    {
  11.178 -        gmyth_query_disconnect ( gmyth_epg->sqlquery );
  11.179 -        g_object_unref ( gmyth_epg->sqlquery );
  11.180 -        gmyth_epg->sqlquery = NULL;
  11.181 -    }
  11.182 +  if (gmyth_epg->sqlquery != NULL)
  11.183 +	{
  11.184 +	  gmyth_query_disconnect(gmyth_epg->sqlquery);
  11.185 +	  g_object_unref(gmyth_epg->sqlquery);
  11.186 +	  gmyth_epg->sqlquery = NULL;
  11.187 +	}
  11.188  
  11.189 -    if ( gmyth_epg->backend_info != NULL )
  11.190 -    {
  11.191 -        g_object_unref ( gmyth_epg->backend_info );
  11.192 -        gmyth_epg->backend_info = NULL;
  11.193 -    }
  11.194 +  if (gmyth_epg->backend_info != NULL)
  11.195 +	{
  11.196 +	  g_object_unref(gmyth_epg->backend_info);
  11.197 +	  gmyth_epg->backend_info = NULL;
  11.198 +	}
  11.199  
  11.200 -    return TRUE;
  11.201 +  return TRUE;
  11.202  }
  11.203  
  11.204  /** Retrieves the available list of channels from the backend Mysql database.
  11.205 @@ -158,87 +157,86 @@
  11.206   * @return The amount of channels retrieved from database,  or -1 if error.
  11.207   */
  11.208  gint
  11.209 -gmyth_epg_get_channel_list ( GMythEPG * gmyth_epg, GList ** glist_ptr )
  11.210 +gmyth_epg_get_channel_list(GMythEPG * gmyth_epg, GList ** glist_ptr)
  11.211  {
  11.212 -    MYSQL_RES *msql_res;
  11.213 +  MYSQL_RES *msql_res;
  11.214  
  11.215 -    g_return_val_if_fail ( gmyth_epg != NULL, -1 );
  11.216 +  g_return_val_if_fail(gmyth_epg != NULL, -1);
  11.217  
  11.218 -    msql_res = gmyth_query_process_statement ( gmyth_epg->sqlquery,
  11.219 -                                               "SELECT chanid, channum, name, icon FROM channel;" );
  11.220 +  msql_res = gmyth_query_process_statement(gmyth_epg->sqlquery,
  11.221 +										   "SELECT chanid, channum, name, icon FROM channel;");
  11.222  
  11.223 -    ( *glist_ptr ) = NULL;
  11.224 +  (*glist_ptr) = NULL;
  11.225  
  11.226 -    if ( msql_res == NULL )
  11.227 -    {
  11.228 -        gmyth_debug ( "[%s] msql query returned NULL MYSQL_RES", __FUNCTION__ );
  11.229 -        return -1;
  11.230 -    }
  11.231 -    else
  11.232 -    {
  11.233 -        MYSQL_ROW row;
  11.234 -        GMythChannelInfo *channel_info;
  11.235 +  if (msql_res == NULL)
  11.236 +	{
  11.237 +	  gmyth_debug("[%s] msql query returned NULL MYSQL_RES", __FUNCTION__);
  11.238 +	  return -1;
  11.239 +	}
  11.240 +  else
  11.241 +	{
  11.242 +	  MYSQL_ROW row;
  11.243 +	  GMythChannelInfo *channel_info;
  11.244  
  11.245 -        while ( ( row = mysql_fetch_row ( msql_res ) ) != NULL )
  11.246 -        {
  11.247 +	  while ((row = mysql_fetch_row(msql_res)) != NULL)
  11.248 +		{
  11.249  
  11.250 -            channel_info = g_new0 ( GMythChannelInfo, 1 );
  11.251 -            channel_info->channel_ID =
  11.252 -                ( gint ) g_ascii_strtoull ( row[0], NULL, 10 );
  11.253 -            channel_info->channel_num = g_string_new ( row[1] );
  11.254 -            channel_info->channel_name = g_string_new ( row[2] );
  11.255 -            channel_info->channel_icon = g_string_new ( row[3] );
  11.256 +		  channel_info = g_new0(GMythChannelInfo, 1);
  11.257 +		  channel_info->channel_ID =
  11.258 +			(gint) g_ascii_strtoull(row[0], NULL, 10);
  11.259 +		  channel_info->channel_num = g_string_new(row[1]);
  11.260 +		  channel_info->channel_name = g_string_new(row[2]);
  11.261 +		  channel_info->channel_icon = g_string_new(row[3]);
  11.262  #ifdef GMYTH_USE_DEBUG
  11.263 -            gmyth_channel_info_print ( channel_info );
  11.264 +		  gmyth_channel_info_print(channel_info);
  11.265  #endif
  11.266 -            ( *glist_ptr ) = g_list_append ( ( *glist_ptr ), channel_info );
  11.267 -        }
  11.268 -    }
  11.269 -    mysql_free_result ( msql_res );
  11.270 +		  (*glist_ptr) = g_list_append((*glist_ptr), channel_info);
  11.271 +		}
  11.272 +	}
  11.273 +  mysql_free_result(msql_res);
  11.274  
  11.275 -    return ( !( *glist_ptr ) ) ? 0 : g_list_length ( *glist_ptr );
  11.276 +  return (!(*glist_ptr)) ? 0 : g_list_length(*glist_ptr);
  11.277  }
  11.278  
  11.279  GMythChannelInfo *
  11.280 -gmyth_epg_get_channel_info ( GMythEPG * gmyth_epg, gint channel_id )
  11.281 +gmyth_epg_get_channel_info(GMythEPG * gmyth_epg, gint channel_id)
  11.282  {
  11.283 -    GMythChannelInfo *channel_info = NULL;
  11.284 -    MYSQL_RES *msql_res;
  11.285 -    gchar *query_str;
  11.286 +  GMythChannelInfo *channel_info = NULL;
  11.287 +  MYSQL_RES *msql_res;
  11.288 +  gchar *query_str;
  11.289  
  11.290 -    g_return_val_if_fail ( gmyth_epg != NULL, NULL );
  11.291 +  g_return_val_if_fail(gmyth_epg != NULL, NULL);
  11.292  
  11.293 -    query_str =
  11.294 -        g_strdup_printf
  11.295 -        ( "SELECT channum, name, icon FROM channel WHERE chanid=%d;",
  11.296 -          channel_id );
  11.297 -    msql_res = gmyth_query_process_statement ( gmyth_epg->sqlquery, query_str );
  11.298 +  query_str =
  11.299 +	g_strdup_printf
  11.300 +	("SELECT channum, name, icon FROM channel WHERE chanid=%d;", channel_id);
  11.301 +  msql_res = gmyth_query_process_statement(gmyth_epg->sqlquery, query_str);
  11.302  
  11.303 -    if ( msql_res == NULL )
  11.304 -    {
  11.305 -        gmyth_debug ( "[%s] msql query returned NULL MYSQL_RES", __FUNCTION__ );
  11.306 -        return NULL;
  11.307 -    }
  11.308 -    else
  11.309 -    {
  11.310 -        MYSQL_ROW row;
  11.311 +  if (msql_res == NULL)
  11.312 +	{
  11.313 +	  gmyth_debug("[%s] msql query returned NULL MYSQL_RES", __FUNCTION__);
  11.314 +	  return NULL;
  11.315 +	}
  11.316 +  else
  11.317 +	{
  11.318 +	  MYSQL_ROW row;
  11.319  
  11.320 -        if ( ( row = mysql_fetch_row ( msql_res ) ) != NULL )
  11.321 -        {
  11.322 +	  if ((row = mysql_fetch_row(msql_res)) != NULL)
  11.323 +		{
  11.324  
  11.325 -            channel_info = g_new0 ( GMythChannelInfo, 1 );
  11.326 -            channel_info->channel_ID = channel_id;
  11.327 -            channel_info->channel_num = g_string_new ( row[0] );
  11.328 -            channel_info->channel_name = g_string_new ( row[1] );
  11.329 -            channel_info->channel_icon = g_string_new ( row[2] );
  11.330 +		  channel_info = g_new0(GMythChannelInfo, 1);
  11.331 +		  channel_info->channel_ID = channel_id;
  11.332 +		  channel_info->channel_num = g_string_new(row[0]);
  11.333 +		  channel_info->channel_name = g_string_new(row[1]);
  11.334 +		  channel_info->channel_icon = g_string_new(row[2]);
  11.335  #ifdef GMYTH_USE_DEBUG
  11.336 -            gmyth_channel_info_print ( channel_info );
  11.337 +		  gmyth_channel_info_print(channel_info);
  11.338  #endif
  11.339 -        }
  11.340 -    }
  11.341 -    mysql_free_result ( msql_res );
  11.342 +		}
  11.343 +	}
  11.344 +  mysql_free_result(msql_res);
  11.345  
  11.346 -    return channel_info;
  11.347 +  return channel_info;
  11.348  }
  11.349  
  11.350  /** 
  11.351 @@ -252,141 +250,141 @@
  11.352   * @return The amount of channels retrieved from database, or -1 if error.
  11.353   */
  11.354  gint
  11.355 -gmyth_epg_get_program_list ( GMythEPG * gmyth_epg, GList ** proglist,
  11.356 -                             const gint chan_num, GTimeVal * starttime,
  11.357 -                             GTimeVal * endtime )
  11.358 +gmyth_epg_get_program_list(GMythEPG * gmyth_epg, GList ** proglist,
  11.359 +						   const gint chan_num, GTimeVal * starttime,
  11.360 +						   GTimeVal * endtime)
  11.361  {
  11.362  
  11.363 -    gchar *startts = gmyth_util_time_to_string_from_time_val ( starttime );
  11.364 -    gchar *endts = gmyth_util_time_to_string_from_time_val ( endtime );
  11.365 -    MYSQL_ROW row;
  11.366 -    GString *querystr;
  11.367 +  gchar *startts = gmyth_util_time_to_string_from_time_val(starttime);
  11.368 +  gchar *endts = gmyth_util_time_to_string_from_time_val(endtime);
  11.369 +  MYSQL_ROW row;
  11.370 +  GString *querystr;
  11.371  
  11.372 -    assert ( gmyth_epg );
  11.373 +  assert(gmyth_epg);
  11.374  
  11.375 -    querystr =
  11.376 -        g_string_new
  11.377 -        ( "SELECT DISTINCT program.chanid, program.starttime, program.endtime, "
  11.378 -          "    program.title, program.subtitle, program.description, "
  11.379 -          "    program.category, channel.channum, channel.callsign, "
  11.380 -          "    channel.name, program.previouslyshown, channel.commfree, "
  11.381 -          "    channel.outputfilters, program.seriesid, program.programid, "
  11.382 -          "    program.airdate, program.stars, program.originalairdate, "
  11.383 -          "    program.category_type, oldrecstatus.recordid, "
  11.384 -          "    oldrecstatus.rectype, oldrecstatus.recstatus, "
  11.385 -          "    oldrecstatus.findid " "FROM program "
  11.386 -          "LEFT JOIN channel ON program.chanid = channel.chanid "
  11.387 -          "LEFT JOIN oldrecorded AS oldrecstatus ON "
  11.388 -          "    program.title = oldrecstatus.title AND "
  11.389 -          "    channel.callsign = oldrecstatus.station AND "
  11.390 -          "    program.starttime = oldrecstatus.starttime " );
  11.391 +  querystr =
  11.392 +	g_string_new
  11.393 +	("SELECT DISTINCT program.chanid, program.starttime, program.endtime, "
  11.394 +	 "    program.title, program.subtitle, program.description, "
  11.395 +	 "    program.category, channel.channum, channel.callsign, "
  11.396 +	 "    channel.name, program.previouslyshown, channel.commfree, "
  11.397 +	 "    channel.outputfilters, program.seriesid, program.programid, "
  11.398 +	 "    program.airdate, program.stars, program.originalairdate, "
  11.399 +	 "    program.category_type, oldrecstatus.recordid, "
  11.400 +	 "    oldrecstatus.rectype, oldrecstatus.recstatus, "
  11.401 +	 "    oldrecstatus.findid " "FROM program "
  11.402 +	 "LEFT JOIN channel ON program.chanid = channel.chanid "
  11.403 +	 "LEFT JOIN oldrecorded AS oldrecstatus ON "
  11.404 +	 "    program.title = oldrecstatus.title AND "
  11.405 +	 "    channel.callsign = oldrecstatus.station AND "
  11.406 +	 "    program.starttime = oldrecstatus.starttime ");
  11.407  
  11.408 -    g_string_append_printf ( querystr,
  11.409 -                             "WHERE program.chanid = %d "
  11.410 -                             "  AND program.endtime >= '%s' "
  11.411 -                             "  AND program.starttime <= '%s' "
  11.412 -                             "  AND program.manualid = 0 ", chan_num, startts,
  11.413 -                             endts );
  11.414 +  g_string_append_printf(querystr,
  11.415 +						 "WHERE program.chanid = %d "
  11.416 +						 "  AND program.endtime >= '%s' "
  11.417 +						 "  AND program.starttime <= '%s' "
  11.418 +						 "  AND program.manualid = 0 ", chan_num, startts,
  11.419 +						 endts);
  11.420  
  11.421 -    if ( !g_strrstr ( querystr->str, " GROUP BY " ) )
  11.422 -        querystr = g_string_append ( querystr,
  11.423 -                                     " GROUP BY program.starttime, channel.channum, "
  11.424 -                                     "  channel.callsign, program.title " );
  11.425 +  if (!g_strrstr(querystr->str, " GROUP BY "))
  11.426 +	querystr = g_string_append(querystr,
  11.427 +							   " GROUP BY program.starttime, channel.channum, "
  11.428 +							   "  channel.callsign, program.title ");
  11.429  
  11.430 -    if ( !g_strrstr ( querystr->str, " LIMIT " ) )
  11.431 -        querystr = g_string_append ( querystr, " LIMIT 1000 " );
  11.432 +  if (!g_strrstr(querystr->str, " LIMIT "))
  11.433 +	querystr = g_string_append(querystr, " LIMIT 1000 ");
  11.434  
  11.435 -    MYSQL_RES *res_set =
  11.436 -        gmyth_query_process_statement ( gmyth_epg->sqlquery, querystr->str );
  11.437 +  MYSQL_RES *res_set =
  11.438 +	gmyth_query_process_statement(gmyth_epg->sqlquery, querystr->str);
  11.439  
  11.440 -    if ( res_set == NULL )
  11.441 -    {
  11.442 -        gmyth_debug ( "[%s] msql query returned NULL MYSQL_RES", __FUNCTION__ );
  11.443 -        return -1;
  11.444 -    }
  11.445 +  if (res_set == NULL)
  11.446 +	{
  11.447 +	  gmyth_debug("[%s] msql query returned NULL MYSQL_RES", __FUNCTION__);
  11.448 +	  return -1;
  11.449 +	}
  11.450  
  11.451 -    ( *proglist ) = NULL;
  11.452 -    while ( ( row = mysql_fetch_row ( res_set ) ) != NULL )
  11.453 -    {
  11.454 +  (*proglist) = NULL;
  11.455 +  while ((row = mysql_fetch_row(res_set)) != NULL)
  11.456 +	{
  11.457  
  11.458 -        GMythProgramInfo *p = gmyth_program_info_new (  );
  11.459 +	  GMythProgramInfo *p = gmyth_program_info_new();
  11.460  
  11.461 -        p->chanid = g_string_new ( row[0] );
  11.462 +	  p->chanid = g_string_new(row[0]);
  11.463  
  11.464 -        p->startts = gmyth_util_string_to_time_val ( row[1] );
  11.465 -        p->endts = gmyth_util_string_to_time_val ( row[2] );
  11.466 +	  p->startts = gmyth_util_string_to_time_val(row[1]);
  11.467 +	  p->endts = gmyth_util_string_to_time_val(row[2]);
  11.468  
  11.469 -        p->recstartts = g_new0 ( GTimeVal, 1 );
  11.470 -        p->recstartts->tv_sec = p->startts->tv_sec;
  11.471 -        p->recstartts->tv_usec = p->startts->tv_usec;
  11.472 +	  p->recstartts = g_new0(GTimeVal, 1);
  11.473 +	  p->recstartts->tv_sec = p->startts->tv_sec;
  11.474 +	  p->recstartts->tv_usec = p->startts->tv_usec;
  11.475  
  11.476 -        p->recendts = g_new0 ( GTimeVal, 1 );
  11.477 -        p->recendts->tv_sec = p->endts->tv_sec;
  11.478 -        p->recendts->tv_usec = p->endts->tv_usec;
  11.479 +	  p->recendts = g_new0(GTimeVal, 1);
  11.480 +	  p->recendts->tv_sec = p->endts->tv_sec;
  11.481 +	  p->recendts->tv_usec = p->endts->tv_usec;
  11.482  
  11.483 -        p->lastmodified = g_new0 ( GTimeVal, 1 );
  11.484 -        p->lastmodified->tv_sec = p->startts->tv_sec;
  11.485 -        p->lastmodified->tv_usec = p->startts->tv_usec;
  11.486 +	  p->lastmodified = g_new0(GTimeVal, 1);
  11.487 +	  p->lastmodified->tv_sec = p->startts->tv_sec;
  11.488 +	  p->lastmodified->tv_usec = p->startts->tv_usec;
  11.489  
  11.490 -        p->title = g_string_new ( row[3] );
  11.491 -        p->subtitle = g_string_new ( row[4] );
  11.492 -        p->description = g_string_new ( row[5] );
  11.493 -        p->category = g_string_new ( row[6] );
  11.494 -        p->chanstr = g_string_new ( row[7] );
  11.495 -        p->chansign = g_string_new ( row[8] );
  11.496 -        p->channame = g_string_new ( row[9] );
  11.497 -        p->repeat = g_ascii_strtoull ( row[10], NULL, 10 );
  11.498 -        p->chancommfree = g_ascii_strtoull ( row[11], NULL, 10 );
  11.499 -        p->chanOutputFilters = g_string_new ( row[12] );
  11.500 -        p->seriesid = g_string_new ( row[13] );
  11.501 -        p->programid = g_string_new ( row[14] );
  11.502 -        p->year = g_string_new ( row[15] );
  11.503 -        p->stars = g_ascii_strtod ( row[16], NULL );
  11.504 +	  p->title = g_string_new(row[3]);
  11.505 +	  p->subtitle = g_string_new(row[4]);
  11.506 +	  p->description = g_string_new(row[5]);
  11.507 +	  p->category = g_string_new(row[6]);
  11.508 +	  p->chanstr = g_string_new(row[7]);
  11.509 +	  p->chansign = g_string_new(row[8]);
  11.510 +	  p->channame = g_string_new(row[9]);
  11.511 +	  p->repeat = g_ascii_strtoull(row[10], NULL, 10);
  11.512 +	  p->chancommfree = g_ascii_strtoull(row[11], NULL, 10);
  11.513 +	  p->chanOutputFilters = g_string_new(row[12]);
  11.514 +	  p->seriesid = g_string_new(row[13]);
  11.515 +	  p->programid = g_string_new(row[14]);
  11.516 +	  p->year = g_string_new(row[15]);
  11.517 +	  p->stars = g_ascii_strtod(row[16], NULL);
  11.518  
  11.519 -        if ( !row[17] || !strcmp ( row[17], "" ) )
  11.520 -        {
  11.521 -            p->originalAirDate = 0;
  11.522 -            p->hasAirDate = FALSE;
  11.523 -        }
  11.524 -        else
  11.525 -        {
  11.526 -            p->originalAirDate = gmyth_util_string_to_time_val ( row[17] );
  11.527 -            p->hasAirDate = TRUE;
  11.528 -        }
  11.529 +	  if (!row[17] || !strcmp(row[17], ""))
  11.530 +		{
  11.531 +		  p->originalAirDate = 0;
  11.532 +		  p->hasAirDate = FALSE;
  11.533 +		}
  11.534 +	  else
  11.535 +		{
  11.536 +		  p->originalAirDate = gmyth_util_string_to_time_val(row[17]);
  11.537 +		  p->hasAirDate = TRUE;
  11.538 +		}
  11.539  
  11.540 -        p->catType = g_string_new ( row[18] );
  11.541 +	  p->catType = g_string_new(row[18]);
  11.542  
  11.543 -        *proglist = g_list_append ( ( *proglist ), p );
  11.544 +	  *proglist = g_list_append((*proglist), p);
  11.545  
  11.546  #ifdef GMYTH_USE_DEBUG
  11.547 -        gmyth_program_info_print ( p );
  11.548 +	  gmyth_program_info_print(p);
  11.549  #endif
  11.550 -    }
  11.551 +	}
  11.552  
  11.553 -    /* deallocate */
  11.554 -    mysql_free_result ( res_set );
  11.555 -    g_string_free ( querystr, TRUE );
  11.556 + /* deallocate */
  11.557 +  mysql_free_result(res_set);
  11.558 +  g_string_free(querystr, TRUE);
  11.559  
  11.560 -    return TRUE;
  11.561 +  return TRUE;
  11.562  }
  11.563  
  11.564  gboolean
  11.565 -gmyth_epg_channel_has_icon ( GMythEPG * gmyth_epg,
  11.566 -                             GMythChannelInfo * channel_info )
  11.567 +gmyth_epg_channel_has_icon(GMythEPG * gmyth_epg,
  11.568 +						   GMythChannelInfo * channel_info)
  11.569  {
  11.570 -    gboolean res = FALSE;
  11.571 +  gboolean res = FALSE;
  11.572  
  11.573 -    g_return_val_if_fail ( gmyth_epg != NULL, FALSE );
  11.574 -    g_return_val_if_fail ( channel_info != NULL, FALSE );
  11.575 +  g_return_val_if_fail(gmyth_epg != NULL, FALSE);
  11.576 +  g_return_val_if_fail(channel_info != NULL, FALSE);
  11.577  
  11.578 -    if ( channel_info->channel_icon != NULL )
  11.579 -    {
  11.580 -        res =
  11.581 -            gmyth_util_file_exists ( gmyth_epg->backend_info,
  11.582 -                                     channel_info->channel_icon->str );
  11.583 -    }
  11.584 +  if (channel_info->channel_icon != NULL)
  11.585 +	{
  11.586 +	  res =
  11.587 +		gmyth_util_file_exists(gmyth_epg->backend_info,
  11.588 +							   channel_info->channel_icon->str);
  11.589 +	}
  11.590  
  11.591 -    return res;
  11.592 +  return res;
  11.593  
  11.594  }
  11.595  
  11.596 @@ -396,57 +394,55 @@
  11.597   * @return TRUE if success, FALSE if any error happens.
  11.598   */
  11.599  gboolean
  11.600 -gmyth_epg_channel_get_icon ( GMythEPG * gmyth_epg,
  11.601 -                             GMythChannelInfo * channel_info, guint8 ** data,
  11.602 -                             guint * length )
  11.603 +gmyth_epg_channel_get_icon(GMythEPG * gmyth_epg,
  11.604 +						   GMythChannelInfo * channel_info, guint8 ** data,
  11.605 +						   guint * length)
  11.606  {
  11.607 -    gboolean res = FALSE;
  11.608 +  gboolean res = FALSE;
  11.609  
  11.610 -    g_return_val_if_fail ( gmyth_epg != NULL, FALSE );
  11.611 -    g_return_val_if_fail ( channel_info != NULL, FALSE );
  11.612 +  g_return_val_if_fail(gmyth_epg != NULL, FALSE);
  11.613 +  g_return_val_if_fail(channel_info != NULL, FALSE);
  11.614  
  11.615 -    if ( gmyth_epg_channel_has_icon ( gmyth_epg, channel_info ) )
  11.616 -    {
  11.617 -        GMythFileTransfer *transfer =
  11.618 -            gmyth_file_transfer_new ( gmyth_epg->backend_info );
  11.619 -        GMythFileReadResult gmyth_res;
  11.620 -        GByteArray *icon_data;
  11.621 -        guint64 icon_length = 0;
  11.622 +  if (gmyth_epg_channel_has_icon(gmyth_epg, channel_info))
  11.623 +	{
  11.624 +	  GMythFileTransfer *transfer =
  11.625 +		gmyth_file_transfer_new(gmyth_epg->backend_info);
  11.626 +	  GMythFileReadResult gmyth_res;
  11.627 +	  GByteArray *icon_data;
  11.628 +	  guint64 icon_length = 0;
  11.629  
  11.630 -        res =
  11.631 -            gmyth_file_transfer_open ( transfer,
  11.632 -                                       channel_info->channel_icon->str );
  11.633 -        if ( !res )
  11.634 -        {
  11.635 -            gmyth_debug ( "Channel icon could not be opened" );
  11.636 -            return FALSE;
  11.637 -        }
  11.638 +	  res =
  11.639 +		gmyth_file_transfer_open(transfer, channel_info->channel_icon->str);
  11.640 +	  if (!res)
  11.641 +		{
  11.642 +		  gmyth_debug("Channel icon could not be opened");
  11.643 +		  return FALSE;
  11.644 +		}
  11.645  
  11.646 -        icon_length = gmyth_file_transfer_get_filesize ( transfer );
  11.647 -        if ( icon_length <= 0 )
  11.648 -        {
  11.649 -            gmyth_debug ( "Channel icon file size is zero or negative" );
  11.650 -            return FALSE;
  11.651 -        }
  11.652 +	  icon_length = gmyth_file_transfer_get_filesize(transfer);
  11.653 +	  if (icon_length <= 0)
  11.654 +		{
  11.655 +		  gmyth_debug("Channel icon file size is zero or negative");
  11.656 +		  return FALSE;
  11.657 +		}
  11.658  
  11.659 -        icon_data = g_byte_array_new (  );
  11.660 -        gmyth_res =
  11.661 -            gmyth_file_transfer_read ( transfer, icon_data, icon_length,
  11.662 -                                       FALSE );
  11.663 -        if ( gmyth_res == GMYTH_FILE_READ_EOF )
  11.664 -        {
  11.665 -            *length = icon_length;
  11.666 -            *data = icon_data->data;
  11.667 -            g_byte_array_free ( icon_data, FALSE );
  11.668 -            res = TRUE;
  11.669 -        }
  11.670 -        else
  11.671 -        {
  11.672 -            *length = 0;
  11.673 -            *data = NULL;
  11.674 -            g_byte_array_free ( icon_data, TRUE );
  11.675 -        }
  11.676 -    }
  11.677 +	  icon_data = g_byte_array_new();
  11.678 +	  gmyth_res =
  11.679 +		gmyth_file_transfer_read(transfer, icon_data, icon_length, FALSE);
  11.680 +	  if (gmyth_res == GMYTH_FILE_READ_EOF)
  11.681 +		{
  11.682 +		  *length = icon_length;
  11.683 +		  *data = icon_data->data;
  11.684 +		  g_byte_array_free(icon_data, FALSE);
  11.685 +		  res = TRUE;
  11.686 +		}
  11.687 +	  else
  11.688 +		{
  11.689 +		  *length = 0;
  11.690 +		  *data = NULL;
  11.691 +		  g_byte_array_free(icon_data, TRUE);
  11.692 +		}
  11.693 +	}
  11.694  
  11.695 -    return res;
  11.696 +  return res;
  11.697  }
    12.1 --- a/gmyth/src/gmyth_epg.h	Wed Jun 13 18:18:42 2007 +0100
    12.2 +++ b/gmyth/src/gmyth_epg.h	Thu Jun 14 18:19:52 2007 +0100
    12.3 @@ -8,22 +8,21 @@
    12.4   *
    12.5   * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    12.6   * @author Leonardo Sobral Cunha <leonardo.cunha@indt.org.br>
    12.7 + * 
    12.8 + * This program is free software; you can redistribute it and/or modify
    12.9 + * it under the terms of the GNU Lesser General Public License as published by
   12.10 + * the Free Software Foundation; either version 2 of the License, or
   12.11 + * (at your option) any later version.
   12.12   *
   12.13 -* 
   12.14 -* This program is free software; you can redistribute it and/or modify
   12.15 -* it under the terms of the GNU Lesser General Public License as published by
   12.16 -* the Free Software Foundation; either version 2 of the License, or
   12.17 -* (at your option) any later version.
   12.18 -*
   12.19 -* This program is distributed in the hope that it will be useful,
   12.20 -	* but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.21 -	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12.22 -	* GNU General Public License for more details.
   12.23 -	*
   12.24 -	* You should have received a copy of the GNU Lesser General Public License
   12.25 -	* along with this program; if not, write to the Free Software
   12.26 -	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   12.27 -	*/
   12.28 + * This program is distributed in the hope that it will be useful,
   12.29 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.30 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12.31 + * GNU General Public License for more details.
   12.32 + *
   12.33 + * You should have received a copy of the GNU Lesser General Public License
   12.34 + * along with this program; if not, write to the Free Software
   12.35 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   12.36 + */
   12.37  
   12.38  #ifndef GMYTH_EPG_H_
   12.39  #define GMYTH_EPG_H_
   12.40 @@ -44,43 +43,43 @@
   12.41  typedef struct _GMythEPGClass GMythEPGClass;
   12.42  
   12.43  struct _GMythEPGClass
   12.44 -    {
   12.45 -        GObjectClass parent_class;
   12.46 +{
   12.47 +  GObjectClass parent_class;
   12.48  
   12.49 -        /* callbacks */
   12.50 -        /* no one for now */
   12.51 -    };
   12.52 + /* callbacks */
   12.53 + /* no one for now */
   12.54 +};
   12.55  
   12.56  struct _GMythEPG
   12.57 -    {
   12.58 -        GObject parent;
   12.59 +{
   12.60 +  GObject parent;
   12.61  
   12.62 -        GMythQuery *sqlquery;
   12.63 -        GMythBackendInfo *backend_info;
   12.64 -    };
   12.65 +  GMythQuery *sqlquery;
   12.66 +  GMythBackendInfo *backend_info;
   12.67 +};
   12.68  
   12.69 -GType gmyth_epg_get_type ( void );
   12.70 +GType gmyth_epg_get_type(void);
   12.71  
   12.72 -GMythEPG *gmyth_epg_new ( void );
   12.73 +GMythEPG *gmyth_epg_new(void);
   12.74  
   12.75 -gboolean gmyth_epg_connect ( GMythEPG * gmyth_epg,
   12.76 -                             GMythBackendInfo * backend_info );
   12.77 -gboolean gmyth_epg_disconnect ( GMythEPG * gmyth_epg );
   12.78 +gboolean gmyth_epg_connect(GMythEPG * gmyth_epg,
   12.79 +						   GMythBackendInfo * backend_info);
   12.80 +gboolean gmyth_epg_disconnect(GMythEPG * gmyth_epg);
   12.81  
   12.82 -gint gmyth_epg_get_channel_list ( GMythEPG * gmyth_epg, GList ** glist_ptr );
   12.83 -gint gmyth_epg_get_program_list ( GMythEPG * gmyth_epg, GList ** proglist,
   12.84 -                                  const gint chanNum, GTimeVal * starttime,
   12.85 -                                  GTimeVal * endtime );
   12.86 +gint gmyth_epg_get_channel_list(GMythEPG * gmyth_epg, GList ** glist_ptr);
   12.87 +gint gmyth_epg_get_program_list(GMythEPG * gmyth_epg, GList ** proglist,
   12.88 +								const gint chanNum, GTimeVal * starttime,
   12.89 +								GTimeVal * endtime);
   12.90  
   12.91 -GMythChannelInfo *gmyth_epg_get_channel_info ( GMythEPG * gmyth_epg,
   12.92 -                                               gint channel_id );
   12.93 +GMythChannelInfo *gmyth_epg_get_channel_info(GMythEPG * gmyth_epg,
   12.94 +											 gint channel_id);
   12.95  
   12.96  
   12.97 -gboolean gmyth_epg_channel_has_icon ( GMythEPG * gmyth_epg,
   12.98 -                                      GMythChannelInfo * channel );
   12.99 -gboolean gmyth_epg_channel_get_icon ( GMythEPG * gmyth_epg,
  12.100 -                                      GMythChannelInfo * channel,
  12.101 -                                      guint8 ** data, guint * length );
  12.102 +gboolean gmyth_epg_channel_has_icon(GMythEPG * gmyth_epg,
  12.103 +									GMythChannelInfo * channel);
  12.104 +gboolean gmyth_epg_channel_get_icon(GMythEPG * gmyth_epg,
  12.105 +									GMythChannelInfo * channel,
  12.106 +									guint8 ** data, guint * length);
  12.107  
  12.108 -
  12.109 +G_END_DECLS
  12.110  #endif /*GMYTH_EPG_H_ */
    13.1 --- a/gmyth/src/gmyth_file.c	Wed Jun 13 18:18:42 2007 +0100
    13.2 +++ b/gmyth/src/gmyth_file.c	Thu Jun 14 18:19:52 2007 +0100
    13.3 @@ -53,151 +53,150 @@
    13.4  	(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GMYTH_FILE_TYPE, GMythFilePrivate))
    13.5  
    13.6  struct _GMythFilePrivate
    13.7 -    {
    13.8 -        gboolean disposed;
    13.9 -        gint64 offset;
   13.10 -        guint64 filesize;
   13.11 +{
   13.12 +  gboolean disposed;
   13.13 +  gint64 offset;
   13.14 +  guint64 filesize;
   13.15  
   13.16 -        GMythBackendInfo *backend_info;
   13.17 +  GMythBackendInfo *backend_info;
   13.18  
   13.19 -        /* Myth URI structure */
   13.20 -        gchar *filename;
   13.21 + /* Myth URI structure */
   13.22 +  gchar *filename;
   13.23  
   13.24 -        gint file_id;
   13.25 -    };
   13.26 +  gint file_id;
   13.27 +};
   13.28  
   13.29  enum
   13.30 -    {
   13.31 -        PROP_GMYTH_FILE_DUMMY,
   13.32 -        PROP_GMYTH_FILE_FILENAME,
   13.33 -        PROP_GMYTH_FILE_OFFSET,
   13.34 -        PROP_GMYTH_FILE_FILESIZE,
   13.35 -        PROP_GMYTH_FILE_BACKEND_INFO,
   13.36 -        PROP_GMYTH_FILE_FILEID
   13.37 -    };
   13.38 +{
   13.39 +  PROP_GMYTH_FILE_DUMMY,
   13.40 +  PROP_GMYTH_FILE_FILENAME,
   13.41 +  PROP_GMYTH_FILE_OFFSET,
   13.42 +  PROP_GMYTH_FILE_FILESIZE,
   13.43 +  PROP_GMYTH_FILE_BACKEND_INFO,
   13.44 +  PROP_GMYTH_FILE_FILEID
   13.45 +};
   13.46  
   13.47 -static void gmyth_file_set_property ( GObject * object, guint prop_id,
   13.48 -                                      const GValue * value,
   13.49 -                                      GParamSpec * pspec );
   13.50 -static void gmyth_file_get_property ( GObject * object, guint prop_id,
   13.51 -                                      GValue * value, GParamSpec * pspec );
   13.52 +static void gmyth_file_set_property(GObject * object, guint prop_id,
   13.53 +									const GValue * value, GParamSpec * pspec);
   13.54 +static void gmyth_file_get_property(GObject * object, guint prop_id,
   13.55 +									GValue * value, GParamSpec * pspec);
   13.56  
   13.57 -static void gmyth_file_class_init ( GMythFileClass * klass );
   13.58 -static void gmyth_file_init ( GMythFile * object );
   13.59 -static void gmyth_file_dispose ( GObject * object );
   13.60 -static void gmyth_file_finalize ( GObject * object );
   13.61 +static void gmyth_file_class_init(GMythFileClass * klass);
   13.62 +static void gmyth_file_init(GMythFile * object);
   13.63 +static void gmyth_file_dispose(GObject * object);
   13.64 +static void gmyth_file_finalize(GObject * object);
   13.65  
   13.66 -G_DEFINE_TYPE ( GMythFile, gmyth_file, G_TYPE_OBJECT )
   13.67 -     static void gmyth_file_class_init ( GMythFileClass * klass )
   13.68 +G_DEFINE_TYPE(GMythFile, gmyth_file, G_TYPE_OBJECT)
   13.69 +	 static void gmyth_file_class_init(GMythFileClass * klass)
   13.70  {
   13.71 -    GObjectClass *gobject_class;
   13.72 -    GMythFileClass *gtransfer_class;
   13.73 +  GObjectClass *gobject_class;
   13.74 +  GMythFileClass *gtransfer_class;
   13.75  
   13.76 -    gobject_class = ( GObjectClass * ) klass;
   13.77 -    gtransfer_class = ( GMythFileClass * ) gobject_class;
   13.78 +  gobject_class = (GObjectClass *) klass;
   13.79 +  gtransfer_class = (GMythFileClass *) gobject_class;
   13.80  
   13.81 -    gobject_class->dispose = gmyth_file_dispose;
   13.82 -    gobject_class->finalize = gmyth_file_finalize;
   13.83 +  gobject_class->dispose = gmyth_file_dispose;
   13.84 +  gobject_class->finalize = gmyth_file_finalize;
   13.85  
   13.86 -    gobject_class->set_property = gmyth_file_set_property;
   13.87 -    gobject_class->get_property = gmyth_file_get_property;
   13.88 +  gobject_class->set_property = gmyth_file_set_property;
   13.89 +  gobject_class->get_property = gmyth_file_get_property;
   13.90  
   13.91 -    g_object_class_install_property
   13.92 -        ( gobject_class, PROP_GMYTH_FILE_FILENAME,
   13.93 -          g_param_spec_string ( "filename", "filename",
   13.94 -                                "The file name.",
   13.95 -                                "",
   13.96 -                                G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
   13.97 -                                G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
   13.98 -                                G_PARAM_WRITABLE ) );
   13.99 +  g_object_class_install_property
  13.100 +	(gobject_class, PROP_GMYTH_FILE_FILENAME,
  13.101 +	 g_param_spec_string("filename", "filename",
  13.102 +						 "The file name.",
  13.103 +						 "",
  13.104 +						 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.105 +						 G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.106 +						 G_PARAM_WRITABLE));
  13.107  
  13.108 -    g_object_class_install_property
  13.109 -        ( gobject_class, PROP_GMYTH_FILE_OFFSET,
  13.110 -          g_param_spec_int64 ( "file-offset", "file-offset",
  13.111 -                               "The offset (position) of this file", 0,
  13.112 -                               G_MAXINT64, 0,
  13.113 -                               G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.114 -                               G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.115 -                               G_PARAM_WRITABLE ) );
  13.116 +  g_object_class_install_property
  13.117 +	(gobject_class, PROP_GMYTH_FILE_OFFSET,
  13.118 +	 g_param_spec_int64("file-offset", "file-offset",
  13.119 +						"The offset (position) of this file", 0,
  13.120 +						G_MAXINT64, 0,
  13.121 +						G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.122 +						G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.123 +						G_PARAM_WRITABLE));
  13.124  
  13.125 -    g_object_class_install_property
  13.126 -        ( gobject_class, PROP_GMYTH_FILE_FILESIZE,
  13.127 -          g_param_spec_uint64 ( "file-size", "file-size",
  13.128 -                                "The file size in bytes",
  13.129 -                                0, G_MAXUINT64, 0,
  13.130 -                                G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.131 -                                G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.132 -                                G_PARAM_WRITABLE ) );
  13.133 +  g_object_class_install_property
  13.134 +	(gobject_class, PROP_GMYTH_FILE_FILESIZE,
  13.135 +	 g_param_spec_uint64("file-size", "file-size",
  13.136 +						 "The file size in bytes",
  13.137 +						 0, G_MAXUINT64, 0,
  13.138 +						 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.139 +						 G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.140 +						 G_PARAM_WRITABLE));
  13.141  
  13.142 -    g_object_class_install_property
  13.143 -        ( gobject_class, PROP_GMYTH_FILE_BACKEND_INFO,
  13.144 -          g_param_spec_object ( "backend-info", "backend-info",
  13.145 -                                "The Backend Information about the remote server",
  13.146 -                                G_TYPE_OBJECT,
  13.147 -                                G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.148 -                                G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.149 -                                G_PARAM_WRITABLE ) );
  13.150 +  g_object_class_install_property
  13.151 +	(gobject_class, PROP_GMYTH_FILE_BACKEND_INFO,
  13.152 +	 g_param_spec_object("backend-info", "backend-info",
  13.153 +						 "The Backend Information about the remote server",
  13.154 +						 G_TYPE_OBJECT,
  13.155 +						 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.156 +						 G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.157 +						 G_PARAM_WRITABLE));
  13.158  
  13.159 -    g_object_class_install_property
  13.160 -        ( gobject_class, PROP_GMYTH_FILE_FILEID,
  13.161 -          g_param_spec_int ( "file-id", "file-id",
  13.162 -                             "The file ID", 0, G_MAXINT, 0,
  13.163 -                             G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.164 -                             G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.165 -                             G_PARAM_WRITABLE ) );
  13.166 +  g_object_class_install_property
  13.167 +	(gobject_class, PROP_GMYTH_FILE_FILEID,
  13.168 +	 g_param_spec_int("file-id", "file-id",
  13.169 +					  "The file ID", 0, G_MAXINT, 0,
  13.170 +					  G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
  13.171 +					  G_PARAM_STATIC_BLURB | G_PARAM_READABLE |
  13.172 +					  G_PARAM_WRITABLE));
  13.173  
  13.174 -    g_type_class_add_private ( gobject_class, sizeof ( GMythFilePrivate ) );
  13.175 +  g_type_class_add_private(gobject_class, sizeof(GMythFilePrivate));
  13.176  
  13.177  }
  13.178  
  13.179  static void
  13.180 -gmyth_file_init ( GMythFile * file )
  13.181 +gmyth_file_init(GMythFile * file)
  13.182  {
  13.183 -    g_return_if_fail ( file != NULL );
  13.184 +  g_return_if_fail(file != NULL);
  13.185  
  13.186 -    file->priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.187 +  file->priv = GMYTH_FILE_GET_PRIVATE(file);
  13.188  }
  13.189  
  13.190  static void
  13.191 -gmyth_file_dispose ( GObject * object )
  13.192 +gmyth_file_dispose(GObject * object)
  13.193  {
  13.194 -    GMythFilePrivate *priv;
  13.195 -    GMythFile *file = GMYTH_FILE ( object );
  13.196 +  GMythFilePrivate *priv;
  13.197 +  GMythFile *file = GMYTH_FILE(object);
  13.198  
  13.199 -    g_return_if_fail ( file != NULL );
  13.200 +  g_return_if_fail(file != NULL);
  13.201  
  13.202 -    priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.203 +  priv = GMYTH_FILE_GET_PRIVATE(file);
  13.204  
  13.205 -    if ( priv->disposed )
  13.206 -    {
  13.207 -        /* If dispose did already run, return. */
  13.208 -        return;
  13.209 -    }
  13.210 +  if (priv->disposed)
  13.211 +	{
  13.212 +	 /* If dispose did already run, return. */
  13.213 +	  return;
  13.214 +	}
  13.215  
  13.216 -    /* Make sure dispose does not run twice. */
  13.217 -    priv->disposed = TRUE;
  13.218 + /* Make sure dispose does not run twice. */
  13.219 +  priv->disposed = TRUE;
  13.220  
  13.221 -    if ( priv->backend_info != NULL )
  13.222 -    {
  13.223 -        g_object_unref ( priv->backend_info );
  13.224 -        priv->backend_info = NULL;
  13.225 -    }
  13.226 +  if (priv->backend_info != NULL)
  13.227 +	{
  13.228 +	  g_object_unref(priv->backend_info);
  13.229 +	  priv->backend_info = NULL;
  13.230 +	}
  13.231  
  13.232 -    if ( priv->filename != NULL )
  13.233 -    {
  13.234 -        g_free ( priv->filename );
  13.235 -        priv->filename = NULL;
  13.236 -    }
  13.237 +  if (priv->filename != NULL)
  13.238 +	{
  13.239 +	  g_free(priv->filename);
  13.240 +	  priv->filename = NULL;
  13.241 +	}
  13.242  
  13.243 -    G_OBJECT_CLASS ( gmyth_file_parent_class )->dispose ( object );
  13.244 +  G_OBJECT_CLASS(gmyth_file_parent_class)->dispose(object);
  13.245  }
  13.246  
  13.247  static void
  13.248 -gmyth_file_finalize ( GObject * object )
  13.249 +gmyth_file_finalize(GObject * object)
  13.250  {
  13.251 -    g_signal_handlers_destroy ( object );
  13.252 +  g_signal_handlers_destroy(object);
  13.253  
  13.254 -    G_OBJECT_CLASS ( gmyth_file_parent_class )->finalize ( object );
  13.255 +  G_OBJECT_CLASS(gmyth_file_parent_class)->finalize(object);
  13.256  }
  13.257  
  13.258  /** 
  13.259 @@ -209,51 +208,51 @@
  13.260   * @return a new instance of the File Transfer. 
  13.261   */
  13.262  GMythFile *
  13.263 -gmyth_file_new ( GMythBackendInfo * backend_info )
  13.264 +gmyth_file_new(GMythBackendInfo * backend_info)
  13.265  {
  13.266 -    GMythFile *file = NULL;
  13.267 +  GMythFile *file = NULL;
  13.268  
  13.269 -    g_return_val_if_fail ( backend_info != NULL, NULL );
  13.270 +  g_return_val_if_fail(backend_info != NULL, NULL);
  13.271  
  13.272 -    GParameter *__params = g_new0 ( GParameter, 1 );
  13.273 -    GParameter *__params_it = __params;
  13.274 +  GParameter *__params = g_new0(GParameter, 1);
  13.275 +  GParameter *__params_it = __params;
  13.276  
  13.277 -    ( __params_it->name =
  13.278 -      "backend-info", g_value_init ( &__params_it->value, G_TYPE_OBJECT ),
  13.279 -      g_value_set_object ( &__params_it->value, backend_info ), __params_it++ );
  13.280 -    file = g_object_newv ( GMYTH_FILE_TYPE, __params_it - __params, __params );
  13.281 +  (__params_it->name =
  13.282 +   "backend-info", g_value_init(&__params_it->value, G_TYPE_OBJECT),
  13.283 +   g_value_set_object(&__params_it->value, backend_info), __params_it++);
  13.284 +  file = g_object_newv(GMYTH_FILE_TYPE, __params_it - __params, __params);
  13.285  
  13.286 -    return file;
  13.287 +  return file;
  13.288  }
  13.289  
  13.290  gchar *
  13.291 -gmyth_file_get_file_name ( GMythFile * file )
  13.292 +gmyth_file_get_file_name(GMythFile * file)
  13.293  {
  13.294 -    GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.295 +  GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(file);
  13.296  
  13.297 -    g_return_val_if_fail ( file != NULL, NULL );
  13.298 +  g_return_val_if_fail(file != NULL, NULL);
  13.299  
  13.300 -    return priv->filename;
  13.301 +  return priv->filename;
  13.302  }
  13.303  
  13.304  void
  13.305 -gmyth_file_set_file_name ( GMythFile * file, const gchar * filename )
  13.306 +gmyth_file_set_file_name(GMythFile * file, const gchar * filename)
  13.307  {
  13.308 -    g_return_if_fail ( file != NULL );
  13.309 -    g_return_if_fail ( filename != NULL );
  13.310 +  g_return_if_fail(file != NULL);
  13.311 +  g_return_if_fail(filename != NULL);
  13.312  
  13.313 -    gchar *__temp2 = NULL;
  13.314 -    const gchar *__temp1 = NULL;
  13.315 +  gchar *__temp2 = NULL;
  13.316 +  const gchar *__temp1 = NULL;
  13.317  
  13.318 -    file->priv->filename = ( __temp2 = ( __temp1 = filename, ( __temp1 == NULL ?
  13.319 -                                                               NULL :
  13.320 -                                                               g_strdup
  13.321 -                                                               ( __temp1 ) ) ),
  13.322 -                             ( file->priv->filename ==
  13.323 -                               NULL ? NULL : ( file->priv->filename =
  13.324 -                                               ( g_free
  13.325 -                                                 ( file->priv->filename ),
  13.326 -                                                 NULL ) ) ), __temp2 );
  13.327 +  file->priv->filename = (__temp2 = (__temp1 = filename, (__temp1 == NULL ?
  13.328 +														  NULL :
  13.329 +														  g_strdup
  13.330 +														  (__temp1))),
  13.331 +						  (file->priv->filename ==
  13.332 +						   NULL ? NULL : (file->priv->filename =
  13.333 +										  (g_free
  13.334 +										   (file->priv->filename),
  13.335 +										   NULL))), __temp2);
  13.336  }
  13.337  
  13.338  /** 
  13.339 @@ -264,13 +263,13 @@
  13.340   * @return a new instance of the File Transfer. 
  13.341   */
  13.342  GMythFile *
  13.343 -gmyth_file_new_with_uri ( const gchar * uri_str )
  13.344 +gmyth_file_new_with_uri(const gchar * uri_str)
  13.345  {
  13.346 -    GMythFile *file = GMYTH_FILE ( g_object_new ( GMYTH_FILE_TYPE, NULL ) );
  13.347 -    GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.348 +  GMythFile *file = GMYTH_FILE(g_object_new(GMYTH_FILE_TYPE, NULL));
  13.349 +  GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(file);
  13.350  
  13.351 -    priv->backend_info = gmyth_backend_info_new_with_uri ( uri_str );
  13.352 -    return file;
  13.353 +  priv->backend_info = gmyth_backend_info_new_with_uri(uri_str);
  13.354 +  return file;
  13.355  }
  13.356  
  13.357  /** 
  13.358 @@ -282,24 +281,24 @@
  13.359   * @return <code>true</code>, if the connection opening had been done successfully. 
  13.360   */
  13.361  gboolean
  13.362 -gmyth_file_setup ( GMythFile * file, const gchar * filename )
  13.363 +gmyth_file_setup(GMythFile * file, const gchar * filename)
  13.364  {
  13.365 -    gboolean ret = TRUE;
  13.366 -    GMythFilePrivate *priv;
  13.367 +  gboolean ret = TRUE;
  13.368 +  GMythFilePrivate *priv;
  13.369  
  13.370 -    g_return_val_if_fail ( file != NULL, FALSE );
  13.371 -    g_return_val_if_fail ( filename != NULL && strlen ( filename ) > 0, FALSE );
  13.372 +  g_return_val_if_fail(file != NULL, FALSE);
  13.373 +  g_return_val_if_fail(filename != NULL && strlen(filename) > 0, FALSE);
  13.374  
  13.375 -    priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.376 +  priv = GMYTH_FILE_GET_PRIVATE(file);
  13.377  
  13.378 -    if ( priv->filename != NULL )
  13.379 -    {
  13.380 -        gmyth_file_close ( file );
  13.381 -    }
  13.382 +  if (priv->filename != NULL)
  13.383 +	{
  13.384 +	  gmyth_file_close(file);
  13.385 +	}
  13.386  
  13.387 -    priv->filename = g_strdup ( filename );
  13.388 +  priv->filename = g_strdup(filename);
  13.389  
  13.390 -    return ret;
  13.391 +  return ret;
  13.392  }
  13.393  
  13.394  /** 
  13.395 @@ -308,17 +307,17 @@
  13.396   * @param file The actual File Transfer instance. 
  13.397   */
  13.398  void
  13.399 -gmyth_file_close ( GMythFile * file )
  13.400 +gmyth_file_close(GMythFile * file)
  13.401  {
  13.402 -    GMythFilePrivate *priv;
  13.403 +  GMythFilePrivate *priv;
  13.404  
  13.405 -    priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.406 +  priv = GMYTH_FILE_GET_PRIVATE(file);
  13.407  
  13.408 -    if ( priv->filename )
  13.409 -    {
  13.410 -        g_free ( priv->filename );
  13.411 -        priv->filename = NULL;
  13.412 -    }
  13.413 +  if (priv->filename)
  13.414 +	{
  13.415 +	  g_free(priv->filename);
  13.416 +	  priv->filename = NULL;
  13.417 +	}
  13.418  
  13.419  }
  13.420  
  13.421 @@ -330,14 +329,14 @@
  13.422   * @return The actual file size in bytes. 
  13.423   */
  13.424  guint64
  13.425 -gmyth_file_get_filesize ( GMythFile * file )
  13.426 +gmyth_file_get_filesize(GMythFile * file)
  13.427  {
  13.428 -    GMythFilePrivate *priv;
  13.429 +  GMythFilePrivate *priv;
  13.430  
  13.431 -    g_return_val_if_fail ( file != NULL, 0 );
  13.432 +  g_return_val_if_fail(file != NULL, 0);
  13.433  
  13.434 -    priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.435 -    return priv->filesize;
  13.436 +  priv = GMYTH_FILE_GET_PRIVATE(file);
  13.437 +  return priv->filesize;
  13.438  }
  13.439  
  13.440  /** 
  13.441 @@ -347,13 +346,13 @@
  13.442   * @param filesize The actual File Transfer size, in bytes.
  13.443   */
  13.444  void
  13.445 -gmyth_file_set_filesize ( GMythFile * file, guint64 filesize )
  13.446 +gmyth_file_set_filesize(GMythFile * file, guint64 filesize)
  13.447  {
  13.448 -    GMythFilePrivate *priv;
  13.449 +  GMythFilePrivate *priv;
  13.450  
  13.451 -    priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.452 +  priv = GMYTH_FILE_GET_PRIVATE(file);
  13.453  
  13.454 -    priv->filesize = filesize;
  13.455 +  priv->filesize = filesize;
  13.456  }
  13.457  
  13.458  /** 
  13.459 @@ -364,11 +363,11 @@
  13.460   * @return The actual file offset in bytes. 
  13.461   */
  13.462  gint64
  13.463 -gmyth_file_get_offset ( GMythFile * file )
  13.464 +gmyth_file_get_offset(GMythFile * file)
  13.465  {
  13.466 -    g_return_val_if_fail ( file != NULL, 0 );
  13.467 +  g_return_val_if_fail(file != NULL, 0);
  13.468  
  13.469 -    return file->priv->offset;
  13.470 +  return file->priv->offset;
  13.471  }
  13.472  
  13.473  /**
  13.474 @@ -378,135 +377,133 @@
  13.475   * @param filesize The actual File offset, in bytes.
  13.476   */
  13.477  void
  13.478 -gmyth_file_set_offset ( GMythFile * file, gint64 offset )
  13.479 +gmyth_file_set_offset(GMythFile * file, gint64 offset)
  13.480  {
  13.481 -    GMythFilePrivate *priv;
  13.482 +  GMythFilePrivate *priv;
  13.483  
  13.484 -    priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.485 +  priv = GMYTH_FILE_GET_PRIVATE(file);
  13.486  
  13.487 -    priv->offset = offset;
  13.488 +  priv->offset = offset;
  13.489  }
  13.490  
  13.491  gchar *
  13.492 -gmyth_file_get_uri ( GMythFile * file )
  13.493 +gmyth_file_get_uri(GMythFile * file)
  13.494  {
  13.495 -    GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE ( file );
  13.496 -    gchar *uri = NULL;
  13.497 +  GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(file);
  13.498 +  gchar *uri = NULL;
  13.499  
  13.500 -    g_return_val_if_fail ( file != NULL, NULL );
  13.501 +  g_return_val_if_fail(file != NULL, NULL);
  13.502  
  13.503 -    if ( g_strstr_len ( priv->filename, strlen ( priv->filename ), "://" ) !=
  13.504 -         NULL )
  13.505 -        uri = g_strdup ( priv->filename );
  13.506 -    else
  13.507 -        uri =
  13.508 -            g_strdup_printf ( "myth://%s:%d/%s",
  13.509 -                              gmyth_backend_info_get_hostname ( priv->
  13.510 -                                                                backend_info ),
  13.511 -                              gmyth_backend_info_get_port ( priv->
  13.512 -                                                            backend_info ),
  13.513 -                              priv->filename );
  13.514 +  if (g_strstr_len(priv->filename, strlen(priv->filename), "://") != NULL)
  13.515 +	uri = g_strdup(priv->filename);
  13.516 +  else
  13.517 +	uri =
  13.518 +	  g_strdup_printf("myth://%s:%d/%s",
  13.519 +					  gmyth_backend_info_get_hostname(priv->
  13.520 +													  backend_info),
  13.521 +					  gmyth_backend_info_get_port(priv->
  13.522 +												  backend_info),
  13.523 +					  priv->filename);
  13.524  
  13.525 -    return uri;
  13.526 +  return uri;
  13.527  }
  13.528  
  13.529  static void
  13.530 -gmyth_file_set_property ( GObject * object, guint prop_id,
  13.531 -                          const GValue * value, GParamSpec * pspec )
  13.532 +gmyth_file_set_property(GObject * object, guint prop_id,
  13.533 +						const GValue * value, GParamSpec * pspec)
  13.534  {
  13.535 -    GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE ( GMYTH_FILE ( object ) );
  13.536 +  GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(GMYTH_FILE(object));
  13.537  
  13.538 -    switch ( prop_id )
  13.539 -    {
  13.540 -    case PROP_GMYTH_FILE_FILENAME:
  13.541 -        {
  13.542 -            if ( !g_value_get_string ( value ) )
  13.543 -            {
  13.544 -                break;
  13.545 -            }
  13.546 +  switch (prop_id)
  13.547 +	{
  13.548 +	case PROP_GMYTH_FILE_FILENAME:
  13.549 +	  {
  13.550 +		if (!g_value_get_string(value))
  13.551 +		  {
  13.552 +			break;
  13.553 +		  }
  13.554  
  13.555 -            if ( priv->filename != NULL )
  13.556 -            {
  13.557 -                g_free ( priv->filename );
  13.558 -                priv->filename = NULL;
  13.559 -            }
  13.560 -            priv->filename = g_value_dup_string ( value );
  13.561 -            gmyth_debug ( "Changed the filename to [%s]!", priv->filename );
  13.562 -            break;
  13.563 -        }
  13.564 -    case PROP_GMYTH_FILE_OFFSET:
  13.565 -        {
  13.566 -            priv->offset = g_value_get_int64 ( value );
  13.567 -            break;
  13.568 -        }
  13.569 -    case PROP_GMYTH_FILE_FILESIZE:
  13.570 -        {
  13.571 -            priv->filesize = g_value_get_uint64 ( value );
  13.572 -            break;
  13.573 -        }
  13.574 -    case PROP_GMYTH_FILE_BACKEND_INFO:
  13.575 -        {
  13.576 -            if ( !g_value_get_object ( value ) )
  13.577 -            {
  13.578 -                break;
  13.579 -            }
  13.580 +		if (priv->filename != NULL)
  13.581 +		  {
  13.582 +			g_free(priv->filename);
  13.583 +			priv->filename = NULL;
  13.584 +		  }
  13.585 +		priv->filename = g_value_dup_string(value);
  13.586 +		gmyth_debug("Changed the filename to [%s]!", priv->filename);
  13.587 +		break;
  13.588 +	  }
  13.589 +	case PROP_GMYTH_FILE_OFFSET:
  13.590 +	  {
  13.591 +		priv->offset = g_value_get_int64(value);
  13.592 +		break;
  13.593 +	  }
  13.594 +	case PROP_GMYTH_FILE_FILESIZE:
  13.595 +	  {
  13.596 +		priv->filesize = g_value_get_uint64(value);
  13.597 +		break;
  13.598 +	  }
  13.599 +	case PROP_GMYTH_FILE_BACKEND_INFO:
  13.600 +	  {
  13.601 +		if (!g_value_get_object(value))
  13.602 +		  {
  13.603 +			break;
  13.604 +		  }
  13.605  
  13.606 -            if ( priv->backend_info != NULL )
  13.607 -            {
  13.608 -                g_object_unref ( priv->backend_info );
  13.609 -                priv->backend_info = NULL;
  13.610 -            }
  13.611 -            priv->backend_info = g_value_get_object ( value );
  13.612 -            gmyth_debug ( "Changed the backend info to [%s]!",
  13.613 -                          gmyth_backend_info_get_hostname ( priv->
  13.614 -                                                            backend_info ) );
  13.615 -            break;
  13.616 -        }
  13.617 -    case PROP_GMYTH_FILE_FILEID:
  13.618 -        {
  13.619 -            priv->file_id = g_value_get_int ( value );
  13.620 -            break;
  13.621 -        }
  13.622 -    default:
  13.623 -        G_OBJECT_WARN_INVALID_PROPERTY_ID ( object, prop_id, pspec );
  13.624 -        break;
  13.625 -    }
  13.626 +		if (priv->backend_info != NULL)
  13.627 +		  {
  13.628 +			g_object_unref(priv->backend_info);
  13.629 +			priv->backend_info = NULL;
  13.630 +		  }
  13.631 +		priv->backend_info = g_value_get_object(value);
  13.632 +		gmyth_debug("Changed the backend info to [%s]!",
  13.633 +					gmyth_backend_info_get_hostname(priv->backend_info));
  13.634 +		break;
  13.635 +	  }
  13.636 +	case PROP_GMYTH_FILE_FILEID:
  13.637 +	  {
  13.638 +		priv->file_id = g_value_get_int(value);
  13.639 +		break;
  13.640 +	  }
  13.641 +	default:
  13.642 +	  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
  13.643 +	  break;
  13.644 +	}
  13.645  
  13.646  }
  13.647  
  13.648  static void
  13.649 -gmyth_file_get_property ( GObject * object, guint prop_id,
  13.650 -                          GValue * value, GParamSpec * pspec )
  13.651 +gmyth_file_get_property(GObject * object, guint prop_id,
  13.652 +						GValue * value, GParamSpec * pspec)
  13.653  {
  13.654 -    GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE ( GMYTH_FILE ( object ) );
  13.655 +  GMythFilePrivate *priv = GMYTH_FILE_GET_PRIVATE(GMYTH_FILE(object));
  13.656  
  13.657 -    switch ( prop_id )
  13.658 -    {
  13.659 -    case PROP_GMYTH_FILE_FILENAME:
  13.660 -        {
  13.661 -            gmyth_debug ( "Got the filename to [%s]!", priv->filename );
  13.662 -            g_value_set_string ( value, priv->filename );
  13.663 -            break;
  13.664 -        }
  13.665 -    case PROP_GMYTH_FILE_OFFSET:
  13.666 -        {
  13.667 -            g_value_set_int64 ( value, priv->offset );
  13.668 -            break;
  13.669 -        }
  13.670 -    case PROP_GMYTH_FILE_FILESIZE:
  13.671 -        {
  13.672 -            g_value_set_uint64 ( value, priv->filesize );
  13.673 -            break;
  13.674 -        }
  13.675 -    case PROP_GMYTH_FILE_BACKEND_INFO:
  13.676 -        g_value_set_object ( value, priv->backend_info );
  13.677 -        break;
  13.678 -    case PROP_GMYTH_FILE_FILEID:
  13.679 -        g_value_set_int ( value, priv->file_id );
  13.680 -        break;
  13.681 -    default:
  13.682 -        G_OBJECT_WARN_INVALID_PROPERTY_ID ( object, prop_id, pspec );
  13.683 -        break;
  13.684 -    }
  13.685 +  switch (prop_id)
  13.686 +	{
  13.687 +	case PROP_GMYTH_FILE_FILENAME:
  13.688 +	  {
  13.689 +		gmyth_debug("Got the filename to [%s]!", priv->filename);
  13.690 +		g_value_set_string(value, priv->filename);
  13.691 +		break;
  13.692 +	  }
  13.693 +	case PROP_GMYTH_FILE_OFFSET:
  13.694 +	  {
  13.695 +		g_value_set_int64(value, priv->offset);
  13.696 +		break;
  13.697 +	  }
  13.698 +	case PROP_GMYTH_FILE_FILESIZE:
  13.699 +	  {
  13.700 +		g_value_set_uint64(value, priv->filesize);
  13.701 +		break;
  13.702 +	  }
  13.703 +	case PROP_GMYTH_FILE_BACKEND_INFO:
  13.704 +	  g_value_set_object(value, priv->backend_info);
  13.705 +	  break;
  13.706 +	case PROP_GMYTH_FILE_FILEID:
  13.707 +	  g_value_set_int(value, priv->file_id);
  13.708 +	  break;
  13.709 +	default:
  13.710 +	  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
  13.711 +	  break;
  13.712 +	}
  13.713  
  13.714  }
    14.1 --- a/gmyth/src/gmyth_file.h	Wed Jun 13 18:18:42 2007 +0100
    14.2 +++ b/gmyth/src/gmyth_file.h	Thu Jun 14 18:19:52 2007 +0100
    14.3 @@ -48,44 +48,44 @@
    14.4  #define IS_GMYTH_FILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_FILE_TYPE))
    14.5  #define IS_GMYTH_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TYPE))
    14.6  #define GMYTH_FILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TYPE, GMythFileClass))
    14.7 -    typedef enum
    14.8 -    {
    14.9 -        GMYTH_FILE_READ_OK = 0,
   14.10 -        GMYTH_FILE_READ_NEXT_PROG_CHAIN = 1,
   14.11 -        GMYTH_FILE_READ_ERROR = 2,
   14.12 -        GMYTH_FILE_READ_EOF = 3
   14.13 -    } GMythFileReadResult;
   14.14 +  typedef enum
   14.15 +{
   14.16 +  GMYTH_FILE_READ_OK = 0,
   14.17 +  GMYTH_FILE_READ_NEXT_PROG_CHAIN = 1,
   14.18 +  GMYTH_FILE_READ_ERROR = 2,
   14.19 +  GMYTH_FILE_READ_EOF = 3
   14.20 +} GMythFileReadResult;
   14.21  
   14.22  typedef struct _GMythFile GMythFile;
   14.23  typedef struct _GMythFileClass GMythFileClass;
   14.24  typedef struct _GMythFilePrivate GMythFilePrivate;
   14.25  
   14.26  struct _GMythFile
   14.27 -    {
   14.28 -        GObject parent;
   14.29 -        GMythFilePrivate *priv;
   14.30 -    };
   14.31 +{
   14.32 +  GObject parent;
   14.33 +  GMythFilePrivate *priv;
   14.34 +};
   14.35  
   14.36  struct _GMythFileClass
   14.37 -    {
   14.38 -        GObjectClass parent_class;
   14.39 -    };
   14.40 +{
   14.41 +  GObjectClass parent_class;
   14.42 +};
   14.43  
   14.44 -GType gmyth_file_get_type ( void );
   14.45 -GMythFile *gmyth_file_new ( GMythBackendInfo * backend_info );
   14.46 -gchar *gmyth_file_get_file_name ( GMythFile * file );
   14.47 -void gmyth_file_set_file_name ( GMythFile * file, const gchar * filename );
   14.48 -gboolean gmyth_file_setup ( GMythFile * file, const gchar * filename );
   14.49 -void gmyth_file_close ( GMythFile * file );
   14.50 -gboolean gmyth_file_is_open ( GMythFile * file );
   14.51 +GType gmyth_file_get_type(void);
   14.52 +GMythFile *gmyth_file_new(GMythBackendInfo * backend_info);
   14.53 +gchar *gmyth_file_get_file_name(GMythFile * file);
   14.54 +void gmyth_file_set_file_name(GMythFile * file, const gchar * filename);
   14.55 +gboolean gmyth_file_setup(GMythFile * file, const gchar * filename);
   14.56 +void gmyth_file_close(GMythFile * file);
   14.57 +gboolean gmyth_file_is_open(GMythFile * file);
   14.58  
   14.59 -guint64 gmyth_file_get_filesize ( GMythFile * file );
   14.60 -void gmyth_file_set_filesize ( GMythFile * file, guint64 filesize );
   14.61 +guint64 gmyth_file_get_filesize(GMythFile * file);
   14.62 +void gmyth_file_set_filesize(GMythFile * file, guint64 filesize);
   14.63  
   14.64 -gint64 gmyth_file_get_offset ( GMythFile * file );
   14.65 -void gmyth_file_set_offset ( GMythFile * file, gint64 offset );
   14.66 +gint64 gmyth_file_get_offset(GMythFile * file);
   14.67 +void gmyth_file_set_offset(GMythFile * file, gint64 offset);
   14.68  
   14.69 -gchar *gmyth_file_get_uri ( GMythFile * file );
   14.70 +gchar *gmyth_file_get_uri(GMythFile * file);
   14.71  
   14.72  G_END_DECLS
   14.73  #endif /* __GMYTH_FILE_H__ */
    15.1 --- a/gmyth/src/gmyth_file_local.c	Wed Jun 13 18:18:42 2007 +0100
    15.2 +++ b/gmyth/src/gmyth_file_local.c	Thu Jun 14 18:19:52 2007 +0100
    15.3 @@ -53,97 +53,96 @@
    15.4  	(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GMYTH_FILE_LOCAL_TYPE, GMythFileLocalPrivate))
    15.5  
    15.6  struct _GMythFileLocalPrivate
    15.7 -    {
    15.8 +{
    15.9  
   15.10 -        gboolean disposed;
   15.11 +  gboolean disposed;
   15.12  
   15.13 -        GMutex *mutex;
   15.14 +  GMutex *mutex;
   15.15  
   15.16 -        gint fd;
   15.17 +  gint fd;
   15.18  
   15.19 -        GIOChannel *file_io;
   15.20 +  GIOChannel *file_io;
   15.21  
   15.22 -    };
   15.23 +};
   15.24  
   15.25 -static void gmyth_file_local_class_init ( GMythFileLocalClass * klass );
   15.26 -static void gmyth_file_local_init ( GMythFileLocal * object );
   15.27 -static void gmyth_file_local_dispose ( GObject * object );
   15.28 -static void gmyth_file_local_finalize ( GObject * object );
   15.29 +static void gmyth_file_local_class_init(GMythFileLocalClass * klass);
   15.30 +static void gmyth_file_local_init(GMythFileLocal * object);
   15.31 +static void gmyth_file_local_dispose(GObject * object);
   15.32 +static void gmyth_file_local_finalize(GObject * object);
   15.33  
   15.34 -static gboolean _control_acquire_context ( GMythFileLocal * file_local,
   15.35 -                                           gboolean do_wait );
   15.36 +static gboolean _control_acquire_context(GMythFileLocal * file_local,
   15.37 +										 gboolean do_wait);
   15.38  
   15.39 -static gboolean _control_release_context ( GMythFileLocal * file_local );
   15.40 +static gboolean _control_release_context(GMythFileLocal * file_local);
   15.41  
   15.42 -G_DEFINE_TYPE ( GMythFileLocal, gmyth_file_local, GMYTH_FILE_TYPE )
   15.43 -     static void gmyth_file_local_class_init ( GMythFileLocalClass * klass )
   15.44 +G_DEFINE_TYPE(GMythFileLocal, gmyth_file_local, GMYTH_FILE_TYPE)
   15.45 +	 static void gmyth_file_local_class_init(GMythFileLocalClass * klass)
   15.46  {
   15.47 -    GObjectClass *gobject_class;
   15.48 -    GMythFileLocalClass *gtransfer_class;
   15.49 +  GObjectClass *gobject_class;
   15.50 +  GMythFileLocalClass *gtransfer_class;
   15.51  
   15.52 -    gobject_class = ( GObjectClass * ) klass;
   15.53 -    gtransfer_class = ( GMythFileLocalClass * ) gobject_class;
   15.54 +  gobject_class = (GObjectClass *) klass;
   15.55 +  gtransfer_class = (GMythFileLocalClass *) gobject_class;
   15.56  
   15.57 -    gobject_class->dispose = gmyth_file_local_dispose;
   15.58 -    gobject_class->finalize = gmyth_file_local_finalize;
   15.59 +  gobject_class->dispose = gmyth_file_local_dispose;
   15.60 +  gobject_class->finalize = gmyth_file_local_finalize;
   15.61  
   15.62 -    g_type_class_add_private ( gobject_class,
   15.63 -                               sizeof ( GMythFileLocalPrivate ) );
   15.64 +  g_type_class_add_private(gobject_class, sizeof(GMythFileLocalPrivate));
   15.65  
   15.66  }
   15.67  
   15.68  static void
   15.69 -gmyth_file_local_init ( GMythFileLocal * file_local )
   15.70 +gmyth_file_local_init(GMythFileLocal * file_local)
   15.71  {
   15.72 -    GMythFileLocalPrivate *priv;
   15.73 +  GMythFileLocalPrivate *priv;
   15.74  
   15.75 -    g_return_if_fail ( file_local != NULL );
   15.76 +  g_return_if_fail(file_local != NULL);
   15.77  
   15.78 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
   15.79 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
   15.80  
   15.81 -    priv->mutex = g_mutex_new (  );
   15.82 +  priv->mutex = g_mutex_new();
   15.83  }
   15.84  
   15.85  static void
   15.86 -gmyth_file_local_dispose ( GObject * object )
   15.87 +gmyth_file_local_dispose(GObject * object)
   15.88  {
   15.89 -    GMythFileLocalPrivate *priv;
   15.90 -    GMythFileLocal *file_local = GMYTH_FILE_LOCAL ( object );
   15.91 +  GMythFileLocalPrivate *priv;
   15.92 +  GMythFileLocal *file_local = GMYTH_FILE_LOCAL(object);
   15.93  
   15.94 -    g_return_if_fail ( file_local != NULL );
   15.95 +  g_return_if_fail(file_local != NULL);
   15.96  
   15.97 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
   15.98 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
   15.99  
  15.100 -    if ( priv->disposed )
  15.101 -    {
  15.102 -        /* If dispose did already run, return. */
  15.103 -        return;
  15.104 -    }
  15.105 +  if (priv->disposed)
  15.106 +	{
  15.107 +	 /* If dispose did already run, return. */
  15.108 +	  return;
  15.109 +	}
  15.110  
  15.111 -    /* Make sure dispose does not run twice. */
  15.112 -    priv->disposed = TRUE;
  15.113 + /* Make sure dispose does not run twice. */
  15.114 +  priv->disposed = TRUE;
  15.115  
  15.116 -    if ( priv->mutex != NULL )
  15.117 -    {
  15.118 -        g_mutex_free ( priv->mutex );
  15.119 -        priv->mutex = NULL;
  15.120 -    }
  15.121 +  if (priv->mutex != NULL)
  15.122 +	{
  15.123 +	  g_mutex_free(priv->mutex);
  15.124 +	  priv->mutex = NULL;
  15.125 +	}
  15.126  
  15.127 -    if ( priv->file_io != NULL )
  15.128 -    {
  15.129 -        g_io_channel_unref ( priv->file_io );
  15.130 -        priv->file_io = NULL;
  15.131 -    }
  15.132 +  if (priv->file_io != NULL)
  15.133 +	{
  15.134 +	  g_io_channel_unref(priv->file_io);
  15.135 +	  priv->file_io = NULL;
  15.136 +	}
  15.137  
  15.138 -    G_OBJECT_CLASS ( gmyth_file_local_parent_class )->dispose ( object );
  15.139 +  G_OBJECT_CLASS(gmyth_file_local_parent_class)->dispose(object);
  15.140  }
  15.141  
  15.142  static void
  15.143 -gmyth_file_local_finalize ( GObject * object )
  15.144 +gmyth_file_local_finalize(GObject * object)
  15.145  {
  15.146 -    g_signal_handlers_destroy ( object );
  15.147 +  g_signal_handlers_destroy(object);
  15.148  
  15.149 -    G_OBJECT_CLASS ( gmyth_file_local_parent_class )->finalize ( object );
  15.150 +  G_OBJECT_CLASS(gmyth_file_local_parent_class)->finalize(object);
  15.151  }
  15.152  
  15.153  /** 
  15.154 @@ -155,15 +154,14 @@
  15.155   * @return a new instance of the File Transfer. 
  15.156   */
  15.157  GMythFileLocal *
  15.158 -gmyth_file_local_new ( GMythBackendInfo * backend_info )
  15.159 +gmyth_file_local_new(GMythBackendInfo * backend_info)
  15.160  {
  15.161 -    GMythFileLocal *file_local =
  15.162 -        GMYTH_FILE_LOCAL ( g_object_new ( GMYTH_FILE_LOCAL_TYPE, NULL ) );
  15.163 +  GMythFileLocal *file_local =
  15.164 +	GMYTH_FILE_LOCAL(g_object_new(GMYTH_FILE_LOCAL_TYPE, NULL));
  15.165  
  15.166 -    g_object_set ( GMYTH_FILE ( file_local ), "backend-info", &backend_info,
  15.167 -                   NULL );
  15.168 +  g_object_set(GMYTH_FILE(file_local), "backend-info", &backend_info, NULL);
  15.169  
  15.170 -    return file_local;
  15.171 +  return file_local;
  15.172  }
  15.173  
  15.174  /** 
  15.175 @@ -174,34 +172,34 @@
  15.176   * @return a new instance of the File Transfer.
  15.177   */
  15.178  GMythFileLocal *
  15.179 -gmyth_file_local_new_with_uri ( const gchar * uri_str )
  15.180 +gmyth_file_local_new_with_uri(const gchar * uri_str)
  15.181  {
  15.182 -    GMythFileLocal *file_local =
  15.183 -        GMYTH_FILE_LOCAL ( g_object_new ( GMYTH_FILE_LOCAL_TYPE, NULL ) );
  15.184 -    GMythURI *uri = gmyth_uri_new_with_value ( uri_str );
  15.185 +  GMythFileLocal *file_local =
  15.186 +	GMYTH_FILE_LOCAL(g_object_new(GMYTH_FILE_LOCAL_TYPE, NULL));
  15.187 +  GMythURI *uri = gmyth_uri_new_with_value(uri_str);
  15.188  
  15.189 -    gmyth_debug ( "GMythURI path segment = %s", gmyth_uri_get_path ( uri ) );
  15.190 +  gmyth_debug("GMythURI path segment = %s", gmyth_uri_get_path(uri));
  15.191  
  15.192 -    g_object_set ( GMYTH_FILE ( file_local ),
  15.193 -                   "backend-info", gmyth_backend_info_new_with_uri ( uri_str ),
  15.194 -                   "filename", g_strdup ( gmyth_uri_get_path ( uri ) ), NULL );
  15.195 +  g_object_set(GMYTH_FILE(file_local),
  15.196 +			   "backend-info", gmyth_backend_info_new_with_uri(uri_str),
  15.197 +			   "filename", g_strdup(gmyth_uri_get_path(uri)), NULL);
  15.198  
  15.199 -    g_object_unref ( uri );
  15.200 +  g_object_unref(uri);
  15.201  
  15.202 -    return file_local;
  15.203 +  return file_local;
  15.204  }
  15.205  
  15.206  gchar *
  15.207 -gmyth_file_local_get_file_name ( GMythFileLocal * file_local )
  15.208 +gmyth_file_local_get_file_name(GMythFileLocal * file_local)
  15.209  {
  15.210 -    return gmyth_file_get_file_name ( GMYTH_FILE ( file_local ) );
  15.211 +  return gmyth_file_get_file_name(GMYTH_FILE(file_local));
  15.212  }
  15.213  
  15.214  void
  15.215 -gmyth_file_local_set_file_name ( GMythFileLocal * file_local,
  15.216 -                                 const gchar * filename )
  15.217 +gmyth_file_local_set_file_name(GMythFileLocal * file_local,
  15.218 +							   const gchar * filename)
  15.219  {
  15.220 -    gmyth_file_set_file_name ( GMYTH_FILE ( file_local ), filename );
  15.221 +  gmyth_file_set_file_name(GMYTH_FILE(file_local), filename);
  15.222  }
  15.223  
  15.224  /** 
  15.225 @@ -212,28 +210,28 @@
  15.226   * @return <code>true</code>, if the connection opening had been done successfully. 
  15.227   */
  15.228  gboolean
  15.229 -gmyth_file_local_open ( GMythFileLocal * file_local )
  15.230 +gmyth_file_local_open(GMythFileLocal * file_local)
  15.231  {
  15.232 -    gboolean ret = TRUE;
  15.233 -    GMythFileLocalPrivate *priv;
  15.234 -    gchar *file_name_uri = NULL;
  15.235 +  gboolean ret = TRUE;
  15.236 +  GMythFileLocalPrivate *priv;
  15.237 +  gchar *file_name_uri = NULL;
  15.238  
  15.239 -    g_return_val_if_fail ( file_local != NULL, FALSE );
  15.240 +  g_return_val_if_fail(file_local != NULL, FALSE);
  15.241  
  15.242 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
  15.243 -    file_name_uri = gmyth_file_local_get_file_name ( file_local );
  15.244 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
  15.245 +  file_name_uri = gmyth_file_local_get_file_name(file_local);
  15.246  
  15.247 -    if ( file_name_uri != NULL )
  15.248 -    {
  15.249 -        priv->file_io =
  15.250 -            g_io_channel_new_file ( g_strdup ( file_name_uri ), "r+", NULL );
  15.251 -        g_free ( file_name_uri );
  15.252 -    }
  15.253 +  if (file_name_uri != NULL)
  15.254 +	{
  15.255 +	  priv->file_io =
  15.256 +		g_io_channel_new_file(g_strdup(file_name_uri), "r+", NULL);
  15.257 +	  g_free(file_name_uri);
  15.258 +	}
  15.259  
  15.260 -    if ( priv->file_io < 0 )
  15.261 -        ret = FALSE;
  15.262 +  if (priv->file_io < 0)
  15.263 +	ret = FALSE;
  15.264  
  15.265 -    return ret;
  15.266 +  return ret;
  15.267  }
  15.268  
  15.269  /** 
  15.270 @@ -242,9 +240,9 @@
  15.271   * @param file_local The actual File Transfer instance. 
  15.272   */
  15.273  void
  15.274 -gmyth_file_local_close ( GMythFileLocal * file_local )
  15.275 +gmyth_file_local_close(GMythFileLocal * file_local)
  15.276  {
  15.277 -    g_return_if_fail ( file_local != NULL );
  15.278 +  g_return_if_fail(file_local != NULL);
  15.279  }
  15.280  
  15.281  /** 
  15.282 @@ -256,16 +254,16 @@
  15.283   * @return <code>true</code>, if the acquire had been got. 
  15.284   */
  15.285  static gboolean
  15.286 -_control_acquire_context ( GMythFileLocal * file_local, gboolean do_wait )
  15.287 +_control_acquire_context(GMythFileLocal * file_local, gboolean do_wait)
  15.288  {
  15.289 -    gboolean ret = TRUE;
  15.290 -    GMythFileLocalPrivate *priv;
  15.291 +  gboolean ret = TRUE;
  15.292 +  GMythFileLocalPrivate *priv;
  15.293  
  15.294 -    g_return_val_if_fail ( file_local != NULL, FALSE );
  15.295 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
  15.296 +  g_return_val_if_fail(file_local != NULL, FALSE);
  15.297 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
  15.298  
  15.299 -    g_mutex_lock ( priv->mutex );
  15.300 -    return ret;
  15.301 +  g_mutex_lock(priv->mutex);
  15.302 +  return ret;
  15.303  }
  15.304  
  15.305  /** 
  15.306 @@ -276,17 +274,17 @@
  15.307   * @return <code>true</code>, if the local file read/write permissions had been releaseds. 
  15.308   */
  15.309  static gboolean
  15.310 -_control_release_context ( GMythFileLocal * file_local )
  15.311 +_control_release_context(GMythFileLocal * file_local)
  15.312  {
  15.313 -    gboolean ret = TRUE;
  15.314 -    GMythFileLocalPrivate *priv;
  15.315 +  gboolean ret = TRUE;
  15.316 +  GMythFileLocalPrivate *priv;
  15.317  
  15.318 -    g_return_val_if_fail ( file_local != NULL, FALSE );
  15.319 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
  15.320 +  g_return_val_if_fail(file_local != NULL, FALSE);
  15.321 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
  15.322  
  15.323 -    g_mutex_unlock ( priv->mutex );
  15.324 +  g_mutex_unlock(priv->mutex);
  15.325  
  15.326 -    return ret;
  15.327 +  return ret;
  15.328  }
  15.329  
  15.330  /** 
  15.331 @@ -303,109 +301,107 @@
  15.332   *              or the error code. 
  15.333   */
  15.334  GMythFileReadResult
  15.335 -gmyth_file_local_read ( GMythFileLocal * file_local, GByteArray * data,
  15.336 -                        gint size, gboolean read_unlimited )
  15.337 +gmyth_file_local_read(GMythFileLocal * file_local, GByteArray * data,
  15.338 +					  gint size, gboolean read_unlimited)
  15.339  {
  15.340 -    gsize bytes_read = 0;
  15.341 -    gint64 total_read = 0;
  15.342 -    GMythFileReadResult retval = GMYTH_FILE_READ_OK;
  15.343 -    GMythFileLocalPrivate *priv;
  15.344 +  gsize bytes_read = 0;
  15.345 +  gint64 total_read = 0;
  15.346 +  GMythFileReadResult retval = GMYTH_FILE_READ_OK;
  15.347 +  GMythFileLocalPrivate *priv;
  15.348  
  15.349 -    GError *error = NULL;
  15.350 +  GError *error = NULL;
  15.351  
  15.352 -    GIOCondition io_cond;
  15.353 -    GIOStatus io_status = G_IO_STATUS_NORMAL;
  15.354 +  GIOCondition io_cond;
  15.355 +  GIOStatus io_status = G_IO_STATUS_NORMAL;
  15.356  
  15.357 -    g_return_val_if_fail ( file_local != NULL, FALSE );
  15.358 -    g_return_val_if_fail ( data != NULL, GMYTH_FILE_READ_ERROR );
  15.359 +  g_return_val_if_fail(file_local != NULL, FALSE);
  15.360 +  g_return_val_if_fail(data != NULL, GMYTH_FILE_READ_ERROR);
  15.361  
  15.362 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
  15.363 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
  15.364  
  15.365 -    io_status = g_io_channel_set_encoding ( priv->file_io, NULL, &error );
  15.366 -    if ( io_status == G_IO_STATUS_NORMAL )
  15.367 -        gmyth_debug ( "Setting encoding to binary file data stream.\n" );
  15.368 +  io_status = g_io_channel_set_encoding(priv->file_io, NULL, &error);
  15.369 +  if (io_status == G_IO_STATUS_NORMAL)
  15.370 +	gmyth_debug("Setting encoding to binary file data stream.\n");
  15.371  
  15.372 -    io_cond = g_io_channel_get_buffer_condition ( priv->file_io );
  15.373 +  io_cond = g_io_channel_get_buffer_condition(priv->file_io);
  15.374  
  15.375 -    _control_acquire_context ( file_local, TRUE );
  15.376 +  _control_acquire_context(file_local, TRUE);
  15.377  
  15.378 -    if ( size > 0 )
  15.379 -    {
  15.380 -        gchar *data_buffer = g_new0 ( gchar, size );
  15.381 +  if (size > 0)
  15.382 +	{
  15.383 +	  gchar *data_buffer = g_new0(gchar, size);
  15.384  
  15.385 -        io_status = g_io_channel_read_chars ( priv->file_io,
  15.386 -                                              data_buffer, ( gsize ) size,
  15.387 -                                              &bytes_read, &error );
  15.388 +	  io_status = g_io_channel_read_chars(priv->file_io,
  15.389 +										  data_buffer, (gsize) size,
  15.390 +										  &bytes_read, &error);
  15.391  
  15.392 -        if ( io_status != G_IO_STATUS_NORMAL )
  15.393 -        {
  15.394 -            gmyth_debug ( "Error on io_channel" );
  15.395 -            g_free ( data_buffer );
  15.396 -            retval = GMYTH_FILE_READ_ERROR;
  15.397 -            goto error;
  15.398 -        }
  15.399 +	  if (io_status != G_IO_STATUS_NORMAL)
  15.400 +		{
  15.401 +		  gmyth_debug("Error on io_channel");
  15.402 +		  g_free(data_buffer);
  15.403 +		  retval = GMYTH_FILE_READ_ERROR;
  15.404 +		  goto error;
  15.405 +		}
  15.406  
  15.407 -        /* append new data to the increasing byte array */
  15.408 -        data =
  15.409 -            g_byte_array_append ( data, ( const guint8 * ) data_buffer,
  15.410 -                                  bytes_read );
  15.411 -        total_read += bytes_read;
  15.412 +	 /* append new data to the increasing byte array */
  15.413 +	  data =
  15.414 +		g_byte_array_append(data, (const guint8 *) data_buffer, bytes_read);
  15.415 +	  total_read += bytes_read;
  15.416  
  15.417 -        if ( !read_unlimited
  15.418 -             && ( gmyth_file_local_get_filesize ( file_local ) > 0 )
  15.419 -             && ( gmyth_file_local_get_offset ( file_local ) ==
  15.420 -                  gmyth_file_local_get_filesize ( file_local ) ) )
  15.421 -        {
  15.422 -            retval = GMYTH_FILE_READ_EOF;
  15.423 -            goto error;
  15.424 -        }
  15.425 +	  if (!read_unlimited
  15.426 +		  && (gmyth_file_local_get_filesize(file_local) > 0)
  15.427 +		  && (gmyth_file_local_get_offset(file_local) ==
  15.428 +			  gmyth_file_local_get_filesize(file_local)))
  15.429 +		{
  15.430 +		  retval = GMYTH_FILE_READ_EOF;
  15.431 +		  goto error;
  15.432 +		}
  15.433  
  15.434 -        g_free ( data_buffer );
  15.435 -    }
  15.436 -    else
  15.437 -    {
  15.438 -        retval = GMYTH_FILE_READ_ERROR;
  15.439 -    }
  15.440 +	  g_free(data_buffer);
  15.441 +	}
  15.442 +  else
  15.443 +	{
  15.444 +	  retval = GMYTH_FILE_READ_ERROR;
  15.445 +	}
  15.446  
  15.447 -  error:
  15.448 -    _control_release_context ( file_local );
  15.449 +error:
  15.450 +  _control_release_context(file_local);
  15.451  
  15.452 -    if ( error != NULL )
  15.453 -    {
  15.454 -        gmyth_debug ( "Cleaning-up ERROR: [msg = %s, code = %d]\n",
  15.455 -                      error->message, error->code );
  15.456 -        g_error_free ( error );
  15.457 -    }
  15.458 +  if (error != NULL)
  15.459 +	{
  15.460 +	  gmyth_debug("Cleaning-up ERROR: [msg = %s, code = %d]\n",
  15.461 +				  error->message, error->code);
  15.462 +	  g_error_free(error);
  15.463 +	}
  15.464  
  15.465 -    if ( total_read > 0 )
  15.466 -        gmyth_file_local_set_offset ( file_local,
  15.467 -                                      ( gmyth_file_local_get_offset
  15.468 -                                        ( file_local ) + total_read ) );
  15.469 +  if (total_read > 0)
  15.470 +	gmyth_file_local_set_offset(file_local,
  15.471 +								(gmyth_file_local_get_offset
  15.472 +								 (file_local) + total_read));
  15.473  
  15.474 -    return retval;
  15.475 +  return retval;
  15.476  }
  15.477  
  15.478  gint64
  15.479 -gmyth_file_local_seek ( GMythFileLocal * file_local, gint64 pos,
  15.480 -                        GSeekType whence )
  15.481 +gmyth_file_local_seek(GMythFileLocal * file_local, gint64 pos,
  15.482 +					  GSeekType whence)
  15.483  {
  15.484 -    GMythFileLocalPrivate *priv;
  15.485 +  GMythFileLocalPrivate *priv;
  15.486  
  15.487 -    GError *error;
  15.488 +  GError *error;
  15.489  
  15.490 -    GIOStatus io_status = G_IO_STATUS_NORMAL;
  15.491 +  GIOStatus io_status = G_IO_STATUS_NORMAL;
  15.492  
  15.493 -    g_return_val_if_fail ( file_local != NULL, -1 );
  15.494 +  g_return_val_if_fail(file_local != NULL, -1);
  15.495  
  15.496 -    priv = GMYTH_FILE_LOCAL_GET_PRIVATE ( file_local );
  15.497 +  priv = GMYTH_FILE_LOCAL_GET_PRIVATE(file_local);
  15.498  
  15.499 -    io_status =
  15.500 -        g_io_channel_seek_position ( priv->file_io, pos, whence, &error );
  15.501 +  io_status = g_io_channel_seek_position(priv->file_io, pos, whence, &error);
  15.502  
  15.503 -    if ( io_status == G_IO_STATUS_ERROR )
  15.504 -        pos = -1;
  15.505 +  if (io_status == G_IO_STATUS_ERROR)
  15.506 +	pos = -1;
  15.507  
  15.508 -    return pos;
  15.509 +  return pos;
  15.510  
  15.511  }
  15.512  
  15.513 @@ -417,11 +413,11 @@
  15.514   * @return The actual file_local size in bytes. 
  15.515   */
  15.516  guint64
  15.517 -gmyth_file_local_get_filesize ( GMythFileLocal * file_local )
  15.518 +gmyth_file_local_get_filesize(GMythFileLocal * file_local)
  15.519  {
  15.520 -    g_return_val_if_fail ( file_local != NULL, 0 );
  15.521 +  g_return_val_if_fail(file_local != NULL, 0);
  15.522  
  15.523 -    return gmyth_file_get_filesize ( GMYTH_FILE ( file_local ) );
  15.524 +  return gmyth_file_get_filesize(GMYTH_FILE(file_local));
  15.525  }
  15.526  
  15.527  /** 
  15.528 @@ -431,11 +427,11 @@
  15.529   * @param filesize The actual File Transfer size, in bytes.
  15.530   */
  15.531  void
  15.532 -gmyth_file_local_set_filesize ( GMythFileLocal * file_local, guint64 filesize )
  15.533 +gmyth_file_local_set_filesize(GMythFileLocal * file_local, guint64 filesize)
  15.534  {
  15.535 -    g_return_if_fail ( file_local != NULL );
  15.536 +  g_return_if_fail(file_local != NULL);
  15.537  
  15.538 -    gmyth_file_set_filesize ( GMYTH_FILE ( file_local ), filesize );
  15.539 +  gmyth_file_set_filesize(GMYTH_FILE(file_local), filesize);
  15.540  }
  15.541  
  15.542  /** 
  15.543 @@ -446,11 +442,11 @@
  15.544   * @return The actual file offset in bytes.
  15.545   */
  15.546  gint64
  15.547 -gmyth_file_local_get_offset ( GMythFileLocal * file_local )
  15.548 +gmyth_file_local_get_offset(GMythFileLocal * file_local)
  15.549  {
  15.550 -    g_return_val_if_fail ( file_local != NULL, 0 );
  15.551 +  g_return_val_if_fail(file_local != NULL, 0);
  15.552  
  15.553 -    return gmyth_file_get_offset ( GMYTH_FILE ( file_local ) );
  15.554 +  return gmyth_file_get_offset(GMYTH_FILE(file_local));
  15.555  }
  15.556  
  15.557  /** 
  15.558 @@ -460,9 +456,9 @@
  15.559   * @param offset The actual File Local offset, in bytes.
  15.560   */
  15.561  void
  15.562 -gmyth_file_local_set_offset ( GMythFileLocal * file_local, gint64 offset )
  15.563 +gmyth_file_local_set_offset(GMythFileLocal * file_local, gint64 offset)
  15.564  {
  15.565 -    g_return_if_fail ( file_local != NULL );
  15.566 +  g_return_if_fail(file_local != NULL);
  15.567  
  15.568 -    gmyth_file_set_offset ( GMYTH_FILE ( file_local ), offset );
  15.569 +  gmyth_file_set_offset(GMYTH_FILE(file_local), offset);
  15.570  }
    16.1 --- a/gmyth/src/gmyth_file_local.h	Wed Jun 13 18:18:42 2007 +0100
    16.2 +++ b/gmyth/src/gmyth_file_local.h	Thu Jun 14 18:19:52 2007 +0100
    16.3 @@ -54,38 +54,38 @@
    16.4  typedef struct _GMythFileLocalPrivate GMythFileLocalPrivate;
    16.5  
    16.6  struct _GMythFileLocal
    16.7 -    {
    16.8 -        GMythFile parent;
    16.9 -    };
   16.10 +{
   16.11 +  GMythFile parent;
   16.12 +};
   16.13  
   16.14  struct _GMythFileLocalClass
   16.15 -    {
   16.16 -        GMythFileClass parent_class;
   16.17 -    };
   16.18 +{
   16.19 +  GMythFileClass parent_class;
   16.20 +};
   16.21  
   16.22  
   16.23 -GType gmyth_file_local_get_type ( void );
   16.24 -GMythFileLocal *gmyth_file_local_new ( GMythBackendInfo * backend_info );
   16.25 -GMythFileLocal *gmyth_file_local_new_with_uri ( const gchar * uri );
   16.26 -gchar *gmyth_file_local_get_file_name ( GMythFileLocal * file_local );
   16.27 -void gmyth_file_local_set_file_name ( GMythFileLocal * file_local,
   16.28 -                                      const gchar * filename );
   16.29 -gboolean gmyth_file_local_open ( GMythFileLocal * file_local );
   16.30 -void gmyth_file_local_close ( GMythFileLocal * file_local );
   16.31 -gboolean gmyth_file_local_is_open ( GMythFileLocal * file_local );
   16.32 +GType gmyth_file_local_get_type(void);
   16.33 +GMythFileLocal *gmyth_file_local_new(GMythBackendInfo * backend_info);
   16.34 +GMythFileLocal *gmyth_file_local_new_with_uri(const gchar * uri);
   16.35 +gchar *gmyth_file_local_get_file_name(GMythFileLocal * file_local);
   16.36 +void gmyth_file_local_set_file_name(GMythFileLocal * file_local,
   16.37 +									const gchar * filename);
   16.38 +gboolean gmyth_file_local_open(GMythFileLocal * file_local);
   16.39 +void gmyth_file_local_close(GMythFileLocal * file_local);
   16.40 +gboolean gmyth_file_local_is_open(GMythFileLocal * file_local);
   16.41  
   16.42  GMythFileReadResult
   16.43 -gmyth_file_local_read ( GMythFileLocal * file_local,
   16.44 -                        GByteArray * data, gint size, gboolean read_unlimited );
   16.45 +gmyth_file_local_read(GMythFileLocal * file_local,
   16.46 +					  GByteArray * data, gint size, gboolean read_unlimited);
   16.47  
   16.48 -gint64 gmyth_file_local_seek ( GMythFileLocal * file_local,
   16.49 -                               gint64 pos, GSeekType whence );
   16.50 +gint64 gmyth_file_local_seek(GMythFileLocal * file_local,
   16.51 +							 gint64 pos, GSeekType whence);
   16.52  
   16.53 -guint64 gmyth_file_local_get_filesize ( GMythFileLocal * file_local );
   16.54 -void gmyth_file_local_set_filesize ( GMythFileLocal * file, guint64 filesize );
   16.55 +guint64 gmyth_file_local_get_filesize(GMythFileLocal * file_local);
   16.56 +void gmyth_file_local_set_filesize(GMythFileLocal * file, guint64 filesize);
   16.57  
   16.58 -gint64 gmyth_file_local_get_offset ( GMythFileLocal * file_local );
   16.59 -void gmyth_file_local_set_offset ( GMythFileLocal * file_local, gint64 offset );
   16.60 +gint64 gmyth_file_local_get_offset(GMythFileLocal * file_local);
   16.61 +void gmyth_file_local_set_offset(GMythFileLocal * file_local, gint64 offset);
   16.62  
   16.63  G_END_DECLS
   16.64  #endif /* __GMYTH_FILE_LOCAL_H__ */
    17.1 --- a/gmyth/src/gmyth_file_transfer.c	Wed Jun 13 18:18:42 2007 +0100
    17.2 +++ b/gmyth/src/gmyth_file_transfer.c	Thu Jun 14 18:19:52 2007 +0100
    17.3 @@ -61,138 +61,137 @@
    17.4  	(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferPrivate))
    17.5  
    17.6  enum myth_sock_types
    17.7 -    {
    17.8 -        GMYTH_PLAYBACK_TYPE = 0,
    17.9 -        GMYTH_MONITOR_TYPE,
   17.10 -        GMYTH_FILETRANSFER_TYPE,
   17.11 -        GMYTH_RINGBUFFER_TYPE
   17.12 -    };
   17.13 +{
   17.14 +  GMYTH_PLAYBACK_TYPE = 0,
   17.15 +  GMYTH_MONITOR_TYPE,
   17.16 +  GMYTH_FILETRANSFER_TYPE,
   17.17 +  GMYTH_RINGBUFFER_TYPE
   17.18 +};
   17.19  
   17.20  struct _GMythFileTransferPrivate
   17.21 -    {
   17.22 -        GMythRecorder *recorder;
   17.23 +{
   17.24 +  GMythRecorder *recorder;
   17.25  
   17.26 -        gboolean do_next_program_chain;
   17.27 -        gboolean disposed;
   17.28 -        gboolean livetv_wait;
   17.29 +  gboolean do_next_program_chain;
   17.30 +  gboolean disposed;
   17.31 +  gboolean livetv_wait;
   17.32  
   17.33 -        /* MythTV version number */
   17.34 -        gint mythtv_version;
   17.35 + /* MythTV version number */
   17.36 +  gint mythtv_version;
   17.37  
   17.38 -        /* socket descriptors */
   17.39 -        GMythSocket *control_sock;
   17.40 -        GMythSocket *sock;
   17.41 -        GMutex *mutex;
   17.42 -        gint file_id;
   17.43 -    };
   17.44 + /* socket descriptors */
   17.45 +  GMythSocket *control_sock;
   17.46 +  GMythSocket *sock;
   17.47 +  GMutex *mutex;
   17.48 +  gint file_id;
   17.49 +};
   17.50  
   17.51 -static void gmyth_file_transfer_class_init ( GMythFileTransferClass * klass );
   17.52 -static void gmyth_file_transfer_init ( GMythFileTransfer * object );
   17.53 -static void gmyth_file_transfer_dispose ( GObject * object );
   17.54 -static void gmyth_file_transfer_finalize ( GObject * object );
   17.55 -static void _file_transfer_program_info_changed ( GMythFileTransfer * transfer,
   17.56 -                                                  gint msg_code,
   17.57 -                                                  gpointer livetv_recorder );
   17.58 -static gboolean _connect_to_backend ( GMythFileTransfer * transfer );
   17.59 -static gboolean _control_acquire_context ( GMythFileTransfer * transfer,
   17.60 -                                           gboolean do_wait );
   17.61 -static gboolean _control_release_context ( GMythFileTransfer * transfer );
   17.62 +static void gmyth_file_transfer_class_init(GMythFileTransferClass * klass);
   17.63 +static void gmyth_file_transfer_init(GMythFileTransfer * object);
   17.64 +static void gmyth_file_transfer_dispose(GObject * object);
   17.65 +static void gmyth_file_transfer_finalize(GObject * object);
   17.66 +static void _file_transfer_program_info_changed(GMythFileTransfer * transfer,
   17.67 +												gint msg_code,
   17.68 +												gpointer livetv_recorder);
   17.69 +static gboolean _connect_to_backend(GMythFileTransfer * transfer);
   17.70 +static gboolean _control_acquire_context(GMythFileTransfer * transfer,
   17.71 +										 gboolean do_wait);
   17.72 +static gboolean _control_release_context(GMythFileTransfer * transfer);
   17.73  
   17.74 -G_DEFINE_TYPE ( GMythFileTransfer, gmyth_file_transfer, GMYTH_FILE_TYPE )
   17.75 -     static void gmyth_file_transfer_class_init ( GMythFileTransferClass *
   17.76 -                                                  klass )
   17.77 +G_DEFINE_TYPE(GMythFileTransfer, gmyth_file_transfer, GMYTH_FILE_TYPE)
   17.78 +	 static void gmyth_file_transfer_class_init(GMythFileTransferClass *
   17.79 +												klass)
   17.80  {
   17.81 -    GObjectClass *gobject_class;
   17.82 -    GMythFileTransferClass *gtransfer_class;
   17.83 +  GObjectClass *gobject_class;
   17.84 +  GMythFileTransferClass *gtransfer_class;
   17.85  
   17.86 -    gobject_class = ( GObjectClass * ) klass;
   17.87 -    gtransfer_class = ( GMythFileTransferClass * ) gobject_class;
   17.88 +  gobject_class = (GObjectClass *) klass;
   17.89 +  gtransfer_class = (GMythFileTransferClass *) gobject_class;
   17.90  
   17.91 -    gobject_class->dispose = gmyth_file_transfer_dispose;
   17.92 -    gobject_class->finalize = gmyth_file_transfer_finalize;
   17.93 +  gobject_class->dispose = gmyth_file_transfer_dispose;
   17.94 +  gobject_class->finalize = gmyth_file_transfer_finalize;
   17.95  
   17.96 -    g_type_class_add_private ( gobject_class,
   17.97 -                               sizeof ( GMythFileTransferPrivate ) );
   17.98 +  g_type_class_add_private(gobject_class, sizeof(GMythFileTransferPrivate));
   17.99  
  17.100 -    gtransfer_class->program_info_changed_handler =
  17.101 -        _file_transfer_program_info_changed;
  17.102 +  gtransfer_class->program_info_changed_handler =
  17.103 +	_file_transfer_program_info_changed;
  17.104  
  17.105 -    gtransfer_class->program_info_changed_handler_signal_id =
  17.106 -        g_signal_new ( "program-info-changed",
  17.107 -                       G_TYPE_FROM_CLASS ( gtransfer_class ),
  17.108 -                       G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
  17.109 -                       G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
  17.110 -                       gmyth_marshal_VOID__INT_POINTER, G_TYPE_NONE, 2,
  17.111 -                       G_TYPE_INT, G_TYPE_POINTER );
  17.112 +  gtransfer_class->program_info_changed_handler_signal_id =
  17.113 +	g_signal_new("program-info-changed",
  17.114 +				 G_TYPE_FROM_CLASS(gtransfer_class),
  17.115 +				 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
  17.116 +				 G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
  17.117 +				 gmyth_marshal_VOID__INT_POINTER, G_TYPE_NONE, 2,
  17.118 +				 G_TYPE_INT, G_TYPE_POINTER);
  17.119  
  17.120  }
  17.121  
  17.122  static void
  17.123 -gmyth_file_transfer_init ( GMythFileTransfer * transfer )
  17.124 +gmyth_file_transfer_init(GMythFileTransfer * transfer)
  17.125  {
  17.126 -    g_return_if_fail ( transfer != NULL );
  17.127 +  g_return_if_fail(transfer != NULL);
  17.128  
  17.129 -    transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.130 -    transfer->priv->mutex = g_mutex_new (  );
  17.131 +  transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.132 +  transfer->priv->mutex = g_mutex_new();
  17.133  
  17.134 -    g_signal_connect ( G_OBJECT ( transfer ), "program-info-changed",
  17.135 -                       ( GCallback ) ( GMYTH_FILE_TRANSFER_GET_CLASS
  17.136 -                                       ( transfer )->
  17.137 -                                       program_info_changed_handler ), NULL );
  17.138 +  g_signal_connect(G_OBJECT(transfer), "program-info-changed",
  17.139 +				   (GCallback) (GMYTH_FILE_TRANSFER_GET_CLASS
  17.140 +								(transfer)->
  17.141 +								program_info_changed_handler), NULL);
  17.142  }
  17.143  
  17.144  static void
  17.145 -gmyth_file_transfer_dispose ( GObject * object )
  17.146 +gmyth_file_transfer_dispose(GObject * object)
  17.147  {
  17.148 -    GMythFileTransferPrivate *priv;
  17.149 -    GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER ( object );
  17.150 +  GMythFileTransferPrivate *priv;
  17.151 +  GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER(object);
  17.152  
  17.153 -    g_return_if_fail ( transfer != NULL );
  17.154 +  g_return_if_fail(transfer != NULL);
  17.155  
  17.156 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.157 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.158  
  17.159 -    if ( priv->disposed )
  17.160 -    {
  17.161 -        /* If dispose did already run, return. */
  17.162 -        return;
  17.163 -    }
  17.164 +  if (priv->disposed)
  17.165 +	{
  17.166 +	 /* If dispose did already run, return. */
  17.167 +	  return;
  17.168 +	}
  17.169  
  17.170 -    /* Make sure dispose does not run twice. */
  17.171 -    priv->disposed = TRUE;
  17.172 + /* Make sure dispose does not run twice. */
  17.173 +  priv->disposed = TRUE;
  17.174  
  17.175 -    if ( priv->mutex != NULL )
  17.176 -    {
  17.177 -        g_mutex_free ( priv->mutex );
  17.178 -        priv->mutex = NULL;
  17.179 -    }
  17.180 +  if (priv->mutex != NULL)
  17.181 +	{
  17.182 +	  g_mutex_free(priv->mutex);
  17.183 +	  priv->mutex = NULL;
  17.184 +	}
  17.185  
  17.186 -    if ( priv->control_sock != NULL )
  17.187 -    {
  17.188 -        g_object_unref ( priv->control_sock );
  17.189 -        priv->control_sock = NULL;
  17.190 -    }
  17.191 +  if (priv->control_sock != NULL)
  17.192 +	{
  17.193 +	  g_object_unref(priv->control_sock);
  17.194 +	  priv->control_sock = NULL;
  17.195 +	}
  17.196  
  17.197 -    if ( priv->sock != NULL )
  17.198 -    {
  17.199 -        g_object_unref ( priv->sock );
  17.200 -        priv->sock = NULL;
  17.201 -    }
  17.202 +  if (priv->sock != NULL)
  17.203 +	{
  17.204 +	  g_object_unref(priv->sock);
  17.205 +	  priv->sock = NULL;
  17.206 +	}
  17.207  
  17.208 -    if ( priv->recorder != NULL )
  17.209 -    {
  17.210 -        g_object_unref ( priv->recorder );
  17.211 -        priv->recorder = NULL;
  17.212 -    }
  17.213 +  if (priv->recorder != NULL)
  17.214 +	{
  17.215 +	  g_object_unref(priv->recorder);
  17.216 +	  priv->recorder = NULL;
  17.217 +	}
  17.218  
  17.219 -    G_OBJECT_CLASS ( gmyth_file_transfer_parent_class )->dispose ( object );
  17.220 +  G_OBJECT_CLASS(gmyth_file_transfer_parent_class)->dispose(object);
  17.221  }
  17.222  
  17.223  static void
  17.224 -gmyth_file_transfer_finalize ( GObject * object )
  17.225 +gmyth_file_transfer_finalize(GObject * object)
  17.226  {
  17.227 -    g_signal_handlers_destroy ( object );
  17.228 +  g_signal_handlers_destroy(object);
  17.229  
  17.230 -    G_OBJECT_CLASS ( gmyth_file_transfer_parent_class )->finalize ( object );
  17.231 +  G_OBJECT_CLASS(gmyth_file_transfer_parent_class)->finalize(object);
  17.232  }
  17.233  
  17.234  /** 
  17.235 @@ -204,32 +203,32 @@
  17.236   * @return a new instance of the File Transfer. 
  17.237   */
  17.238  GMythFileTransfer *
  17.239 -gmyth_file_transfer_new ( GMythBackendInfo * backend_info )
  17.240 +gmyth_file_transfer_new(GMythBackendInfo * backend_info)
  17.241  {
  17.242 -    GMythFileTransfer *transfer = g_object_new ( GMYTH_FILE_TRANSFER_TYPE,
  17.243 -                                                 "backend-info", backend_info,
  17.244 -                                                 NULL );
  17.245 +  GMythFileTransfer *transfer = g_object_new(GMYTH_FILE_TRANSFER_TYPE,
  17.246 +											 "backend-info", backend_info,
  17.247 +											 NULL);
  17.248  
  17.249 -    //GValue val = {0,};    
  17.250 -    //backend_info = g_object_ref( backend_info );
  17.251 -    gmyth_debug ( "Creating FileTransfer BackendInfo hostname = %s",
  17.252 -                  gmyth_backend_info_get_hostname ( backend_info ) );
  17.253 -    //GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri (uri_str);
  17.254 -    //g_value_init (&val, G_TYPE_OBJECT);
  17.255 -    //g_value_set_object (&val, backend_info);    
  17.256 -    //g_object_set (G_OBJECT (transfer), "backend-info", &val, NULL);
  17.257 + //GValue val = {0,};    
  17.258 + //backend_info = g_object_ref( backend_info );
  17.259 +  gmyth_debug("Creating FileTransfer BackendInfo hostname = %s",
  17.260 +			  gmyth_backend_info_get_hostname(backend_info));
  17.261 + //GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri (uri_str);
  17.262 + //g_value_init (&val, G_TYPE_OBJECT);
  17.263 + //g_value_set_object (&val, backend_info);    
  17.264 + //g_object_set (G_OBJECT (transfer), "backend-info", &val, NULL);
  17.265  
  17.266 -    return transfer;
  17.267 +  return transfer;
  17.268  }
  17.269  
  17.270  gchar *
  17.271 -gmyth_file_transfer_get_file_name ( GMythFileTransfer * transfer )
  17.272 +gmyth_file_transfer_get_file_name(GMythFileTransfer * transfer)
  17.273  {
  17.274 -    gchar *filename;
  17.275 +  gchar *filename;
  17.276  
  17.277 -    g_object_get ( G_OBJECT ( transfer ), "filename", &filename, NULL );
  17.278 +  g_object_get(G_OBJECT(transfer), "filename", &filename, NULL);
  17.279  
  17.280 -    return filename;
  17.281 +  return filename;
  17.282  }
  17.283  
  17.284  /** 
  17.285 @@ -240,18 +239,18 @@
  17.286   * @return a new instance of the File Transfer. 
  17.287   */
  17.288  GMythFileTransfer *
  17.289 -gmyth_file_transfer_new_with_uri ( const gchar * uri_str )
  17.290 +gmyth_file_transfer_new_with_uri(const gchar * uri_str)
  17.291  {
  17.292 -    GMythFileTransfer *transfer =
  17.293 -        GMYTH_FILE_TRANSFER ( g_object_new ( GMYTH_FILE_TRANSFER_TYPE, NULL ) );
  17.294 -    gmyth_debug ( "URI str = %s", uri_str );
  17.295 -    //GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri (uri_str);
  17.296 -    GValue val = { 0, };
  17.297 -    g_value_init ( &val, G_TYPE_OBJECT );
  17.298 -    g_value_set_object ( &val, gmyth_backend_info_new_with_uri ( uri_str ) );
  17.299 -    g_object_set ( G_OBJECT ( transfer ), "backend-info", &val, NULL );
  17.300 +  GMythFileTransfer *transfer =
  17.301 +	GMYTH_FILE_TRANSFER(g_object_new(GMYTH_FILE_TRANSFER_TYPE, NULL));
  17.302 +  gmyth_debug("URI str = %s", uri_str);
  17.303 + //GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri (uri_str);
  17.304 +  GValue val = { 0, };
  17.305 +  g_value_init(&val, G_TYPE_OBJECT);
  17.306 +  g_value_set_object(&val, gmyth_backend_info_new_with_uri(uri_str));
  17.307 +  g_object_set(G_OBJECT(transfer), "backend-info", &val, NULL);
  17.308  
  17.309 -    return transfer;
  17.310 +  return transfer;
  17.311  }
  17.312  
  17.313  /** 
  17.314 @@ -263,76 +262,74 @@
  17.315   * @return <code>true</code>, if the connection opening had been done successfully. 
  17.316   */
  17.317  gboolean
  17.318 -gmyth_file_transfer_open ( GMythFileTransfer * transfer,
  17.319 -                           const gchar * filename )
  17.320 +gmyth_file_transfer_open(GMythFileTransfer * transfer, const gchar * filename)
  17.321  {
  17.322 -    gboolean ret = TRUE;
  17.323 -    GMythFileTransferPrivate *priv;
  17.324 +  gboolean ret = TRUE;
  17.325 +  GMythFileTransferPrivate *priv;
  17.326  
  17.327 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.328 -    g_return_val_if_fail ( filename != NULL && strlen ( filename ) > 0, FALSE );
  17.329 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.330 +  g_return_val_if_fail(filename != NULL && strlen(filename) > 0, FALSE);
  17.331  
  17.332 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.333 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.334  
  17.335 -    gmyth_debug ( "Opening the FileTransfer... (%s)", filename );
  17.336 +  gmyth_debug("Opening the FileTransfer... (%s)", filename);
  17.337  
  17.338 -    g_object_set ( GMYTH_FILE ( transfer ), "filename", filename, NULL );
  17.339 +  g_object_set(GMYTH_FILE(transfer), "filename", filename, NULL);
  17.340  
  17.341 -    /* configure the control socket */
  17.342 -    if ( TRUE /*priv->control_sock == NULL */  )
  17.343 -    {
  17.344 -        if ( !_connect_to_backend ( transfer ) )
  17.345 -        {
  17.346 -            gmyth_debug ( "Connection to backend failed (Control Socket)." );
  17.347 -            ret = FALSE;
  17.348 -        }
  17.349 + /* configure the control socket */
  17.350 +  if (TRUE /*priv->control_sock == NULL */ )
  17.351 +	{
  17.352 +	  if (!_connect_to_backend(transfer))
  17.353 +		{
  17.354 +		  gmyth_debug("Connection to backend failed (Control Socket).");
  17.355 +		  ret = FALSE;
  17.356 +		}
  17.357  
  17.358 -        if ( priv->do_next_program_chain )
  17.359 -        {
  17.360 -            priv->do_next_program_chain = FALSE;    // fixme
  17.361 -            gmyth_debug
  17.362 -                ( "New file available before the current file was opened" );
  17.363 -            GMythProgramInfo *prog_info =
  17.364 -                gmyth_recorder_get_current_program_info ( priv->recorder );
  17.365 +	  if (priv->do_next_program_chain)
  17.366 +		{
  17.367 +		  priv->do_next_program_chain = FALSE;	// fixme
  17.368 +		  gmyth_debug
  17.369 +			("New file available before the current file was opened");
  17.370 +		  GMythProgramInfo *prog_info =
  17.371 +			gmyth_recorder_get_current_program_info(priv->recorder);
  17.372  
  17.373 -            if ( prog_info != NULL && prog_info->pathname != NULL
  17.374 -                 && strlen ( prog_info->pathname->str ) > 0
  17.375 -                 && g_ascii_strcasecmp ( prog_info->pathname->str,
  17.376 -                                         gmyth_file_get_file_name ( GMYTH_FILE
  17.377 -                                                                    ( transfer ) ) )
  17.378 -                 != 0 )
  17.379 -                ret =
  17.380 -                    gmyth_file_transfer_open ( transfer,
  17.381 -                                               g_strrstr ( prog_info->pathname->
  17.382 -                                                           str, "/" ) );
  17.383 +		  if (prog_info != NULL && prog_info->pathname != NULL
  17.384 +			  && strlen(prog_info->pathname->str) > 0
  17.385 +			  && g_ascii_strcasecmp(prog_info->pathname->str,
  17.386 +									gmyth_file_get_file_name(GMYTH_FILE
  17.387 +															 (transfer)))
  17.388 +			  != 0)
  17.389 +			ret =
  17.390 +			  gmyth_file_transfer_open(transfer,
  17.391 +									   g_strrstr(prog_info->pathname->
  17.392 +												 str, "/"));
  17.393  
  17.394 -            if ( prog_info != NULL )
  17.395 -                g_object_unref ( prog_info );
  17.396 +		  if (prog_info != NULL)
  17.397 +			g_object_unref(prog_info);
  17.398  
  17.399 -            if ( !ret )
  17.400 -                gmyth_debug ( "Cannot change to the next program info!" );
  17.401 -            else
  17.402 -                gmyth_debug ( "OK!!! MOVED to the next program info [%s]!",
  17.403 -                              gmyth_file_get_file_name ( GMYTH_FILE
  17.404 -                                                         ( transfer ) ) );
  17.405 +		  if (!ret)
  17.406 +			gmyth_debug("Cannot change to the next program info!");
  17.407 +		  else
  17.408 +			gmyth_debug("OK!!! MOVED to the next program info [%s]!",
  17.409 +						gmyth_file_get_file_name(GMYTH_FILE(transfer)));
  17.410  
  17.411 -        }
  17.412 -        else
  17.413 -        {
  17.414 -            gmyth_debug
  17.415 -                ( "None new file found. We continue with the same file opened before" );
  17.416 -        }
  17.417 +		}
  17.418 +	  else
  17.419 +		{
  17.420 +		  gmyth_debug
  17.421 +			("None new file found. We continue with the same file opened before");
  17.422 +		}
  17.423  
  17.424 -    }
  17.425 -    else
  17.426 -    {
  17.427 -        gmyth_debug ( "Remote transfer control socket already created." );
  17.428 -    }
  17.429 +	}
  17.430 +  else
  17.431 +	{
  17.432 +	  gmyth_debug("Remote transfer control socket already created.");
  17.433 +	}
  17.434  
  17.435 -    gmyth_debug ( "Got file with size = %lld.\n",
  17.436 -                  gmyth_file_get_filesize ( GMYTH_FILE ( transfer ) ) );
  17.437 +  gmyth_debug("Got file with size = %lld.\n",
  17.438 +			  gmyth_file_get_filesize(GMYTH_FILE(transfer)));
  17.439  
  17.440 -    return ret;
  17.441 +  return ret;
  17.442  }
  17.443  
  17.444  /** 
  17.445 @@ -343,111 +340,110 @@
  17.446   * @return <code>true</code>, if the connection had been configured successfully. 
  17.447   */
  17.448  static gboolean
  17.449 -_connect_to_backend ( GMythFileTransfer * transfer )
  17.450 +_connect_to_backend(GMythFileTransfer * transfer)
  17.451  {
  17.452 -    GString *base_str = NULL;
  17.453 -    GString *hostname = NULL;
  17.454 -    GMythStringList *strlist = NULL;
  17.455 -    gboolean ret = TRUE;
  17.456 -    GMythFileTransferPrivate *priv;
  17.457 -    GMythBackendInfo *backend_info;
  17.458 +  GString *base_str = NULL;
  17.459 +  GString *hostname = NULL;
  17.460 +  GMythStringList *strlist = NULL;
  17.461 +  gboolean ret = TRUE;
  17.462 +  GMythFileTransferPrivate *priv;
  17.463 +  GMythBackendInfo *backend_info;
  17.464  
  17.465 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.466 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.467  
  17.468 -    g_object_get ( GMYTH_FILE ( transfer ), "backend-info", &backend_info,
  17.469 -                   NULL );
  17.470 +  g_object_get(GMYTH_FILE(transfer), "backend-info", &backend_info, NULL);
  17.471  
  17.472 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.473 -    _control_acquire_context ( transfer, TRUE );
  17.474 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.475 +  _control_acquire_context(transfer, TRUE);
  17.476  
  17.477 -    /* Creates the control socket */
  17.478 + /* Creates the control socket */
  17.479  
  17.480 -    if ( priv->control_sock != NULL )
  17.481 -    {
  17.482 -        g_object_unref ( priv->control_sock );
  17.483 -        priv->control_sock = NULL;
  17.484 -    }
  17.485 +  if (priv->control_sock != NULL)
  17.486 +	{
  17.487 +	  g_object_unref(priv->control_sock);
  17.488 +	  priv->control_sock = NULL;
  17.489 +	}
  17.490  
  17.491 -    base_str = g_string_new ( "" );
  17.492 +  base_str = g_string_new("");
  17.493  
  17.494 -    priv->control_sock = gmyth_socket_new (  );
  17.495 -    // Connects the socket, send Mythtv ANN command and verify Mythtv protocol version 
  17.496 -    if ( !gmyth_socket_connect_to_backend ( priv->control_sock,
  17.497 -                                            backend_info->hostname,
  17.498 -                                            backend_info->port, TRUE ) )
  17.499 -    {
  17.500 +  priv->control_sock = gmyth_socket_new();
  17.501 + // Connects the socket, send Mythtv ANN command and verify Mythtv protocol version 
  17.502 +  if (!gmyth_socket_connect_to_backend(priv->control_sock,
  17.503 +									   backend_info->hostname,
  17.504 +									   backend_info->port, TRUE))
  17.505 +	{
  17.506  
  17.507 -        g_object_unref ( priv->control_sock );
  17.508 -        priv->control_sock = NULL;
  17.509 -        return FALSE;
  17.510 -    }
  17.511 +	  g_object_unref(priv->control_sock);
  17.512 +	  priv->control_sock = NULL;
  17.513 +	  return FALSE;
  17.514 +	}
  17.515  
  17.516 -    /* Creates the data socket */
  17.517 -    if ( priv->sock != NULL )
  17.518 -    {
  17.519 -        g_object_unref ( priv->sock );
  17.520 -        priv->sock = NULL;
  17.521 -    }
  17.522 + /* Creates the data socket */
  17.523 +  if (priv->sock != NULL)
  17.524 +	{
  17.525 +	  g_object_unref(priv->sock);
  17.526 +	  priv->sock = NULL;
  17.527 +	}
  17.528  
  17.529 -    priv->sock = gmyth_socket_new (  );
  17.530 -    gmyth_socket_connect ( priv->sock, backend_info->hostname,
  17.531 -                           backend_info->port );
  17.532 -    gmyth_debug ( "Connecting file transfer... (%s, %d)",
  17.533 -                  backend_info->hostname, backend_info->port );
  17.534 +  priv->sock = gmyth_socket_new();
  17.535 +  gmyth_socket_connect(priv->sock, backend_info->hostname,
  17.536 +					   backend_info->port);
  17.537 +  gmyth_debug("Connecting file transfer... (%s, %d)",
  17.538 +			  backend_info->hostname, backend_info->port);
  17.539  
  17.540 -    strlist = gmyth_string_list_new (  );
  17.541 -    hostname = gmyth_socket_get_local_hostname (  );
  17.542 -    gmyth_debug ( "[%s] MythTV version (from backend) = %d.\n", __FUNCTION__,
  17.543 -                  priv->control_sock->mythtv_version );
  17.544 -    if ( priv->control_sock->mythtv_version > 26 )
  17.545 -        g_string_printf ( base_str, "ANN FileTransfer %s 1 -1", hostname->str );
  17.546 -    else
  17.547 -        g_string_printf ( base_str, "ANN FileTransfer %s", hostname->str );
  17.548 +  strlist = gmyth_string_list_new();
  17.549 +  hostname = gmyth_socket_get_local_hostname();
  17.550 +  gmyth_debug("[%s] MythTV version (from backend) = %d.\n", __FUNCTION__,
  17.551 +			  priv->control_sock->mythtv_version);
  17.552 +  if (priv->control_sock->mythtv_version > 26)
  17.553 +	g_string_printf(base_str, "ANN FileTransfer %s 1 -1", hostname->str);
  17.554 +  else
  17.555 +	g_string_printf(base_str, "ANN FileTransfer %s", hostname->str);
  17.556  
  17.557 -    gmyth_string_list_append_string ( strlist, base_str );
  17.558 -    gmyth_string_list_append_char_array ( strlist,
  17.559 -                                          gmyth_file_get_file_name ( GMYTH_FILE
  17.560 -                                                                     ( transfer ) ) );
  17.561 +  gmyth_string_list_append_string(strlist, base_str);
  17.562 +  gmyth_string_list_append_char_array(strlist,
  17.563 +									  gmyth_file_get_file_name(GMYTH_FILE
  17.564 +															   (transfer)));
  17.565  
  17.566 -    gmyth_socket_write_stringlist ( priv->sock, strlist );
  17.567 +  gmyth_socket_write_stringlist(priv->sock, strlist);
  17.568  
  17.569 -    /* MONITOR Handler - DVB TV Chain update messages!!! */
  17.570 + /* MONITOR Handler - DVB TV Chain update messages!!! */
  17.571  
  17.572 -    gmyth_socket_read_stringlist ( priv->sock, strlist );
  17.573 +  gmyth_socket_read_stringlist(priv->sock, strlist);
  17.574  
  17.575 -    /* file identification used in future file transfer requests to backend */
  17.576 -    priv->file_id = gmyth_string_list_get_int ( strlist, 1 );
  17.577 + /* file identification used in future file transfer requests to backend */
  17.578 +  priv->file_id = gmyth_string_list_get_int(strlist, 1);
  17.579  
  17.580 -    /* Myth URI stream file size - decoded using two 8-bytes sequences (64 bits/long long types) */
  17.581 -    gmyth_file_set_filesize ( GMYTH_FILE ( transfer ),
  17.582 -                              gmyth_string_list_get_int64 ( strlist, 2 ) );
  17.583 + /* Myth URI stream file size - decoded using two 8-bytes sequences (64 bits/long long types) */
  17.584 +  gmyth_file_set_filesize(GMYTH_FILE(transfer),
  17.585 +						  gmyth_string_list_get_int64(strlist, 2));
  17.586  
  17.587 -    gmyth_debug ( "***** Received: recordernum = %d, filesize = %"
  17.588 -                  G_GUINT64_FORMAT "\n", priv->file_id,
  17.589 -                  gmyth_file_get_filesize ( GMYTH_FILE ( transfer ) ) );
  17.590 +  gmyth_debug("***** Received: recordernum = %d, filesize = %"
  17.591 +			  G_GUINT64_FORMAT "\n", priv->file_id,
  17.592 +			  gmyth_file_get_filesize(GMYTH_FILE(transfer)));
  17.593  
  17.594 -    if ( gmyth_file_get_filesize ( GMYTH_FILE ( transfer ) ) < 0 )
  17.595 -    {
  17.596 -        gmyth_debug
  17.597 -            ( "Got filesize equals to %llu is lesser than 0 [invalid stream file]\n",
  17.598 -              gmyth_file_get_filesize ( GMYTH_FILE ( transfer ) ) );
  17.599 -        g_object_unref ( priv->sock );
  17.600 -        priv->sock = NULL;
  17.601 -        ret = FALSE;
  17.602 -    }
  17.603 +  if (gmyth_file_get_filesize(GMYTH_FILE(transfer)) < 0)
  17.604 +	{
  17.605 +	  gmyth_debug
  17.606 +		("Got filesize equals to %llu is lesser than 0 [invalid stream file]\n",
  17.607 +		 gmyth_file_get_filesize(GMYTH_FILE(transfer)));
  17.608 +	  g_object_unref(priv->sock);
  17.609 +	  priv->sock = NULL;
  17.610 +	  ret = FALSE;
  17.611 +	}
  17.612  
  17.613 -    _control_release_context ( transfer );
  17.614 +  _control_release_context(transfer);
  17.615  
  17.616 -    if ( strlist != NULL )
  17.617 -        g_object_unref ( strlist );
  17.618 +  if (strlist != NULL)
  17.619 +	g_object_unref(strlist);
  17.620  
  17.621 -    if ( base_str != NULL )
  17.622 -        g_string_free ( base_str, TRUE );
  17.623 +  if (base_str != NULL)
  17.624 +	g_string_free(base_str, TRUE);
  17.625  
  17.626 -    if ( hostname != NULL )
  17.627 -        g_string_free ( hostname, TRUE );
  17.628 +  if (hostname != NULL)
  17.629 +	g_string_free(hostname, TRUE);
  17.630  
  17.631 -    return ret;
  17.632 +  return ret;
  17.633  }
  17.634  
  17.635  /** 
  17.636 @@ -459,15 +455,15 @@
  17.637   * @param live_tv A pointer to the LiveTV instance. * 
  17.638   */
  17.639  void
  17.640 -gmyth_file_transfer_emit_program_info_changed_signal ( GMythFileTransfer *
  17.641 -                                                       transfer, gint msg_code,
  17.642 -                                                       gpointer
  17.643 -                                                       live_tv_recorder )
  17.644 +gmyth_file_transfer_emit_program_info_changed_signal(GMythFileTransfer *
  17.645 +													 transfer, gint msg_code,
  17.646 +													 gpointer
  17.647 +													 live_tv_recorder)
  17.648  {
  17.649 -    gmyth_debug ( "Calling signal handler... [FILE_TRANSFER]" );
  17.650 +  gmyth_debug("Calling signal handler... [FILE_TRANSFER]");
  17.651  
  17.652 -    g_signal_emit ( transfer, GMYTH_FILE_TRANSFER_GET_CLASS ( transfer )->program_info_changed_handler_signal_id, 0,    /* details */
  17.653 -                    msg_code, live_tv_recorder );
  17.654 +  g_signal_emit(transfer, GMYTH_FILE_TRANSFER_GET_CLASS(transfer)->program_info_changed_handler_signal_id, 0,	/* details */
  17.655 +				msg_code, live_tv_recorder);
  17.656  
  17.657  }
  17.658  
  17.659 @@ -479,36 +475,36 @@
  17.660   * @return <code>true</code>, if the File Transfer connection is opened. 
  17.661   */
  17.662  gboolean
  17.663 -gmyth_file_transfer_is_open ( GMythFileTransfer * transfer )
  17.664 +gmyth_file_transfer_is_open(GMythFileTransfer * transfer)
  17.665  {
  17.666 -    GMythStringList *strlist;
  17.667 -    GMythFileTransferPrivate *priv;
  17.668 -    GString *query;
  17.669 +  GMythStringList *strlist;
  17.670 +  GMythFileTransferPrivate *priv;
  17.671 +  GString *query;
  17.672  
  17.673 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.674 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.675  
  17.676 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.677 -    g_return_val_if_fail ( priv->control_sock != NULL, FALSE );
  17.678 -    g_return_val_if_fail ( priv->sock != NULL, FALSE );
  17.679 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.680 +  g_return_val_if_fail(priv->control_sock != NULL, FALSE);
  17.681 +  g_return_val_if_fail(priv->sock != NULL, FALSE);
  17.682  
  17.683 -    _control_acquire_context ( transfer, TRUE );
  17.684 +  _control_acquire_context(transfer, TRUE);
  17.685  
  17.686 -    strlist = gmyth_string_list_new (  );
  17.687 -    query = g_string_new ( GMYTHTV_QUERY_HEADER );
  17.688 -    g_string_append_printf ( query, "%d", priv->file_id );
  17.689 +  strlist = gmyth_string_list_new();
  17.690 +  query = g_string_new(GMYTHTV_QUERY_HEADER);
  17.691 +  g_string_append_printf(query, "%d", priv->file_id);
  17.692  
  17.693 -    gmyth_string_list_append_string ( strlist, query );
  17.694 -    gmyth_string_list_append_char_array ( strlist, "IS_OPEN" );
  17.695 +  gmyth_string_list_append_string(strlist, query);
  17.696 +  gmyth_string_list_append_char_array(strlist, "IS_OPEN");
  17.697  
  17.698 -    gmyth_socket_write_stringlist ( priv->control_sock, strlist );
  17.699 -    gmyth_socket_read_stringlist ( priv->control_sock, strlist );
  17.700 +  gmyth_socket_write_stringlist(priv->control_sock, strlist);
  17.701 +  gmyth_socket_read_stringlist(priv->control_sock, strlist);
  17.702  
  17.703 -    _control_release_context ( transfer );
  17.704 +  _control_release_context(transfer);
  17.705  
  17.706 -    g_string_free ( query, TRUE );
  17.707 -    g_object_unref ( strlist );
  17.708 +  g_string_free(query, TRUE);
  17.709 +  g_object_unref(strlist);
  17.710  
  17.711 -    return ( strlist != NULL && gmyth_string_list_get_int ( strlist, 0 ) == 1 );
  17.712 +  return (strlist != NULL && gmyth_string_list_get_int(strlist, 0) == 1);
  17.713  }
  17.714  
  17.715  /** 
  17.716 @@ -517,51 +513,50 @@
  17.717   * @param transfer The actual File Transfer instance. 
  17.718   */
  17.719  void
  17.720 -gmyth_file_transfer_close ( GMythFileTransfer * transfer )
  17.721 +gmyth_file_transfer_close(GMythFileTransfer * transfer)
  17.722  {
  17.723 -    GMythStringList *strlist;
  17.724 -    GMythFileTransferPrivate *priv;
  17.725 -    GString *query;
  17.726 +  GMythStringList *strlist;
  17.727 +  GMythFileTransferPrivate *priv;
  17.728 +  GString *query;
  17.729  
  17.730 -    g_return_if_fail ( transfer != NULL );
  17.731 +  g_return_if_fail(transfer != NULL);
  17.732  
  17.733 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.734 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.735  
  17.736 -    if ( priv->control_sock == NULL )
  17.737 -        return;
  17.738 +  if (priv->control_sock == NULL)
  17.739 +	return;
  17.740  
  17.741 -    _control_acquire_context ( transfer, TRUE );
  17.742 +  _control_acquire_context(transfer, TRUE);
  17.743  
  17.744 -    strlist = gmyth_string_list_new (  );
  17.745 -    query = g_string_new ( GMYTHTV_QUERY_HEADER );
  17.746 -    g_string_append_printf ( query, "%d", priv->file_id );
  17.747 +  strlist = gmyth_string_list_new();
  17.748 +  query = g_string_new(GMYTHTV_QUERY_HEADER);
  17.749 +  g_string_append_printf(query, "%d", priv->file_id);
  17.750  
  17.751 -    gmyth_string_list_append_string ( strlist, query );
  17.752 -    gmyth_string_list_append_char_array ( strlist, "DONE" );
  17.753 +  gmyth_string_list_append_string(strlist, query);
  17.754 +  gmyth_string_list_append_char_array(strlist, "DONE");
  17.755  
  17.756 -    if ( gmyth_socket_sendreceive_stringlist ( priv->control_sock, strlist ) <=
  17.757 -         0 )
  17.758 -    {
  17.759 -        // fixme: time out???
  17.760 -        gmyth_debug ( "Remote file timeout.\n" );
  17.761 -    }
  17.762 +  if (gmyth_socket_sendreceive_stringlist(priv->control_sock, strlist) <= 0)
  17.763 +	{
  17.764 +	 // fixme: time out???
  17.765 +	  gmyth_debug("Remote file timeout.\n");
  17.766 +	}
  17.767  
  17.768 -    g_string_free ( query, TRUE );
  17.769 -    g_object_unref ( strlist );
  17.770 +  g_string_free(query, TRUE);
  17.771 +  g_object_unref(strlist);
  17.772  
  17.773 -    if ( priv->sock )
  17.774 -    {
  17.775 -        g_object_unref ( priv->sock );
  17.776 -        priv->sock = NULL;
  17.777 -    }
  17.778 +  if (priv->sock)
  17.779 +	{
  17.780 +	  g_object_unref(priv->sock);
  17.781 +	  priv->sock = NULL;
  17.782 +	}
  17.783  
  17.784 -    if ( priv->control_sock )
  17.785 -    {
  17.786 -        g_object_unref ( priv->control_sock );
  17.787 -        priv->control_sock = NULL;
  17.788 -    }
  17.789 +  if (priv->control_sock)
  17.790 +	{
  17.791 +	  g_object_unref(priv->control_sock);
  17.792 +	  priv->control_sock = NULL;
  17.793 +	}
  17.794  
  17.795 -    _control_release_context ( transfer );
  17.796 +  _control_release_context(transfer);
  17.797  }
  17.798  
  17.799  /** 
  17.800 @@ -574,52 +569,52 @@
  17.801   * @return The actual position on the remote file (after seek has been done). 
  17.802   */
  17.803  gint64
  17.804 -gmyth_file_transfer_seek ( GMythFileTransfer * transfer, guint64 pos,
  17.805 -                           gint whence )
  17.806 +gmyth_file_transfer_seek(GMythFileTransfer * transfer, guint64 pos,
  17.807 +						 gint whence)
  17.808  {
  17.809 -    GMythStringList *strlist = gmyth_string_list_new (  );
  17.810 -    GMythFileTransferPrivate *priv;
  17.811 -    GString *query;
  17.812 +  GMythStringList *strlist = gmyth_string_list_new();
  17.813 +  GMythFileTransferPrivate *priv;
  17.814 +  GString *query;
  17.815  
  17.816 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.817 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.818 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.819 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.820  
  17.821 -    g_return_val_if_fail ( priv->sock != NULL, -1 );
  17.822 -    g_return_val_if_fail ( priv->control_sock != NULL, -1 );
  17.823 +  g_return_val_if_fail(priv->sock != NULL, -1);
  17.824 +  g_return_val_if_fail(priv->control_sock != NULL, -1);
  17.825  
  17.826 -    strlist = gmyth_string_list_new (  );
  17.827 -    query = g_string_new ( GMYTHTV_QUERY_HEADER );
  17.828 -    g_string_append_printf ( query, "%d", priv->file_id );
  17.829 +  strlist = gmyth_string_list_new();
  17.830 +  query = g_string_new(GMYTHTV_QUERY_HEADER);
  17.831 +  g_string_append_printf(query, "%d", priv->file_id);
  17.832  
  17.833 -    /* myth_control_acquire_context( transfer, TRUE ); */
  17.834 + /* myth_control_acquire_context( transfer, TRUE ); */
  17.835  
  17.836 -    gmyth_string_list_append_string ( strlist, query );
  17.837 -    gmyth_string_list_append_char_array ( strlist, "SEEK" );
  17.838 -    gmyth_string_list_append_uint64 ( strlist, pos );
  17.839 +  gmyth_string_list_append_string(strlist, query);
  17.840 +  gmyth_string_list_append_char_array(strlist, "SEEK");
  17.841 +  gmyth_string_list_append_uint64(strlist, pos);
  17.842  
  17.843 -    gmyth_string_list_append_int ( strlist, whence );
  17.844 +  gmyth_string_list_append_int(strlist, whence);
  17.845  
  17.846 -    if ( pos > 0 )
  17.847 -        gmyth_string_list_append_uint64 ( strlist, pos );
  17.848 -    else
  17.849 -        gmyth_string_list_append_uint64 ( strlist,
  17.850 -                                          gmyth_file_get_offset ( GMYTH_FILE
  17.851 -                                                                  ( transfer ) ) );
  17.852 +  if (pos > 0)
  17.853 +	gmyth_string_list_append_uint64(strlist, pos);
  17.854 +  else
  17.855 +	gmyth_string_list_append_uint64(strlist,
  17.856 +									gmyth_file_get_offset(GMYTH_FILE
  17.857 +														  (transfer)));
  17.858  
  17.859 -    gmyth_socket_sendreceive_stringlist ( priv->control_sock, strlist );
  17.860 +  gmyth_socket_sendreceive_stringlist(priv->control_sock, strlist);
  17.861  
  17.862 -    gint64 retval = gmyth_string_list_get_int64 ( strlist, 0 );
  17.863 +  gint64 retval = gmyth_string_list_get_int64(strlist, 0);
  17.864  
  17.865 -    gmyth_file_set_offset ( GMYTH_FILE ( transfer ), retval );
  17.866 -    gmyth_debug ( "Got reading position pointer from the streaming = %lld\n",
  17.867 -                  retval );
  17.868 +  gmyth_file_set_offset(GMYTH_FILE(transfer), retval);
  17.869 +  gmyth_debug("Got reading position pointer from the streaming = %lld\n",
  17.870 +			  retval);
  17.871  
  17.872 -    g_object_unref ( strlist );
  17.873 -    g_string_free ( query, TRUE );
  17.874 +  g_object_unref(strlist);
  17.875 +  g_string_free(query, TRUE);
  17.876  
  17.877 -    /* myth_control_release_context( transfer ); */
  17.878 + /* myth_control_release_context( transfer ); */
  17.879  
  17.880 -    return retval;
  17.881 +  return retval;
  17.882  }
  17.883  
  17.884  /** 
  17.885 @@ -631,16 +626,16 @@
  17.886   * @return <code>true</code>, if the acquire had been got. 
  17.887   */
  17.888  static gboolean
  17.889 -_control_acquire_context ( GMythFileTransfer * transfer, gboolean do_wait )
  17.890 +_control_acquire_context(GMythFileTransfer * transfer, gboolean do_wait)
  17.891  {
  17.892 -    gboolean ret = TRUE;
  17.893 -    GMythFileTransferPrivate *priv;
  17.894 +  gboolean ret = TRUE;
  17.895 +  GMythFileTransferPrivate *priv;
  17.896  
  17.897 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.898 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.899 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.900 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.901  
  17.902 -    g_mutex_lock ( priv->mutex );
  17.903 -    return ret;
  17.904 +  g_mutex_lock(priv->mutex);
  17.905 +  return ret;
  17.906  }
  17.907  
  17.908  /** 
  17.909 @@ -651,17 +646,17 @@
  17.910   * @return <code>true</code>, if the socket read/write permissions had been releaseds. 
  17.911   */
  17.912  static gboolean
  17.913 -_control_release_context ( GMythFileTransfer * transfer )
  17.914 +_control_release_context(GMythFileTransfer * transfer)
  17.915  {
  17.916 -    gboolean ret = TRUE;
  17.917 -    GMythFileTransferPrivate *priv;
  17.918 +  gboolean ret = TRUE;
  17.919 +  GMythFileTransferPrivate *priv;
  17.920  
  17.921 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.922 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.923 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.924 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.925  
  17.926 -    g_mutex_unlock ( priv->mutex );
  17.927 +  g_mutex_unlock(priv->mutex);
  17.928  
  17.929 -    return ret;
  17.930 +  return ret;
  17.931  }
  17.932  
  17.933  /** 
  17.934 @@ -678,254 +673,250 @@
  17.935   * 				or the error code. 
  17.936   */
  17.937  GMythFileReadResult
  17.938 -gmyth_file_transfer_read ( GMythFileTransfer * transfer, GByteArray * data,
  17.939 -                           gint size, gboolean read_unlimited )
  17.940 +gmyth_file_transfer_read(GMythFileTransfer * transfer, GByteArray * data,
  17.941 +						 gint size, gboolean read_unlimited)
  17.942  {
  17.943 -    gint bytes_sent = 0;
  17.944 -    gsize bytes_read = 0;
  17.945 -    gint64 total_read = 0;
  17.946 -    GMythFileReadResult retval = GMYTH_FILE_READ_OK;
  17.947 -    GMythFileTransferPrivate *priv;
  17.948 +  gint bytes_sent = 0;
  17.949 +  gsize bytes_read = 0;
  17.950 +  gint64 total_read = 0;
  17.951 +  GMythFileReadResult retval = GMYTH_FILE_READ_OK;
  17.952 +  GMythFileTransferPrivate *priv;
  17.953  
  17.954 -    GError *error = NULL;
  17.955 +  GError *error = NULL;
  17.956  
  17.957 -    GIOChannel *io_channel;
  17.958 -    GIOChannel *io_channel_control;
  17.959 +  GIOChannel *io_channel;
  17.960 +  GIOChannel *io_channel_control;
  17.961  
  17.962 -    GIOCondition io_cond;
  17.963 -    GIOCondition io_cond_control;
  17.964 -    GIOStatus io_status = G_IO_STATUS_NORMAL;
  17.965 -    GIOStatus io_status_control = G_IO_STATUS_NORMAL;
  17.966 +  GIOCondition io_cond;
  17.967 +  GIOCondition io_cond_control;
  17.968 +  GIOStatus io_status = G_IO_STATUS_NORMAL;
  17.969 +  GIOStatus io_status_control = G_IO_STATUS_NORMAL;
  17.970  
  17.971 -    GMythStringList *strlist;
  17.972 -    GMythStringList *ret_strlist = NULL;
  17.973 -    gboolean ret = TRUE;
  17.974 -    GString *query;
  17.975 +  GMythStringList *strlist;
  17.976 +  GMythStringList *ret_strlist = NULL;
  17.977 +  gboolean ret = TRUE;
  17.978 +  GString *query;
  17.979  
  17.980 -    g_return_val_if_fail ( transfer != NULL, FALSE );
  17.981 -    g_return_val_if_fail ( data != NULL, GMYTH_FILE_READ_ERROR );
  17.982 +  g_return_val_if_fail(transfer != NULL, FALSE);
  17.983 +  g_return_val_if_fail(data != NULL, GMYTH_FILE_READ_ERROR);
  17.984  
  17.985 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
  17.986 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
  17.987  
  17.988 -    strlist = gmyth_string_list_new (  );
  17.989 +  strlist = gmyth_string_list_new();
  17.990  
  17.991 -    io_channel = priv->sock->sd_io_ch;
  17.992 -    io_channel_control = priv->control_sock->sd_io_ch;
  17.993 +  io_channel = priv->sock->sd_io_ch;
  17.994 +  io_channel_control = priv->control_sock->sd_io_ch;
  17.995  
  17.996 -    io_status = g_io_channel_set_encoding ( io_channel, NULL, &error );
  17.997 -    if ( io_status == G_IO_STATUS_NORMAL )
  17.998 -        gmyth_debug ( "[%s] Setting encoding to binary data socket).\n",
  17.999 -                      __FUNCTION__ );
 17.1000 +  io_status = g_io_channel_set_encoding(io_channel, NULL, &error);
 17.1001 +  if (io_status == G_IO_STATUS_NORMAL)
 17.1002 +	gmyth_debug("[%s] Setting encoding to binary data socket).\n",
 17.1003 +				__FUNCTION__);
 17.1004  
 17.1005 -    io_cond = g_io_channel_get_buffer_condition ( io_channel );
 17.1006 +  io_cond = g_io_channel_get_buffer_condition(io_channel);
 17.1007  
 17.1008 -    io_cond_control = g_io_channel_get_buffer_condition ( io_channel );
 17.1009 -    if ( priv->sock == NULL || ( io_status == G_IO_STATUS_ERROR ) )
 17.1010 -    {
 17.1011 -        g_printerr
 17.1012 -            ( "gmyth_file_transfer_read(): Called with no raw socket.\n" );
 17.1013 -        return GMYTH_FILE_READ_ERROR;
 17.1014 -    }
 17.1015 +  io_cond_control = g_io_channel_get_buffer_condition(io_channel);
 17.1016 +  if (priv->sock == NULL || (io_status == G_IO_STATUS_ERROR))
 17.1017 +	{
 17.1018 +	  g_printerr("gmyth_file_transfer_read(): Called with no raw socket.\n");
 17.1019 +	  return GMYTH_FILE_READ_ERROR;
 17.1020 +	}
 17.1021  
 17.1022 -    if ( priv->control_sock == NULL
 17.1023 -         || ( io_status_control == G_IO_STATUS_ERROR ) )
 17.1024 -    {
 17.1025 -        g_printerr
 17.1026 -            ( "gmyth_file_transfer_read(): Called with no control socket.\n" );
 17.1027 -        return GMYTH_FILE_READ_ERROR;
 17.1028 -    }
 17.1029 +  if (priv->control_sock == NULL || (io_status_control == G_IO_STATUS_ERROR))
 17.1030 +	{
 17.1031 +	  g_printerr
 17.1032 +		("gmyth_file_transfer_read(): Called with no control socket.\n");
 17.1033 +	  return GMYTH_FILE_READ_ERROR;
 17.1034 +	}
 17.1035  
 17.1036 -    query = g_string_new ( GMYTHTV_QUERY_HEADER );
 17.1037 -    g_string_append_printf ( query, "%d", priv->file_id );
 17.1038 -    gmyth_debug ( "[%s] Transfer_query = %s\n", __FUNCTION__, query->str );
 17.1039 +  query = g_string_new(GMYTHTV_QUERY_HEADER);
 17.1040 +  g_string_append_printf(query, "%d", priv->file_id);
 17.1041 +  gmyth_debug("[%s] Transfer_query = %s\n", __FUNCTION__, query->str);
 17.1042  
 17.1043 -    _control_acquire_context ( transfer, TRUE );
 17.1044 -    //Do Read
 17.1045 -    gmyth_string_list_append_char_array ( strlist, query->str );
 17.1046 -    gmyth_string_list_append_char_array ( strlist, "REQUEST_BLOCK" );
 17.1047 -    gmyth_string_list_append_int ( strlist, size - total_read );
 17.1048 +  _control_acquire_context(transfer, TRUE);
 17.1049 + //Do Read
 17.1050 +  gmyth_string_list_append_char_array(strlist, query->str);
 17.1051 +  gmyth_string_list_append_char_array(strlist, "REQUEST_BLOCK");
 17.1052 +  gmyth_string_list_append_int(strlist, size - total_read);
 17.1053  
 17.1054 -    guint iter_count = 3;
 17.1055 +  guint iter_count = 3;
 17.1056  
 17.1057 -    do
 17.1058 -    {
 17.1059 -        bytes_sent = 0;
 17.1060 +  do
 17.1061 +	{
 17.1062 +	  bytes_sent = 0;
 17.1063  
 17.1064 -        // Request the block to the backend
 17.1065 -        gmyth_socket_write_stringlist ( priv->control_sock, strlist );
 17.1066 +	 // Request the block to the backend
 17.1067 +	  gmyth_socket_write_stringlist(priv->control_sock, strlist);
 17.1068  
 17.1069 -        if ( ret_strlist != NULL )
 17.1070 -            g_object_unref ( ret_strlist );
 17.1071 +	  if (ret_strlist != NULL)
 17.1072 +		g_object_unref(ret_strlist);
 17.1073  
 17.1074 -        ret_strlist = gmyth_string_list_new (  );
 17.1075 -        // Receives the backand answer    
 17.1076 -        gmyth_socket_read_stringlist ( priv->control_sock, ret_strlist );
 17.1077 +	  ret_strlist = gmyth_string_list_new();
 17.1078 +	 // Receives the backand answer    
 17.1079 +	  gmyth_socket_read_stringlist(priv->control_sock, ret_strlist);
 17.1080  
 17.1081 -        if ( ret_strlist != NULL
 17.1082 -             && gmyth_string_list_length ( ret_strlist ) > 0 )
 17.1083 -        {
 17.1084 -            bytes_sent = gmyth_string_list_get_int ( ret_strlist, 0 );  // -1 on backend error
 17.1085 -            gmyth_debug ( "[%s] got SENT buffer message = %d\n", __FUNCTION__,
 17.1086 -                          bytes_sent );
 17.1087 -        }
 17.1088 +	  if (ret_strlist != NULL && gmyth_string_list_length(ret_strlist) > 0)
 17.1089 +		{
 17.1090 +		  bytes_sent = gmyth_string_list_get_int(ret_strlist, 0);	// -1 on backend error
 17.1091 +		  gmyth_debug("[%s] got SENT buffer message = %d\n", __FUNCTION__,
 17.1092 +					  bytes_sent);
 17.1093 +		}
 17.1094  
 17.1095 -        if ( read_unlimited && ( bytes_sent == 0 ) )
 17.1096 -        {
 17.1097 -            g_usleep ( 300 );
 17.1098 -        }
 17.1099 +	  if (read_unlimited && (bytes_sent == 0))
 17.1100 +		{
 17.1101 +		  g_usleep(300);
 17.1102 +		}
 17.1103  
 17.1104 -        --iter_count;
 17.1105 -
 17.1106 -    }
 17.1107 -    while ( read_unlimited && ( bytes_sent == 0 ) && iter_count > 0 );
 17.1108 -
 17.1109 -    if ( bytes_sent > 0 )
 17.1110 -    {
 17.1111 -        gchar *data_buffer = g_new0 ( gchar, bytes_sent );
 17.1112 -
 17.1113 -        io_status = g_io_channel_read_chars ( io_channel,
 17.1114 -                                              data_buffer, ( gsize ) bytes_sent,
 17.1115 -                                              &bytes_read, &error );
 17.1116 -
 17.1117 -        if ( io_status != G_IO_STATUS_NORMAL )
 17.1118 -        {
 17.1119 -            gmyth_debug ( "Error on io_channel" );
 17.1120 -            g_free ( data_buffer );
 17.1121 -            g_object_unref ( strlist );
 17.1122 -            retval = GMYTH_FILE_READ_ERROR;
 17.1123 -            goto error;
 17.1124 -        }
 17.1125 -
 17.1126 -        /* append new data to the increasing byte array */
 17.1127 -        data =
 17.1128 -            g_byte_array_append ( data, ( const guint8 * ) data_buffer,
 17.1129 -                                  bytes_read );
 17.1130 -        gmyth_file_set_offset ( GMYTH_FILE ( transfer ),
 17.1131 -                                gmyth_file_get_offset ( GMYTH_FILE
 17.1132 -                                                        ( transfer ) ) +
 17.1133 -                                bytes_read );
 17.1134 -
 17.1135 -        if ( !read_unlimited
 17.1136 -             && ( gmyth_file_get_filesize ( GMYTH_FILE ( transfer ) ) > 0 )
 17.1137 -             && ( gmyth_file_get_offset ( GMYTH_FILE ( transfer ) ) ==
 17.1138 -                  gmyth_file_get_filesize ( GMYTH_FILE ( transfer ) ) ) )
 17.1139 -        {
 17.1140 -            retval = GMYTH_FILE_READ_EOF;
 17.1141 -            goto error;
 17.1142 -        }
 17.1143 -
 17.1144 -        g_free ( data_buffer );
 17.1145 -    }
 17.1146 -    else
 17.1147 -    {
 17.1148 -        retval = GMYTH_FILE_READ_ERROR;
 17.1149 -    }
 17.1150 -
 17.1151 -    if ( strlist != NULL )
 17.1152 -    {
 17.1153 -        g_object_unref ( strlist );
 17.1154 -        strlist = NULL;
 17.1155 -    }
 17.1156 -
 17.1157 -    if ( ret_strlist != NULL )
 17.1158 -    {
 17.1159 -        g_object_unref ( ret_strlist );
 17.1160 -        ret_strlist = NULL;
 17.1161 -    }
 17.1162 -
 17.1163 -    if ( read_unlimited && ( bytes_sent == 0 ) )
 17.1164 -    {
 17.1165 -        gmyth_debug ( "Trying to move to the next program chain..." );
 17.1166 -        if ( priv->recorder != NULL && priv->do_next_program_chain )
 17.1167 -        {
 17.1168 -            priv->do_next_program_chain = FALSE;
 17.1169 -            retval = GMYTH_FILE_READ_NEXT_PROG_CHAIN;
 17.1170 -            GMythProgramInfo *prog_info =
 17.1171 -                gmyth_recorder_get_current_program_info ( priv->recorder );
 17.1172 -	      
 17.1173 -	    gmyth_debug( "Comparing if the current prog. info = %s [strlen == %d] is equals to " \
 17.1174 -	    	" %s [strlen == %d]...", 
 17.1175 -	    	prog_info->pathname->str, strlen ( prog_info->pathname->str ), 
 17.1176 -		gmyth_file_get_file_name( GMYTH_FILE( transfer ) ), 
 17.1177 -		strlen( gmyth_file_get_file_name( GMYTH_FILE( transfer ) ) ) );
 17.1178 -
 17.1179 -            if ( prog_info != NULL && prog_info->pathname != NULL
 17.1180 -                 && strlen ( prog_info->pathname->str ) > 0
 17.1181 -                 && ( NULL == g_strstr_len( prog_info->pathname->str, strlen( prog_info->pathname->str ),
 17.1182 -                                         gmyth_file_get_file_name ( 
 17.1183 -					 	GMYTH_FILE( transfer ) ) ) ) )
 17.1184 -	    {
 17.1185 -                /* releasing context got at this function starting... */
 17.1186 -                _control_release_context ( transfer );
 17.1187 -            ret =
 17.1188 -                gmyth_file_transfer_open ( transfer,
 17.1189 -                                           g_strrstr ( prog_info->pathname->str,
 17.1190 -                                                       "/" ) );
 17.1191 -	    _control_acquire_context ( transfer, TRUE );
 17.1192 -            /* acquiring context released at this function stopping... */
 17.1193 -
 17.1194 -            if ( prog_info != NULL )
 17.1195 -                g_object_unref ( prog_info );
 17.1196 -
 17.1197 -            if ( !ret )
 17.1198 -                gmyth_debug ( "Cannot change to the next program info!" );
 17.1199 -            else
 17.1200 -                gmyth_debug ( "OK!!! MOVED to the next program info [%s]!",
 17.1201 -                              gmyth_file_get_file_name ( GMYTH_FILE
 17.1202 -                                                         ( transfer ) ) );
 17.1203 -           }
 17.1204 +	  --iter_count;
 17.1205  
 17.1206  	}
 17.1207 +  while (read_unlimited && (bytes_sent == 0) && iter_count > 0);
 17.1208  
 17.1209 -    } /* if */
 17.1210 +  if (bytes_sent > 0)
 17.1211 +	{
 17.1212 +	  gchar *data_buffer = g_new0(gchar, bytes_sent);
 17.1213  
 17.1214 -  error:
 17.1215 +	  io_status = g_io_channel_read_chars(io_channel,
 17.1216 +										  data_buffer, (gsize) bytes_sent,
 17.1217 +										  &bytes_read, &error);
 17.1218  
 17.1219 -    _control_release_context ( transfer );
 17.1220 -    g_string_free ( query, TRUE );
 17.1221 +	  if (io_status != G_IO_STATUS_NORMAL)
 17.1222 +		{
 17.1223 +		  gmyth_debug("Error on io_channel");
 17.1224 +		  g_free(data_buffer);
 17.1225 +		  g_object_unref(strlist);
 17.1226 +		  retval = GMYTH_FILE_READ_ERROR;
 17.1227 +		  goto error;
 17.1228 +		}
 17.1229  
 17.1230 -    if ( error != NULL )
 17.1231 -    {
 17.1232 -        gmyth_debug ( "Cleaning-up ERROR: %s [msg = %s, code = %d]\n",
 17.1233 -                      __FUNCTION__, error->message, error->code );
 17.1234 -        g_error_free ( error );
 17.1235 -    }
 17.1236 +	 /* append new data to the increasing byte array */
 17.1237 +	  data =
 17.1238 +		g_byte_array_append(data, (const guint8 *) data_buffer, bytes_read);
 17.1239 +	  gmyth_file_set_offset(GMYTH_FILE(transfer),
 17.1240 +							gmyth_file_get_offset(GMYTH_FILE
 17.1241 +												  (transfer)) + bytes_read);
 17.1242  
 17.1243 -    if ( total_read > 0 )
 17.1244 -        gmyth_file_set_offset ( GMYTH_FILE ( transfer ),
 17.1245 -                                gmyth_file_get_offset ( GMYTH_FILE
 17.1246 -                                                        ( transfer ) ) +
 17.1247 -                                total_read );
 17.1248 +	  if (!read_unlimited
 17.1249 +		  && (gmyth_file_get_filesize(GMYTH_FILE(transfer)) > 0)
 17.1250 +		  && (gmyth_file_get_offset(GMYTH_FILE(transfer)) ==
 17.1251 +			  gmyth_file_get_filesize(GMYTH_FILE(transfer))))
 17.1252 +		{
 17.1253 +		  retval = GMYTH_FILE_READ_EOF;
 17.1254 +		  goto error;
 17.1255 +		}
 17.1256  
 17.1257 -    return retval;
 17.1258 +	  g_free(data_buffer);
 17.1259 +	}
 17.1260 +  else
 17.1261 +	{
 17.1262 +	  retval = GMYTH_FILE_READ_ERROR;
 17.1263 +	}
 17.1264 +
 17.1265 +  if (strlist != NULL)
 17.1266 +	{
 17.1267 +	  g_object_unref(strlist);
 17.1268 +	  strlist = NULL;
 17.1269 +	}
 17.1270 +
 17.1271 +  if (ret_strlist != NULL)
 17.1272 +	{
 17.1273 +	  g_object_unref(ret_strlist);
 17.1274 +	  ret_strlist = NULL;
 17.1275 +	}
 17.1276 +
 17.1277 +  if (read_unlimited && (bytes_sent == 0))
 17.1278 +	{
 17.1279 +	  gmyth_debug("Trying to move to the next program chain...");
 17.1280 +	  if (priv->recorder != NULL && priv->do_next_program_chain)
 17.1281 +		{
 17.1282 +		  priv->do_next_program_chain = FALSE;
 17.1283 +		  retval = GMYTH_FILE_READ_NEXT_PROG_CHAIN;
 17.1284 +		  GMythProgramInfo *prog_info =
 17.1285 +			gmyth_recorder_get_current_program_info(priv->recorder);
 17.1286 +
 17.1287 +		  gmyth_debug
 17.1288 +			("Comparing if the current prog. info = %s [strlen == %d] is equals to "
 17.1289 +			 " %s [strlen == %d]...", prog_info->pathname->str,
 17.1290 +			 strlen(prog_info->pathname->str),
 17.1291 +			 gmyth_file_get_file_name(GMYTH_FILE(transfer)),
 17.1292 +			 strlen(gmyth_file_get_file_name(GMYTH_FILE(transfer))));
 17.1293 +
 17.1294 +		  if (prog_info != NULL && prog_info->pathname != NULL
 17.1295 +			  && strlen(prog_info->pathname->str) > 0
 17.1296 +			  && (NULL ==
 17.1297 +				  g_strstr_len(prog_info->pathname->str,
 17.1298 +							   strlen(prog_info->pathname->str),
 17.1299 +							   gmyth_file_get_file_name(GMYTH_FILE
 17.1300 +														(transfer)))))
 17.1301 +			{
 17.1302 +			 /* releasing context got at this function starting... */
 17.1303 +			  _control_release_context(transfer);
 17.1304 +			  ret =
 17.1305 +				gmyth_file_transfer_open(transfer,
 17.1306 +										 g_strrstr(prog_info->pathname->str,
 17.1307 +												   "/"));
 17.1308 +			  _control_acquire_context(transfer, TRUE);
 17.1309 +			 /* acquiring context released at this function stopping... */
 17.1310 +
 17.1311 +			  if (prog_info != NULL)
 17.1312 +				g_object_unref(prog_info);
 17.1313 +
 17.1314 +			  if (!ret)
 17.1315 +				gmyth_debug("Cannot change to the next program info!");
 17.1316 +			  else
 17.1317 +				gmyth_debug("OK!!! MOVED to the next program info [%s]!",
 17.1318 +							gmyth_file_get_file_name(GMYTH_FILE(transfer)));
 17.1319 +			}
 17.1320 +
 17.1321 +		}
 17.1322 +
 17.1323 +	}							/* if */
 17.1324 +
 17.1325 +error:
 17.1326 +
 17.1327 +  _control_release_context(transfer);
 17.1328 +  g_string_free(query, TRUE);
 17.1329 +
 17.1330 +  if (error != NULL)
 17.1331 +	{
 17.1332 +	  gmyth_debug("Cleaning-up ERROR: %s [msg = %s, code = %d]\n",
 17.1333 +				  __FUNCTION__, error->message, error->code);
 17.1334 +	  g_error_free(error);
 17.1335 +	}
 17.1336 +
 17.1337 +  if (total_read > 0)
 17.1338 +	gmyth_file_set_offset(GMYTH_FILE(transfer),
 17.1339 +						  gmyth_file_get_offset(GMYTH_FILE
 17.1340 +												(transfer)) + total_read);
 17.1341 +
 17.1342 +  return retval;
 17.1343  }
 17.1344  
 17.1345  static void
 17.1346 -_file_transfer_program_info_changed ( GMythFileTransfer * transfer,
 17.1347 -                                      gint msg_code, gpointer livetv_recorder )
 17.1348 +_file_transfer_program_info_changed(GMythFileTransfer * transfer,
 17.1349 +									gint msg_code, gpointer livetv_recorder)
 17.1350  {
 17.1351 -    GMythRecorder *recorder;
 17.1352 -    GMythFileTransferPrivate *priv;
 17.1353 +  GMythRecorder *recorder;
 17.1354 +  GMythFileTransferPrivate *priv;
 17.1355  
 17.1356 -    g_return_if_fail ( transfer != NULL );
 17.1357 +  g_return_if_fail(transfer != NULL);
 17.1358  
 17.1359 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
 17.1360 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
 17.1361  
 17.1362 -    recorder = GMYTH_RECORDER ( livetv_recorder );
 17.1363 -    gmyth_debug
 17.1364 -        ( "Program info changed! ( file transfer orig. = %p, ptr. = [%s] )",
 17.1365 -          transfer, livetv_recorder != NULL ? "[NOT NULL]" : "[NULL]" );
 17.1366 +  recorder = GMYTH_RECORDER(livetv_recorder);
 17.1367 +  gmyth_debug
 17.1368 +	("Program info changed! ( file transfer orig. = %p, ptr. = [%s] )",
 17.1369 +	 transfer, livetv_recorder != NULL ? "[NOT NULL]" : "[NULL]");
 17.1370  
 17.1371 -    if ( NULL != recorder )
 17.1372 -    {
 17.1373 -        gmyth_debug
 17.1374 -            ( "YES, the requested program info movement on the LiveTV transfer is authentical!" );
 17.1375 -    }
 17.1376 +  if (NULL != recorder)
 17.1377 +	{
 17.1378 +	  gmyth_debug
 17.1379 +		("YES, the requested program info movement on the LiveTV transfer is authentical!");
 17.1380 +	}
 17.1381  
 17.1382 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
 17.1383 -    g_object_ref ( recorder );
 17.1384 -    priv->recorder = recorder;
 17.1385 -    priv->do_next_program_chain = TRUE;
 17.1386 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
 17.1387 +  g_object_ref(recorder);
 17.1388 +  priv->recorder = recorder;
 17.1389 +  priv->do_next_program_chain = TRUE;
 17.1390  }
 17.1391  
 17.1392  /** 
 17.1393 @@ -938,43 +929,42 @@
 17.1394   * @return <code>true</code>, if the acquire had been got. 
 17.1395   */
 17.1396  gboolean
 17.1397 -gmyth_file_transfer_settimeout ( GMythFileTransfer * transfer, gboolean fast )
 17.1398 +gmyth_file_transfer_settimeout(GMythFileTransfer * transfer, gboolean fast)
 17.1399  {
 17.1400 -    GMythFileTransferPrivate *priv;
 17.1401 -    GMythStringList *strlist = NULL;
 17.1402 +  GMythFileTransferPrivate *priv;
 17.1403 +  GMythStringList *strlist = NULL;
 17.1404  
 17.1405 -    g_return_val_if_fail ( transfer != NULL, FALSE );
 17.1406 +  g_return_val_if_fail(transfer != NULL, FALSE);
 17.1407  
 17.1408 -    priv = GMYTH_FILE_TRANSFER_GET_PRIVATE ( transfer );
 17.1409 +  priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
 17.1410  
 17.1411 -    g_return_val_if_fail ( priv->sock != NULL, FALSE );
 17.1412 -    g_return_val_if_fail ( priv->control_sock != NULL, FALSE );
 17.1413 +  g_return_val_if_fail(priv->sock != NULL, FALSE);
 17.1414 +  g_return_val_if_fail(priv->control_sock != NULL, FALSE);
 17.1415  
 17.1416 -    _control_acquire_context ( transfer, TRUE );
 17.1417 +  _control_acquire_context(transfer, TRUE);
 17.1418  
 17.1419 -    strlist = gmyth_string_list_new (  );
 17.1420 -    gmyth_string_list_append_char_array ( strlist, GMYTHTV_QUERY_HEADER );
 17.1421 -    gmyth_string_list_append_char_array ( strlist, "SET_TIMEOUT" );
 17.1422 -    gmyth_string_list_append_int ( strlist, fast );
 17.1423 +  strlist = gmyth_string_list_new();
 17.1424 +  gmyth_string_list_append_char_array(strlist, GMYTHTV_QUERY_HEADER);
 17.1425 +  gmyth_string_list_append_char_array(strlist, "SET_TIMEOUT");
 17.1426 +  gmyth_string_list_append_int(strlist, fast);
 17.1427  
 17.1428 -    gint strlist_len = gmyth_socket_sendreceive_stringlist ( priv->control_sock,
 17.1429 -                                                             strlist );
 17.1430 +  gint strlist_len = gmyth_socket_sendreceive_stringlist(priv->control_sock,
 17.1431 +														 strlist);
 17.1432  
 17.1433 -    if ( strlist_len > 0 )
 17.1434 -        gmyth_debug ( "Yes, timeout was changed: %s.",
 17.1435 -                      gmyth_string_list_get_char_array ( strlist, 0 ) );
 17.1436 -    else
 17.1437 -        gmyth_debug ( "Timeout cannot be changed!" );
 17.1438 +  if (strlist_len > 0)
 17.1439 +	gmyth_debug("Yes, timeout was changed: %s.",
 17.1440 +				gmyth_string_list_get_char_array(strlist, 0));
 17.1441 +  else
 17.1442 +	gmyth_debug("Timeout cannot be changed!");
 17.1443  
 17.1444 -    _control_release_context ( transfer );
 17.1445 +  _control_release_context(transfer);
 17.1446  
 17.1447 -    gmyth_debug ( "%s setting timeout flag of this file transfer = %s\n",
 17.1448 -                  strlist_len > 0 ? "Yes," : "NOT",
 17.1449 -                  fast ? "FAST" : "NOT FAST" );
 17.1450 +  gmyth_debug("%s setting timeout flag of this file transfer = %s\n",
 17.1451 +			  strlist_len > 0 ? "Yes," : "NOT", fast ? "FAST" : "NOT FAST");
 17.1452  
 17.1453 -    g_object_unref ( strlist );
 17.1454 +  g_object_unref(strlist);
 17.1455  
 17.1456 -    return TRUE;
 17.1457 +  return TRUE;
 17.1458  }
 17.1459  
 17.1460  /** 
 17.1461 @@ -985,14 +975,13 @@
 17.1462   * @return The actual file size in bytes. 
 17.1463   */
 17.1464  guint64
 17.1465 -gmyth_file_transfer_get_filesize ( GMythFileTransfer * transfer )
 17.1466 +gmyth_file_transfer_get_filesize(GMythFileTransfer * transfer)
 17.1467  {
 17.1468 -    guint64 filesize;
 17.1469 +  guint64 filesize;
 17.1470  
 17.1471 -    g_return_val_if_fail ( transfer != NULL, 0 );
 17.1472 +  g_return_val_if_fail(transfer != NULL, 0);
 17.1473  
 17.1474 -    g_object_get ( GMYTH_FILE ( transfer ), "file-size", &filesize, NULL );
 17.1475 +  g_object_get(GMYTH_FILE(transfer), "file-size", &filesize, NULL);
 17.1476  
 17.1477 -    return filesize;
 17.1478 +  return filesize;
 17.1479  }
 17.1480 -
    18.1 --- a/gmyth/src/gmyth_file_transfer.h	Wed Jun 13 18:18:42 2007 +0100
    18.2 +++ b/gmyth/src/gmyth_file_transfer.h	Thu Jun 14 18:19:52 2007 +0100
    18.3 @@ -55,48 +55,48 @@
    18.4  typedef struct _GMythFileTransferPrivate GMythFileTransferPrivate;
    18.5  
    18.6  struct _GMythFileTransfer
    18.7 -    {
    18.8 -        GMythFile parent;
    18.9 -        GMythFileTransferPrivate *priv;
   18.10 -    };
   18.11 +{
   18.12 +  GMythFile parent;
   18.13 +  GMythFileTransferPrivate *priv;
   18.14 +};
   18.15  
   18.16  struct _GMythFileTransferClass
   18.17 -    {
   18.18 -        GMythFileClass parent_class;
   18.19 +{
   18.20 +  GMythFileClass parent_class;
   18.21  
   18.22 -        /* callbacks */
   18.23 -        guint program_info_changed_handler_signal_id;
   18.24 + /* callbacks */
   18.25 +  guint program_info_changed_handler_signal_id;
   18.26  
   18.27 -        /* signal default handlers */
   18.28 -        void ( *program_info_changed_handler ) ( GMythFileTransfer * transfer,
   18.29 -                                                 gint msg_code,
   18.30 -                                                 gpointer livetv_recorder );
   18.31 -    };
   18.32 + /* signal default handlers */
   18.33 +  void (*program_info_changed_handler) (GMythFileTransfer * transfer,
   18.34 +										gint msg_code,
   18.35 +										gpointer livetv_recorder);
   18.36 +};
   18.37  
   18.38  
   18.39 -GType gmyth_file_transfer_get_type ( void );
   18.40 -GMythFileTransfer *gmyth_file_transfer_new ( GMythBackendInfo * backend_info );
   18.41 -gchar *gmyth_file_transfer_get_file_name ( GMythFileTransfer * transfer );
   18.42 -gboolean gmyth_file_transfer_open ( GMythFileTransfer * transfer,
   18.43 -                                    const gchar * filename );
   18.44 -void gmyth_file_transfer_close ( GMythFileTransfer * transfer );
   18.45 -gboolean gmyth_file_transfer_is_open ( GMythFileTransfer * transfer );
   18.46 +GType gmyth_file_transfer_get_type(void);
   18.47 +GMythFileTransfer *gmyth_file_transfer_new(GMythBackendInfo * backend_info);
   18.48 +gchar *gmyth_file_transfer_get_file_name(GMythFileTransfer * transfer);
   18.49 +gboolean gmyth_file_transfer_open(GMythFileTransfer * transfer,
   18.50 +								  const gchar * filename);
   18.51 +void gmyth_file_transfer_close(GMythFileTransfer * transfer);
   18.52 +gboolean gmyth_file_transfer_is_open(GMythFileTransfer * transfer);
   18.53  
   18.54  GMythFileReadResult
   18.55 -gmyth_file_transfer_read ( GMythFileTransfer * transfer,
   18.56 -                           GByteArray * data, gint size,
   18.57 -                           gboolean read_unlimited );
   18.58 -gint64 gmyth_file_transfer_seek ( GMythFileTransfer * transfer, guint64 pos,
   18.59 -                                  gint whence );
   18.60 -gboolean gmyth_file_transfer_settimeout ( GMythFileTransfer * transfer,
   18.61 -                                          gboolean fast );
   18.62 -guint64 gmyth_file_transfer_get_filesize ( GMythFileTransfer * transfer );
   18.63 +gmyth_file_transfer_read(GMythFileTransfer * transfer,
   18.64 +						 GByteArray * data, gint size,
   18.65 +						 gboolean read_unlimited);
   18.66 +gint64 gmyth_file_transfer_seek(GMythFileTransfer * transfer, guint64 pos,
   18.67 +								gint whence);
   18.68 +gboolean gmyth_file_transfer_settimeout(GMythFileTransfer * transfer,
   18.69 +										gboolean fast);
   18.70 +guint64 gmyth_file_transfer_get_filesize(GMythFileTransfer * transfer);
   18.71  
   18.72 -void gmyth_file_transfer_emit_program_info_changed_signal ( GMythFileTransfer *
   18.73 -                                                            transfer,
   18.74 -                                                            gint msg_code,
   18.75 -                                                            gpointer
   18.76 -                                                            live_tv_recorder );
   18.77 +void gmyth_file_transfer_emit_program_info_changed_signal(GMythFileTransfer *
   18.78 +														  transfer,
   18.79 +														  gint msg_code,
   18.80 +														  gpointer
   18.81 +														  live_tv_recorder);
   18.82  
   18.83  G_END_DECLS
   18.84  #endif /* __GMYTH_FILE_TRANSFER_H__ */
    19.1 --- a/gmyth/src/gmyth_http.c	Wed Jun 13 18:18:42 2007 +0100
    19.2 +++ b/gmyth/src/gmyth_http.c	Thu Jun 14 18:19:52 2007 +0100
    19.3 @@ -40,48 +40,48 @@
    19.4  #include "gmyth_socket.h"
    19.5  
    19.6  xmlXPathObjectPtr
    19.7 -getnodeset ( xmlDocPtr doc, xmlChar * xpath )
    19.8 +getnodeset(xmlDocPtr doc, xmlChar * xpath)
    19.9  {
   19.10  
   19.11 -    xmlXPathContextPtr context;
   19.12 -    xmlXPathObjectPtr result;
   19.13 +  xmlXPathContextPtr context;
   19.14 +  xmlXPathObjectPtr result;
   19.15  
   19.16 -    context = xmlXPathNewContext ( doc );
   19.17 -    result = xmlXPathEvalExpression ( xpath, context );
   19.18 +  context = xmlXPathNewContext(doc);
   19.19 +  result = xmlXPathEvalExpression(xpath, context);
   19.20  
   19.21 -    if ( xmlXPathNodeSetIsEmpty ( result->nodesetval ) )
   19.22 -    {
   19.23 -        g_fprintf ( stderr, "Error: No result at XPath\n" );
   19.24 -        return NULL;
   19.25 -    }
   19.26 +  if (xmlXPathNodeSetIsEmpty(result->nodesetval))
   19.27 +	{
   19.28 +	  g_fprintf(stderr, "Error: No result at XPath\n");
   19.29 +	  return NULL;
   19.30 +	}
   19.31  
   19.32 -    xmlXPathFreeContext ( context );
   19.33 -    return result;
   19.34 +  xmlXPathFreeContext(context);
   19.35 +  return result;
   19.36  }
   19.37  
   19.38  
   19.39  xmlDocPtr
   19.40 -XMLParse ( const char *content, int length )
   19.41 +XMLParse(const char *content, int length)
   19.42  {
   19.43 -    xmlDocPtr doc;              /* the resulting document tree */
   19.44 +  xmlDocPtr doc;				/* the resulting document tree */
   19.45  
   19.46 -    doc = xmlReadMemory ( content, length, NULL, NULL, 0 );
   19.47 -    if ( doc == NULL )
   19.48 -    {
   19.49 -        g_fprintf ( stderr, "Error: Failed to parse XML document\n" );
   19.50 -        return NULL;
   19.51 -    }
   19.52 +  doc = xmlReadMemory(content, length, NULL, NULL, 0);
   19.53 +  if (doc == NULL)
   19.54 +	{
   19.55 +	  g_fprintf(stderr, "Error: Failed to parse XML document\n");
   19.56 +	  return NULL;
   19.57 +	}
   19.58  
   19.59 -    return doc;
   19.60 +  return doc;
   19.61  }
   19.62  
   19.63  xmlXPathObjectPtr
   19.64 -getXPath ( xmlChar * xpath, xmlDocPtr doc )
   19.65 +getXPath(xmlChar * xpath, xmlDocPtr doc)
   19.66  {
   19.67 -    xmlXPathObjectPtr result;
   19.68 +  xmlXPathObjectPtr result;
   19.69  
   19.70 -    result = getnodeset ( doc, xpath );
   19.71 -    return result;
   19.72 +  result = getnodeset(doc, xpath);
   19.73 +  return result;
   19.74  }
   19.75  
   19.76  
   19.77 @@ -91,49 +91,48 @@
   19.78   * @return A GSList containing a list of all the programs
   19.79   */
   19.80  GSList *
   19.81 -get_Program_List ( xmlNodePtr node )
   19.82 +get_Program_List(xmlNodePtr node)
   19.83  {
   19.84 -    GSList *program_list = NULL;
   19.85 +  GSList *program_list = NULL;
   19.86  
   19.87 -    while ( node != NULL )
   19.88 -    {
   19.89 -        if ( g_ascii_strcasecmp ( ( char * ) node->name, "text" ) != 0 )
   19.90 -        {
   19.91 -            GMythProgram *program = ( GMythProgram * )
   19.92 -                g_malloc ( sizeof ( struct _GMythProgram ) );
   19.93 +  while (node != NULL)
   19.94 +	{
   19.95 +	  if (g_ascii_strcasecmp((char *) node->name, "text") != 0)
   19.96 +		{
   19.97 +		  GMythProgram *program = (GMythProgram *)
   19.98 +			g_malloc(sizeof(struct _GMythProgram));
   19.99  
  19.100 -            program->title = g_strdup ( ( char * )
  19.101 -                                        xmlGetProp ( node,
  19.102 -                                                     ( xmlChar * ) "title" ) );
  19.103 +		  program->title = g_strdup((char *)
  19.104 +									xmlGetProp(node, (xmlChar *) "title"));
  19.105  
  19.106 -            program->subtitle = g_strdup ( ( char * )
  19.107 -                                           xmlGetProp ( node, ( xmlChar * )
  19.108 -                                                        "subtitle" ) );
  19.109 +		  program->subtitle = g_strdup((char *)
  19.110 +									   xmlGetProp(node, (xmlChar *)
  19.111 +												  "subtitle"));
  19.112  
  19.113 -            program->catType = g_strdup ( ( char * )
  19.114 -                                          xmlGetProp ( node, ( xmlChar * )
  19.115 -                                                       "catType" ) );
  19.116 +		  program->catType = g_strdup((char *)
  19.117 +									  xmlGetProp(node, (xmlChar *)
  19.118 +												 "catType"));
  19.119  
  19.120 -            program->category = g_strdup ( ( char * )
  19.121 -                                           xmlGetProp ( node, ( xmlChar * )
  19.122 -                                                        "category" ) );
  19.123 +		  program->category = g_strdup((char *)
  19.124 +									   xmlGetProp(node, (xmlChar *)
  19.125 +												  "category"));
  19.126  
  19.127 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "repeat" ),
  19.128 -                     "%d", &( program->repeat ) );
  19.129 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "repeat"),
  19.130 +				 "%d", &(program->repeat));
  19.131  
  19.132 -            program->startTime = gmyth_util_string_to_time_val
  19.133 -                ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "startTime" ) );
  19.134 +		  program->startTime = gmyth_util_string_to_time_val
  19.135 +			((char *) xmlGetProp(node, (xmlChar *) "startTime"));
  19.136  
  19.137 -            program->endTime = gmyth_util_string_to_time_val
  19.138 -                ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "endTime" ) );
  19.139 +		  program->endTime = gmyth_util_string_to_time_val
  19.140 +			((char *) xmlGetProp(node, (xmlChar *) "endTime"));
  19.141  
  19.142 -            program_list = g_slist_append ( program_list, program );
  19.143 -        }
  19.144 +		  program_list = g_slist_append(program_list, program);
  19.145 +		}
  19.146  
  19.147 -        node = node->next;
  19.148 -    }
  19.149 +	  node = node->next;
  19.150 +	}
  19.151  
  19.152 -    return program_list;
  19.153 +  return program_list;
  19.154  }
  19.155  
  19.156  /** Retrieves the Channel List from the ProgramGuide
  19.157 @@ -143,40 +142,40 @@
  19.158   * @return The epg from "param" updated
  19.159   */
  19.160  void
  19.161 -get_Channel_List ( xmlNodePtr node, GMythEpg * epg )
  19.162 +get_Channel_List(xmlNodePtr node, GMythEpg * epg)
  19.163  {
  19.164 -    epg->channelList = NULL;
  19.165 +  epg->channelList = NULL;
  19.166  
  19.167 -    while ( node != NULL )
  19.168 -    {
  19.169 +  while (node != NULL)
  19.170 +	{
  19.171  
  19.172 -        if ( g_ascii_strcasecmp ( ( char * ) node->name, "text" ) != 0 )
  19.173 -        {
  19.174 -            GMythChannel *channel = ( GMythChannel * ) g_malloc
  19.175 -                ( sizeof ( struct _GMythChannel ) );
  19.176 +	  if (g_ascii_strcasecmp((char *) node->name, "text") != 0)
  19.177 +		{
  19.178 +		  GMythChannel *channel = (GMythChannel *) g_malloc
  19.179 +			(sizeof(struct _GMythChannel));
  19.180  
  19.181 -            channel->channelName = g_strdup ( ( char * )
  19.182 -                                              xmlGetProp ( node, ( xmlChar * )
  19.183 -                                                           "channelName" ) );
  19.184 +		  channel->channelName = g_strdup((char *)
  19.185 +										  xmlGetProp(node, (xmlChar *)
  19.186 +													 "channelName"));
  19.187  
  19.188 -            channel->chanNum = g_strdup ( ( char * )
  19.189 -                                          xmlGetProp ( node, ( xmlChar * )
  19.190 -                                                       "chanNum" ) );
  19.191 +		  channel->chanNum = g_strdup((char *)
  19.192 +									  xmlGetProp(node, (xmlChar *)
  19.193 +												 "chanNum"));
  19.194  
  19.195 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "chanId" ),
  19.196 -                     "%d", &( channel->chanId ) );
  19.197 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "chanId"),
  19.198 +				 "%d", &(channel->chanId));
  19.199  
  19.200 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "callSign" ),
  19.201 -                     "%d", &( channel->callSign ) );
  19.202 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "callSign"),
  19.203 +				 "%d", &(channel->callSign));
  19.204  
  19.205 -            channel->programList = get_Program_List ( node->children );
  19.206 +		  channel->programList = get_Program_List(node->children);
  19.207  
  19.208 -            epg->channelList = g_slist_append ( epg->channelList, channel );
  19.209 +		  epg->channelList = g_slist_append(epg->channelList, channel);
  19.210  
  19.211 -        }
  19.212 +		}
  19.213  
  19.214 -        node = node->next;
  19.215 -    }
  19.216 +	  node = node->next;
  19.217 +	}
  19.218  }
  19.219  
  19.220  /** Retrieves the properties from the ProgramGuide
  19.221 @@ -186,46 +185,46 @@
  19.222   * @return The epg from "param" updated
  19.223   */
  19.224  void
  19.225 -get_ProgramGuide_Properties ( xmlNodePtr nodeTab, GMythEpg * epg )
  19.226 +get_ProgramGuide_Properties(xmlNodePtr nodeTab, GMythEpg * epg)
  19.227  {
  19.228  
  19.229 -    xmlNode *ptr = nodeTab->children->next->children;
  19.230 +  xmlNode *ptr = nodeTab->children->next->children;
  19.231  
  19.232 -    epg->startTime = gmyth_util_string_to_time_val ( ( char * ) ptr->content );
  19.233 +  epg->startTime = gmyth_util_string_to_time_val((char *) ptr->content);
  19.234  
  19.235 -    ptr = ptr->parent->next->next->children;
  19.236 -    epg->endTime = gmyth_util_string_to_time_val ( ( char * ) ptr->content );
  19.237 +  ptr = ptr->parent->next->next->children;
  19.238 +  epg->endTime = gmyth_util_string_to_time_val((char *) ptr->content);
  19.239  
  19.240 -    ptr = ptr->parent->next->next->children;
  19.241 -    sscanf ( ( char * ) ptr->content, "%d", &( epg->startChanId ) );
  19.242 +  ptr = ptr->parent->next->next->children;
  19.243 +  sscanf((char *) ptr->content, "%d", &(epg->startChanId));
  19.244  
  19.245 -    ptr = ptr->parent->next->next->children;
  19.246 -    sscanf ( ( char * ) ptr->content, "%d", &( epg->endChanId ) );
  19.247 +  ptr = ptr->parent->next->next->children;
  19.248 +  sscanf((char *) ptr->content, "%d", &(epg->endChanId));
  19.249  
  19.250 -    ptr = ptr->parent->next->next->children;
  19.251 -    sscanf ( ( char * ) ptr->content, "%d", &( epg->numOfChannels ) );
  19.252 +  ptr = ptr->parent->next->next->children;
  19.253 +  sscanf((char *) ptr->content, "%d", &(epg->numOfChannels));
  19.254  
  19.255 -    ptr = ptr->parent->next->next->children;
  19.256 -    sscanf ( ( char * ) ptr->content, "%d", &( epg->details ) );
  19.257 +  ptr = ptr->parent->next->next->children;
  19.258 +  sscanf((char *) ptr->content, "%d", &(epg->details));
  19.259  
  19.260 -    ptr = ptr->parent->next->next->children;
  19.261 -    sscanf ( ( char * ) ptr->content, "%d", &( epg->totalCount ) );
  19.262 +  ptr = ptr->parent->next->next->children;
  19.263 +  sscanf((char *) ptr->content, "%d", &(epg->totalCount));
  19.264  
  19.265 -    ptr = ptr->parent->next->next->children;
  19.266 -    epg->asOf = gmyth_util_string_to_time_val ( ( char * ) ptr->content );
  19.267 +  ptr = ptr->parent->next->next->children;
  19.268 +  epg->asOf = gmyth_util_string_to_time_val((char *) ptr->content);
  19.269  
  19.270 -    ptr = ptr->parent->next->next->children;
  19.271 -    epg->version = g_strdup ( ( char * ) ptr->content );
  19.272 +  ptr = ptr->parent->next->next->children;
  19.273 +  epg->version = g_strdup((char *) ptr->content);
  19.274  
  19.275 -    ptr = ptr->parent->next->next->children;
  19.276 -    sscanf ( ( char * ) ptr->content, "%d", &( epg->protoVer ) );
  19.277 +  ptr = ptr->parent->next->next->children;
  19.278 +  sscanf((char *) ptr->content, "%d", &(epg->protoVer));
  19.279  
  19.280 -    ptr = ptr->parent->next->next->children;
  19.281 -    // go to Channel section and retrieve Channels and Programs
  19.282 -    if ( epg->numOfChannels > 0 )
  19.283 -        get_Channel_List ( ptr, epg );
  19.284 -    else
  19.285 -        epg->channelList = NULL;
  19.286 +  ptr = ptr->parent->next->next->children;
  19.287 + // go to Channel section and retrieve Channels and Programs
  19.288 +  if (epg->numOfChannels > 0)
  19.289 +	get_Channel_List(ptr, epg);
  19.290 +  else
  19.291 +	epg->channelList = NULL;
  19.292  }
  19.293  
  19.294  /** Aux function to retrieve the Eletronic Program Guide
  19.295 @@ -234,31 +233,31 @@
  19.296   * @return The epg
  19.297   */
  19.298  void
  19.299 -getEpg ( xmlDocPtr doc, GMythEpg * epg )
  19.300 +getEpg(xmlDocPtr doc, GMythEpg * epg)
  19.301  {
  19.302 -    xmlXPathObjectPtr result;
  19.303 -    xmlNodeSetPtr nodeset;
  19.304 -    xmlChar *keyword;
  19.305 +  xmlXPathObjectPtr result;
  19.306 +  xmlNodeSetPtr nodeset;
  19.307 +  xmlChar *keyword;
  19.308  
  19.309 -    int i;
  19.310 +  int i;
  19.311  
  19.312 -    result = getXPath ( ( xmlChar * ) "/*", doc );
  19.313 +  result = getXPath((xmlChar *) "/*", doc);
  19.314  
  19.315 -    if ( result )
  19.316 -    {
  19.317 -        nodeset = result->nodesetval;
  19.318 -        for ( i = 0; i < nodeset->nodeNr; i++ )
  19.319 -        {
  19.320 -            keyword = ( xmlChar * ) nodeset->nodeTab[i]->name;
  19.321 -            if ( g_ascii_strcasecmp
  19.322 -                 ( ( char * ) keyword, "GetProgramGuideResponse" ) == 0 )
  19.323 -            {
  19.324 -                get_ProgramGuide_Properties ( nodeset->nodeTab[i], epg );
  19.325 -                break;
  19.326 -            }
  19.327 -        }
  19.328 -        xmlXPathFreeObject ( result );
  19.329 -    }
  19.330 +  if (result)
  19.331 +	{
  19.332 +	  nodeset = result->nodesetval;
  19.333 +	  for (i = 0; i < nodeset->nodeNr; i++)
  19.334 +		{
  19.335 +		  keyword = (xmlChar *) nodeset->nodeTab[i]->name;
  19.336 +		  if (g_ascii_strcasecmp
  19.337 +			  ((char *) keyword, "GetProgramGuideResponse") == 0)
  19.338 +			{
  19.339 +			  get_ProgramGuide_Properties(nodeset->nodeTab[i], epg);
  19.340 +			  break;
  19.341 +			}
  19.342 +		}
  19.343 +	  xmlXPathFreeObject(result);
  19.344 +	}
  19.345  
  19.346  }
  19.347  
  19.348 @@ -270,138 +269,136 @@
  19.349   * @return The epg
  19.350   */
  19.351  GMythEpg
  19.352 -gmyth_http_retrieve_epg ( GMythBackendInfo * backend_info,
  19.353 -                          GTimeVal * StartTime, GTimeVal * EndTime,
  19.354 -                          gint StartChanId, gint NumOfChannels,
  19.355 -                          gchar * Details )
  19.356 +gmyth_http_retrieve_epg(GMythBackendInfo * backend_info,
  19.357 +						GTimeVal * StartTime, GTimeVal * EndTime,
  19.358 +						gint StartChanId, gint NumOfChannels, gchar * Details)
  19.359  {
  19.360 -    GMythEpg epg;
  19.361 -    MemoryStruct chunk;
  19.362 +  GMythEpg epg;
  19.363 +  MemoryStruct chunk;
  19.364  
  19.365 -    chunk.memory = NULL;        /* we expect realloc(NULL, size) to work */
  19.366 -    chunk.size = 0;             /* no data at this point */
  19.367 +  chunk.memory = NULL;			/* we expect realloc(NULL, size) to work */
  19.368 +  chunk.size = 0;				/* no data at this point */
  19.369  
  19.370 -    gchar *starttime;
  19.371 +  gchar *starttime;
  19.372  
  19.373 -    starttime = ( gchar * ) xmlURIEscapeStr ( ( const xmlChar * )
  19.374 -                                              gmyth_util_time_to_mythformat_from_time_val
  19.375 -                                              ( StartTime ), NULL );
  19.376 +  starttime = (gchar *) xmlURIEscapeStr((const xmlChar *)
  19.377 +										gmyth_util_time_to_mythformat_from_time_val
  19.378 +										(StartTime), NULL);
  19.379  
  19.380 -    gchar *endtime;
  19.381 +  gchar *endtime;
  19.382  
  19.383 -    endtime = ( gchar * ) xmlURIEscapeStr ( ( const xmlChar * )
  19.384 -                                            gmyth_util_time_to_mythformat_from_time_val
  19.385 -                                            ( EndTime ), NULL );
  19.386 +  endtime = (gchar *) xmlURIEscapeStr((const xmlChar *)
  19.387 +									  gmyth_util_time_to_mythformat_from_time_val
  19.388 +									  (EndTime), NULL);
  19.389  
  19.390 -    GString *command = g_string_new ( "" );
  19.391 +  GString *command = g_string_new("");
  19.392  
  19.393 -    g_string_printf ( command,
  19.394 -                      "GetProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d"
  19.395 -                      "&NumOfChannels=%d&Details=%s", starttime, endtime,
  19.396 -                      StartChanId, NumOfChannels, Details );
  19.397 -    gmyth_debug ( "HTTP Request command = %s\n", command->str );
  19.398 +  g_string_printf(command,
  19.399 +				  "GetProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d"
  19.400 +				  "&NumOfChannels=%d&Details=%s", starttime, endtime,
  19.401 +				  StartChanId, NumOfChannels, Details);
  19.402 +  gmyth_debug("HTTP Request command = %s\n", command->str);
  19.403  
  19.404 -    chunk = gmyth_http_request ( backend_info, command );
  19.405 -    if ( chunk.memory != NULL )
  19.406 -    {
  19.407 -        xmlDocPtr doc = XMLParse ( chunk.memory, strlen ( chunk.memory ) );
  19.408 +  chunk = gmyth_http_request(backend_info, command);
  19.409 +  if (chunk.memory != NULL)
  19.410 +	{
  19.411 +	  xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
  19.412  
  19.413 -        getEpg ( doc, &epg );
  19.414 -        free ( chunk.memory );
  19.415 -    }
  19.416 +	  getEpg(doc, &epg);
  19.417 +	  free(chunk.memory);
  19.418 +	}
  19.419  
  19.420 -    return epg;
  19.421 +  return epg;
  19.422  }
  19.423  
  19.424  
  19.425  GMythRecorded_Recording
  19.426 -retrieve_recorded_recording ( xmlNodePtr node )
  19.427 +retrieve_recorded_recording(xmlNodePtr node)
  19.428  {
  19.429 -    GMythRecorded_Recording recording;
  19.430 +  GMythRecorded_Recording recording;
  19.431  
  19.432 -    if ( g_ascii_strcasecmp ( ( char * ) node->name, "text" ) != 0 )
  19.433 -    {
  19.434 +  if (g_ascii_strcasecmp((char *) node->name, "text") != 0)
  19.435 +	{
  19.436  
  19.437 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "dupInType" ),
  19.438 -                 "%d", &( recording.dupInType ) );
  19.439 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "dupInType"),
  19.440 +			 "%d", &(recording.dupInType));
  19.441  
  19.442 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "dupMethod" ),
  19.443 -                 "%d", &( recording.dupMethod ) );
  19.444 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "dupMethod"),
  19.445 +			 "%d", &(recording.dupMethod));
  19.446  
  19.447 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "recStatus" ),
  19.448 -                 "%d", &( recording.recStatus ) );
  19.449 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "recStatus"),
  19.450 +			 "%d", &(recording.recStatus));
  19.451  
  19.452 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "encoderId" ),
  19.453 -                 "%d", &( recording.encoderId ) );
  19.454 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "encoderId"),
  19.455 +			 "%d", &(recording.encoderId));
  19.456  
  19.457 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "recordId" ),
  19.458 -                 "%d", &( recording.recordId ) );
  19.459 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "recordId"),
  19.460 +			 "%d", &(recording.recordId));
  19.461  
  19.462 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "recType" ),
  19.463 -                 "%d", &( recording.recType ) );
  19.464 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "recType"),
  19.465 +			 "%d", &(recording.recType));
  19.466  
  19.467 -        recording.playGroup = g_strdup ( ( char * )
  19.468 -                                         xmlGetProp ( node, ( xmlChar * )
  19.469 -                                                      "playGroup" ) );
  19.470 +	  recording.playGroup = g_strdup((char *)
  19.471 +									 xmlGetProp(node, (xmlChar *)
  19.472 +												"playGroup"));
  19.473  
  19.474 -        recording.recGroup = g_strdup ( ( char * )
  19.475 -                                        xmlGetProp ( node, ( xmlChar * )
  19.476 -                                                     "recGroup" ) );
  19.477 +	  recording.recGroup = g_strdup((char *)
  19.478 +									xmlGetProp(node, (xmlChar *) "recGroup"));
  19.479  
  19.480 -        recording.recProfile = g_strdup ( ( char * )
  19.481 -                                          xmlGetProp ( node, ( xmlChar * )
  19.482 -                                                       "recProfile" ) );
  19.483 +	  recording.recProfile = g_strdup((char *)
  19.484 +									  xmlGetProp(node, (xmlChar *)
  19.485 +												 "recProfile"));
  19.486  
  19.487 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "recPriority" ),
  19.488 -                 "%d", &( recording.recPriority ) );
  19.489 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "recPriority"),
  19.490 +			 "%d", &(recording.recPriority));
  19.491  
  19.492 -        recording.recStartTs = gmyth_util_string_to_time_val
  19.493 -            ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "recStartTs" ) );
  19.494 +	  recording.recStartTs = gmyth_util_string_to_time_val
  19.495 +		((char *) xmlGetProp(node, (xmlChar *) "recStartTs"));
  19.496  
  19.497 -        recording.recEndTs = gmyth_util_string_to_time_val
  19.498 -            ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "recEndTs" ) );
  19.499 -    }
  19.500 +	  recording.recEndTs = gmyth_util_string_to_time_val
  19.501 +		((char *) xmlGetProp(node, (xmlChar *) "recEndTs"));
  19.502 +	}
  19.503  
  19.504 -    return recording;
  19.505 +  return recording;
  19.506  }
  19.507  
  19.508  
  19.509  GMythRecorded_Channel
  19.510 -retrieve_recorded_channel ( xmlNodePtr node )
  19.511 +retrieve_recorded_channel(xmlNodePtr node)
  19.512  {
  19.513 -    GMythRecorded_Channel channel;
  19.514 +  GMythRecorded_Channel channel;
  19.515  
  19.516 -    if ( g_ascii_strcasecmp ( ( char * ) node->name, "text" ) != 0 )
  19.517 -    {
  19.518 +  if (g_ascii_strcasecmp((char *) node->name, "text") != 0)
  19.519 +	{
  19.520  
  19.521 -        channel.chanFilters = g_strdup ( ( char * )
  19.522 -                                         xmlGetProp ( node, ( xmlChar * )
  19.523 -                                                      "chanFilters" ) );
  19.524 +	  channel.chanFilters = g_strdup((char *)
  19.525 +									 xmlGetProp(node, (xmlChar *)
  19.526 +												"chanFilters"));
  19.527  
  19.528 -        channel.channelName = g_strdup ( ( char * )
  19.529 -                                         xmlGetProp ( node, ( xmlChar * )
  19.530 -                                                      "channelName" ) );
  19.531 +	  channel.channelName = g_strdup((char *)
  19.532 +									 xmlGetProp(node, (xmlChar *)
  19.533 +												"channelName"));
  19.534  
  19.535 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "chanNum" ),
  19.536 -                 "%d", &( channel.chanNum ) );
  19.537 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "chanNum"),
  19.538 +			 "%d", &(channel.chanNum));
  19.539  
  19.540 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "sourceId" ),
  19.541 -                 "%d", &( channel.sourceId ) );
  19.542 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "sourceId"),
  19.543 +			 "%d", &(channel.sourceId));
  19.544  
  19.545 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "commFree" ),
  19.546 -                 "%d", &( channel.commFree ) );
  19.547 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "commFree"),
  19.548 +			 "%d", &(channel.commFree));
  19.549  
  19.550 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "inputId" ),
  19.551 -                 "%d", &( channel.inputId ) );
  19.552 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "inputId"),
  19.553 +			 "%d", &(channel.inputId));
  19.554  
  19.555 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "chanId" ),
  19.556 -                 "%d", &( channel.chanId ) );
  19.557 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "chanId"),
  19.558 +			 "%d", &(channel.chanId));
  19.559  
  19.560 -        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "callSign" ),
  19.561 -                 "%d", &( channel.callSign ) );
  19.562 -    }
  19.563 +	  sscanf((char *) xmlGetProp(node, (xmlChar *) "callSign"),
  19.564 +			 "%d", &(channel.callSign));
  19.565 +	}
  19.566  
  19.567 -    return channel;
  19.568 +  return channel;
  19.569  }
  19.570  
  19.571  
  19.572 @@ -413,90 +410,89 @@
  19.573   * @return list with all the recorded programs
  19.574   */
  19.575  GSList *
  19.576 -get_Recorded_Programs ( xmlNodePtr node )
  19.577 +get_Recorded_Programs(xmlNodePtr node)
  19.578  {
  19.579 -    GSList *programList = NULL;
  19.580 +  GSList *programList = NULL;
  19.581  
  19.582 -    while ( node != NULL )
  19.583 -    {
  19.584 +  while (node != NULL)
  19.585 +	{
  19.586  
  19.587 -        if ( g_ascii_strcasecmp ( ( char * ) node->name, "text" ) != 0 )
  19.588 -        {
  19.589 +	  if (g_ascii_strcasecmp((char *) node->name, "text") != 0)
  19.590 +		{
  19.591  
  19.592 -            GMythRecorded_Program *program = ( GMythRecorded_Program * )
  19.593 -                g_malloc ( sizeof ( struct _GMythRecorded_Program ) );
  19.594 +		  GMythRecorded_Program *program = (GMythRecorded_Program *)
  19.595 +			g_malloc(sizeof(struct _GMythRecorded_Program));
  19.596  
  19.597 -            sscanf ( ( char * )
  19.598 -                     xmlGetProp ( node, ( xmlChar * ) "programFlags" ), "%d",
  19.599 -                     &( program->programFlags ) );
  19.600 +		  sscanf((char *)
  19.601 +				 xmlGetProp(node, (xmlChar *) "programFlags"), "%d",
  19.602 +				 &(program->programFlags));
  19.603  
  19.604 -            program->title = g_strdup ( ( char * )
  19.605 -                                        xmlGetProp ( node,
  19.606 -                                                     ( xmlChar * ) "title" ) );
  19.607 +		  program->title = g_strdup((char *)
  19.608 +									xmlGetProp(node, (xmlChar *) "title"));
  19.609  
  19.610 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "programId" ),
  19.611 -                     "%d", &( program->programId ) );
  19.612 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "programId"),
  19.613 +				 "%d", &(program->programId));
  19.614  
  19.615 -            program->catType = g_strdup ( ( char * )
  19.616 -                                          xmlGetProp ( node, ( xmlChar * )
  19.617 -                                                       "catType" ) );
  19.618 +		  program->catType = g_strdup((char *)
  19.619 +									  xmlGetProp(node, (xmlChar *)
  19.620 +												 "catType"));
  19.621  
  19.622 -            program->category = g_strdup ( ( char * )
  19.623 -                                           xmlGetProp ( node, ( xmlChar * )
  19.624 -                                                        "category" ) );
  19.625 +		  program->category = g_strdup((char *)
  19.626 +									   xmlGetProp(node, (xmlChar *)
  19.627 +												  "category"));
  19.628  
  19.629 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "seriesId" ),
  19.630 -                     "%d", &( program->seriesId ) );
  19.631 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "seriesId"),
  19.632 +				 "%d", &(program->seriesId));
  19.633  
  19.634  
  19.635 -            program->startTime = gmyth_util_string_to_time_val
  19.636 -                ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "startTime" ) );
  19.637 +		  program->startTime = gmyth_util_string_to_time_val
  19.638 +			((char *) xmlGetProp(node, (xmlChar *) "startTime"));
  19.639  
  19.640 -            program->endTime = gmyth_util_string_to_time_val
  19.641 -                ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "endTime" ) );
  19.642 +		  program->endTime = gmyth_util_string_to_time_val
  19.643 +			((char *) xmlGetProp(node, (xmlChar *) "endTime"));
  19.644  
  19.645 -            program->lastModified = gmyth_util_string_to_time_val ( ( char * )
  19.646 -                                                                    xmlGetProp
  19.647 -                                                                    ( node,
  19.648 -                                                                      ( xmlChar
  19.649 -                                                                        * )
  19.650 -                                                                      "lastModified" ) );
  19.651 +		  program->lastModified = gmyth_util_string_to_time_val((char *)
  19.652 +																xmlGetProp
  19.653 +																(node,
  19.654 +																 (xmlChar
  19.655 +																  *)
  19.656 +																 "lastModified"));
  19.657  
  19.658 -            /* TODO: FIX ME at gmyth_util
  19.659 -               program->asOf = gmyth_util_string_to_time_val\
  19.660 -               ((char *)xmlGetProp(node, (xmlChar *)"airdate")); */
  19.661 +		 /* TODO: FIX ME at gmyth_util
  19.662 +		    program->asOf = gmyth_util_string_to_time_val\
  19.663 +		    ((char *)xmlGetProp(node, (xmlChar *)"airdate")); */
  19.664  
  19.665 -            program->subTitle = g_strdup ( ( char * )
  19.666 -                                           xmlGetProp ( node, ( xmlChar * )
  19.667 -                                                        "subTitle" ) );
  19.668 +		  program->subTitle = g_strdup((char *)
  19.669 +									   xmlGetProp(node, (xmlChar *)
  19.670 +												  "subTitle"));
  19.671  
  19.672 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "stars" ),
  19.673 -                     "%d", &( program->stars ) );
  19.674 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "stars"),
  19.675 +				 "%d", &(program->stars));
  19.676  
  19.677 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "repeat" ),
  19.678 -                     "%d", &( program->repeat ) );
  19.679 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "repeat"),
  19.680 +				 "%d", &(program->repeat));
  19.681  
  19.682 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "fileSize" ),
  19.683 -                     "%d", &( program->repeat ) );
  19.684 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "fileSize"),
  19.685 +				 "%d", &(program->repeat));
  19.686  
  19.687 -            program->hostname = g_strdup ( ( char * )
  19.688 -                                           xmlGetProp ( node, ( xmlChar * )
  19.689 -                                                        "hostname" ) );
  19.690 +		  program->hostname = g_strdup((char *)
  19.691 +									   xmlGetProp(node, (xmlChar *)
  19.692 +												  "hostname"));
  19.693  
  19.694 -            program->channel = retrieve_recorded_channel ( node->children );
  19.695 +		  program->channel = retrieve_recorded_channel(node->children);
  19.696  
  19.697 -            // Skip the \n
  19.698 -            program->recording =
  19.699 -                retrieve_recorded_recording ( node->children->next->next );
  19.700 +		 // Skip the \n
  19.701 +		  program->recording =
  19.702 +			retrieve_recorded_recording(node->children->next->next);
  19.703  
  19.704 -            // add to the list
  19.705 -            programList = g_slist_append ( programList, program );
  19.706 -        }
  19.707 +		 // add to the list
  19.708 +		  programList = g_slist_append(programList, program);
  19.709 +		}
  19.710  
  19.711 -        node = node->next;
  19.712 -    }
  19.713 +	  node = node->next;
  19.714 +	}
  19.715  
  19.716 -    return programList;
  19.717 +  return programList;
  19.718  }
  19.719  
  19.720  /** Retrieves the properties from Recorded XML
  19.721 @@ -506,25 +502,25 @@
  19.722   * @return "recorded" from "param" updated
  19.723   */
  19.724  void
  19.725 -get_Recorded_Properties ( xmlNodePtr nodeTab, GMythRecorded * recorded )
  19.726 +get_Recorded_Properties(xmlNodePtr nodeTab, GMythRecorded * recorded)
  19.727  {
  19.728 -    xmlNode *ptr = nodeTab->children->next->children;
  19.729 +  xmlNode *ptr = nodeTab->children->next->children;
  19.730  
  19.731 -    sscanf ( ( char * ) ptr->content, "%d", &( recorded->totalCount ) );
  19.732 +  sscanf((char *) ptr->content, "%d", &(recorded->totalCount));
  19.733  
  19.734  
  19.735 -    ptr = ptr->parent->next->next->children;
  19.736 -    recorded->asOf = gmyth_util_string_to_time_val ( ( char * ) ptr->content );
  19.737 +  ptr = ptr->parent->next->next->children;
  19.738 +  recorded->asOf = gmyth_util_string_to_time_val((char *) ptr->content);
  19.739  
  19.740 -    ptr = ptr->parent->next->next->children;
  19.741 -    recorded->version = g_strdup ( ( char * ) ptr->content );
  19.742 +  ptr = ptr->parent->next->next->children;
  19.743 +  recorded->version = g_strdup((char *) ptr->content);
  19.744  
  19.745 -    ptr = ptr->parent->next->next->children;
  19.746 -    sscanf ( ( char * ) ptr->content, "%d", &( recorded->protoVer ) );
  19.747 +  ptr = ptr->parent->next->next->children;
  19.748 +  sscanf((char *) ptr->content, "%d", &(recorded->protoVer));
  19.749  
  19.750 -    ptr = ptr->parent->next->next->children;
  19.751 -    if ( recorded->totalCount > 0 )
  19.752 -        recorded->programList = get_Recorded_Programs ( ptr->children );
  19.753 +  ptr = ptr->parent->next->next->children;
  19.754 +  if (recorded->totalCount > 0)
  19.755 +	recorded->programList = get_Recorded_Programs(ptr->children);
  19.756  
  19.757  }
  19.758  
  19.759 @@ -535,31 +531,31 @@
  19.760   * @return The recorded var updated
  19.761   */
  19.762  void
  19.763 -getRecorded ( xmlDocPtr doc, GMythRecorded * recorded )
  19.764 +getRecorded(xmlDocPtr doc, GMythRecorded * recorded)
  19.765  {
  19.766 -    xmlXPathObjectPtr result;
  19.767 -    xmlNodeSetPtr nodeset;
  19.768 -    xmlChar *keyword;
  19.769 +  xmlXPathObjectPtr result;
  19.770 +  xmlNodeSetPtr nodeset;
  19.771 +  xmlChar *keyword;
  19.772  
  19.773 -    int i;
  19.774 +  int i;
  19.775  
  19.776 -    result = getXPath ( ( xmlChar * ) "/*", doc );
  19.777 +  result = getXPath((xmlChar *) "/*", doc);
  19.778  
  19.779 -    if ( result )
  19.780 -    {
  19.781 -        nodeset = result->nodesetval;
  19.782 -        for ( i = 0; i < nodeset->nodeNr; i++ )
  19.783 -        {
  19.784 -            keyword = ( xmlChar * ) nodeset->nodeTab[i]->name;
  19.785 -            if ( g_ascii_strcasecmp
  19.786 -                 ( ( char * ) keyword, "GetRecordedResponse" ) == 0 )
  19.787 -            {
  19.788 -                get_Recorded_Properties ( nodeset->nodeTab[i], recorded );
  19.789 -                break;
  19.790 -            }
  19.791 -        }
  19.792 -        xmlXPathFreeObject ( result );
  19.793 -    }
  19.794 +  if (result)
  19.795 +	{
  19.796 +	  nodeset = result->nodesetval;
  19.797 +	  for (i = 0; i < nodeset->nodeNr; i++)
  19.798 +		{
  19.799 +		  keyword = (xmlChar *) nodeset->nodeTab[i]->name;
  19.800 +		  if (g_ascii_strcasecmp
  19.801 +			  ((char *) keyword, "GetRecordedResponse") == 0)
  19.802 +			{
  19.803 +			  get_Recorded_Properties(nodeset->nodeTab[i], recorded);
  19.804 +			  break;
  19.805 +			}
  19.806 +		}
  19.807 +	  xmlXPathFreeObject(result);
  19.808 +	}
  19.809  
  19.810  }
  19.811  
  19.812 @@ -568,28 +564,28 @@
  19.813   *
  19.814   */
  19.815  GMythRecorded
  19.816 -gmyth_http_retrieve_recorded ( GMythBackendInfo * backend_info )
  19.817 +gmyth_http_retrieve_recorded(GMythBackendInfo * backend_info)
  19.818  {
  19.819 -    GMythRecorded recorded;
  19.820 -    MemoryStruct chunk;
  19.821 +  GMythRecorded recorded;
  19.822 +  MemoryStruct chunk;
  19.823  
  19.824 -    chunk.memory = NULL;
  19.825 -    chunk.size = 0;
  19.826 +  chunk.memory = NULL;
  19.827 +  chunk.size = 0;
  19.828  
  19.829 -    GString *command = g_string_new ( "" );
  19.830 +  GString *command = g_string_new("");
  19.831  
  19.832 -    g_string_printf ( command, "GetRecorded" );
  19.833 +  g_string_printf(command, "GetRecorded");
  19.834  
  19.835 -    chunk = gmyth_http_request ( backend_info, command );
  19.836 -    if ( chunk.memory != NULL )
  19.837 -    {
  19.838 -        xmlDocPtr doc = XMLParse ( chunk.memory, strlen ( chunk.memory ) );
  19.839 +  chunk = gmyth_http_request(backend_info, command);
  19.840 +  if (chunk.memory != NULL)
  19.841 +	{
  19.842 +	  xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
  19.843  
  19.844 -        getRecorded ( doc, &recorded );
  19.845 -        free ( chunk.memory );
  19.846 -    }
  19.847 +	  getRecorded(doc, &recorded);
  19.848 +	  free(chunk.memory);
  19.849 +	}
  19.850  
  19.851 -    return recorded;
  19.852 +  return recorded;
  19.853  }
  19.854  
  19.855  
  19.856 @@ -598,83 +594,83 @@
  19.857   *
  19.858   */
  19.859  gint
  19.860 -gmyth_http_retrieve_job_status ( GMythBackendInfo * backend_info,
  19.861 -                                 gint chanid, GTimeVal * start )
  19.862 +gmyth_http_retrieve_job_status(GMythBackendInfo * backend_info,
  19.863 +							   gint chanid, GTimeVal * start)
  19.864  {
  19.865 -    gint status = 0;
  19.866 -    gint count = 0;
  19.867 -    gint temp_chanid = 0;
  19.868 -    GTimeVal *temp_start = NULL;
  19.869 -    int i;
  19.870 +  gint status = 0;
  19.871 +  gint count = 0;
  19.872 +  gint temp_chanid = 0;
  19.873 +  GTimeVal *temp_start = NULL;
  19.874 +  int i;
  19.875  
  19.876 -    xmlXPathObjectPtr result;
  19.877 -    xmlNodeSetPtr nodeset;
  19.878 -    xmlNodePtr node;
  19.879 -    MemoryStruct chunk;
  19.880 +  xmlXPathObjectPtr result;
  19.881 +  xmlNodeSetPtr nodeset;
  19.882 +  xmlNodePtr node;
  19.883 +  MemoryStruct chunk;
  19.884  
  19.885 -    chunk.memory = NULL;
  19.886 -    chunk.size = 0;
  19.887 +  chunk.memory = NULL;
  19.888 +  chunk.size = 0;
  19.889  
  19.890 -    GString *command = g_string_new ( "" );
  19.891 +  GString *command = g_string_new("");
  19.892  
  19.893 -    g_string_printf ( command, "GetStatus" );
  19.894 +  g_string_printf(command, "GetStatus");
  19.895  
  19.896 -    chunk = gmyth_http_request ( backend_info, command );
  19.897 +  chunk = gmyth_http_request(backend_info, command);
  19.898  
  19.899 -    if ( chunk.memory != NULL )
  19.900 -    {
  19.901 -        xmlDocPtr doc = XMLParse ( chunk.memory, strlen ( chunk.memory ) );
  19.902 +  if (chunk.memory != NULL)
  19.903 +	{
  19.904 +	  xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
  19.905  
  19.906 -        result = getXPath ( ( xmlChar * ) "/Status/JobQueue", doc );
  19.907 -        if ( result )
  19.908 -        {
  19.909 -            nodeset = result->nodesetval;
  19.910 -            node = nodeset->nodeTab[0];
  19.911 -            sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * ) "count" ),
  19.912 -                     "%d", &count );
  19.913 +	  result = getXPath((xmlChar *) "/Status/JobQueue", doc);
  19.914 +	  if (result)
  19.915 +		{
  19.916 +		  nodeset = result->nodesetval;
  19.917 +		  node = nodeset->nodeTab[0];
  19.918 +		  sscanf((char *) xmlGetProp(node, (xmlChar *) "count"),
  19.919 +				 "%d", &count);
  19.920  
  19.921 -            if ( count > 0 )
  19.922 -            {
  19.923 +		  if (count > 0)
  19.924 +			{
  19.925  
  19.926 -                // Get the first child
  19.927 -                node = node->children->next;
  19.928 +			 // Get the first child
  19.929 +			  node = node->children->next;
  19.930  
  19.931 -                for ( i = 0; i < count; i++ )
  19.932 -                {
  19.933 +			  for (i = 0; i < count; i++)
  19.934 +				{
  19.935  
  19.936 -                    sscanf ( ( char * )
  19.937 -                             xmlGetProp ( node, ( xmlChar * ) "chanId" ), "%d",
  19.938 -                             &temp_chanid );
  19.939 +				  sscanf((char *)
  19.940 +						 xmlGetProp(node, (xmlChar *) "chanId"), "%d",
  19.941 +						 &temp_chanid);
  19.942  
  19.943 -                    if ( chanid == temp_chanid )
  19.944 -                    {
  19.945 -                        temp_start = gmyth_util_string_to_time_val ( ( char * )
  19.946 -                                                                     xmlGetProp
  19.947 -                                                                     ( node,
  19.948 -                                                                       ( xmlChar
  19.949 -                                                                         * )
  19.950 -                                                                       "startTime" ) );
  19.951 +				  if (chanid == temp_chanid)
  19.952 +					{
  19.953 +					  temp_start = gmyth_util_string_to_time_val((char *)
  19.954 +																 xmlGetProp
  19.955 +																 (node,
  19.956 +																  (xmlChar
  19.957 +																   *)
  19.958 +																  "startTime"));
  19.959  
  19.960 -                        if ( ( temp_start->tv_sec == start->tv_sec ) &&
  19.961 -                             ( temp_start->tv_usec == start->tv_usec ) )
  19.962 -                            sscanf ( ( char * )
  19.963 -                                     xmlGetProp ( node,
  19.964 -                                                  ( xmlChar * ) "status" ),
  19.965 -                                     "%d", &status );
  19.966 -                    }
  19.967 -                    // Escape "text" node
  19.968 -                    node = node->next->next;
  19.969 -                }
  19.970 -            }
  19.971 +					  if ((temp_start->tv_sec == start->tv_sec) &&
  19.972 +						  (temp_start->tv_usec == start->tv_usec))
  19.973 +						sscanf((char *)
  19.974 +							   xmlGetProp(node,
  19.975 +										  (xmlChar *) "status"),
  19.976 +							   "%d", &status);
  19.977 +					}
  19.978 +				 // Escape "text" node
  19.979 +				  node = node->next->next;
  19.980 +				}
  19.981 +			}
  19.982  
  19.983 -        }
  19.984 +		}
  19.985  
  19.986 -        xmlXPathFreeObject ( result );
  19.987 -        free ( chunk.memory );
  19.988 +	  xmlXPathFreeObject(result);
  19.989 +	  free(chunk.memory);
  19.990  
  19.991 -    }
  19.992 +	}
  19.993  
  19.994 -    return status;
  19.995 +  return status;
  19.996  }
  19.997  
  19.998  
  19.999 @@ -687,47 +683,47 @@
 19.1000   * @return the value of the key
 19.1001   */
 19.1002  gchar *
 19.1003 -gmyth_http_retrieve_setting ( GMythBackendInfo * backend_info,
 19.1004 -                              gchar * key, gchar * hostname )
 19.1005 +gmyth_http_retrieve_setting(GMythBackendInfo * backend_info,
 19.1006 +							gchar * key, gchar * hostname)
 19.1007  {
 19.1008 -    xmlXPathObjectPtr result;
 19.1009 -    xmlNodeSetPtr nodeset;
 19.1010 -    xmlChar *keyword;
 19.1011 -    MemoryStruct chunk;
 19.1012 -    gchar *value = NULL;
 19.1013 +  xmlXPathObjectPtr result;
 19.1014 +  xmlNodeSetPtr nodeset;
 19.1015 +  xmlChar *keyword;
 19.1016 +  MemoryStruct chunk;
 19.1017 +  gchar *value = NULL;
 19.1018  
 19.1019 -    chunk.memory = NULL;
 19.1020 -    chunk.size = 0;
 19.1021 +  chunk.memory = NULL;
 19.1022 +  chunk.size = 0;
 19.1023  
 19.1024 -    GString *command = g_string_new ( "" );
 19.1025 +  GString *command = g_string_new("");
 19.1026  
 19.1027 -    g_string_printf ( command, "GetSetting?Key=%s&HostName=%s&Default=NULL",
 19.1028 -                      key, hostname );
 19.1029 +  g_string_printf(command, "GetSetting?Key=%s&HostName=%s&Default=NULL",
 19.1030 +				  key, hostname);
 19.1031  
 19.1032 -    chunk = gmyth_http_request ( backend_info, command );
 19.1033 +  chunk = gmyth_http_request(backend_info, command);
 19.1034  
 19.1035 -    if ( chunk.memory != NULL )
 19.1036 -    {
 19.1037 -        xmlDocPtr doc = XMLParse ( chunk.memory, strlen ( chunk.memory ) );
 19.1038 +  if (chunk.memory != NULL)
 19.1039 +	{
 19.1040 +	  xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
 19.1041  
 19.1042 -        result = getXPath ( ( xmlChar * ) "/GetSettingResponse/Values/*", doc );
 19.1043 +	  result = getXPath((xmlChar *) "/GetSettingResponse/Values/*", doc);
 19.1044  
 19.1045 -        if ( result )
 19.1046 -        {
 19.1047 -            nodeset = result->nodesetval;
 19.1048 -            keyword = ( xmlChar * ) nodeset->nodeTab[0]->name;
 19.1049 -            if ( g_ascii_strcasecmp ( ( char * ) keyword, "Value" ) == 0 )
 19.1050 -            {
 19.1051 -                // Here we have the value
 19.1052 -                value = ( gchar * ) nodeset->nodeTab[0]->children->content;
 19.1053 -            }
 19.1054 -            xmlXPathFreeObject ( result );
 19.1055 -        }
 19.1056 +	  if (result)
 19.1057 +		{
 19.1058 +		  nodeset = result->nodesetval;
 19.1059 +		  keyword = (xmlChar *) nodeset->nodeTab[0]->name;
 19.1060 +		  if (g_ascii_strcasecmp((char *) keyword, "Value") == 0)
 19.1061 +			{
 19.1062 +			 // Here we have the value
 19.1063 +			  value = (gchar *) nodeset->nodeTab[0]->children->content;
 19.1064 +			}
 19.1065 +		  xmlXPathFreeObject(result);
 19.1066 +		}
 19.1067  
 19.1068 -        free ( chunk.memory );
 19.1069 -    }
 19.1070 +	  free(chunk.memory);
 19.1071 +	}
 19.1072  
 19.1073 -    return value;
 19.1074 +  return value;
 19.1075  }
 19.1076  
 19.1077  /** Common steps for rec_profile's functions
 19.1078 @@ -737,41 +733,41 @@
 19.1079   * @return 0 if OK
 19.1080   */
 19.1081  gint
 19.1082 -rec_profile_common ( GMythBackendInfo * backend_info, GString * command )
 19.1083 +rec_profile_common(GMythBackendInfo * backend_info, GString * command)
 19.1084  {
 19.1085 -    xmlXPathObjectPtr result;
 19.1086 -    xmlNodeSetPtr nodeset;
 19.1087 -    xmlChar *keyword;
 19.1088 -    MemoryStruct chunk;
 19.1089 +  xmlXPathObjectPtr result;
 19.1090 +  xmlNodeSetPtr nodeset;
 19.1091 +  xmlChar *keyword;
 19.1092 +  MemoryStruct chunk;
 19.1093  
 19.1094 -    chunk.memory = NULL;
 19.1095 -    chunk.size = 0;
 19.1096 +  chunk.memory = NULL;
 19.1097 +  chunk.size = 0;
 19.1098  
 19.1099 -    int ret = -1;
 19.1100 +  int ret = -1;
 19.1101  
 19.1102 -    chunk = gmyth_http_request ( backend_info, command );
 19.1103 +  chunk = gmyth_http_request(backend_info, command);
 19.1104  
 19.1105 -    if ( chunk.memory != NULL )
 19.1106 -    {
 19.1107 -        xmlDocPtr doc = XMLParse ( chunk.memory, strlen ( chunk.memory ) );
 19.1108 +  if (chunk.memory != NULL)
 19.1109 +	{
 19.1110 +	  xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
 19.1111  
 19.1112 -        result = getXPath ( ( xmlChar * ) "/*", doc );
 19.1113 +	  result = getXPath((xmlChar *) "/*", doc);
 19.1114  
 19.1115 -        if ( result )
 19.1116 -        {
 19.1117 -            nodeset = result->nodesetval;
 19.1118 -            keyword = ( xmlChar * ) nodeset->nodeTab[0]->name;
 19.1119 +	  if (result)
 19.1120 +		{
 19.1121 +		  nodeset = result->nodesetval;
 19.1122 +		  keyword = (xmlChar *) nodeset->nodeTab[0]->name;
 19.1123  
 19.1124 -            if ( g_ascii_strcasecmp ( ( char * ) keyword, "Success" ) == 0 )
 19.1125 -                ret = 0;
 19.1126 +		  if (g_ascii_strcasecmp((char *) keyword, "Success") == 0)
 19.1127 +			ret = 0;
 19.1128  
 19.1129 -            xmlXPathFreeObject ( result );
 19.1130 -        }
 19.1131 +		  xmlXPathFreeObject(result);
 19.1132 +		}
 19.1133  
 19.1134 -        free ( chunk.memory );
 19.1135 -    }
 19.1136 +	  free(chunk.memory);
 19.1137 +	}
 19.1138  
 19.1139 -    return ret;
 19.1140 +  return ret;
 19.1141  }
 19.1142  
 19.1143  
 19.1144 @@ -782,15 +778,15 @@
 19.1145   * @return 0 if OK
 19.1146   */
 19.1147  gint
 19.1148 -gmyth_http_del_rec_profile ( GMythBackendInfo * backend_info, gint id )
 19.1149 +gmyth_http_del_rec_profile(GMythBackendInfo * backend_info, gint id)
 19.1150  {
 19.1151  
 19.1152 -    GString *command = g_string_new ( "" );
 19.1153 +  GString *command = g_string_new("");
 19.1154  
 19.1155 -    g_string_printf ( command, "delRecProfiles?id=%d", id );
 19.1156 +  g_string_printf(command, "delRecProfiles?id=%d", id);
 19.1157  
 19.1158  
 19.1159 -    return rec_profile_common ( backend_info, command );
 19.1160 +  return rec_profile_common(backend_info, command);
 19.1161  }
 19.1162  
 19.1163  /** Function to create recording profiles
 19.1164 @@ -803,70 +799,70 @@
 19.1165   * @return 0 if OK
 19.1166   */
 19.1167  gint
 19.1168 -gmyth_http_create_rec_profile ( GMythBackendInfo * backend_info,
 19.1169 -                                GMythRecProfile * profile )
 19.1170 +gmyth_http_create_rec_profile(GMythBackendInfo * backend_info,
 19.1171 +							  GMythRecProfile * profile)
 19.1172  {
 19.1173  
 19.1174 -    if ( profile->name != NULL && profile->group != NULL &&
 19.1175 -         profile->vcodec && profile->acodec && profile->options != NULL )
 19.1176 -    {
 19.1177 -        GString *command = g_string_new ( "" );
 19.1178 +  if (profile->name != NULL && profile->group != NULL &&
 19.1179 +	  profile->vcodec && profile->acodec && profile->options != NULL)
 19.1180 +	{
 19.1181 +	  GString *command = g_string_new("");
 19.1182  
 19.1183 -        g_string_printf ( command, "createRecProfiles?profilename=%s&"
 19.1184 -                          "groupname=%s&vcodec=%s&acodec=%s&"
 19.1185 -                          "transcodelossless=%d&transcoderesize=%d&"
 19.1186 -                          "width=%d&height=%d&rtjpegquality=%d&"
 19.1187 -                          "rtjpeglumafilter=%d&rtjpegchromafilter=%d&"
 19.1188 -                          "mpeg4bitrate=%d&mpeg4maxquality=%d&"
 19.1189 -                          "mpeg4minquality=%d&mpeg4qualdiff=%d&"
 19.1190 -                          "mpeg4scalebitrate=%d&mpeg4optionvhq=%d&"
 19.1191 -                          "mpeg4option4mv=%d&mpeg4optionidct=%d&"
 19.1192 -                          "mpeg4optionime=%d&hardwaremjpegquality=%d&"
 19.1193 -                          "hardwaremjpeghdecimation=%d&hardwaremjpegvdecimation=%d&"
 19.1194 -                          "mpeg2streamtype=%s&mpeg2aspectratio=%s&"
 19.1195 -                          "mpeg2bitrate=%d&mpeg2maxbitrate=%d&"
 19.1196 -                          "samplerate=%d&mp3quality=%d&"
 19.1197 -                          "volume=%d&mpeg2audtype=%s&"
 19.1198 -                          "mpeg2audbitratel1=%d&mpeg2audbitratel2=%d&"
 19.1199 -                          "mpeg2audvolume=%d",
 19.1200 -                          profile->name, profile->group,
 19.1201 -                          profile->vcodec, profile->acodec,
 19.1202 -                          profile->options->transcodelossless,
 19.1203 -                          profile->options->transcoderesize,
 19.1204 -                          profile->options->width,
 19.1205 -                          profile->options->height,
 19.1206 -                          profile->options->rtjpegquality,
 19.1207 -                          profile->options->rtjpeglumafilter,
 19.1208 -                          profile->options->rtjpegchromafilter,
 19.1209 -                          profile->options->mpeg4bitrate,
 19.1210 -                          profile->options->mpeg4maxquality,
 19.1211 -                          profile->options->mpeg4minquality,
 19.1212 -                          profile->options->mpeg4qualdiff,
 19.1213 -                          profile->options->mpeg4scalebitrate,
 19.1214 -                          profile->options->mpeg4optionvhq,
 19.1215 -                          profile->options->mpeg4option4mv,
 19.1216 -                          profile->options->mpeg4optionidct,
 19.1217 -                          profile->options->mpeg4optionime,
 19.1218 -                          profile->options->hardwaremjpegquality,
 19.1219 -                          profile->options->hardwaremjpeghdecimation,
 19.1220 -                          profile->options->hardwaremjpegvdecimation,
 19.1221 -                          profile->options->mpeg2streamtype,
 19.1222 -                          profile->options->mpeg2aspectratio,
 19.1223 -                          profile->options->mpeg2bitrate,
 19.1224 -                          profile->options->mpeg2maxbitrate,
 19.1225 -                          profile->options->samplerate,
 19.1226 -                          profile->options->mp3quality,
 19.1227 -                          profile->options->volume,
 19.1228 -                          profile->options->mpeg2audtype,
 19.1229 -                          profile->options->mpeg2audbitratel1,
 19.1230 -                          profile->options->mpeg2audbitratel2,
 19.1231 -                          profile->options->mpeg2audvolume );
 19.1232 +	  g_string_printf(command, "createRecProfiles?profilename=%s&"
 19.1233 +					  "groupname=%s&vcodec=%s&acodec=%s&"
 19.1234 +					  "transcodelossless=%d&transcoderesize=%d&"
 19.1235 +					  "width=%d&height=%d&rtjpegquality=%d&"
 19.1236 +					  "rtjpeglumafilter=%d&rtjpegchromafilter=%d&"
 19.1237 +					  "mpeg4bitrate=%d&mpeg4maxquality=%d&"
 19.1238 +					  "mpeg4minquality=%d&mpeg4qualdiff=%d&"
 19.1239 +					  "mpeg4scalebitrate=%d&mpeg4optionvhq=%d&"
 19.1240 +					  "mpeg4option4mv=%d&mpeg4optionidct=%d&"
 19.1241 +					  "mpeg4optionime=%d&hardwaremjpegquality=%d&"
 19.1242 +					  "hardwaremjpeghdecimation=%d&hardwaremjpegvdecimation=%d&"
 19.1243 +					  "mpeg2streamtype=%s&mpeg2aspectratio=%s&"
 19.1244 +					  "mpeg2bitrate=%d&mpeg2maxbitrate=%d&"
 19.1245 +					  "samplerate=%d&mp3quality=%d&"
 19.1246 +					  "volume=%d&mpeg2audtype=%s&"
 19.1247 +					  "mpeg2audbitratel1=%d&mpeg2audbitratel2=%d&"
 19.1248 +					  "mpeg2audvolume=%d",
 19.1249 +					  profile->name, profile->group,
 19.1250 +					  profile->vcodec, profile->acodec,
 19.1251 +					  profile->options->transcodelossless,
 19.1252 +					  profile->options->transcoderesize,
 19.1253 +					  profile->options->width,
 19.1254 +					  profile->options->height,
 19.1255 +					  profile->options->rtjpegquality,
 19.1256 +					  profile->options->rtjpeglumafilter,
 19.1257 +					  profile->options->rtjpegchromafilter,
 19.1258 +					  profile->options->mpeg4bitrate,
 19.1259 +					  profile->options->mpeg4maxquality,
 19.1260 +					  profile->options->mpeg4minquality,
 19.1261 +					  profile->options->mpeg4qualdiff,
 19.1262 +					  profile->options->mpeg4scalebitrate,
 19.1263 +					  profile->options->mpeg4optionvhq,
 19.1264 +					  profile->options->mpeg4option4mv,
 19.1265 +					  profile->options->mpeg4optionidct,
 19.1266 +					  profile->options->mpeg4optionime,
 19.1267 +					  profile->options->hardwaremjpegquality,
 19.1268 +					  profile->options->hardwaremjpeghdecimation,
 19.1269 +					  profile->options->hardwaremjpegvdecimation,
 19.1270 +					  profile->options->mpeg2streamtype,
 19.1271 +					  profile->options->mpeg2aspectratio,
 19.1272 +					  profile->options->mpeg2bitrate,
 19.1273 +					  profile->options->mpeg2maxbitrate,
 19.1274 +					  profile->options->samplerate,
 19.1275 +					  profile->options->mp3quality,
 19.1276 +					  profile->options->volume,
 19.1277 +					  profile->options->mpeg2audtype,
 19.1278 +					  profile->options->mpeg2audbitratel1,
 19.1279 +					  profile->options->mpeg2audbitratel2,
 19.1280 +					  profile->options->mpeg2audvolume);
 19.1281  
 19.1282  
 19.1283 -        return rec_profile_common ( backend_info, command );
 19.1284 -    }
 19.1285 -    else
 19.1286 -        return -1;
 19.1287 +	  return rec_profile_common(backend_info, command);
 19.1288 +	}
 19.1289 +  else
 19.1290 +	return -1;
 19.1291  }
 19.1292  
 19.1293  /** Function to retrieve recording profiles
 19.1294 @@ -876,113 +872,110 @@
 19.1295   * @return the list of profiles
 19.1296   */
 19.1297  GSList *
 19.1298 -gmyth_http_retrieve_rec_profiles ( GMythBackendInfo * backend_info,
 19.1299 -                                   gchar * groupname )
 19.1300 +gmyth_http_retrieve_rec_profiles(GMythBackendInfo * backend_info,
 19.1301 +								 gchar * groupname)
 19.1302  {
 19.1303 -    xmlXPathObjectPtr result;
 19.1304 -    xmlNodeSetPtr nodeset;
 19.1305 -    xmlChar *keyword;
 19.1306 -    MemoryStruct chunk;
 19.1307 -    GSList *profiles = NULL;
 19.1308 +  xmlXPathObjectPtr result;
 19.1309 +  xmlNodeSetPtr nodeset;
 19.1310 +  xmlChar *keyword;
 19.1311 +  MemoryStruct chunk;
 19.1312 +  GSList *profiles = NULL;
 19.1313  
 19.1314 -    chunk.memory = NULL;
 19.1315 -    chunk.size = 0;
 19.1316 +  chunk.memory = NULL;
 19.1317 +  chunk.size = 0;
 19.1318  
 19.1319 -    GString *command = g_string_new ( "" );
 19.1320 +  GString *command = g_string_new("");
 19.1321  
 19.1322 -    g_string_printf ( command, "GetRecProfiles?groupname=%s", groupname );
 19.1323 +  g_string_printf(command, "GetRecProfiles?groupname=%s", groupname);
 19.1324  
 19.1325 -    chunk = gmyth_http_request ( backend_info, command );
 19.1326 +  chunk = gmyth_http_request(backend_info, command);
 19.1327  
 19.1328 -    if ( chunk.memory != NULL )
 19.1329 -    {
 19.1330 -        xmlDocPtr doc = XMLParse ( chunk.memory, strlen ( chunk.memory ) );
 19.1331 +  if (chunk.memory != NULL)
 19.1332 +	{
 19.1333 +	  xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
 19.1334  
 19.1335 -        result = getXPath ( ( xmlChar * ) "/*", doc );
 19.1336 +	  result = getXPath((xmlChar *) "/*", doc);
 19.1337  
 19.1338 -        if ( result )
 19.1339 -        {
 19.1340 -            nodeset = result->nodesetval;
 19.1341 -            keyword = ( xmlChar * ) nodeset->nodeTab[0]->name;
 19.1342 +	  if (result)
 19.1343 +		{
 19.1344 +		  nodeset = result->nodesetval;
 19.1345 +		  keyword = (xmlChar *) nodeset->nodeTab[0]->name;
 19.1346  
 19.1347 -            if ( g_ascii_strcasecmp ( ( char * ) keyword, "Profiles" ) == 0 )
 19.1348 -            {
 19.1349 -                xmlNodePtr node = nodeset->nodeTab[0]->children->next;
 19.1350 -                GMythRecProfile *profile;
 19.1351 +		  if (g_ascii_strcasecmp((char *) keyword, "Profiles") == 0)
 19.1352 +			{
 19.1353 +			  xmlNodePtr node = nodeset->nodeTab[0]->children->next;
 19.1354 +			  GMythRecProfile *profile;
 19.1355  
 19.1356 -                while ( node != NULL )
 19.1357 -                {
 19.1358 -                    if ( g_ascii_strcasecmp ( ( char * ) node->name, "text" ) !=
 19.1359 -                         0 )
 19.1360 -                    {
 19.1361 -                        profile = gmyth_recprofile_new (  );
 19.1362 +			  while (node != NULL)
 19.1363 +				{
 19.1364 +				  if (g_ascii_strcasecmp((char *) node->name, "text") != 0)
 19.1365 +					{
 19.1366 +					  profile = gmyth_recprofile_new();
 19.1367  
 19.1368 -                        sscanf ( ( char * ) xmlGetProp ( node, ( xmlChar * )
 19.1369 -                                                         "id" ), "%d",
 19.1370 -                                 &( profile->id ) );
 19.1371 +					  sscanf((char *) xmlGetProp(node, (xmlChar *)
 19.1372 +												 "id"), "%d", &(profile->id));
 19.1373  
 19.1374 -                        profile->name = g_strdup ( ( char * )
 19.1375 -                                                   xmlGetProp ( node,
 19.1376 -                                                                ( xmlChar * )
 19.1377 -                                                                "name" ) );
 19.1378 +					  profile->name = g_strdup((char *)
 19.1379 +											   xmlGetProp(node,
 19.1380 +														  (xmlChar *)
 19.1381 +														  "name"));
 19.1382  
 19.1383 -                        profile->vcodec = g_strdup ( ( char * )
 19.1384 -                                                     xmlGetProp ( node,
 19.1385 -                                                                  ( xmlChar * )
 19.1386 -                                                                  "vcodec" ) );
 19.1387 +					  profile->vcodec = g_strdup((char *)
 19.1388 +												 xmlGetProp(node,
 19.1389 +															(xmlChar *)
 19.1390 +															"vcodec"));
 19.1391  
 19.1392 -                        profile->acodec = g_strdup ( ( char * )
 19.1393 -                                                     xmlGetProp ( node,
 19.1394 -                                                                  ( xmlChar * )
 19.1395 -                                                                  "acodec" ) );
 19.1396 +					  profile->acodec = g_strdup((char *)
 19.1397 +												 xmlGetProp(node,
 19.1398 +															(xmlChar *)
 19.1399 +															"acodec"));
 19.1400  
 19.1401 -                        profile->group = g_strdup ( groupname );
 19.1402 +					  profile->group = g_strdup(groupname);
 19.1403  
 19.1404 -                        profiles = g_slist_append ( profiles, profile );
 19.1405 -                    }
 19.1406 -                    node = node->next;
 19.1407 -                }
 19.1408 +					  profiles = g_slist_append(profiles, profile);
 19.1409 +					}
 19.1410 +				  node = node->next;
 19.1411 +				}
 19.1412  
 19.1413 -            }
 19.1414 -            xmlXPathFreeObject ( result );
 19.1415 -        }
 19.1416 +			}
 19.1417 +		  xmlXPathFreeObject(result);
 19.1418 +		}
 19.1419  
 19.1420 -        free ( chunk.memory );
 19.1421 -    }
 19.1422 +	  free(chunk.memory);
 19.1423 +	}
 19.1424  
 19.1425 -    return profiles;
 19.1426 +  return profiles;
 19.1427  }
 19.1428  
 19.1429  
 19.1430  
 19.1431  /* Aux functions got from libcurl */
 19.1432  void *
 19.1433 -myrealloc ( void *ptr, size_t size )
 19.1434 +myrealloc(void *ptr, size_t size)
 19.1435  {
 19.1436 -    /* There might be a realloc() out there that doesn't like reallocing
 19.1437 -       NULL pointers, so we take care of it here */
 19.1438 -    if ( ptr )
 19.1439 -        return realloc ( ptr, size );
 19.1440 -    else
 19.1441 -        return malloc ( size );
 19.1442 + /* There might be a realloc() out there that doesn't like reallocing
 19.1443 +    NULL pointers, so we take care of it here */
 19.1444 +  if (ptr)
 19.1445 +	return realloc(ptr, size);
 19.1446 +  else
 19.1447 +	return malloc(size);
 19.1448  }
 19.1449  
 19.1450  size_t
 19.1451 -WriteMemoryCallback ( void *ptr, size_t size, size_t nmemb, void *data )
 19.1452 +WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
 19.1453  {
 19.1454 -    size_t realsize = size * nmemb;
 19.1455 -    MemoryStruct *mem = ( struct _MemoryStruct * ) data;
 19.1456 +  size_t realsize = size * nmemb;
 19.1457 +  MemoryStruct *mem = (struct _MemoryStruct *) data;
 19.1458  
 19.1459 -    mem->memory =
 19.1460 -        ( char * ) myrealloc ( mem->memory, mem->size + realsize + 1 );
 19.1461 -    if ( mem->memory )
 19.1462 -    {
 19.1463 -        memcpy ( &( mem->memory[mem->size] ), ptr, realsize );
 19.1464 -        mem->size += realsize;
 19.1465 -        mem->memory[mem->size] = 0;
 19.1466 -    }
 19.1467 +  mem->memory = (char *) myrealloc(mem->memory, mem->size + realsize + 1);
 19.1468 +  if (mem->memory)
 19.1469 +	{
 19.1470 +	  memcpy(&(mem->memory[mem->size]), ptr, realsize);
 19.1471 +	  mem->size += realsize;
 19.1472 +	  mem->memory[mem->size] = 0;
 19.1473 +	}
 19.1474  
 19.1475 -    return realsize;
 19.1476 +  return realsize;
 19.1477  }
 19.1478  
 19.1479  
 19.1480 @@ -992,61 +985,59 @@
 19.1481   *          NULL if there is no response.
 19.1482   */
 19.1483  MemoryStruct
 19.1484 -gmyth_http_request ( GMythBackendInfo * backend_info, GString * command )
 19.1485 +gmyth_http_request(GMythBackendInfo * backend_info, GString * command)
 19.1486  {
 19.1487 -    LIBXML_TEST_VERSION
 19.1488 -        size_t size = strlen ( backend_info->hostname ) +
 19.1489 -        strlen ( command->str ) + 20;
 19.1490 +  LIBXML_TEST_VERSION
 19.1491 +	size_t size = strlen(backend_info->hostname) + strlen(command->str) + 20;
 19.1492  
 19.1493 -    gchar *URL = ( gchar * ) g_malloc ( sizeof ( gchar ) * size );
 19.1494 -    gchar *mid = ( gchar * ) g_malloc ( sizeof ( gchar ) * 6 );
 19.1495 +  gchar *URL = (gchar *) g_malloc(sizeof(gchar) * size);
 19.1496 +  gchar *mid = (gchar *) g_malloc(sizeof(gchar) * 6);
 19.1497  
 19.1498 -    mid = "";
 19.1499 +  mid = "";
 19.1500  
 19.1501 -    if ( g_ascii_strcasecmp ( command->str, "GetStatus" ) &&
 19.1502 -         g_ascii_strcasecmp ( command->str, "GetStatusHTML" ) )
 19.1503 -    {
 19.1504 -        mid = "Myth/";
 19.1505 -    }
 19.1506 +  if (g_ascii_strcasecmp(command->str, "GetStatus") &&
 19.1507 +	  g_ascii_strcasecmp(command->str, "GetStatusHTML"))
 19.1508 +	{
 19.1509 +	  mid = "Myth/";
 19.1510 +	}
 19.1511  
 19.1512 -    g_snprintf ( URL, size, "http://%s:%d/%s%s",
 19.1513 -                 backend_info->hostname, backend_info->status_port, mid,
 19.1514 -                 command->str );
 19.1515 +  g_snprintf(URL, size, "http://%s:%d/%s%s",
 19.1516 +			 backend_info->hostname, backend_info->status_port, mid,
 19.1517 +			 command->str);
 19.1518  
 19.1519 -    CURL *curl_handle;
 19.1520 +  CURL *curl_handle;
 19.1521  
 19.1522 -    MemoryStruct chunk;
 19.1523 +  MemoryStruct chunk;
 19.1524  
 19.1525 -    chunk.memory = NULL;        /* we expect realloc(NULL, size) to work */
 19.1526 -    chunk.size = 0;             /* no data at this point */
 19.1527 +  chunk.memory = NULL;			/* we expect realloc(NULL, size) to work */
 19.1528 +  chunk.size = 0;				/* no data at this point */
 19.1529  
 19.1530 -    curl_global_init ( CURL_GLOBAL_ALL );
 19.1531 +  curl_global_init(CURL_GLOBAL_ALL);
 19.1532  
 19.1533 -    /* init the curl session */
 19.1534 -    curl_handle = curl_easy_init (  );
 19.1535 + /* init the curl session */
 19.1536 +  curl_handle = curl_easy_init();
 19.1537  
 19.1538 -    /* specify URL to get */
 19.1539 -    curl_easy_setopt ( curl_handle, CURLOPT_URL, URL );
 19.1540 + /* specify URL to get */
 19.1541 +  curl_easy_setopt(curl_handle, CURLOPT_URL, URL);
 19.1542  
 19.1543 -    /* send all data to this function  */
 19.1544 -    curl_easy_setopt ( curl_handle, CURLOPT_WRITEFUNCTION,
 19.1545 -                       WriteMemoryCallback );
 19.1546 + /* send all data to this function  */
 19.1547 +  curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
 19.1548  
 19.1549 -    /* we pass our 'chunk' struct to the callback function */
 19.1550 -    curl_easy_setopt ( curl_handle, CURLOPT_WRITEDATA, ( void * ) &chunk );
 19.1551 + /* we pass our 'chunk' struct to the callback function */
 19.1552 +  curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &chunk);
 19.1553  
 19.1554 -    /* some servers don't like requests that are made without a user-agent
 19.1555 -       field, so we provide one */
 19.1556 -    curl_easy_setopt ( curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0" );
 19.1557 + /* some servers don't like requests that are made without a user-agent
 19.1558 +    field, so we provide one */
 19.1559 +  curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");
 19.1560  
 19.1561 -    /* set timeout */
 19.1562 -    curl_easy_setopt ( curl_handle, CURLOPT_CONNECTTIMEOUT, 20 );
 19.1563 + /* set timeout */
 19.1564 +  curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 20);
 19.1565  
 19.1566 -    /* get it! */
 19.1567 -    curl_easy_perform ( curl_handle );
 19.1568 + /* get it! */
 19.1569 +  curl_easy_perform(curl_handle);
 19.1570  
 19.1571 -    /* cleanup curl stuff */
 19.1572 -    curl_easy_cleanup ( curl_handle );
 19.1573 + /* cleanup curl stuff */
 19.1574 +  curl_easy_cleanup(curl_handle);
 19.1575  
 19.1576 -    return chunk;
 19.1577 +  return chunk;
 19.1578  }
    20.1 --- a/gmyth/src/gmyth_http.h	Wed Jun 13 18:18:42 2007 +0100
    20.2 +++ b/gmyth/src/gmyth_http.h	Thu Jun 14 18:19:52 2007 +0100
    20.3 @@ -74,131 +74,131 @@
    20.4  typedef struct _MemoryStruct MemoryStruct;
    20.5  
    20.6  struct _MemoryStruct
    20.7 -    {
    20.8 -        char *memory;
    20.9 -        size_t size;
   20.10 -    };
   20.11 +{
   20.12 +  char *memory;
   20.13 +  size_t size;
   20.14 +};
   20.15  
   20.16  struct _GMythProgram
   20.17 -    {
   20.18 -        gchar *title;
   20.19 -        gchar *subtitle;
   20.20 -        gchar *catType;
   20.21 -        gchar *category;
   20.22 -        gint repeat;
   20.23 -        GTimeVal *startTime;
   20.24 -        GTimeVal *endTime;
   20.25 -    };
   20.26 +{
   20.27 +  gchar *title;
   20.28 +  gchar *subtitle;
   20.29 +  gchar *catType;
   20.30 +  gchar *category;
   20.31 +  gint repeat;
   20.32 +  GTimeVal *startTime;
   20.33 +  GTimeVal *endTime;
   20.34 +};
   20.35  
   20.36  struct _GMythChannel
   20.37 -    {
   20.38 -        gchar *channelName;
   20.39 -        gchar *chanNum;
   20.40 -        gint chanId;
   20.41 -        gint callSign;
   20.42 -        GSList *programList;
   20.43 -    };
   20.44 +{
   20.45 +  gchar *channelName;
   20.46 +  gchar *chanNum;
   20.47 +  gint chanId;
   20.48 +  gint callSign;
   20.49 +  GSList *programList;
   20.50 +};
   20.51  
   20.52  struct _GMythEpg
   20.53 -    {
   20.54 -        gint startChanId;
   20.55 -        gint endChanId;
   20.56 -        gchar *version;
   20.57 -        gint protoVer;
   20.58 -        gint totalCount;
   20.59 -        gint numOfChannels;
   20.60 -        GTimeVal *asOf;
   20.61 -        GTimeVal *startTime;
   20.62 -        GTimeVal *endTime;
   20.63 -        gint details;
   20.64 -        GSList *channelList;
   20.65 -    };
   20.66 +{
   20.67 +  gint startChanId;
   20.68 +  gint endChanId;
   20.69 +  gchar *version;
   20.70 +  gint protoVer;
   20.71 +  gint totalCount;
   20.72 +  gint numOfChannels;
   20.73 +  GTimeVal *asOf;
   20.74 +  GTimeVal *startTime;
   20.75 +  GTimeVal *endTime;
   20.76 +  gint details;
   20.77 +  GSList *channelList;
   20.78 +};
   20.79  
   20.80  
   20.81  struct _GMythRecorded_Recording
   20.82 -    {
   20.83 -        gint dupInType;
   20.84 -        gint dupMethod;
   20.85 -        gchar *playGroup;
   20.86 -        gchar *recGroup;
   20.87 -        gchar *recProfile;
   20.88 -        gint recPriority;
   20.89 -        gint recStatus;
   20.90 -        gint encoderId;
   20.91 -        gint recordId;
   20.92 -        gint recType;
   20.93 -        GTimeVal *recStartTs;
   20.94 -        GTimeVal *recEndTs;
   20.95 -    };
   20.96 +{
   20.97 +  gint dupInType;
   20.98 +  gint dupMethod;
   20.99 +  gchar *playGroup;
  20.100 +  gchar *recGroup;
  20.101 +  gchar *recProfile;
  20.102 +  gint recPriority;
  20.103 +  gint recStatus;
  20.104 +  gint encoderId;
  20.105 +  gint recordId;
  20.106 +  gint recType;
  20.107 +  GTimeVal *recStartTs;
  20.108 +  GTimeVal *recEndTs;
  20.109 +};
  20.110  
  20.111  
  20.112  struct _GMythRecorded_Channel
  20.113 -    {
  20.114 -        gchar *chanFilters;
  20.115 -        gchar *channelName;
  20.116 -        gint chanNum;
  20.117 -        gint sourceId;
  20.118 -        gint commFree;
  20.119 -        gint inputId;
  20.120 -        gint chanId;
  20.121 -        gint callSign;
  20.122 -    };
  20.123 +{
  20.124 +  gchar *chanFilters;
  20.125 +  gchar *channelName;
  20.126 +  gint chanNum;
  20.127 +  gint sourceId;
  20.128 +  gint commFree;
  20.129 +  gint inputId;
  20.130 +  gint chanId;
  20.131 +  gint callSign;
  20.132 +};
  20.133  
  20.134  
  20.135  struct _GMythRecorded_Program
  20.136 -    {
  20.137 -        gint programFlags;
  20.138 -        gchar *title;
  20.139 -        gint programId;
  20.140 -        gchar *catType;
  20.141 -        gchar *category;
  20.142 -        gint seriesId;
  20.143 -        GTimeVal *startTime;
  20.144 -        GTimeVal *endTime;
  20.145 -        GTimeVal *airdate;      //?
  20.146 -        GTimeVal *lastModified;
  20.147 -        gchar *subTitle;
  20.148 -        gint stars;
  20.149 -        gint repeat;
  20.150 -        gint fileSize;
  20.151 -        gchar *hostname;
  20.152 -        GMythRecorded_Channel channel;
  20.153 -        GMythRecorded_Recording recording;
  20.154 -    };
  20.155 +{
  20.156 +  gint programFlags;
  20.157 +  gchar *title;
  20.158 +  gint programId;
  20.159 +  gchar *catType;
  20.160 +  gchar *category;
  20.161 +  gint seriesId;
  20.162 +  GTimeVal *startTime;
  20.163 +  GTimeVal *endTime;
  20.164 +  GTimeVal *airdate;			//?
  20.165 +  GTimeVal *lastModified;
  20.166 +  gchar *subTitle;
  20.167 +  gint stars;
  20.168 +  gint repeat;
  20.169 +  gint fileSize;
  20.170 +  gchar *hostname;
  20.171 +  GMythRecorded_Channel channel;
  20.172 +  GMythRecorded_Recording recording;
  20.173 +};
  20.174  
  20.175  struct _GMythRecorded
  20.176 -    {
  20.177 -        gchar *version;
  20.178 -        gint protoVer;
  20.179 -        gint totalCount;
  20.180 -        GTimeVal *asOf;
  20.181 -        GSList *programList;
  20.182 -    };
  20.183 +{
  20.184 +  gchar *version;
  20.185 +  gint protoVer;
  20.186 +  gint totalCount;
  20.187 +  GTimeVal *asOf;
  20.188 +  GSList *programList;
  20.189 +};
  20.190  
  20.191  
  20.192 -gint gmyth_http_retrieve_job_status ( GMythBackendInfo * backend_info,
  20.193 -                                      gint chanid, GTimeVal * start );
  20.194 +gint gmyth_http_retrieve_job_status(GMythBackendInfo * backend_info,
  20.195 +									gint chanid, GTimeVal * start);
  20.196  
  20.197 -gchar *gmyth_http_retrieve_setting ( GMythBackendInfo * backend_info,
  20.198 -                                     gchar * key, gchar * hostname );
  20.199 +gchar *gmyth_http_retrieve_setting(GMythBackendInfo * backend_info,
  20.200 +								   gchar * key, gchar * hostname);
  20.201  
  20.202 -GMythEpg gmyth_http_retrieve_epg ( GMythBackendInfo * backend_info,
  20.203 -                                   GTimeVal * StartTime, GTimeVal * EndTime,
  20.204 -                                   gint StartChanId, gint NumOfChannels,
  20.205 -                                   gchar * Details );
  20.206 +GMythEpg gmyth_http_retrieve_epg(GMythBackendInfo * backend_info,
  20.207 +								 GTimeVal * StartTime, GTimeVal * EndTime,
  20.208 +								 gint StartChanId, gint NumOfChannels,
  20.209 +								 gchar * Details);
  20.210  
  20.211 -GMythRecorded gmyth_http_retrieve_recorded ( GMythBackendInfo * backend_info );
  20.212 +GMythRecorded gmyth_http_retrieve_recorded(GMythBackendInfo * backend_info);
  20.213  
  20.214 -GSList *gmyth_http_retrieve_rec_profiles ( GMythBackendInfo * backend_info,
  20.215 -                                           gchar * groupname );
  20.216 +GSList *gmyth_http_retrieve_rec_profiles(GMythBackendInfo * backend_info,
  20.217 +										 gchar * groupname);
  20.218  
  20.219 -gint gmyth_http_create_rec_profile ( GMythBackendInfo * backend_info,
  20.220 -                                     GMythRecProfile * profile );
  20.221 +gint gmyth_http_create_rec_profile(GMythBackendInfo * backend_info,
  20.222 +								   GMythRecProfile * profile);
  20.223  
  20.224 -gint gmyth_http_del_rec_profile ( GMythBackendInfo * backend_info, gint id );
  20.225 +gint gmyth_http_del_rec_profile(GMythBackendInfo * backend_info, gint id);
  20.226  
  20.227 -MemoryStruct gmyth_http_request ( GMythBackendInfo * backend_info,
  20.228 -                                  GString * command );
  20.229 +MemoryStruct gmyth_http_request(GMythBackendInfo * backend_info,
  20.230 +								GString * command);
  20.231  
  20.232  G_END_DECLS
  20.233  #endif /* __GMYTH_HTTP_H__ */
    21.1 --- a/gmyth/src/gmyth_jobqueue.c	Wed Jun 13 18:18:42 2007 +0100
    21.2 +++ b/gmyth/src/gmyth_jobqueue.c	Thu Jun 14 18:19:52 2007 +0100
    21.3 @@ -40,24 +40,24 @@
    21.4   *
    21.5   */
    21.6  static GMythSocket *
    21.7 -backend_connect ( GMythBackendInfo * backend_info )
    21.8 +backend_connect(GMythBackendInfo * backend_info)
    21.9  {
   21.10 -    GMythSocket *socket = gmyth_socket_new (  );
   21.11 +  GMythSocket *socket = gmyth_socket_new();
   21.12  
   21.13 -    if ( gmyth_socket_connect_to_backend ( socket,
   21.14 -                                           gmyth_backend_info_get_hostname
   21.15 -                                           ( backend_info ),
   21.16 -                                           gmyth_backend_info_get_port
   21.17 -                                           ( backend_info ), TRUE ) == TRUE )
   21.18 -    {
   21.19 -        gmyth_debug ( "Backend socket connection success" );
   21.20 -        return socket;
   21.21 -    }
   21.22 -    else
   21.23 -    {
   21.24 -        gmyth_debug ( "Connection failed" );
   21.25 -        return NULL;
   21.26 -    }
   21.27 +  if (gmyth_socket_connect_to_backend(socket,
   21.28 +									  gmyth_backend_info_get_hostname
   21.29 +									  (backend_info),
   21.30 +									  gmyth_backend_info_get_port
   21.31 +									  (backend_info), TRUE) == TRUE)
   21.32 +	{
   21.33 +	  gmyth_debug("Backend socket connection success");
   21.34 +	  return socket;
   21.35 +	}
   21.36 +  else
   21.37 +	{
   21.38 +	  gmyth_debug("Connection failed");
   21.39 +	  return NULL;
   21.40 +	}
   21.41  }
   21.42  
   21.43  
   21.44 @@ -73,33 +73,33 @@
   21.45   *
   21.46   */
   21.47  static gchar *
   21.48 -send_command ( GMythSocket * socket, gchar * action,
   21.49 -               gchar * job, gint chanid, gchar * starttime, gchar * options )
   21.50 +send_command(GMythSocket * socket, gchar * action,
   21.51 +			 gchar * job, gint chanid, gchar * starttime, gchar * options)
   21.52  {
   21.53 -    GString *command = g_string_new ( "" );
   21.54 -    GString *ret_str;
   21.55 -    gchar *ret;
   21.56 +  GString *command = g_string_new("");
   21.57 +  GString *ret_str;
   21.58 +  gchar *ret;
   21.59  
   21.60 -    GMythStringList *retlist = gmyth_string_list_new (  );
   21.61 +  GMythStringList *retlist = gmyth_string_list_new();
   21.62  
   21.63 -    g_string_printf ( command, "JOBQUEUE %s %s %d %s %s", action, job,
   21.64 -                      chanid, starttime, options );
   21.65 +  g_string_printf(command, "JOBQUEUE %s %s %d %s %s", action, job,
   21.66 +				  chanid, starttime, options);
   21.67  
   21.68 -    gmyth_string_list_append_string ( retlist, command );
   21.69 -    gmyth_socket_write_stringlist ( socket, retlist );
   21.70 +  gmyth_string_list_append_string(retlist, command);
   21.71 +  gmyth_socket_write_stringlist(socket, retlist);
   21.72  
   21.73 -    // receive answer
   21.74 -    gmyth_socket_read_stringlist ( socket, retlist );
   21.75 -    ret_str = gmyth_string_list_get_string ( retlist, 0 );
   21.76 + // receive answer
   21.77 +  gmyth_socket_read_stringlist(socket, retlist);
   21.78 +  ret_str = gmyth_string_list_get_string(retlist, 0);
   21.79  
   21.80 -    //ret = ret_str->str;
   21.81 -    ret = g_string_free ( ret_str, FALSE );
   21.82 -    g_string_free ( command, TRUE );
   21.83 + //ret = ret_str->str;
   21.84 +  ret = g_string_free(ret_str, FALSE);
   21.85 +  g_string_free(command, TRUE);
   21.86  
   21.87 -    gmyth_string_list_clear_all ( retlist );
   21.88 -    g_object_unref ( retlist );
   21.89 +  gmyth_string_list_clear_all(retlist);
   21.90 +  g_object_unref(retlist);
   21.91  
   21.92 -    return ret;
   21.93 +  return ret;
   21.94  }
   21.95  
   21.96  
   21.97 @@ -111,17 +111,17 @@
   21.98   *
   21.99   */
  21.100  static gboolean
  21.101 -test_result ( gchar * ret, gchar * value )
  21.102 +test_result(gchar * ret, gchar * value)
  21.103  {
  21.104 -    if ( g_ascii_strcasecmp ( ret, value ) == 0 )
  21.105 -    {
  21.106 -        return TRUE;
  21.107 -    }
  21.108 -    else
  21.109 -    {
  21.110 -        gmyth_debug ( "JobQueue Error: %s", ret );
  21.111 -        return FALSE;
  21.112 -    }
  21.113 +  if (g_ascii_strcasecmp(ret, value) == 0)
  21.114 +	{
  21.115 +	  return TRUE;
  21.116 +	}
  21.117 +  else
  21.118 +	{
  21.119 +	  gmyth_debug("JobQueue Error: %s", ret);
  21.120 +	  return FALSE;
  21.121 +	}
  21.122  }
  21.123  
  21.124  /** Function to add a job inside JOBQUEUE
  21.125 @@ -132,47 +132,47 @@
  21.126   *
  21.127   */
  21.128  gboolean
  21.129 -gmyth_jobqueue_add_job ( GMythTranscoder * transcode, gchar * job )
  21.130 +gmyth_jobqueue_add_job(GMythTranscoder * transcode, gchar * job)
  21.131  {
  21.132 -    GMythSocket *socket = backend_connect ( transcode->backend_info );
  21.133 -    gboolean res = FALSE;
  21.134 +  GMythSocket *socket = backend_connect(transcode->backend_info);
  21.135 +  gboolean res = FALSE;
  21.136  
  21.137 -    if ( socket != NULL )
  21.138 -    {
  21.139 -        GString *options = g_string_new ( "" );
  21.140 -        gchar *ret = NULL;
  21.141 +  if (socket != NULL)
  21.142 +	{
  21.143 +	  GString *options = g_string_new("");
  21.144 +	  gchar *ret = NULL;
  21.145  
  21.146 -        if ( g_ascii_strcasecmp ( job, "JOB_TRANSCODE" ) == 0 )
  21.147 -        {
  21.148 -            if ( transcode->cutlist )
  21.149 -                g_string_append ( options, " JOB_USE_CUTLIST" );
  21.150 +	  if (g_ascii_strcasecmp(job, "JOB_TRANSCODE") == 0)
  21.151 +		{
  21.152 +		  if (transcode->cutlist)
  21.153 +			g_string_append(options, " JOB_USE_CUTLIST");
  21.154  
  21.155 -            if ( transcode->output )
  21.156 -                g_string_append_printf ( options, " JOB_OUTPUT %s",
  21.157 -                                         transcode->output_filename );
  21.158 +		  if (transcode->output)
  21.159 +			g_string_append_printf(options, " JOB_OUTPUT %s",
  21.160 +								   transcode->output_filename);
  21.161  
  21.162 -            if ( transcode->profile != NULL )
  21.163 -                g_string_append_printf ( options, " %s", transcode->profile );
  21.164 -        }
  21.165 -        ret = send_command ( socket, "ADD", job, transcode->chanid,
  21.166 -                             transcode->starttime, options->str );
  21.167 -        res = test_result ( ret, "JOBQUEUE_OK" );
  21.168 -        gmyth_socket_close_connection ( socket );
  21.169 +		  if (transcode->profile != NULL)
  21.170 +			g_string_append_printf(options, " %s", transcode->profile);
  21.171 +		}
  21.172 +	  ret = send_command(socket, "ADD", job, transcode->chanid,
  21.173 +						 transcode->starttime, options->str);
  21.174 +	  res = test_result(ret, "JOBQUEUE_OK");
  21.175 +	  gmyth_socket_close_connection(socket);
  21.176  
  21.177 -        g_object_unref ( socket );
  21.178 +	  g_object_unref(socket);
  21.179  
  21.180 -        g_string_free ( options, TRUE );
  21.181 +	  g_string_free(options, TRUE);
  21.182  
  21.183 -        if ( ret )
  21.184 -            g_free ( ret );
  21.185 +	  if (ret)
  21.186 +		g_free(ret);
  21.187  
  21.188 -    }
  21.189 -    else
  21.190 -    {
  21.191 -        gmyth_debug ( "JobQueue Connection Failed" );
  21.192 -    }
  21.193 +	}
  21.194 +  else
  21.195 +	{
  21.196 +	  gmyth_debug("JobQueue Connection Failed");
  21.197 +	}
  21.198  
  21.199 -    return res;
  21.200 +  return res;
  21.201  }
  21.202  
  21.203  /** Function to change a job cmd inside JOBQUEUE
  21.204 @@ -184,30 +184,30 @@
  21.205   *
  21.206   */
  21.207  gboolean
  21.208 -gmyth_jobqueue_change_cmd ( GMythTranscoder * transcode, gchar * action,
  21.209 -                            gchar * job )
  21.210 +gmyth_jobqueue_change_cmd(GMythTranscoder * transcode, gchar * action,
  21.211 +						  gchar * job)
  21.212  {
  21.213 -    GMythSocket *socket = backend_connect ( transcode->backend_info );
  21.214 -    gboolean res = FALSE;
  21.215 +  GMythSocket *socket = backend_connect(transcode->backend_info);
  21.216 +  gboolean res = FALSE;
  21.217  
  21.218 -    if ( socket != NULL )
  21.219 -    {
  21.220 -        gchar *ret = send_command ( socket, action, job,
  21.221 -                                    transcode->chanid,
  21.222 -                                    transcode->starttime, "" );
  21.223 +  if (socket != NULL)
  21.224 +	{
  21.225 +	  gchar *ret = send_command(socket, action, job,
  21.226 +								transcode->chanid,
  21.227 +								transcode->starttime, "");
  21.228  
  21.229 -        res = test_result ( ret, "JOBQUEUE_CHANGED_CMD_OK" );
  21.230 +	  res = test_result(ret, "JOBQUEUE_CHANGED_CMD_OK");
  21.231  
  21.232 -        gmyth_socket_close_connection ( socket );
  21.233 -        g_object_unref ( socket );
  21.234 +	  gmyth_socket_close_connection(socket);
  21.235 +	  g_object_unref(socket);
  21.236  
  21.237 -        g_free ( ret );
  21.238 +	  g_free(ret);
  21.239  
  21.240 -    }
  21.241 -    else
  21.242 -    {
  21.243 -        gmyth_debug ( "JobQueue Connection Failed" );
  21.244 -    }
  21.245 +	}
  21.246 +  else
  21.247 +	{
  21.248 +	  gmyth_debug("JobQueue Connection Failed");
  21.249 +	}
  21.250  
  21.251 -    return res;
  21.252 +  return res;
  21.253  }
    22.1 --- a/gmyth/src/gmyth_jobqueue.h	Wed Jun 13 18:18:42 2007 +0100
    22.2 +++ b/gmyth/src/gmyth_jobqueue.h	Thu Jun 14 18:19:52 2007 +0100
    22.3 @@ -43,10 +43,9 @@
    22.4  #include "gmyth_util.h"
    22.5  
    22.6  G_BEGIN_DECLS
    22.7 -    gboolean gmyth_jobqueue_add_job ( GMythTranscoder * transcoder,
    22.8 -                                      gchar * job );
    22.9 -gboolean gmyth_jobqueue_change_cmd ( GMythTranscoder * transcoder,
   22.10 -                                     gchar * action, gchar * job );
   22.11 +  gboolean gmyth_jobqueue_add_job(GMythTranscoder * transcoder, gchar * job);
   22.12 +gboolean gmyth_jobqueue_change_cmd(GMythTranscoder * transcoder,
   22.13 +								   gchar * action, gchar * job);
   22.14  
   22.15  G_END_DECLS
   22.16  #endif /* __GMYTH_JOBQUEUE_H__ */
    23.1 --- a/gmyth/src/gmyth_livetv.c	Wed Jun 13 18:18:42 2007 +0100
    23.2 +++ b/gmyth/src/gmyth_livetv.c	Thu Jun 14 18:19:52 2007 +0100
    23.3 @@ -43,11 +43,11 @@
    23.4  #include "gmyth_common.h"
    23.5  #include "gmyth_util.h"
    23.6  
    23.7 -static void gmyth_livetv_class_init (GMythLiveTVClass * klass);
    23.8 -static void gmyth_livetv_init (GMythLiveTV * object);
    23.9 +static void gmyth_livetv_class_init(GMythLiveTVClass * klass);
   23.10 +static void gmyth_livetv_init(GMythLiveTV * object);
   23.11  
   23.12 -static void gmyth_livetv_dispose (GObject * object);
   23.13 -static void gmyth_livetv_finalize (GObject * object);
   23.14 +static void gmyth_livetv_dispose(GObject * object);
   23.15 +static void gmyth_livetv_finalize(GObject * object);
   23.16  
   23.17  static gint tvchain_curr_index = -1;
   23.18  
   23.19 @@ -55,113 +55,124 @@
   23.20  
   23.21  #define GMYTHTV_TRANSFER_MAX_WAITS	    100
   23.22  
   23.23 -	G_DEFINE_TYPE (GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT)
   23.24 -static void gmyth_livetv_class_init (GMythLiveTVClass * klass)
   23.25 +G_DEFINE_TYPE(GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT)
   23.26 +	 static void gmyth_livetv_class_init(GMythLiveTVClass * klass)
   23.27  {
   23.28 -	GObjectClass *gobject_class;
   23.29 +  GObjectClass *gobject_class;
   23.30  
   23.31 -	gobject_class = (GObjectClass *) klass;
   23.32 +  gobject_class = (GObjectClass *) klass;
   23.33  
   23.34 -	gobject_class->dispose = gmyth_livetv_dispose;
   23.35 -	gobject_class->finalize = gmyth_livetv_finalize;
   23.36 +  gobject_class->dispose = gmyth_livetv_dispose;
   23.37 +  gobject_class->finalize = gmyth_livetv_finalize;
   23.38  }
   23.39  
   23.40 -	static void
   23.41 -gmyth_livetv_init (GMythLiveTV * livetv)
   23.42 +static void
   23.43 +gmyth_livetv_init(GMythLiveTV * livetv)
   23.44  {
   23.45 -	livetv->monitor = NULL;
   23.46 -	livetv->backend_info = NULL;
   23.47 -	livetv->local_hostname = NULL;
   23.48 -	livetv->file = NULL;
   23.49 -	livetv->setup_done = FALSE;
   23.50 +  livetv->monitor = NULL;
   23.51 +  livetv->backend_info = NULL;
   23.52 +  livetv->local_hostname = NULL;
   23.53 +  livetv->file = NULL;
   23.54 +  livetv->setup_done = FALSE;
   23.55  
   23.56 -	livetv->socket = NULL;
   23.57 -	livetv->recorder = NULL;
   23.58 -	livetv->tvchain = NULL;
   23.59 -	livetv->proginfo = NULL;
   23.60 -	livetv->uri = NULL;
   23.61 +  livetv->socket = NULL;
   23.62 +  livetv->recorder = NULL;
   23.63 +  livetv->tvchain = NULL;
   23.64 +  livetv->proginfo = NULL;
   23.65 +  livetv->uri = NULL;
   23.66  
   23.67 -	livetv->mutex = g_mutex_new ();
   23.68 +  livetv->mutex = g_mutex_new();
   23.69  }
   23.70  
   23.71 -	static void
   23.72 -gmyth_livetv_dispose (GObject * object)
   23.73 +static void
   23.74 +gmyth_livetv_dispose(GObject * object)
   23.75  {
   23.76 -	GMythLiveTV *livetv = GMYTH_LIVETV (object);
   23.77 +  GMythLiveTV *livetv = GMYTH_LIVETV(object);
   23.78  
   23.79  
   23.80 -	if (livetv->disposed) {
   23.81 -		/* If dispose did already run, return. */
   23.82 -		return;
   23.83 +  if (livetv->disposed)
   23.84 +	{
   23.85 +	 /* If dispose did already run, return. */
   23.86 +	  return;
   23.87  	}
   23.88  
   23.89 -	/* Make sure dispose does not run twice. */
   23.90 -	livetv->disposed = TRUE;
   23.91 + /* Make sure dispose does not run twice. */
   23.92 +  livetv->disposed = TRUE;
   23.93  
   23.94 -	if (livetv->monitor != NULL) {
   23.95 -		g_object_unref (livetv->monitor);
   23.96 -		livetv->monitor = NULL;
   23.97 +  if (livetv->monitor != NULL)
   23.98 +	{
   23.99 +	  g_object_unref(livetv->monitor);
  23.100 +	  livetv->monitor = NULL;
  23.101  	}
  23.102  
  23.103 -	if (livetv->file != NULL) {
  23.104 -		g_object_unref (livetv->file);
  23.105 -		livetv->file = NULL;
  23.106 +  if (livetv->file != NULL)
  23.107 +	{
  23.108 +	  g_object_unref(livetv->file);
  23.109 +	  livetv->file = NULL;
  23.110  	}
  23.111  
  23.112  
  23.113 -	if (livetv->recorder != NULL) {
  23.114 -		//gmyth_recorder_close(livetv->recorder);
  23.115 -		g_object_unref (livetv->recorder);
  23.116 -		livetv->recorder = NULL;
  23.117 +  if (livetv->recorder != NULL)
  23.118 +	{
  23.119 +	 //gmyth_recorder_close(livetv->recorder);
  23.120 +	  g_object_unref(livetv->recorder);
  23.121 +	  livetv->recorder = NULL;
  23.122  	}
  23.123  
  23.124 -	if (livetv->socket != NULL) {
  23.125 -		g_object_unref (livetv->socket);
  23.126 -		livetv->socket = NULL;
  23.127 +  if (livetv->socket != NULL)
  23.128 +	{
  23.129 +	  g_object_unref(livetv->socket);
  23.130 +	  livetv->socket = NULL;
  23.131  	}
  23.132  
  23.133 -	if (livetv->tvchain != NULL) {
  23.134 -		g_object_unref (livetv->tvchain);
  23.135 -		livetv->tvchain = NULL;
  23.136 +  if (livetv->tvchain != NULL)
  23.137 +	{
  23.138 +	  g_object_unref(livetv->tvchain);
  23.139 +	  livetv->tvchain = NULL;
  23.140  	}
  23.141  
  23.142  
  23.143 -	if (livetv->proginfo != NULL) {
  23.144 -		g_object_unref (livetv->proginfo);
  23.145 -		livetv->proginfo = NULL;
  23.146 +  if (livetv->proginfo != NULL)
  23.147 +	{
  23.148 +	  g_object_unref(livetv->proginfo);
  23.149 +	  livetv->proginfo = NULL;
  23.150  	}
  23.151  
  23.152 -	if (livetv->backend_info != NULL) {
  23.153 -		g_object_unref (livetv->backend_info);
  23.154 -		livetv->backend_info = NULL;
  23.155 +  if (livetv->backend_info != NULL)
  23.156 +	{
  23.157 +	  g_object_unref(livetv->backend_info);
  23.158 +	  livetv->backend_info = NULL;
  23.159  	}
  23.160  
  23.161  
  23.162 -	if (livetv->uri != NULL) {
  23.163 -		g_object_unref (livetv->uri);
  23.164 -		livetv->uri = NULL;
  23.165 +  if (livetv->uri != NULL)
  23.166 +	{
  23.167 +	  g_object_unref(livetv->uri);
  23.168 +	  livetv->uri = NULL;
  23.169  	}
  23.170  
  23.171 -	if (livetv->mutex != NULL) {
  23.172 -		g_mutex_free (livetv->mutex);
  23.173 -		livetv->mutex = NULL;
  23.174 +  if (livetv->mutex != NULL)
  23.175 +	{
  23.176 +	  g_mutex_free(livetv->mutex);
  23.177 +	  livetv->mutex = NULL;
  23.178  	}
  23.179  
  23.180  
  23.181 -	if (livetv->local_hostname != NULL) {
  23.182 -		g_string_free (livetv->local_hostname, TRUE);
  23.183 -		livetv->local_hostname = NULL;
  23.184 +  if (livetv->local_hostname != NULL)
  23.185 +	{
  23.186 +	  g_string_free(livetv->local_hostname, TRUE);
  23.187 +	  livetv->local_hostname = NULL;
  23.188  	}
  23.189  
  23.190 -	G_OBJECT_CLASS (gmyth_livetv_parent_class)->dispose (object);
  23.191 +  G_OBJECT_CLASS(gmyth_livetv_parent_class)->dispose(object);
  23.192  }
  23.193  
  23.194 -	static void
  23.195 -gmyth_livetv_finalize (GObject * object)
  23.196 +static void
  23.197 +gmyth_livetv_finalize(GObject * object)
  23.198  {
  23.199 -	g_signal_handlers_destroy (object);
  23.200 +  g_signal_handlers_destroy(object);
  23.201  
  23.202 -	G_OBJECT_CLASS (gmyth_livetv_parent_class)->finalize (object);
  23.203 +  G_OBJECT_CLASS(gmyth_livetv_parent_class)->finalize(object);
  23.204  }
  23.205  
  23.206  /**
  23.207 @@ -169,15 +180,15 @@
  23.208   * 
  23.209   * @return a newly allocated GMythLiveTV instance
  23.210   */
  23.211 -	GMythLiveTV *
  23.212 -gmyth_livetv_new (GMythBackendInfo * backend_info)
  23.213 +GMythLiveTV *
  23.214 +gmyth_livetv_new(GMythBackendInfo * backend_info)
  23.215  {
  23.216 -	GMythLiveTV *livetv = GMYTH_LIVETV (g_object_new (GMYTH_LIVETV_TYPE, NULL));
  23.217 +  GMythLiveTV *livetv = GMYTH_LIVETV(g_object_new(GMYTH_LIVETV_TYPE, NULL));
  23.218  
  23.219 -	livetv->backend_info = backend_info;
  23.220 -	g_object_ref (livetv->backend_info);
  23.221 +  livetv->backend_info = backend_info;
  23.222 +  g_object_ref(livetv->backend_info);
  23.223  
  23.224 -	return livetv;
  23.225 +  return livetv;
  23.226  }
  23.227  
  23.228  /**
  23.229 @@ -190,96 +201,105 @@
  23.230   * @param message the message's string description
  23.231   * @param user_data pointer to the GMythLiveTV instance
  23.232   */
  23.233 -	static void
  23.234 -gmyth_livetv_monitor_signal_handler (GMythMonitorHandler * monitor,
  23.235 -		gint msg_code, gchar * message, gpointer user_data)
  23.236 +static void
  23.237 +gmyth_livetv_monitor_signal_handler(GMythMonitorHandler * monitor,
  23.238 +									gint msg_code, gchar * message,
  23.239 +									gpointer user_data)
  23.240  {
  23.241 -	GMythLiveTV *live_tv = GMYTH_LIVETV (user_data);
  23.242 +  GMythLiveTV *live_tv = GMYTH_LIVETV(user_data);
  23.243  
  23.244 -	gmyth_debug
  23.245 -		("LIVETV Signal handler ( msg = %s, code = %d, live_tv param = %s, user_data = %s )\n",
  23.246 -		 message, msg_code, live_tv != NULL ? "" : "NULL",
  23.247 -		 user_data != NULL ? "" : "NULL");
  23.248 +  gmyth_debug
  23.249 +	("LIVETV Signal handler ( msg = %s, code = %d, live_tv param = %s, user_data = %s )\n",
  23.250 +	 message, msg_code, live_tv != NULL ? "" : "NULL",
  23.251 +	 user_data != NULL ? "" : "NULL");
  23.252  
  23.253 -	if (NULL == live_tv || !IS_GMYTH_FILE_TRANSFER (live_tv->file)) {
  23.254 -		gmyth_debug ("LiveTV_obj is equals to NULL!!!");
  23.255 -		return;
  23.256 +  if (NULL == live_tv || !IS_GMYTH_FILE_TRANSFER(live_tv->file))
  23.257 +	{
  23.258 +	  gmyth_debug("LiveTV_obj is equals to NULL!!!");
  23.259 +	  return;
  23.260  	}
  23.261  
  23.262 -	switch (msg_code) {
  23.263 +  switch (msg_code)
  23.264 +	{
  23.265  
  23.266 -		case GMYTH_BACKEND_PROGRAM_INFO_CHANGED:
  23.267 -			{
  23.268 +	case GMYTH_BACKEND_PROGRAM_INFO_CHANGED:
  23.269 +	  {
  23.270 +		gmyth_debug
  23.271 +		  ("LIVETV Program Changed request received [ msg = %s ]. Watching if the new "
  23.272 +		   "TV Chain ID is the same as the old one...\n", message);
  23.273 +		if (g_ascii_strcasecmp
  23.274 +			(message, (gmyth_tvchain_get_id(live_tv->tvchain))->str) != 0)
  23.275 +		  {
  23.276 +			gmyth_debug
  23.277 +			  ("OK!!! MOVED to the next program chain [actual == %s]!",
  23.278 +			   (gmyth_tvchain_get_id(live_tv->tvchain))->str);
  23.279 +		   /* advertises the FileTransfer about the program info changed */
  23.280 +			if (live_tv->file != NULL)
  23.281 +			  {
  23.282  				gmyth_debug
  23.283 -					("LIVETV Program Changed request received [ msg = %s ]. Watching if the new "
  23.284 -					 "TV Chain ID is the same as the old one...\n", message);
  23.285 -				if (g_ascii_strcasecmp
  23.286 -						(message,
  23.287 -						 (gmyth_tvchain_get_id (live_tv->tvchain))->str) != 0) {
  23.288 -					gmyth_debug
  23.289 -						("OK!!! MOVED to the next program chain [actual == %s]!",
  23.290 -						 (gmyth_tvchain_get_id (live_tv->tvchain))->str);
  23.291 -					/* advertises the FileTransfer about the program info changed */
  23.292 -					if (live_tv->file != NULL) {
  23.293 -						gmyth_debug
  23.294 -							("Emitting signal to the FileTransfer... [ \"program-info-changed \" ]");
  23.295 +				  ("Emitting signal to the FileTransfer... [ \"program-info-changed \" ]");
  23.296  
  23.297 -						gmyth_file_transfer_emit_program_info_changed_signal
  23.298 -							(GMYTH_FILE_TRANSFER (live_tv->file), msg_code,
  23.299 -							 (gpointer) (live_tv->recorder));
  23.300 +				gmyth_file_transfer_emit_program_info_changed_signal
  23.301 +				  (GMYTH_FILE_TRANSFER(live_tv->file), msg_code,
  23.302 +				   (gpointer) (live_tv->recorder));
  23.303  
  23.304 -						/* gmyth_livetv_monitor_handler_stop( live_tv ); */
  23.305 -					} else
  23.306 -						gmyth_debug
  23.307 -							("LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
  23.308 -				}
  23.309 -				break;
  23.310 -			}
  23.311 -		case GMYTH_BACKEND_DONE_RECORDING:
  23.312 -			{
  23.313 +			   /* gmyth_livetv_monitor_handler_stop( live_tv ); */
  23.314 +			  }
  23.315 +			else
  23.316 +			  gmyth_debug
  23.317 +				("LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
  23.318 +		  }
  23.319 +		break;
  23.320 +	  }
  23.321 +	case GMYTH_BACKEND_DONE_RECORDING:
  23.322 +	  {
  23.323 +		gmyth_debug
  23.324 +		  ("LIVETV Program Changed request received [ msg = %s ]. Watching if the new "
  23.325 +		   "TV Chain ID is the same as the old one...\n", message);
  23.326 +		if (g_ascii_strcasecmp
  23.327 +			(message, (gmyth_tvchain_get_id(live_tv->tvchain))->str) != 0)
  23.328 +		  {
  23.329 +			gmyth_debug
  23.330 +			  ("OK!!! MOVED to the next program chain [actual == %s]!",
  23.331 +			   (gmyth_tvchain_get_id(live_tv->tvchain))->str);
  23.332 +		   /* advertises the FileTransfer about the program info changed */
  23.333 +			if (live_tv->file != NULL)
  23.334 +			  {
  23.335  				gmyth_debug
  23.336 -					("LIVETV Program Changed request received [ msg = %s ]. Watching if the new "
  23.337 -					 "TV Chain ID is the same as the old one...\n", message);
  23.338 -				if (g_ascii_strcasecmp
  23.339 -						(message,
  23.340 -						 (gmyth_tvchain_get_id (live_tv->tvchain))->str) != 0) {
  23.341 -					gmyth_debug
  23.342 -						("OK!!! MOVED to the next program chain [actual == %s]!",
  23.343 -						 (gmyth_tvchain_get_id (live_tv->tvchain))->str);
  23.344 -					/* advertises the FileTransfer about the program info changed */
  23.345 -					if (live_tv->file != NULL) {
  23.346 -						gmyth_debug
  23.347 -							("Emitting signal to the FileTransfer... [ \"backend-done-recording\" ]");
  23.348 +				  ("Emitting signal to the FileTransfer... [ \"backend-done-recording\" ]");
  23.349  
  23.350 -						gmyth_file_transfer_emit_program_info_changed_signal
  23.351 -							(GMYTH_FILE_TRANSFER (live_tv->file), msg_code,
  23.352 -							 (gpointer) (live_tv->recorder));
  23.353 +				gmyth_file_transfer_emit_program_info_changed_signal
  23.354 +				  (GMYTH_FILE_TRANSFER(live_tv->file), msg_code,
  23.355 +				   (gpointer) (live_tv->recorder));
  23.356  
  23.357 -					} else
  23.358 -						gmyth_debug
  23.359 -							("LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
  23.360 -				}
  23.361 -				break;
  23.362 -			}
  23.363 -		case GMYTH_BACKEND_STOP_LIVETV:
  23.364 -			{
  23.365 -				gmyth_debug
  23.366 -					("LIVETV Stop LiveTV request received [ msg = %s ]. Going out the "
  23.367 -					 "LiveTV...\n", message);
  23.368 -				/* stops the LiveTV */
  23.369 -				if (live_tv != NULL) {
  23.370 -					gmyth_debug ("Going out the LiveTV... [ \"quit-livetv\" ]");
  23.371 +			  }
  23.372 +			else
  23.373 +			  gmyth_debug
  23.374 +				("LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
  23.375 +		  }
  23.376 +		break;
  23.377 +	  }
  23.378 +	case GMYTH_BACKEND_STOP_LIVETV:
  23.379 +	  {
  23.380 +		gmyth_debug
  23.381 +		  ("LIVETV Stop LiveTV request received [ msg = %s ]. Going out the "
  23.382 +		   "LiveTV...\n", message);
  23.383 +	   /* stops the LiveTV */
  23.384 +		if (live_tv != NULL)
  23.385 +		  {
  23.386 +			gmyth_debug("Going out the LiveTV... [ \"quit-livetv\" ]");
  23.387  
  23.388 -					g_object_unref (live_tv);
  23.389 -				} else
  23.390 -					gmyth_debug
  23.391 -						("LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
  23.392 +			g_object_unref(live_tv);
  23.393 +		  }
  23.394 +		else
  23.395 +		  gmyth_debug
  23.396 +			("LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
  23.397  
  23.398 -				break;
  23.399 -			}
  23.400 -		default:
  23.401 -			break;
  23.402 -	}                           /* switch (Monitor Handler messages) */
  23.403 +		break;
  23.404 +	  }
  23.405 +	default:
  23.406 +	  break;
  23.407 +	}							/* switch (Monitor Handler messages) */
  23.408  
  23.409  }
  23.410  
  23.411 @@ -292,43 +312,48 @@
  23.412   * @return <code>true</code> if the Monitor Handler start-up process
  23.413   * 	   had been concluded succcesfully 
  23.414   */
  23.415 -	gboolean
  23.416 -gmyth_livetv_monitor_handler_start (GMythLiveTV * livetv)
  23.417 +gboolean
  23.418 +gmyth_livetv_monitor_handler_start(GMythLiveTV * livetv)
  23.419  {
  23.420 -	gboolean res = TRUE;
  23.421 +  gboolean res = TRUE;
  23.422  
  23.423 -	if (livetv->monitor != NULL) {
  23.424 -		g_object_unref (livetv->monitor);
  23.425 -		livetv->monitor = NULL;
  23.426 +  if (livetv->monitor != NULL)
  23.427 +	{
  23.428 +	  g_object_unref(livetv->monitor);
  23.429 +	  livetv->monitor = NULL;
  23.430  	}
  23.431  
  23.432 -	livetv->monitor = gmyth_monitor_handler_new ();
  23.433 +  livetv->monitor = gmyth_monitor_handler_new();
  23.434  
  23.435 -	res =
  23.436 -		gmyth_monitor_handler_open (livetv->monitor,
  23.437 -				livetv->backend_info->hostname, livetv->backend_info->port);
  23.438 +  res =
  23.439 +	gmyth_monitor_handler_open(livetv->monitor,
  23.440 +							   livetv->backend_info->hostname,
  23.441 +							   livetv->backend_info->port);
  23.442  
  23.443 -	if (res == TRUE) {
  23.444 -		gmyth_debug
  23.445 -			("Connect MythTV Monitor event socket! Trying to start the message handler...");
  23.446 +  if (res == TRUE)
  23.447 +	{
  23.448 +	  gmyth_debug
  23.449 +		("Connect MythTV Monitor event socket! Trying to start the message handler...");
  23.450  
  23.451 -		res = gmyth_monitor_handler_start (livetv->monitor);
  23.452 +	  res = gmyth_monitor_handler_start(livetv->monitor);
  23.453  
  23.454 -		if (res) {
  23.455 -			gmyth_debug
  23.456 -				("MythTV Monitor event socket connected and listening!");
  23.457 -			g_signal_connect (G_OBJECT (livetv->monitor),
  23.458 -					"backend-events-handler", (GCallback)
  23.459 -					gmyth_livetv_monitor_signal_handler, livetv);
  23.460 -		} else {
  23.461 -			gmyth_debug
  23.462 -				("Problems when trying to start MythTV Monitor event socket!");
  23.463 -			goto error;
  23.464 +	  if (res)
  23.465 +		{
  23.466 +		  gmyth_debug("MythTV Monitor event socket connected and listening!");
  23.467 +		  g_signal_connect(G_OBJECT(livetv->monitor),
  23.468 +						   "backend-events-handler", (GCallback)
  23.469 +						   gmyth_livetv_monitor_signal_handler, livetv);
  23.470 +		}
  23.471 +	  else
  23.472 +		{
  23.473 +		  gmyth_debug
  23.474 +			("Problems when trying to start MythTV Monitor event socket!");
  23.475 +		  goto error;
  23.476  		}
  23.477  	}
  23.478  
  23.479  error:
  23.480 -	return res;
  23.481 +  return res;
  23.482  
  23.483  }
  23.484  
  23.485 @@ -341,26 +366,27 @@
  23.486   * @return <code>true</code> if the Monitor Handler shutdown process
  23.487   * 	   had been concluded succcesfully 
  23.488   */
  23.489 -	void
  23.490 -gmyth_livetv_monitor_handler_stop (GMythLiveTV * livetv)
  23.491 +void
  23.492 +gmyth_livetv_monitor_handler_stop(GMythLiveTV * livetv)
  23.493  {
  23.494  
  23.495 -	if (livetv->monitor != NULL) {
  23.496 -		g_object_unref (livetv->monitor);
  23.497 -		livetv->monitor = NULL;
  23.498 +  if (livetv->monitor != NULL)
  23.499 +	{
  23.500 +	  g_object_unref(livetv->monitor);
  23.501 +	  livetv->monitor = NULL;
  23.502  	}
  23.503  
  23.504  }
  23.505  
  23.506  #if 0
  23.507 -	static gchar *
  23.508 -gmyth_livetv_create_remote_url (GMythLiveTV * livetv)
  23.509 +static gchar *
  23.510 +gmyth_livetv_create_remote_url(GMythLiveTV * livetv)
  23.511  {
  23.512 -	gchar *uri = g_strdup ("");
  23.513 +  gchar *uri = g_strdup("");
  23.514  
  23.515 -	gmyth_backend_info_get_remote_h
  23.516 -		//gmyth_backend(livetv->backend_info)
  23.517 -		return uri;
  23.518 +  gmyth_backend_info_get_remote_h
  23.519 +   //gmyth_backend(livetv->backend_info)
  23.520 +	return uri;
  23.521  }
  23.522  #endif
  23.523  
  23.524 @@ -376,272 +402,303 @@
  23.525   * @return <code>true</code> if the LiveTV's recorder instance configuration 
  23.526   * 				had been concluded succcesfully 
  23.527   */
  23.528 -	static gboolean
  23.529 -gmyth_livetv_setup_recorder_channel_name (GMythLiveTV * livetv, gchar * channel)
  23.530 +static gboolean
  23.531 +gmyth_livetv_setup_recorder_channel_name(GMythLiveTV * livetv,
  23.532 +										 gchar * channel)
  23.533  {
  23.534 -	gboolean res = TRUE;
  23.535 +  gboolean res = TRUE;
  23.536  
  23.537 -	g_return_val_if_fail (livetv != NULL, FALSE);
  23.538 +  g_return_val_if_fail(livetv != NULL, FALSE);
  23.539  
  23.540 -	if (NULL == livetv->socket) {
  23.541 -		livetv->socket = gmyth_socket_new ();
  23.542 +  if (NULL == livetv->socket)
  23.543 +	{
  23.544 +	  livetv->socket = gmyth_socket_new();
  23.545  
  23.546 -		/* FIME: Implement this at gmyth_socket */
  23.547 -		res =
  23.548 -			gmyth_socket_connect_to_backend (livetv->socket,
  23.549 -					livetv->backend_info->hostname, livetv->backend_info->port, TRUE);
  23.550 -		if (!res) {
  23.551 -			gmyth_debug ("[%s] LiveTV can not connect to backend",
  23.552 -					__FUNCTION__);
  23.553 -			res = FALSE;
  23.554 -			goto error;
  23.555 +	 /* FIME: Implement this at gmyth_socket */
  23.556 +	  res =
  23.557 +		gmyth_socket_connect_to_backend(livetv->socket,
  23.558 +										livetv->backend_info->hostname,
  23.559 +										livetv->backend_info->port, TRUE);
  23.560 +	  if (!res)
  23.561 +		{
  23.562 +		  gmyth_debug("[%s] LiveTV can not connect to backend", __FUNCTION__);
  23.563 +		  res = FALSE;
  23.564 +		  goto error;
  23.565  		}
  23.566  	}
  23.567  
  23.568 -	g_mutex_lock (livetv->mutex);
  23.569 +  g_mutex_lock(livetv->mutex);
  23.570  
  23.571 -	livetv->is_livetv = TRUE;
  23.572 +  livetv->is_livetv = TRUE;
  23.573  
  23.574 -	livetv->local_hostname = gmyth_socket_get_local_hostname ();
  23.575 +  livetv->local_hostname = gmyth_socket_get_local_hostname();
  23.576  
  23.577 -	if (livetv->local_hostname == NULL) {
  23.578 -		g_warning ("livetv could not retrieve the local hostname");
  23.579 -		res = FALSE;
  23.580 -		goto error;
  23.581 -	} else {
  23.582 -		gmyth_debug ("Local hostname: %s", livetv->local_hostname->str);
  23.583 +  if (livetv->local_hostname == NULL)
  23.584 +	{
  23.585 +	  g_warning("livetv could not retrieve the local hostname");
  23.586 +	  res = FALSE;
  23.587 +	  goto error;
  23.588 +	}
  23.589 +  else
  23.590 +	{
  23.591 +	  gmyth_debug("Local hostname: %s", livetv->local_hostname->str);
  23.592  	}
  23.593  
  23.594 -	if (livetv->recorder != NULL) {
  23.595 -		g_object_unref (livetv->recorder);
  23.596 -		livetv->recorder = NULL;
  23.597 +  if (livetv->recorder != NULL)
  23.598 +	{
  23.599 +	  g_object_unref(livetv->recorder);
  23.600 +	  livetv->recorder = NULL;
  23.601  	}
  23.602  
  23.603 -	if (gmyth_remote_util_get_free_recorder_count (livetv->socket) <= 0) {
  23.604 -		gmyth_debug ("No free remote encoder available.");
  23.605 -		res = FALSE;
  23.606 -		goto error;
  23.607 +  if (gmyth_remote_util_get_free_recorder_count(livetv->socket) <= 0)
  23.608 +	{
  23.609 +	  gmyth_debug("No free remote encoder available.");
  23.610 +	  res = FALSE;
  23.611 +	  goto error;
  23.612  	}
  23.613  
  23.614 -	/* Gets the recorder num */
  23.615 -	livetv->recorder = remote_request_next_free_recorder (livetv->socket, -1);
  23.616 -	gmyth_socket_close_connection (livetv->socket);
  23.617 + /* Gets the recorder num */
  23.618 +  livetv->recorder = remote_request_next_free_recorder(livetv->socket, -1);
  23.619 +  gmyth_socket_close_connection(livetv->socket);
  23.620  
  23.621 -	if (NULL == livetv->recorder) {
  23.622 -		gmyth_debug ("[%s] None remote encoder available", __FUNCTION__);
  23.623 -		res = FALSE;
  23.624 -		goto error;
  23.625 +  if (NULL == livetv->recorder)
  23.626 +	{
  23.627 +	  gmyth_debug("[%s] None remote encoder available", __FUNCTION__);
  23.628 +	  res = FALSE;
  23.629 +	  goto error;
  23.630  	}
  23.631  
  23.632 -	/* Init remote encoder. Opens its control socket. */
  23.633 -	res = gmyth_recorder_setup (livetv->recorder);
  23.634 -	if (!res) {
  23.635 -		gmyth_debug ("[%s] Fail while setting remote encoder\n", __FUNCTION__);
  23.636 -		res = FALSE;
  23.637 -		goto error;
  23.638 + /* Init remote encoder. Opens its control socket. */
  23.639 +  res = gmyth_recorder_setup(livetv->recorder);
  23.640 +  if (!res)
  23.641 +	{
  23.642 +	  gmyth_debug("[%s] Fail while setting remote encoder\n", __FUNCTION__);
  23.643 +	  res = FALSE;
  23.644 +	  goto error;
  23.645  	}
  23.646  
  23.647 -	/* Creates livetv chain handler */
  23.648 -	livetv->tvchain = gmyth_tvchain_new ();
  23.649 -	gmyth_tvchain_initialize (livetv->tvchain, livetv->backend_info);
  23.650 + /* Creates livetv chain handler */
  23.651 +  livetv->tvchain = gmyth_tvchain_new();
  23.652 +  gmyth_tvchain_initialize(livetv->tvchain, livetv->backend_info);
  23.653  
  23.654 -	if (livetv->tvchain == NULL || livetv->tvchain->tvchain_id == NULL) {
  23.655 -		res = FALSE;
  23.656 -		goto error;
  23.657 +  if (livetv->tvchain == NULL || livetv->tvchain->tvchain_id == NULL)
  23.658 +	{
  23.659 +	  res = FALSE;
  23.660 +	  goto error;
  23.661  	}
  23.662 -	// Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly)
  23.663 -	res = gmyth_recorder_spawntv (livetv->recorder,
  23.664 -			gmyth_tvchain_get_id (livetv->tvchain));
  23.665 -	if (!res) {
  23.666 -		gmyth_debug ("[%s] Fail while spawn tv\n", __FUNCTION__);
  23.667 -		res = FALSE;
  23.668 -		goto error;
  23.669 + // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly)
  23.670 +  res = gmyth_recorder_spawntv(livetv->recorder,
  23.671 +							   gmyth_tvchain_get_id(livetv->tvchain));
  23.672 +  if (!res)
  23.673 +	{
  23.674 +	  gmyth_debug("[%s] Fail while spawn tv\n", __FUNCTION__);
  23.675 +	  res = FALSE;
  23.676 +	  goto error;
  23.677  	}
  23.678  
  23.679 -	if (res == TRUE) {
  23.680 -		/* loop finished, set the max tries variable to zero again... */
  23.681 -		gint wait_to_transfer = 0;
  23.682 +  if (res == TRUE)
  23.683 +	{
  23.684 +	 /* loop finished, set the max tries variable to zero again... */
  23.685 +	  gint wait_to_transfer = 0;
  23.686  
  23.687 -		while (wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
  23.688 -				(gmyth_recorder_is_recording (livetv->recorder) == FALSE))
  23.689 -			g_usleep (300);
  23.690 +	  while (wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
  23.691 +			 (gmyth_recorder_is_recording(livetv->recorder) == FALSE))
  23.692 +		g_usleep(300);
  23.693  
  23.694 -		if (channel != NULL) {
  23.695 -			/* Pauses remote encoder. */
  23.696 -			res = gmyth_recorder_pause_recording (livetv->recorder);
  23.697 -			if (!res) {
  23.698 -				gmyth_debug ("[%s] Fail while pausing remote encoder\n",
  23.699 -						__FUNCTION__);
  23.700 -				res = FALSE;
  23.701 -				goto error;
  23.702 +	  if (channel != NULL)
  23.703 +		{
  23.704 +		 /* Pauses remote encoder. */
  23.705 +		  res = gmyth_recorder_pause_recording(livetv->recorder);
  23.706 +		  if (!res)
  23.707 +			{
  23.708 +			  gmyth_debug("[%s] Fail while pausing remote encoder\n",
  23.709 +						  __FUNCTION__);
  23.710 +			  res = FALSE;
  23.711 +			  goto error;
  23.712  			}
  23.713  
  23.714 -			if (gmyth_recorder_check_channel_name (livetv->recorder, channel)) {
  23.715 -				if (gmyth_recorder_set_channel_name (livetv->recorder, channel)) {
  23.716 -					gmyth_debug ("Channel changed!!! [%s].\n", channel);
  23.717 +		  if (gmyth_recorder_check_channel_name(livetv->recorder, channel))
  23.718 +			{
  23.719 +			  if (gmyth_recorder_set_channel_name(livetv->recorder, channel))
  23.720 +				{
  23.721 +				  gmyth_debug("Channel changed!!! [%s].\n", channel);
  23.722  				}
  23.723  			}
  23.724  
  23.725  		}
  23.726 -		/* if - changes the channel number */
  23.727 -		/* sleep (5); */
  23.728 -		/* FIXME: this is evil (tpm) */
  23.729 +	 /* if - changes the channel number */
  23.730 +	 /* sleep (5); */
  23.731 +	 /* FIXME: this is evil (tpm) */
  23.732  	}
  23.733  
  23.734 -	/* DEBUG message */
  23.735 -	GMythProgramInfo *prog_info =
  23.736 -		gmyth_recorder_get_current_program_info (livetv->recorder);
  23.737 + /* DEBUG message */
  23.738 +  GMythProgramInfo *prog_info =
  23.739 +	gmyth_recorder_get_current_program_info(livetv->recorder);
  23.740  
  23.741 -	if (NULL == prog_info) {
  23.742 -		gmyth_debug ("ProgramInfo is equals to NULL!!!");
  23.743 +  if (NULL == prog_info)
  23.744 +	{
  23.745 +	  gmyth_debug("ProgramInfo is equals to NULL!!!");
  23.746  
  23.747 -		gint i;
  23.748 -		gchar *channame = NULL;
  23.749 +	  gint i;
  23.750 +	  gchar *channame = NULL;
  23.751  
  23.752 -		gmyth_debug ("Problem getting current proginfo!\n");
  23.753 +	  gmyth_debug("Problem getting current proginfo!\n");
  23.754  
  23.755 -		/*
  23.756 -		 * mythbackend must not be tuned in to a channel, so keep
  23.757 -		 * changing channels until we find a valid one, or until
  23.758 -		 * we decide to give up.
  23.759 -		 */
  23.760 -		for (i = 1; i < 1000; i++) {
  23.761 -			if (channame != NULL)
  23.762 -				g_free (channame);
  23.763 -			channame = g_strdup_printf ("%d", i);
  23.764 -			if (gmyth_recorder_set_channel_name (livetv->recorder, channame)
  23.765 -					< 0) {
  23.766 -				continue;
  23.767 +	 /*
  23.768 +	  * mythbackend must not be tuned in to a channel, so keep
  23.769 +	  * changing channels until we find a valid one, or until
  23.770 +	  * we decide to give up.
  23.771 +	  */
  23.772 +	  for (i = 1; i < 1000; i++)
  23.773 +		{
  23.774 +		  if (channame != NULL)
  23.775 +			g_free(channame);
  23.776 +		  channame = g_strdup_printf("%d", i);
  23.777 +		  if (gmyth_recorder_set_channel_name(livetv->recorder, channame) < 0)
  23.778 +			{
  23.779 +			  continue;
  23.780  			}
  23.781 -			prog_info =
  23.782 -				gmyth_recorder_get_next_program_info (livetv->recorder,
  23.783 -						BROWSE_DIRECTION_UP);
  23.784 -			gmyth_program_info_print (prog_info);
  23.785 -			if (prog_info != NULL)
  23.786 -				break;
  23.787 +		  prog_info =
  23.788 +			gmyth_recorder_get_next_program_info(livetv->recorder,
  23.789 +												 BROWSE_DIRECTION_UP);
  23.790 +		  gmyth_program_info_print(prog_info);
  23.791 +		  if (prog_info != NULL)
  23.792 +			break;
  23.793  		}
  23.794  
  23.795  	}
  23.796  
  23.797 -	/* if - Program Info */
  23.798 -	/* prints program info data text */
  23.799 -	gmyth_debug ("New ProgramInfo...\n");
  23.800 -	gmyth_program_info_print (prog_info);
  23.801 + /* if - Program Info */
  23.802 + /* prints program info data text */
  23.803 +  gmyth_debug("New ProgramInfo...\n");
  23.804 +  gmyth_program_info_print(prog_info);
  23.805  
  23.806 -	/* check if the program chain could be obtained from the MythTV protocol message */
  23.807 -	if (prog_info != NULL) {
  23.808 -		gmyth_backend_info_set_username (livetv->tvchain->backend_info,
  23.809 -				"mythtv");
  23.810 -		gmyth_backend_info_set_password (livetv->tvchain->backend_info,
  23.811 -				"mythtv");
  23.812 -		gmyth_backend_info_set_db_name (livetv->tvchain->backend_info,
  23.813 -				"mythconverg");
  23.814 -		GList *prog_list =
  23.815 -			gmyth_tvchain_get_program_info_from_channel (livetv->tvchain,
  23.816 -					channel);
  23.817 -		GMythProgramInfo *ch_prog = NULL;
  23.818 + /* check if the program chain could be obtained from the MythTV protocol message */
  23.819 +  if (prog_info != NULL)
  23.820 +	{
  23.821 +	  gmyth_backend_info_set_username(livetv->tvchain->backend_info,
  23.822 +									  "mythtv");
  23.823 +	  gmyth_backend_info_set_password(livetv->tvchain->backend_info,
  23.824 +									  "mythtv");
  23.825 +	  gmyth_backend_info_set_db_name(livetv->tvchain->backend_info,
  23.826 +									 "mythconverg");
  23.827 +	  GList *prog_list =
  23.828 +		gmyth_tvchain_get_program_info_from_channel(livetv->tvchain,
  23.829 +													channel);
  23.830 +	  GMythProgramInfo *ch_prog = NULL;
  23.831  
  23.832 -		if (prog_list != NULL && g_list_length (prog_list) > 0) {
  23.833 -			ch_prog = (GMythProgramInfo *) g_list_nth_data (prog_list, 0);
  23.834 -			gmyth_debug ("Channel program info (from a list with size = %d)!",
  23.835 -					g_list_length (prog_list));
  23.836 -			gmyth_program_info_print (ch_prog);
  23.837 +	  if (prog_list != NULL && g_list_length(prog_list) > 0)
  23.838 +		{
  23.839 +		  ch_prog = (GMythProgramInfo *) g_list_nth_data(prog_list, 0);
  23.840 +		  gmyth_debug("Channel program info (from a list with size = %d)!",
  23.841 +					  g_list_length(prog_list));
  23.842 +		  gmyth_program_info_print(ch_prog);
  23.843  		}
  23.844  
  23.845 -		gmyth_debug ("Program Info: %s\n",
  23.846 -				gmyth_program_info_to_string (prog_info));
  23.847 -		livetv->proginfo = prog_info;
  23.848 -		/* testing change channel */
  23.849 -		//gmyth_recorder_spawntv_no_tvchain( livetv->recorder );
  23.850 -	} else {
  23.851 +	  gmyth_debug("Program Info: %s\n",
  23.852 +				  gmyth_program_info_to_string(prog_info));
  23.853 +	  livetv->proginfo = prog_info;
  23.854 +	 /* testing change channel */
  23.855 +	 //gmyth_recorder_spawntv_no_tvchain( livetv->recorder );
  23.856 +	}
  23.857 +  else
  23.858 +	{
  23.859  
  23.860 -		/* check for the program info in the TV program chain could be obtained 
  23.861 -		   from the MythTV MySQL database */
  23.862 +	 /* check for the program info in the TV program chain could be obtained 
  23.863 +	    from the MythTV MySQL database */
  23.864  
  23.865 -		/* Reload all TV chain from Mysql database. */
  23.866 -		gmyth_tvchain_reload_all (livetv->tvchain);
  23.867 +	 /* Reload all TV chain from Mysql database. */
  23.868 +	  gmyth_tvchain_reload_all(livetv->tvchain);
  23.869  
  23.870 -		if (livetv->tvchain == NULL) {
  23.871 -			res = FALSE;
  23.872 -			goto error;
  23.873 +	  if (livetv->tvchain == NULL)
  23.874 +		{
  23.875 +		  res = FALSE;
  23.876 +		  goto error;
  23.877  		}
  23.878  
  23.879 -		/* Get program info from database using chanid and starttime */
  23.880 -		livetv->proginfo =
  23.881 -			gmyth_tvchain_get_program_at (livetv->tvchain,
  23.882 -					tvchain_curr_index++);
  23.883 -		if (livetv->proginfo == NULL) {
  23.884 -			gmyth_debug ("LiveTV not successfully started.\n");
  23.885 -			res = FALSE;
  23.886 -			goto error;
  23.887 -		} else {
  23.888 -			res = TRUE;
  23.889 -			gmyth_debug
  23.890 -				("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n",
  23.891 -				 livetv->proginfo->pathname->str);
  23.892 +	 /* Get program info from database using chanid and starttime */
  23.893 +	  livetv->proginfo =
  23.894 +		gmyth_tvchain_get_program_at(livetv->tvchain, tvchain_curr_index++);
  23.895 +	  if (livetv->proginfo == NULL)
  23.896 +		{
  23.897 +		  gmyth_debug("LiveTV not successfully started.\n");
  23.898 +		  res = FALSE;
  23.899 +		  goto error;
  23.900 +		}
  23.901 +	  else
  23.902 +		{
  23.903 +		  res = TRUE;
  23.904 +		  gmyth_debug
  23.905 +			("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n",
  23.906 +			 livetv->proginfo->pathname->str);
  23.907  		}
  23.908  
  23.909  	}
  23.910  
  23.911 -	livetv->uri =
  23.912 -		(GMythURI *) gmyth_backend_info_get_uri (livetv->backend_info);
  23.913 +  livetv->uri = (GMythURI *) gmyth_backend_info_get_uri(livetv->backend_info);
  23.914  
  23.915 -	g_mutex_unlock (livetv->mutex);
  23.916 +  g_mutex_unlock(livetv->mutex);
  23.917  
  23.918 -	if (!gmyth_livetv_monitor_handler_start (livetv)) {
  23.919 -		res = FALSE;
  23.920 -		gmyth_debug ("LiveTV MONITOR handler error on setup!");
  23.921 -		goto error;
  23.922 +  if (!gmyth_livetv_monitor_handler_start(livetv))
  23.923 +	{
  23.924 +	  res = FALSE;
  23.925 +	  gmyth_debug("LiveTV MONITOR handler error on setup!");
  23.926 +	  goto error;
  23.927  	}
  23.928  
  23.929 -	livetv->setup_done = TRUE;
  23.930 +  livetv->setup_done = TRUE;
  23.931  
  23.932 -	return res;
  23.933 +  return res;
  23.934  
  23.935  error:
  23.936 -	g_mutex_unlock (livetv->mutex);
  23.937 +  g_mutex_unlock(livetv->mutex);
  23.938  
  23.939 -	gmyth_debug ("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.940 +  gmyth_debug("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.941  
  23.942 -	res = FALSE;
  23.943 +  res = FALSE;
  23.944  
  23.945 -	if (livetv->local_hostname != NULL) {
  23.946 -		g_string_free (livetv->local_hostname, TRUE);
  23.947 -		livetv->local_hostname = NULL;
  23.948 +  if (livetv->local_hostname != NULL)
  23.949 +	{
  23.950 +	  g_string_free(livetv->local_hostname, TRUE);
  23.951 +	  livetv->local_hostname = NULL;
  23.952  	}
  23.953  
  23.954 -	gmyth_debug ("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.955 +  gmyth_debug("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.956  
  23.957 -	if (livetv->recorder != NULL) {
  23.958 -		g_object_unref (livetv->recorder);
  23.959 -		livetv->recorder = NULL;
  23.960 +  if (livetv->recorder != NULL)
  23.961 +	{
  23.962 +	  g_object_unref(livetv->recorder);
  23.963 +	  livetv->recorder = NULL;
  23.964  	}
  23.965  
  23.966 -	gmyth_debug ("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.967 +  gmyth_debug("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.968  
  23.969 -	if (livetv->tvchain != NULL) {
  23.970 -		g_object_unref (livetv->tvchain);
  23.971 -		livetv->tvchain = NULL;
  23.972 +  if (livetv->tvchain != NULL)
  23.973 +	{
  23.974 +	  g_object_unref(livetv->tvchain);
  23.975 +	  livetv->tvchain = NULL;
  23.976  	}
  23.977  
  23.978 -	gmyth_debug ("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.979 +  gmyth_debug("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.980  
  23.981 -	if (livetv->proginfo != NULL) {
  23.982 -		g_object_unref (livetv->proginfo);
  23.983 -		livetv->proginfo = NULL;
  23.984 +  if (livetv->proginfo != NULL)
  23.985 +	{
  23.986 +	  g_object_unref(livetv->proginfo);
  23.987 +	  livetv->proginfo = NULL;
  23.988  	}
  23.989  
  23.990 -	gmyth_debug ("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.991 +  gmyth_debug("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
  23.992  
  23.993 -	if (livetv->monitor != NULL) {
  23.994 -		g_object_unref (livetv->monitor);
  23.995 -		livetv->monitor = NULL;
  23.996 +  if (livetv->monitor != NULL)
  23.997 +	{
  23.998 +	  g_object_unref(livetv->monitor);
  23.999 +	  livetv->monitor = NULL;
 23.1000  	}
 23.1001  
 23.1002  
 23.1003 -	gmyth_debug ("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
 23.1004 +  gmyth_debug("[%s] ERROR running LiveTV setup.\n", __FUNCTION__);
 23.1005  
 23.1006 -	return res;
 23.1007 +  return res;
 23.1008  
 23.1009  }
 23.1010  
 23.1011 @@ -657,12 +714,14 @@
 23.1012   * @return <code>true</code> if the LiveTV's recorder instance configuration 
 23.1013   * 				had been concluded succcesfully 
 23.1014   */
 23.1015 -	static gboolean
 23.1016 -gmyth_livetv_setup_recorder (GMythLiveTV * livetv, gint channel)
 23.1017 +static gboolean
 23.1018 +gmyth_livetv_setup_recorder(GMythLiveTV * livetv, gint channel)
 23.1019  {
 23.1020 -	return gmyth_livetv_setup_recorder_channel_name (livetv,
 23.1021 -			(channel != -1) ? g_strdup_printf ("%d", channel)
 23.1022 -			: NULL);
 23.1023 +  return gmyth_livetv_setup_recorder_channel_name(livetv,
 23.1024 +												  (channel !=
 23.1025 +												   -1) ? g_strdup_printf("%d",
 23.1026 +																		 channel)
 23.1027 +												  : NULL);
 23.1028  }
 23.1029  
 23.1030  /**
 23.1031 @@ -677,10 +736,10 @@
 23.1032   * @return <code>true</code> if the LiveTV's recorder instance configuration 
 23.1033   * 				had been concluded succcesfully 
 23.1034   */
 23.1035 -	gboolean
 23.1036 -gmyth_livetv_channel_setup (GMythLiveTV * livetv, gint channel)
 23.1037 +gboolean
 23.1038 +gmyth_livetv_channel_setup(GMythLiveTV * livetv, gint channel)
 23.1039  {
 23.1040 -	return gmyth_livetv_setup_recorder (livetv, channel);
 23.1041 +  return gmyth_livetv_setup_recorder(livetv, channel);
 23.1042  }
 23.1043  
 23.1044  /**
 23.1045 @@ -695,10 +754,10 @@
 23.1046   * @return <code>true</code> if the LiveTV's recorder instance configuration 
 23.1047   * 				had been concluded succcesfully 
 23.1048   */
 23.1049 -	gboolean
 23.1050 -gmyth_livetv_channel_name_setup (GMythLiveTV * livetv, gchar * channel)
 23.1051 +gboolean
 23.1052 +gmyth_livetv_channel_name_setup(GMythLiveTV * livetv, gchar * channel)
 23.1053  {
 23.1054 -	return gmyth_livetv_setup_recorder_channel_name (livetv, channel);
 23.1055 +  return gmyth_livetv_setup_recorder_channel_name(livetv, channel);
 23.1056  }
 23.1057  
 23.1058  /**
 23.1059 @@ -712,10 +771,10 @@
 23.1060   * @return <code>true</code> if the LiveTV's recorder instance configuration 
 23.1061   * 				had been concluded succcesfully 
 23.1062   */
 23.1063 -	gboolean
 23.1064 -gmyth_livetv_setup (GMythLiveTV * livetv)
 23.1065 +gboolean
 23.1066 +gmyth_livetv_setup(GMythLiveTV * livetv)
 23.1067  {
 23.1068 -	return gmyth_livetv_setup_recorder (livetv, -1);
 23.1069 +  return gmyth_livetv_setup_recorder(livetv, -1);
 23.1070  }
 23.1071  
 23.1072  /**
 23.1073 @@ -725,72 +784,82 @@
 23.1074   * 
 23.1075   * @return <code>true</code> if the next program info could be got 
 23.1076   */
 23.1077 -	gboolean
 23.1078 -gmyth_livetv_next_program_chain (GMythLiveTV * livetv)
 23.1079 +gboolean
 23.1080 +gmyth_livetv_next_program_chain(GMythLiveTV * livetv)
 23.1081  {
 23.1082 -	gboolean res = TRUE;
 23.1083 -	GMythProgramInfo *prog_info = NULL;
 23.1084 +  gboolean res = TRUE;
 23.1085 +  GMythProgramInfo *prog_info = NULL;
 23.1086  
 23.1087 -	if (!livetv->setup_done) {
 23.1088 -		gmyth_debug ("Call the setup function first!");
 23.1089 -		goto error;
 23.1090 +  if (!livetv->setup_done)
 23.1091 +	{
 23.1092 +	  gmyth_debug("Call the setup function first!");
 23.1093 +	  goto error;
 23.1094  	}
 23.1095  
 23.1096 -	gmyth_debug ("Current ProgramInfo...\n");
 23.1097 -	prog_info = gmyth_recorder_get_current_program_info (livetv->recorder);
 23.1098 +  gmyth_debug("Current ProgramInfo...\n");
 23.1099 +  prog_info = gmyth_recorder_get_current_program_info(livetv->recorder);
 23.1100  
 23.1101 -	if (prog_info != NULL) {
 23.1102 -		livetv->proginfo = prog_info;
 23.1103 -	} else {
 23.1104 -		gmyth_debug
 23.1105 -			("ProgramInfo equals to NULL!!! Getting the next program info...");
 23.1106 -		prog_info =
 23.1107 -			gmyth_recorder_get_next_program_info (livetv->recorder,
 23.1108 -					BROWSE_DIRECTION_RIGHT);
 23.1109 -		livetv->proginfo = prog_info;
 23.1110 +  if (prog_info != NULL)
 23.1111 +	{
 23.1112 +	  livetv->proginfo = prog_info;
 23.1113  	}
 23.1114 -	/* prints program info data text */
 23.1115 -	gmyth_program_info_print (prog_info);
 23.1116 +  else
 23.1117 +	{
 23.1118 +	  gmyth_debug
 23.1119 +		("ProgramInfo equals to NULL!!! Getting the next program info...");
 23.1120 +	  prog_info =
 23.1121 +		gmyth_recorder_get_next_program_info(livetv->recorder,
 23.1122 +											 BROWSE_DIRECTION_RIGHT);
 23.1123 +	  livetv->proginfo = prog_info;
 23.1124 +	}
 23.1125 + /* prints program info data text */
 23.1126 +  gmyth_program_info_print(prog_info);
 23.1127  
 23.1128 -	if (prog_info != NULL) {
 23.1129 -		res = TRUE;
 23.1130 -		livetv->proginfo = prog_info;
 23.1131 -		gmyth_debug
 23.1132 -			("GMythLiveTV: All requests to backend to start TV were OK, program info changed.");
 23.1133 -	} else {
 23.1134 -		gmyth_debug
 23.1135 -			("[%s] LiveTV not successfully started on the next program chain.\n",
 23.1136 -			 __FUNCTION__);
 23.1137 -		goto error;
 23.1138 +  if (prog_info != NULL)
 23.1139 +	{
 23.1140 +	  res = TRUE;
 23.1141 +	  livetv->proginfo = prog_info;
 23.1142 +	  gmyth_debug
 23.1143 +		("GMythLiveTV: All requests to backend to start TV were OK, program info changed.");
 23.1144 +	}
 23.1145 +  else
 23.1146 +	{
 23.1147 +	  gmyth_debug
 23.1148 +		("[%s] LiveTV not successfully started on the next program chain.\n",
 23.1149 +		 __FUNCTION__);
 23.1150 +	  goto error;
 23.1151  	}
 23.1152  
 23.1153 -	livetv->setup_done = TRUE;
 23.1154 +  livetv->setup_done = TRUE;
 23.1155  
 23.1156 -	return res;
 23.1157 +  return res;
 23.1158  
 23.1159  error:
 23.1160 -	gmyth_debug ("ERROR running LiveTV setup.\n");
 23.1161 +  gmyth_debug("ERROR running LiveTV setup.\n");
 23.1162  
 23.1163 -	res = FALSE;
 23.1164 +  res = FALSE;
 23.1165  
 23.1166 -	g_string_free (livetv->local_hostname, TRUE);
 23.1167 +  g_string_free(livetv->local_hostname, TRUE);
 23.1168  
 23.1169 -	if (livetv->recorder != NULL) {
 23.1170 -		g_object_unref (livetv->recorder);
 23.1171 -		livetv->recorder = NULL;
 23.1172 +  if (livetv->recorder != NULL)
 23.1173 +	{
 23.1174 +	  g_object_unref(livetv->recorder);
 23.1175 +	  livetv->recorder = NULL;
 23.1176  	}
 23.1177  
 23.1178 -	if (livetv->tvchain != NULL) {
 23.1179 -		g_object_unref (livetv->tvchain);
 23.1180 -		livetv->tvchain = NULL;
 23.1181 +  if (livetv->tvchain != NULL)
 23.1182 +	{
 23.1183 +	  g_object_unref(livetv->tvchain);
 23.1184 +	  livetv->tvchain = NULL;
 23.1185  	}
 23.1186  
 23.1187 -	if (livetv->proginfo != NULL) {
 23.1188 -		g_object_unref (livetv->proginfo);
 23.1189 -		livetv->proginfo = NULL;
 23.1190 +  if (livetv->proginfo != NULL)
 23.1191 +	{
 23.1192 +	  g_object_unref(livetv->proginfo);
 23.1193 +	  livetv->proginfo = NULL;
 23.1194  	}
 23.1195  
 23.1196 -	return res;
 23.1197 +  return res;
 23.1198  }
 23.1199  
 23.1200  /**
 23.1201 @@ -802,85 +871,92 @@
 23.1202   * @return the actual GMythFileTransfer instance, generated using the
 23.1203   * 		data got from the actual program info.
 23.1204   */
 23.1205 -	GMythFile *
 23.1206 -gmyth_livetv_create_file_transfer (GMythLiveTV * livetv)
 23.1207 +GMythFile *
 23.1208 +gmyth_livetv_create_file_transfer(GMythLiveTV * livetv)
 23.1209  {
 23.1210 -	//GMythURI* uri = NULL;
 23.1211 + //GMythURI* uri = NULL;
 23.1212  
 23.1213 -	if (NULL == livetv)
 23.1214 -		goto done;
 23.1215 +  if (NULL == livetv)
 23.1216 +	goto done;
 23.1217  
 23.1218 -	if (!livetv->setup_done) {
 23.1219 -		gmyth_debug
 23.1220 -			("Error: You must do the LiveTV setup, just before generating the FileTransfer from LiveTV source!");
 23.1221 -		goto done;
 23.1222 +  if (!livetv->setup_done)
 23.1223 +	{
 23.1224 +	  gmyth_debug
 23.1225 +		("Error: You must do the LiveTV setup, just before generating the FileTransfer from LiveTV source!");
 23.1226 +	  goto done;
 23.1227  	}
 23.1228  
 23.1229 -	if (livetv->proginfo != NULL)
 23.1230 -		gmyth_debug ("URI path (from program info) = %s.\n",
 23.1231 +  if (livetv->proginfo != NULL)
 23.1232 +	gmyth_debug("URI path (from program info) = %s.\n",
 23.1233  				livetv->proginfo->pathname->str);
 23.1234 -	else
 23.1235 -		gmyth_debug ("URI path (from URI) = %s.\n", livetv->uri->uri->str);
 23.1236 +  else
 23.1237 +	gmyth_debug("URI path (from URI) = %s.\n", livetv->uri->uri->str);
 23.1238  
 23.1239 -	g_mutex_lock (livetv->mutex);
 23.1240 +  g_mutex_lock(livetv->mutex);
 23.1241  
 23.1242 -	if (livetv->file != NULL) {
 23.1243 -		/*gmyth_file_transfer_close( livetv->file ); */
 23.1244 -		g_object_unref (livetv->file);
 23.1245 -		livetv->file = NULL;
 23.1246 +  if (livetv->file != NULL)
 23.1247 +	{
 23.1248 +	 /*gmyth_file_transfer_close( livetv->file ); */
 23.1249 +	  g_object_unref(livetv->file);
 23.1250 +	  livetv->file = NULL;
 23.1251  	}
 23.1252  
 23.1253 -	if (livetv->uri != NULL) {
 23.1254 -		gmyth_debug
 23.1255 -			("URI is not NULL, creating from the ProgramInfo pathname... (%s)",
 23.1256 -			 livetv->proginfo->pathname->str);
 23.1257 -		livetv->uri->path = g_string_erase (livetv->uri->path, 0, -1);
 23.1258 -		livetv->uri->path =
 23.1259 -			g_string_new (g_strrstr (livetv->proginfo->pathname->str, "/"));
 23.1260 -	} else {
 23.1261 -		gmyth_debug
 23.1262 -			("URI is NULL, creating from the ProgramInfo pathname... (%s)",
 23.1263 -			 livetv->proginfo->pathname->str);
 23.1264 -		livetv->uri =
 23.1265 -			gmyth_uri_new_with_value (livetv->proginfo->pathname->str);
 23.1266 +  if (livetv->uri != NULL)
 23.1267 +	{
 23.1268 +	  gmyth_debug
 23.1269 +		("URI is not NULL, creating from the ProgramInfo pathname... (%s)",
 23.1270 +		 livetv->proginfo->pathname->str);
 23.1271 +	  livetv->uri->path = g_string_erase(livetv->uri->path, 0, -1);
 23.1272 +	  livetv->uri->path =
 23.1273 +		g_string_new(g_strrstr(livetv->proginfo->pathname->str, "/"));
 23.1274 +	}
 23.1275 +  else
 23.1276 +	{
 23.1277 +	  gmyth_debug
 23.1278 +		("URI is NULL, creating from the ProgramInfo pathname... (%s)",
 23.1279 +		 livetv->proginfo->pathname->str);
 23.1280 +	  livetv->uri = gmyth_uri_new_with_value(livetv->proginfo->pathname->str);
 23.1281  	}
 23.1282  
 23.1283 -	if (NULL == livetv->uri) {
 23.1284 -		gmyth_debug ("Couldn't parse the URI to start LiveTV! [ uri = %s ]",
 23.1285 -				livetv->proginfo->pathname->str);
 23.1286 -		goto done;
 23.1287 +  if (NULL == livetv->uri)
 23.1288 +	{
 23.1289 +	  gmyth_debug("Couldn't parse the URI to start LiveTV! [ uri = %s ]",
 23.1290 +				  livetv->proginfo->pathname->str);
 23.1291 +	  goto done;
 23.1292  	}
 23.1293  
 23.1294 -	if (gmyth_uri_is_local_file (livetv->uri))
 23.1295 -		livetv->file = GMYTH_FILE (gmyth_file_local_new (livetv->backend_info));
 23.1296 -	else {
 23.1297 -		livetv->file =
 23.1298 -			GMYTH_FILE (gmyth_file_transfer_new (livetv->backend_info));
 23.1299 -		/* gmyth_file_transfer_settimeout( GMYTH_FILE_TRANSFER(livetv->file), TRUE ); */
 23.1300 +  if (gmyth_uri_is_local_file(livetv->uri))
 23.1301 +	livetv->file = GMYTH_FILE(gmyth_file_local_new(livetv->backend_info));
 23.1302 +  else
 23.1303 +	{
 23.1304 +	  livetv->file =
 23.1305 +		GMYTH_FILE(gmyth_file_transfer_new(livetv->backend_info));
 23.1306 +	 /* gmyth_file_transfer_settimeout( GMYTH_FILE_TRANSFER(livetv->file), TRUE ); */
 23.1307  	}
 23.1308  
 23.1309 -	if (NULL == livetv->file) {
 23.1310 -		gmyth_debug
 23.1311 -			("Error: couldn't create the FileTransfer from LiveTV source!");
 23.1312 -		goto done;
 23.1313 +  if (NULL == livetv->file)
 23.1314 +	{
 23.1315 +	  gmyth_debug
 23.1316 +		("Error: couldn't create the FileTransfer from LiveTV source!");
 23.1317 +	  goto done;
 23.1318  	}
 23.1319  
 23.1320 -	g_object_ref (livetv->file);
 23.1321 +  g_object_ref(livetv->file);
 23.1322  
 23.1323 -	g_mutex_unlock (livetv->mutex);
 23.1324 +  g_mutex_unlock(livetv->mutex);
 23.1325  
 23.1326 -	/* Do some locking procedure with the Monitor Handler messages... */
 23.1327 + /* Do some locking procedure with the Monitor Handler messages... */
 23.1328  
 23.1329  done:
 23.1330 -	/*
 23.1331 -	   if ( uri != NULL )
 23.1332 -	   {
 23.1333 -	   g_object_unref( uri );
 23.1334 -	   uri = NULL;
 23.1335 -	   }
 23.1336 -	   */
 23.1337 + /*
 23.1338 +    if ( uri != NULL )
 23.1339 +    {
 23.1340 +    g_object_unref( uri );
 23.1341 +    uri = NULL;
 23.1342 +    }
 23.1343 +  */
 23.1344  
 23.1345 -	return livetv->file;
 23.1346 +  return livetv->file;
 23.1347  
 23.1348  }
 23.1349  
 23.1350 @@ -889,35 +965,38 @@
 23.1351   * 
 23.1352   * @param live_tv the GMythLiveTV instance
 23.1353   */
 23.1354 -	void
 23.1355 -gmyth_livetv_stop_playing (GMythLiveTV * livetv)
 23.1356 +void
 23.1357 +gmyth_livetv_stop_playing(GMythLiveTV * livetv)
 23.1358  {
 23.1359 -	gmyth_debug ("Stopping the LiveTV...\n");
 23.1360 +  gmyth_debug("Stopping the LiveTV...\n");
 23.1361  
 23.1362 -	if (livetv->is_livetv) {
 23.1363 -		if (!gmyth_recorder_stop_livetv (livetv->recorder)) {
 23.1364 -			gmyth_debug ("[%s] Error while stoping remote encoder",
 23.1365 -					__FUNCTION__);
 23.1366 +  if (livetv->is_livetv)
 23.1367 +	{
 23.1368 +	  if (!gmyth_recorder_stop_livetv(livetv->recorder))
 23.1369 +		{
 23.1370 +		  gmyth_debug("[%s] Error while stoping remote encoder",
 23.1371 +					  __FUNCTION__);
 23.1372  		}
 23.1373  
 23.1374 -		if (!gmyth_recorder_finish_recording (livetv->recorder)) {
 23.1375 -			gmyth_debug
 23.1376 -				("[%s] Error while finishing recording on remote encoder",
 23.1377 -				 __FUNCTION__);
 23.1378 +	  if (!gmyth_recorder_finish_recording(livetv->recorder))
 23.1379 +		{
 23.1380 +		  gmyth_debug
 23.1381 +			("[%s] Error while finishing recording on remote encoder",
 23.1382 +			 __FUNCTION__);
 23.1383  		}
 23.1384  	}
 23.1385  }
 23.1386  
 23.1387 -	gboolean
 23.1388 -gmyth_livetv_is_playing (GMythLiveTV * livetv)
 23.1389 +gboolean
 23.1390 +gmyth_livetv_is_playing(GMythLiveTV * livetv)
 23.1391  {
 23.1392 -	return TRUE;
 23.1393 +  return TRUE;
 23.1394  }
 23.1395  
 23.1396 -	void
 23.1397 -gmyth_livetv_start_playing (GMythLiveTV * livetv)
 23.1398 +void
 23.1399 +gmyth_livetv_start_playing(GMythLiveTV * livetv)
 23.1400  {
 23.1401  
 23.1402 -	// TODO
 23.1403 + // TODO
 23.1404  
 23.1405  }
    24.1 --- a/gmyth/src/gmyth_livetv.h	Wed Jun 13 18:18:42 2007 +0100
    24.2 +++ b/gmyth/src/gmyth_livetv.h	Thu Jun 14 18:19:52 2007 +0100
    24.3 @@ -48,55 +48,55 @@
    24.4  typedef struct _GMythLiveTVClass GMythLiveTVClass;
    24.5  
    24.6  struct _GMythLiveTVClass
    24.7 -    {
    24.8 -        GObjectClass parent_class;
    24.9 +{
   24.10 +  GObjectClass parent_class;
   24.11  
   24.12 -        /* callbacks */
   24.13 -    };
   24.14 + /* callbacks */
   24.15 +};
   24.16  
   24.17  struct _GMythLiveTV
   24.18 -    {
   24.19 -        GObject parent;
   24.20 +{
   24.21 +  GObject parent;
   24.22  
   24.23 -        GMythSocket *socket;
   24.24 +  GMythSocket *socket;
   24.25  
   24.26 -        GString *local_hostname;
   24.27 +  GString *local_hostname;
   24.28  
   24.29 -        GMythBackendInfo *backend_info;
   24.30 +  GMythBackendInfo *backend_info;
   24.31  
   24.32 -        GMythRecorder *recorder;
   24.33 -        GMythTVChain *tvchain;
   24.34 -        GMythProgramInfo *proginfo;
   24.35 +  GMythRecorder *recorder;
   24.36 +  GMythTVChain *tvchain;
   24.37 +  GMythProgramInfo *proginfo;
   24.38  
   24.39 -        GMythFile *file;
   24.40 +  GMythFile *file;
   24.41  
   24.42 -        GMythMonitorHandler *monitor;
   24.43 -        GMythURI *uri;
   24.44 +  GMythMonitorHandler *monitor;
   24.45 +  GMythURI *uri;
   24.46  
   24.47 -        gboolean is_livetv;
   24.48 -        gboolean setup_done;
   24.49 +  gboolean is_livetv;
   24.50 +  gboolean setup_done;
   24.51  
   24.52 -        GMutex *mutex;
   24.53 -        gboolean disposed;
   24.54 -    };
   24.55 +  GMutex *mutex;
   24.56 +  gboolean disposed;
   24.57 +};
   24.58  
   24.59 -GType gmyth_livetv_get_type ( void );
   24.60 +GType gmyth_livetv_get_type(void);
   24.61  
   24.62 -GMythLiveTV *gmyth_livetv_new ( GMythBackendInfo * backend_info );
   24.63 +GMythLiveTV *gmyth_livetv_new(GMythBackendInfo * backend_info);
   24.64  
   24.65 -void gmyth_livetv_start_playing ( GMythLiveTV * livetv );
   24.66 -void gmyth_livetv_stop_playing ( GMythLiveTV * livetv );
   24.67 +void gmyth_livetv_start_playing(GMythLiveTV * livetv);
   24.68 +void gmyth_livetv_stop_playing(GMythLiveTV * livetv);
   24.69  
   24.70 -gboolean gmyth_livetv_setup ( GMythLiveTV * livetv );
   24.71 -gboolean gmyth_livetv_channel_setup ( GMythLiveTV * livetv, gint channel );
   24.72 -gboolean gmyth_livetv_channel_name_setup ( GMythLiveTV * livetv,
   24.73 -                                           gchar * channel );
   24.74 -gboolean gmyth_livetv_next_program_chain ( GMythLiveTV * livetv );
   24.75 +gboolean gmyth_livetv_setup(GMythLiveTV * livetv);
   24.76 +gboolean gmyth_livetv_channel_setup(GMythLiveTV * livetv, gint channel);
   24.77 +gboolean gmyth_livetv_channel_name_setup(GMythLiveTV * livetv,
   24.78 +										 gchar * channel);
   24.79 +gboolean gmyth_livetv_next_program_chain(GMythLiveTV * livetv);
   24.80  
   24.81 -GMythFile *gmyth_livetv_create_file_transfer ( GMythLiveTV * livetv );
   24.82 +GMythFile *gmyth_livetv_create_file_transfer(GMythLiveTV * livetv);
   24.83  
   24.84 -gboolean gmyth_livetv_monitor_handler_start ( GMythLiveTV * livetv );
   24.85 -void gmyth_livetv_monitor_handler_stop ( GMythLiveTV * livetv );
   24.86 +gboolean gmyth_livetv_monitor_handler_start(GMythLiveTV * livetv);
   24.87 +void gmyth_livetv_monitor_handler_stop(GMythLiveTV * livetv);
   24.88  
   24.89  G_END_DECLS
   24.90  #endif /*GMYTH_LIVETV_H_ */
    25.1 --- a/gmyth/src/gmyth_monitor_handler.c	Wed Jun 13 18:18:42 2007 +0100
    25.2 +++ b/gmyth/src/gmyth_monitor_handler.c	Thu Jun 14 18:19:52 2007 +0100
    25.3 @@ -68,138 +68,138 @@
    25.4  #define GMYTHTV_ENABLE_DEBUG				1
    25.5  #endif
    25.6  
    25.7 -gpointer gmyth_monitor_handler_listener ( gpointer data );
    25.8 +gpointer gmyth_monitor_handler_listener(gpointer data);
    25.9  
   25.10 -static void gmyth_monitor_handler_default_listener ( GMythMonitorHandler *
   25.11 -                                                     monitor, gint msg_code,
   25.12 -                                                     gchar * message );
   25.13 +static void gmyth_monitor_handler_default_listener(GMythMonitorHandler *
   25.14 +												   monitor, gint msg_code,
   25.15 +												   gchar * message);
   25.16  
   25.17 -static void gmyth_monitor_handler_class_init ( GMythMonitorHandlerClass *
   25.18 -                                               klass );
   25.19 -static void gmyth_monitor_handler_init ( GMythMonitorHandler * object );
   25.20 +static void gmyth_monitor_handler_class_init(GMythMonitorHandlerClass *
   25.21 +											 klass);
   25.22 +static void gmyth_monitor_handler_init(GMythMonitorHandler * object);
   25.23  
   25.24 -static void gmyth_monitor_handler_dispose ( GObject * object );
   25.25 -static void gmyth_monitor_handler_finalize ( GObject * object );
   25.26 +static void gmyth_monitor_handler_dispose(GObject * object);
   25.27 +static void gmyth_monitor_handler_finalize(GObject * object);
   25.28  
   25.29 -static gboolean gmyth_connect_to_backend_monitor ( GMythMonitorHandler *
   25.30 -                                                   monitor );
   25.31 +static gboolean gmyth_connect_to_backend_monitor(GMythMonitorHandler *
   25.32 +												 monitor);
   25.33  
   25.34 -static gboolean gmyth_monitor_handler_setup ( GMythMonitorHandler * monitor,
   25.35 -                                              GIOChannel * channel );
   25.36 +static gboolean gmyth_monitor_handler_setup(GMythMonitorHandler * monitor,
   25.37 +											GIOChannel * channel);
   25.38  
   25.39 -void gmyth_monitor_handler_close ( GMythMonitorHandler * monitor );
   25.40 +void gmyth_monitor_handler_close(GMythMonitorHandler * monitor);
   25.41  
   25.42 -G_DEFINE_TYPE ( GMythMonitorHandler, gmyth_monitor_handler, G_TYPE_OBJECT )
   25.43 -     static void
   25.44 -         gmyth_monitor_handler_class_init ( GMythMonitorHandlerClass * klass )
   25.45 +G_DEFINE_TYPE(GMythMonitorHandler, gmyth_monitor_handler, G_TYPE_OBJECT)
   25.46 +	 static void
   25.47 +	   gmyth_monitor_handler_class_init(GMythMonitorHandlerClass * klass)
   25.48  {
   25.49 -    GObjectClass *gobject_class;
   25.50 -    GMythMonitorHandlerClass *gmonitor_class;
   25.51 +  GObjectClass *gobject_class;
   25.52 +  GMythMonitorHandlerClass *gmonitor_class;
   25.53  
   25.54 -    gobject_class = ( GObjectClass * ) klass;
   25.55 -    gmonitor_class = ( GMythMonitorHandlerClass * ) gobject_class;
   25.56 +  gobject_class = (GObjectClass *) klass;
   25.57 +  gmonitor_class = (GMythMonitorHandlerClass *) gobject_class;
   25.58  
   25.59 -    gobject_class->dispose = gmyth_monitor_handler_dispose;
   25.60 -    gobject_class->finalize = gmyth_monitor_handler_finalize;
   25.61 +  gobject_class->dispose = gmyth_monitor_handler_dispose;
   25.62 +  gobject_class->finalize = gmyth_monitor_handler_finalize;
   25.63  
   25.64 -    gmonitor_class->backend_events_handler_signal_id =
   25.65 -        g_signal_new ( "backend-events-handler",
   25.66 -                       G_TYPE_FROM_CLASS ( gmonitor_class ),
   25.67 -                       G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
   25.68 -                       G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
   25.69 -                       gmyth_marshal_VOID__INT_STRING, G_TYPE_NONE, 2,
   25.70 -                       G_TYPE_INT, G_TYPE_STRING );
   25.71 +  gmonitor_class->backend_events_handler_signal_id =
   25.72 +	g_signal_new("backend-events-handler",
   25.73 +				 G_TYPE_FROM_CLASS(gmonitor_class),
   25.74 +				 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
   25.75 +				 G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
   25.76 +				 gmyth_marshal_VOID__INT_STRING, G_TYPE_NONE, 2,
   25.77 +				 G_TYPE_INT, G_TYPE_STRING);
   25.78  
   25.79 -    gmonitor_class->backend_events_handler =
   25.80 -        gmyth_monitor_handler_default_listener;
   25.81 +  gmonitor_class->backend_events_handler =
   25.82 +	gmyth_monitor_handler_default_listener;
   25.83  
   25.84  }
   25.85  
   25.86  static void
   25.87 -gmyth_monitor_handler_init ( GMythMonitorHandler * monitor )
   25.88 +gmyth_monitor_handler_init(GMythMonitorHandler * monitor)
   25.89  {
   25.90 -    g_return_if_fail ( monitor != NULL );
   25.91 +  g_return_if_fail(monitor != NULL);
   25.92  
   25.93 -    monitor->event_sock = NULL;
   25.94 -    monitor->hostname = NULL;
   25.95 -    monitor->port = 0;
   25.96 -    monitor->actual_index = 0;
   25.97 +  monitor->event_sock = NULL;
   25.98 +  monitor->hostname = NULL;
   25.99 +  monitor->port = 0;
  25.100 +  monitor->actual_index = 0;
  25.101  
  25.102 -    monitor->allow_msgs_listener = FALSE;
  25.103 +  monitor->allow_msgs_listener = FALSE;
  25.104  
  25.105 -    /* monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal ); */
  25.106 + /* monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal ); */
  25.107  
  25.108 -    /* it is used for signalizing the event socket consumer thread */
  25.109 -    monitor->mutex = g_mutex_new (  );
  25.110 + /* it is used for signalizing the event socket consumer thread */
  25.111 +  monitor->mutex = g_mutex_new();
  25.112  
  25.113 -    monitor->th = NULL;
  25.114 +  monitor->th = NULL;
  25.115  
  25.116 -    monitor->gmyth_monitor_handler_listener = gmyth_monitor_handler_listener;
  25.117 +  monitor->gmyth_monitor_handler_listener = gmyth_monitor_handler_listener;
  25.118  }
  25.119  
  25.120  static void
  25.121 -gmyth_monitor_handler_dispose ( GObject * object )
  25.122 +gmyth_monitor_handler_dispose(GObject * object)
  25.123  {
  25.124 -    GMythMonitorHandler *monitor = GMYTH_MONITOR_HANDLER ( object );
  25.125 +  GMythMonitorHandler *monitor = GMYTH_MONITOR_HANDLER(object);
  25.126  
  25.127 -    gmyth_monitor_handler_close ( monitor );
  25.128 +  gmyth_monitor_handler_close(monitor);
  25.129  
  25.130 -    monitor->allow_msgs_listener = FALSE;
  25.131 +  monitor->allow_msgs_listener = FALSE;
  25.132  
  25.133 -    if ( monitor->th != NULL )
  25.134 +  if (monitor->th != NULL)
  25.135 +	{
  25.136 +	  gboolean *ret = (gboolean *) g_thread_join(monitor->th);
  25.137 +
  25.138 +	  if (*ret == FALSE)
  25.139 +		gmyth_debug("Error closing GThread listener socket!");
  25.140 +	  else
  25.141 +		gmyth_debug("Closed GThread listener socket.");
  25.142 +	 //g_object_unref( monitor->th );
  25.143 +	}
  25.144 +
  25.145 + /* mutex to control access to the event socket consumer thread */
  25.146 +  if (monitor->mutex != NULL)
  25.147 +	{
  25.148 +	 //g_mutex_unlock( monitor->mutex );
  25.149 +	  g_mutex_free(monitor->mutex);
  25.150 +	  monitor->mutex = NULL;
  25.151 +	}
  25.152 +
  25.153 +  if (monitor->event_sock != NULL)
  25.154 +	{
  25.155 +	  g_object_unref(monitor->event_sock);
  25.156 +	  monitor->event_sock = NULL;
  25.157 +	}
  25.158 +
  25.159 +  if (monitor->hostname != NULL)
  25.160 +	{
  25.161 +	  g_free(monitor->hostname);
  25.162 +	  monitor->hostname = NULL;
  25.163 +	}
  25.164 +
  25.165 +  if (monitor->backend_msgs != NULL)
  25.166 +	{
  25.167 +	  g_hash_table_destroy(monitor->backend_msgs);
  25.168 +	  monitor->backend_msgs = NULL;
  25.169 +	}
  25.170 +
  25.171 + /*
  25.172 +    if ( io_watcher_cond != NULL )  
  25.173      {
  25.174 -        gboolean *ret = ( gboolean * ) g_thread_join ( monitor->th );
  25.175 +    g_cond_free( io_watcher_cond );
  25.176 +    io_watcher_cond = NULL;
  25.177 +    }
  25.178 +  */
  25.179  
  25.180 -        if ( *ret == FALSE )
  25.181 -            gmyth_debug ( "Error closing GThread listener socket!" );
  25.182 -        else
  25.183 -            gmyth_debug ( "Closed GThread listener socket." );
  25.184 -        //g_object_unref( monitor->th );
  25.185 -    }
  25.186 -
  25.187 -    /* mutex to control access to the event socket consumer thread */
  25.188 -    if ( monitor->mutex != NULL )
  25.189 -    {
  25.190 -        //g_mutex_unlock( monitor->mutex );
  25.191 -        g_mutex_free ( monitor->mutex );
  25.192 -        monitor->mutex = NULL;
  25.193 -    }
  25.194 -
  25.195 -    if ( monitor->event_sock != NULL )
  25.196 -    {
  25.197 -        g_object_unref ( monitor->event_sock );
  25.198 -        monitor->event_sock = NULL;
  25.199 -    }
  25.200 -
  25.201 -    if ( monitor->hostname != NULL )
  25.202 -    {
  25.203 -        g_free ( monitor->hostname );
  25.204 -        monitor->hostname = NULL;
  25.205 -    }
  25.206 -
  25.207 -    if ( monitor->backend_msgs != NULL )
  25.208 -    {
  25.209 -        g_hash_table_destroy ( monitor->backend_msgs );
  25.210 -        monitor->backend_msgs = NULL;
  25.211 -    }
  25.212 -
  25.213 -    /*
  25.214 -       if ( io_watcher_cond != NULL )  
  25.215 -       {
  25.216 -       g_cond_free( io_watcher_cond );
  25.217 -       io_watcher_cond = NULL;
  25.218 -       }
  25.219 -     */
  25.220 -
  25.221 -    G_OBJECT_CLASS ( gmyth_monitor_handler_parent_class )->dispose ( object );
  25.222 +  G_OBJECT_CLASS(gmyth_monitor_handler_parent_class)->dispose(object);
  25.223  }
  25.224  
  25.225  static void
  25.226 -gmyth_monitor_handler_finalize ( GObject * object )
  25.227 +gmyth_monitor_handler_finalize(GObject * object)
  25.228  {
  25.229 -    g_signal_handlers_destroy ( object );
  25.230 +  g_signal_handlers_destroy(object);
  25.231  
  25.232 -    G_OBJECT_CLASS ( gmyth_monitor_handler_parent_class )->finalize ( object );
  25.233 +  G_OBJECT_CLASS(gmyth_monitor_handler_parent_class)->finalize(object);
  25.234  }
  25.235  
  25.236  /** 
  25.237 @@ -208,13 +208,12 @@
  25.238   * @return a new instance of the Monitor Handler. 
  25.239   */
  25.240  GMythMonitorHandler *
  25.241 -gmyth_monitor_handler_new ( void )
  25.242 +gmyth_monitor_handler_new(void)
  25.243  {
  25.244 -    GMythMonitorHandler *monitor =
  25.245 -        GMYTH_MONITOR_HANDLER ( g_object_new
  25.246 -                                ( GMYTH_MONITOR_HANDLER_TYPE, FALSE ) );
  25.247 +  GMythMonitorHandler *monitor =
  25.248 +	GMYTH_MONITOR_HANDLER(g_object_new(GMYTH_MONITOR_HANDLER_TYPE, FALSE));
  25.249  
  25.250 -    return monitor;
  25.251 +  return monitor;
  25.252  }
  25.253  
  25.254  /** 
  25.255 @@ -226,14 +225,14 @@
  25.256   * @return <code>true</code>, if the access to IO Watcher was acquired. 
  25.257   */
  25.258  static gboolean
  25.259 -myth_control_acquire_context ( GMythMonitorHandler * monitor, gboolean do_wait )
  25.260 +myth_control_acquire_context(GMythMonitorHandler * monitor, gboolean do_wait)
  25.261  {
  25.262  
  25.263 -    gboolean ret = TRUE;
  25.264 +  gboolean ret = TRUE;
  25.265  
  25.266 -    g_mutex_lock ( monitor->mutex );
  25.267 +  g_mutex_lock(monitor->mutex);
  25.268  
  25.269 -    return ret;
  25.270 +  return ret;
  25.271  
  25.272  }
  25.273  
  25.274 @@ -245,35 +244,35 @@
  25.275   * @return <code>true</code>, if the access to IO Watcher was released. 
  25.276   */
  25.277  static gboolean
  25.278 -myth_control_release_context ( GMythMonitorHandler * monitor )
  25.279 +myth_control_release_context(GMythMonitorHandler * monitor)
  25.280  {
  25.281  
  25.282 -    gboolean ret = TRUE;
  25.283 +  gboolean ret = TRUE;
  25.284  
  25.285 -    g_mutex_unlock ( monitor->mutex );
  25.286 +  g_mutex_unlock(monitor->mutex);
  25.287  
  25.288 -    return ret;
  25.289 +  return ret;
  25.290  }
  25.291  
  25.292  void
  25.293 -gmyth_monitor_handler_close ( GMythMonitorHandler * monitor )
  25.294 +gmyth_monitor_handler_close(GMythMonitorHandler * monitor)
  25.295  {
  25.296 -    monitor->allow_msgs_listener = FALSE;
  25.297 +  monitor->allow_msgs_listener = FALSE;
  25.298  
  25.299  #if 0
  25.300 -    if ( monitor->monitor_th != NULL )
  25.301 -    {
  25.302 -        g_thread_pool_free ( monitor->monitor_th, TRUE, FALSE );
  25.303 -        //g_thread_exit( monitor->monitor_th );
  25.304 -        /*if ( monitor->monitor_th != NULL )
  25.305 -           g_object_unref( monitor->monitor_th ); */
  25.306 -        monitor->monitor_th = NULL;
  25.307 -    }
  25.308 +  if (monitor->monitor_th != NULL)
  25.309 +	{
  25.310 +	  g_thread_pool_free(monitor->monitor_th, TRUE, FALSE);
  25.311 +	 //g_thread_exit( monitor->monitor_th );
  25.312 +	 /*if ( monitor->monitor_th != NULL )
  25.313 +	    g_object_unref( monitor->monitor_th ); */
  25.314 +	  monitor->monitor_th = NULL;
  25.315 +	}
  25.316  
  25.317 -    if ( monitor->event_sock != NULL )
  25.318 -    {
  25.319 -        gmyth_socket_close_connection ( monitor->event_sock );
  25.320 -    }
  25.321 +  if (monitor->event_sock != NULL)
  25.322 +	{
  25.323 +	  gmyth_socket_close_connection(monitor->event_sock);
  25.324 +	}
  25.325  #endif
  25.326  
  25.327  }
  25.328 @@ -289,53 +288,53 @@
  25.329   * @return <code>true</code>, if the connection was successfully opened.
  25.330   */
  25.331  gboolean
  25.332 -gmyth_monitor_handler_open ( GMythMonitorHandler * monitor,
  25.333 -                             const gchar * hostname, gint port )
  25.334 +gmyth_monitor_handler_open(GMythMonitorHandler * monitor,
  25.335 +						   const gchar * hostname, gint port)
  25.336  {
  25.337 -    gboolean ret = TRUE;
  25.338 +  gboolean ret = TRUE;
  25.339  
  25.340 -    g_return_val_if_fail ( hostname != NULL, FALSE );
  25.341 +  g_return_val_if_fail(hostname != NULL, FALSE);
  25.342  
  25.343 -    if ( monitor->hostname != NULL )
  25.344 -    {
  25.345 -        g_free ( monitor->hostname );
  25.346 -        monitor->hostname = NULL;
  25.347 -    }
  25.348 +  if (monitor->hostname != NULL)
  25.349 +	{
  25.350 +	  g_free(monitor->hostname);
  25.351 +	  monitor->hostname = NULL;
  25.352 +	}
  25.353  
  25.354 -    monitor->hostname = g_strdup ( hostname );
  25.355 -    monitor->port = port;
  25.356 +  monitor->hostname = g_strdup(hostname);
  25.357 +  monitor->port = port;
  25.358  
  25.359 -    gmyth_debug ( "Monitor event socket --- hostname: %s, port %d\n",
  25.360 -                  monitor->hostname, monitor->port );
  25.361 +  gmyth_debug("Monitor event socket --- hostname: %s, port %d\n",
  25.362 +			  monitor->hostname, monitor->port);
  25.363  
  25.364 -    if ( NULL != monitor->event_sock )
  25.365 -    {
  25.366 -        g_object_unref ( monitor->event_sock );
  25.367 -        monitor->event_sock = NULL;
  25.368 -    }
  25.369 +  if (NULL != monitor->event_sock)
  25.370 +	{
  25.371 +	  g_object_unref(monitor->event_sock);
  25.372 +	  monitor->event_sock = NULL;
  25.373 +	}
  25.374  
  25.375 -    /* configure the event socket */
  25.376 -    if ( NULL == monitor->event_sock )
  25.377 -    {
  25.378 -        if ( !gmyth_connect_to_backend_monitor ( monitor ) )
  25.379 -        {
  25.380 -            gmyth_debug ( "Connection to backend failed (Event Socket)!" );
  25.381 -            ret = FALSE;
  25.382 -        }
  25.383 -        else
  25.384 -        {
  25.385 -            gmyth_debug
  25.386 -                ( "Remote monitor event socket had been succesfully created. (io_fd == %d)\n",
  25.387 -                  g_io_channel_unix_get_fd ( monitor->event_sock->sd_io_ch ) );
  25.388 -        }
  25.389 -    }
  25.390 -    else
  25.391 -    {
  25.392 -        gmyth_debug
  25.393 -            ( "ASSERT ERROR: Remote monitor event socket is not NULL at the setup...\n" );
  25.394 -    }
  25.395 + /* configure the event socket */
  25.396 +  if (NULL == monitor->event_sock)
  25.397 +	{
  25.398 +	  if (!gmyth_connect_to_backend_monitor(monitor))
  25.399 +		{
  25.400 +		  gmyth_debug("Connection to backend failed (Event Socket)!");
  25.401 +		  ret = FALSE;
  25.402 +		}
  25.403 +	  else
  25.404 +		{
  25.405 +		  gmyth_debug
  25.406 +			("Remote monitor event socket had been succesfully created. (io_fd == %d)\n",
  25.407 +			 g_io_channel_unix_get_fd(monitor->event_sock->sd_io_ch));
  25.408 +		}
  25.409 +	}
  25.410 +  else
  25.411 +	{
  25.412 +	  gmyth_debug
  25.413 +		("ASSERT ERROR: Remote monitor event socket is not NULL at the setup...\n");
  25.414 +	}
  25.415  
  25.416 -    return ret;
  25.417 +  return ret;
  25.418  
  25.419  }
  25.420  
  25.421 @@ -350,100 +349,98 @@
  25.422   * @return The backend status message code ID.
  25.423   */
  25.424  static gint
  25.425 -gmyth_monitor_handler_is_backend_message ( GMythMonitorHandler * monitor,
  25.426 -                                           GMythStringList * strlist,
  25.427 -                                           gchar ** back_msg_action )
  25.428 +gmyth_monitor_handler_is_backend_message(GMythMonitorHandler * monitor,
  25.429 +										 GMythStringList * strlist,
  25.430 +										 gchar ** back_msg_action)
  25.431  {
  25.432 -    gint msg_type = GMYTH_BACKEND_NO_MESSAGE;
  25.433 -    GString *back_msg = NULL;
  25.434 +  gint msg_type = GMYTH_BACKEND_NO_MESSAGE;
  25.435 +  GString *back_msg = NULL;
  25.436  
  25.437 -    if ( gmyth_string_list_length ( strlist ) > 0 )
  25.438 -    {
  25.439 +  if (gmyth_string_list_length(strlist) > 0)
  25.440 +	{
  25.441  
  25.442 -        back_msg = gmyth_string_list_get_string ( strlist, 0 );
  25.443 -        if ( back_msg != NULL && back_msg->str != NULL &&
  25.444 -             strstr ( back_msg->str, "BACKEND" ) != NULL )
  25.445 -        {
  25.446 -            gmyth_debug ( "MONITOR HANDLER - Received backend message = %s",
  25.447 -                          back_msg->str );
  25.448 -            *back_msg_action = gmyth_string_list_get_char_array ( strlist, 1 );
  25.449 +	  back_msg = gmyth_string_list_get_string(strlist, 0);
  25.450 +	  if (back_msg != NULL && back_msg->str != NULL &&
  25.451 +		  strstr(back_msg->str, "BACKEND") != NULL)
  25.452 +		{
  25.453 +		  gmyth_debug("MONITOR HANDLER - Received backend message = %s",
  25.454 +					  back_msg->str);
  25.455 +		  *back_msg_action = gmyth_string_list_get_char_array(strlist, 1);
  25.456  
  25.457 -            if ( back_msg_action != NULL )
  25.458 -            {
  25.459 +		  if (back_msg_action != NULL)
  25.460 +			{
  25.461  
  25.462 -                if ( g_strstr_len
  25.463 -                     ( *back_msg_action, strlen ( *back_msg_action ),
  25.464 -                       "LIVETV_CHAIN" )
  25.465 -                     || g_strstr_len ( *back_msg_action,
  25.466 -                                       strlen ( *back_msg_action ),
  25.467 -                                       "RECORDING_LIST_CHANGE" )
  25.468 -                     || g_strstr_len ( *back_msg_action,
  25.469 -                                       strlen ( *back_msg_action ),
  25.470 -                                       "SCHEDULE_CHANGE" )
  25.471 -                     || g_strstr_len ( *back_msg_action,
  25.472 -                                       strlen ( *back_msg_action ),
  25.473 -                                       "LIVETV_WATCH" ) )
  25.474 -                {
  25.475 -                    gmyth_debug
  25.476 -                        ( "MONITOR: message type == GMYTH_BACKEND_PROGRAM_INFO_CHANGED, msg = %s",
  25.477 -                          *back_msg_action );
  25.478 -                    msg_type = GMYTH_BACKEND_PROGRAM_INFO_CHANGED;
  25.479 -                }
  25.480 -                else if ( g_strstr_len
  25.481 -                          ( *back_msg_action, strlen ( *back_msg_action ),
  25.482 -                            "DONE_RECORDING" ) )
  25.483 -                {
  25.484 -                    gmyth_debug
  25.485 -                        ( "MONITOR: message type == GMYTH_BACKEND_DONE_RECORDING, msg = %s",
  25.486 -                          *back_msg_action );
  25.487 -                    msg_type = GMYTH_BACKEND_DONE_RECORDING;
  25.488 -                }
  25.489 -                else if ( g_strstr_len
  25.490 -                          ( *back_msg_action, strlen ( *back_msg_action ),
  25.491 -                            "QUIT" ) )
  25.492 -                {
  25.493 -                    gmyth_debug
  25.494 -                        ( "MONITOR: message type == GMYTH_BACKEND_STOP_LIVETV, msg = %s",
  25.495 -                          *back_msg_action );
  25.496 -                    msg_type = GMYTH_BACKEND_STOP_LIVETV;
  25.497 -                }
  25.498 +			  if (g_strstr_len
  25.499 +				  (*back_msg_action, strlen(*back_msg_action),
  25.500 +				   "LIVETV_CHAIN")
  25.501 +				  || g_strstr_len(*back_msg_action,
  25.502 +								  strlen(*back_msg_action),
  25.503 +								  "RECORDING_LIST_CHANGE")
  25.504 +				  || g_strstr_len(*back_msg_action,
  25.505 +								  strlen(*back_msg_action),
  25.506 +								  "SCHEDULE_CHANGE")
  25.507 +				  || g_strstr_len(*back_msg_action,
  25.508 +								  strlen(*back_msg_action), "LIVETV_WATCH"))
  25.509 +				{
  25.510 +				  gmyth_debug
  25.511 +					("MONITOR: message type == GMYTH_BACKEND_PROGRAM_INFO_CHANGED, msg = %s",
  25.512 +					 *back_msg_action);
  25.513 +				  msg_type = GMYTH_BACKEND_PROGRAM_INFO_CHANGED;
  25.514 +				}
  25.515 +			  else if (g_strstr_len
  25.516 +					   (*back_msg_action, strlen(*back_msg_action),
  25.517 +						"DONE_RECORDING"))
  25.518 +				{
  25.519 +				  gmyth_debug
  25.520 +					("MONITOR: message type == GMYTH_BACKEND_DONE_RECORDING, msg = %s",
  25.521 +					 *back_msg_action);
  25.522 +				  msg_type = GMYTH_BACKEND_DONE_RECORDING;
  25.523 +				}
  25.524 +			  else if (g_strstr_len
  25.525 +					   (*back_msg_action, strlen(*back_msg_action), "QUIT"))
  25.526 +				{
  25.527 +				  gmyth_debug
  25.528 +					("MONITOR: message type == GMYTH_BACKEND_STOP_LIVETV, msg = %s",
  25.529 +					 *back_msg_action);
  25.530 +				  msg_type = GMYTH_BACKEND_STOP_LIVETV;
  25.531 +				}
  25.532  
  25.533 -                /* g_hash_table_insert ( monitor->backend_msgs,
  25.534 -                   &(monitor->actual_index), *back_msg_action ); */
  25.535 +			 /* g_hash_table_insert ( monitor->backend_msgs,
  25.536 +			    &(monitor->actual_index), *back_msg_action ); */
  25.537  
  25.538 -            }
  25.539 -            /*  if  */
  25.540 -        }
  25.541 -        /* if */
  25.542 -        if ( back_msg != NULL )
  25.543 -        {
  25.544 -            g_string_free ( back_msg, TRUE );
  25.545 -            back_msg = NULL;
  25.546 -        }
  25.547 +			}
  25.548 +		 /*  if  */
  25.549 +		}
  25.550 +	 /* if */
  25.551 +	  if (back_msg != NULL)
  25.552 +		{
  25.553 +		  g_string_free(back_msg, TRUE);
  25.554 +		  back_msg = NULL;
  25.555 +		}
  25.556  
  25.557 -    }                           /* if - Does Monitor got any message from backend? */
  25.558 -    else
  25.559 -    {
  25.560 -        *back_msg_action = g_strdup ( "" );
  25.561 -    }
  25.562 +	}							/* if - Does Monitor got any message from backend? */
  25.563 +  else
  25.564 +	{
  25.565 +	  *back_msg_action = g_strdup("");
  25.566 +	}
  25.567  
  25.568 -    return msg_type;
  25.569 +  return msg_type;
  25.570  
  25.571  }
  25.572  
  25.573  static void
  25.574 -gmyth_monitor_handler_default_listener ( GMythMonitorHandler * monitor,
  25.575 -                                         gint msg_code, gchar * message )
  25.576 +gmyth_monitor_handler_default_listener(GMythMonitorHandler * monitor,
  25.577 +									   gint msg_code, gchar * message)
  25.578  {
  25.579 -    //assert( message!= NULL );  
  25.580 -    gmyth_debug ( "DEFAULT Signal handler ( msg = %s, code = %d )\n",
  25.581 -                  message, msg_code );
  25.582 + //assert( message!= NULL );  
  25.583 +  gmyth_debug("DEFAULT Signal handler ( msg = %s, code = %d )\n",
  25.584 +			  message, msg_code);
  25.585  }
  25.586  
  25.587  static void
  25.588 -gmyth_monitor_handler_print ( GString * str, gpointer ptr )
  25.589 +gmyth_monitor_handler_print(GString * str, gpointer ptr)
  25.590  {
  25.591 -    gmyth_debug ( "Backend message event: %s --- ", str->str );
  25.592 +  gmyth_debug("Backend message event: %s --- ", str->str);
  25.593  }
  25.594  
  25.595  /** 
  25.596 @@ -456,114 +453,111 @@
  25.597   * 	successfully read.
  25.598   */
  25.599  gpointer
  25.600 -gmyth_monitor_handler_listener ( gpointer data )
  25.601 +gmyth_monitor_handler_listener(gpointer data)
  25.602  {
  25.603 -    GMythMonitorHandler *monitor = ( GMythMonitorHandler * ) data;
  25.604 -    guint recv = 0;
  25.605 -    gboolean *ret = g_new0 ( gboolean, 1 );
  25.606 -    gsize len = 0;
  25.607 -    GIOChannel *io_channel = monitor->event_sock->sd_io_ch;
  25.608 -    GIOCondition io_cond = g_io_channel_get_buffer_condition ( io_channel );
  25.609 -    static guint count = 0;
  25.610 +  GMythMonitorHandler *monitor = (GMythMonitorHandler *) data;
  25.611 +  guint recv = 0;
  25.612 +  gboolean *ret = g_new0(gboolean, 1);
  25.613 +  gsize len = 0;
  25.614 +  GIOChannel *io_channel = monitor->event_sock->sd_io_ch;
  25.615 +  GIOCondition io_cond = g_io_channel_get_buffer_condition(io_channel);
  25.616 +  static guint count = 0;
  25.617  
  25.618 -    *ret = TRUE;
  25.619 +  *ret = TRUE;
  25.620  
  25.621 -    gmyth_debug ( "Entering MONITOR handler listener..." );
  25.622 +  gmyth_debug("Entering MONITOR handler listener...");
  25.623  
  25.624 -    myth_control_acquire_context ( monitor, TRUE );
  25.625 +  myth_control_acquire_context(monitor, TRUE);
  25.626  
  25.627 -    if ( ( io_cond & G_IO_HUP ) != 0 )
  25.628 -    {
  25.629 -        *ret = FALSE;
  25.630 -        goto clean_up;
  25.631 -    }
  25.632 +  if ((io_cond & G_IO_HUP) != 0)
  25.633 +	{
  25.634 +	  *ret = FALSE;
  25.635 +	  goto clean_up;
  25.636 +	}
  25.637  
  25.638 -    GMythStringList *strlist = NULL;
  25.639 +  GMythStringList *strlist = NULL;
  25.640  
  25.641 -    if ( NULL == io_channel )
  25.642 -    {
  25.643 -        gmyth_debug ( "Monitor socket is NULL! (GIOChannel)" );
  25.644 -        *ret = FALSE;
  25.645 -        goto clean_up;
  25.646 -    }
  25.647 +  if (NULL == io_channel)
  25.648 +	{
  25.649 +	  gmyth_debug("Monitor socket is NULL! (GIOChannel)");
  25.650 +	  *ret = FALSE;
  25.651 +	  goto clean_up;
  25.652 +	}
  25.653  
  25.654 -    while ( monitor->allow_msgs_listener )
  25.655 -    {
  25.656 -        ++count;
  25.657 +  while (monitor->allow_msgs_listener)
  25.658 +	{
  25.659 +	  ++count;
  25.660  
  25.661 -        gmyth_debug ( "%d - Listening on Monitor socket...!\n", count );
  25.662 +	  gmyth_debug("%d - Listening on Monitor socket...!\n", count);
  25.663  
  25.664 -        do
  25.665 -        {
  25.666 +	  do
  25.667 +		{
  25.668  
  25.669 -            gint bytes_sent = 0;
  25.670 +		  gint bytes_sent = 0;
  25.671  
  25.672 -            strlist = gmyth_string_list_new (  );
  25.673 +		  strlist = gmyth_string_list_new();
  25.674  
  25.675 -            if ( monitor->event_sock != NULL )
  25.676 -            {
  25.677 +		  if (monitor->event_sock != NULL)
  25.678 +			{
  25.679  
  25.680 -                len =
  25.681 -                    gmyth_socket_read_stringlist ( monitor->event_sock,
  25.682 -                                                   strlist );
  25.683 +			  len =
  25.684 +				gmyth_socket_read_stringlist(monitor->event_sock, strlist);
  25.685  
  25.686 -                if ( ( len > 0 ) && strlist != NULL
  25.687 -                     && gmyth_string_list_length ( strlist ) > 0 )
  25.688 -                {
  25.689 -                    bytes_sent = gmyth_string_list_get_int ( strlist, 0 );  // -1 on backend error
  25.690 +			  if ((len > 0) && strlist != NULL
  25.691 +				  && gmyth_string_list_length(strlist) > 0)
  25.692 +				{
  25.693 +				  bytes_sent = gmyth_string_list_get_int(strlist, 0);	// -1 on backend error
  25.694  
  25.695 -                    gmyth_debug
  25.696 -                        ( "[%s] MONITOR: received data buffer from IO event channel... %d strings gone!\n",
  25.697 -                          __FUNCTION__, len );
  25.698 +				  gmyth_debug
  25.699 +					("[%s] MONITOR: received data buffer from IO event channel... %d strings gone!\n",
  25.700 +					 __FUNCTION__, len);
  25.701  
  25.702 -                    recv += len;
  25.703 +				  recv += len;
  25.704  
  25.705 -                    /* debug purpose: prints out all the string list elements */
  25.706 -                    g_list_foreach ( strlist->glist,
  25.707 -                                     ( GFunc ) gmyth_monitor_handler_print,
  25.708 -                                     NULL );
  25.709 +				 /* debug purpose: prints out all the string list elements */
  25.710 +				  g_list_foreach(strlist->glist,
  25.711 +								 (GFunc) gmyth_monitor_handler_print, NULL);
  25.712  
  25.713 -                    gchar *back_msg_action = g_new0 ( gchar, 1 );
  25.714 -                    gint msg_type =
  25.715 -                        gmyth_monitor_handler_is_backend_message ( monitor,
  25.716 -                                                                   strlist,
  25.717 -                                                                   &back_msg_action );
  25.718 +				  gchar *back_msg_action = g_new0(gchar, 1);
  25.719 +				  gint msg_type =
  25.720 +					gmyth_monitor_handler_is_backend_message(monitor,
  25.721 +															 strlist,
  25.722 +															 &back_msg_action);
  25.723  
  25.724 -                    if ( monitor != NULL
  25.725 -                         && msg_type != GMYTH_BACKEND_NO_MESSAGE )
  25.726 -                        g_signal_emit ( monitor, GMYTH_MONITOR_HANDLER_GET_CLASS ( monitor )->backend_events_handler_signal_id, 0,  /* details */
  25.727 -                                        msg_type, back_msg_action );
  25.728 +				  if (monitor != NULL && msg_type != GMYTH_BACKEND_NO_MESSAGE)
  25.729 +					g_signal_emit(monitor, GMYTH_MONITOR_HANDLER_GET_CLASS(monitor)->backend_events_handler_signal_id, 0,	/* details */
  25.730 +								  msg_type, back_msg_action);
  25.731  
  25.732 -                    if ( back_msg_action != NULL )
  25.733 -                        g_free ( back_msg_action );
  25.734 +				  if (back_msg_action != NULL)
  25.735 +					g_free(back_msg_action);
  25.736  
  25.737 -                }
  25.738 +				}
  25.739  
  25.740 -            }
  25.741 +			}
  25.742  
  25.743 -            if ( strlist != NULL )
  25.744 -            {
  25.745 -                g_object_unref ( strlist );
  25.746 -                strlist = NULL;
  25.747 -            }
  25.748 +		  if (strlist != NULL)
  25.749 +			{
  25.750 +			  g_object_unref(strlist);
  25.751 +			  strlist = NULL;
  25.752 +			}
  25.753  
  25.754 -            io_cond = g_io_channel_get_buffer_condition ( io_channel );
  25.755 +		  io_cond = g_io_channel_get_buffer_condition(io_channel);
  25.756  
  25.757 -            g_usleep ( 500 );
  25.758 +		  g_usleep(500);
  25.759  
  25.760 -        }
  25.761 -        while ( recv <= 0 && ( ( io_cond & G_IO_HUP ) == 0 ) );
  25.762 +		}
  25.763 +	  while (recv <= 0 && ((io_cond & G_IO_HUP) == 0));
  25.764  
  25.765 -        gmyth_debug ( "\tMONITOR EVENT: Read %d bytes\n", recv );
  25.766 +	  gmyth_debug("\tMONITOR EVENT: Read %d bytes\n", recv);
  25.767  
  25.768 -    }                           /* main GThread while */
  25.769 +	}							/* main GThread while */
  25.770  
  25.771 -  clean_up:
  25.772 -    myth_control_release_context ( monitor );
  25.773 +clean_up:
  25.774 +  myth_control_release_context(monitor);
  25.775  
  25.776 -    g_thread_exit ( ret );
  25.777 +  g_thread_exit(ret);
  25.778  
  25.779 -    return ( gpointer ) ret;
  25.780 +  return (gpointer) ret;
  25.781  
  25.782  }
  25.783  
  25.784 @@ -576,23 +570,23 @@
  25.785   * @return <code>true</code>, if the socket was successfully opened.
  25.786   */
  25.787  static gboolean
  25.788 -gmyth_connect_to_backend_monitor ( GMythMonitorHandler * monitor )
  25.789 +gmyth_connect_to_backend_monitor(GMythMonitorHandler * monitor)
  25.790  {
  25.791 -    gboolean ret = TRUE;
  25.792 +  gboolean ret = TRUE;
  25.793  
  25.794 -    monitor->event_sock = gmyth_socket_new (  );
  25.795 +  monitor->event_sock = gmyth_socket_new();
  25.796  
  25.797 -    /* Connects the socket, send Mythtv ANN Monitor and verify Mythtv protocol version */
  25.798 -    if ( !gmyth_socket_connect_to_backend_events ( monitor->event_sock,
  25.799 -                                                   monitor->hostname,
  25.800 -                                                   monitor->port, FALSE ) )
  25.801 -    {
  25.802 -        g_object_unref ( monitor->event_sock );
  25.803 -        monitor->event_sock = NULL;
  25.804 -        ret = FALSE;
  25.805 -    }
  25.806 + /* Connects the socket, send Mythtv ANN Monitor and verify Mythtv protocol version */
  25.807 +  if (!gmyth_socket_connect_to_backend_events(monitor->event_sock,
  25.808 +											  monitor->hostname,
  25.809 +											  monitor->port, FALSE))
  25.810 +	{
  25.811 +	  g_object_unref(monitor->event_sock);
  25.812 +	  monitor->event_sock = NULL;
  25.813 +	  ret = FALSE;
  25.814 +	}
  25.815  
  25.816 -    return ret;
  25.817 +  return ret;
  25.818  }
  25.819  
  25.820  /** 
  25.821 @@ -606,38 +600,38 @@
  25.822   * 				 GMythMonitorHandler could be configured.
  25.823   */
  25.824  static gboolean
  25.825 -gmyth_monitor_handler_setup ( GMythMonitorHandler * monitor,
  25.826 -                              GIOChannel * channel )
  25.827 +gmyth_monitor_handler_setup(GMythMonitorHandler * monitor,
  25.828 +							GIOChannel * channel)
  25.829  {
  25.830 -    gboolean ret = TRUE;
  25.831 +  gboolean ret = TRUE;
  25.832  
  25.833 -    if ( channel != NULL )
  25.834 -    {
  25.835 -        monitor->allow_msgs_listener = TRUE;
  25.836 +  if (channel != NULL)
  25.837 +	{
  25.838 +	  monitor->allow_msgs_listener = TRUE;
  25.839  
  25.840 -        monitor->th =
  25.841 -            g_thread_create ( ( GThreadFunc ) gmyth_monitor_handler_listener,
  25.842 -                              monitor, TRUE, NULL );
  25.843 -        gmyth_debug ( "MONITOR GThread created!" );
  25.844 -    }
  25.845 -    else
  25.846 -    {
  25.847 -        ret = FALSE;
  25.848 -        goto cleanup;
  25.849 -    }
  25.850 +	  monitor->th =
  25.851 +		g_thread_create((GThreadFunc) gmyth_monitor_handler_listener,
  25.852 +						monitor, TRUE, NULL);
  25.853 +	  gmyth_debug("MONITOR GThread created!");
  25.854 +	}
  25.855 +  else
  25.856 +	{
  25.857 +	  ret = FALSE;
  25.858 +	  goto cleanup;
  25.859 +	}
  25.860  
  25.861 -    if ( NULL == monitor->th )
  25.862 -    {
  25.863 -        gmyth_debug
  25.864 -            ( "[%s] Error adding GThread listener function to the IO control channel!\n",
  25.865 -              __FUNCTION__ );
  25.866 -        ret = FALSE;
  25.867 -        goto cleanup;
  25.868 -    }
  25.869 +  if (NULL == monitor->th)
  25.870 +	{
  25.871 +	  gmyth_debug
  25.872 +		("[%s] Error adding GThread listener function to the IO control channel!\n",
  25.873 +		 __FUNCTION__);
  25.874 +	  ret = FALSE;
  25.875 +	  goto cleanup;
  25.876 +	}
  25.877  
  25.878 -  cleanup:
  25.879 +cleanup:
  25.880  
  25.881 -    return ret;
  25.882 +  return ret;
  25.883  }
  25.884  
  25.885  /** 
  25.886 @@ -648,35 +642,34 @@
  25.887   * @return <code>true</code>, if the MonitorHandler was started.
  25.888   */
  25.889  gboolean
  25.890 -gmyth_monitor_handler_start ( GMythMonitorHandler * monitor )
  25.891 +gmyth_monitor_handler_start(GMythMonitorHandler * monitor)
  25.892  {
  25.893 -    gboolean ret = TRUE;
  25.894 +  gboolean ret = TRUE;
  25.895  
  25.896 -    if ( !( ret = g_thread_supported (  ) ) )
  25.897 -    {
  25.898 -        gmyth_debug ( "Thread system wasn't initialized, starting NOW!!!" );
  25.899 -        g_thread_init ( NULL );
  25.900 -    }
  25.901 +  if (!(ret = g_thread_supported()))
  25.902 +	{
  25.903 +	  gmyth_debug("Thread system wasn't initialized, starting NOW!!!");
  25.904 +	  g_thread_init(NULL);
  25.905 +	}
  25.906  
  25.907 -    ret =
  25.908 -        gmyth_monitor_handler_setup ( monitor, monitor->event_sock->sd_io_ch );
  25.909 -    if ( ret )
  25.910 -    {
  25.911 -        gmyth_debug
  25.912 -            ( "\n[%s]\tOK! Starting listener on the MONITOR event socket...[thread location = %p]\n",
  25.913 -              __FUNCTION__, g_thread_self (  ) );
  25.914 -    }
  25.915 -    else
  25.916 -    {
  25.917 -        gmyth_debug
  25.918 -            ( "\n[%s]\tERROR! Coudn't start listener on the MONITOR event socket...[thread location = %p]\n",
  25.919 -              __FUNCTION__, g_thread_self (  ) );
  25.920 -        ret = FALSE;
  25.921 -    }
  25.922 +  ret = gmyth_monitor_handler_setup(monitor, monitor->event_sock->sd_io_ch);
  25.923 +  if (ret)
  25.924 +	{
  25.925 +	  gmyth_debug
  25.926 +		("\n[%s]\tOK! Starting listener on the MONITOR event socket...[thread location = %p]\n",
  25.927 +		 __FUNCTION__, g_thread_self());
  25.928 +	}
  25.929 +  else
  25.930 +	{
  25.931 +	  gmyth_debug
  25.932 +		("\n[%s]\tERROR! Coudn't start listener on the MONITOR event socket...[thread location = %p]\n",
  25.933 +		 __FUNCTION__, g_thread_self());
  25.934 +	  ret = FALSE;
  25.935 +	}
  25.936  
  25.937 -    gmyth_debug
  25.938 -        ( "[%s] Watch listener function over the IO control channel? %s!!!\n",
  25.939 -          __FUNCTION__, ( ret == TRUE ? "YES" : "NO" ) );
  25.940 +  gmyth_debug
  25.941 +	("[%s] Watch listener function over the IO control channel? %s!!!\n",
  25.942 +	 __FUNCTION__, (ret == TRUE ? "YES" : "NO"));
  25.943  
  25.944 -    return ret;
  25.945 +  return ret;
  25.946  }
    26.1 --- a/gmyth/src/gmyth_monitor_handler.h	Wed Jun 13 18:18:42 2007 +0100
    26.2 +++ b/gmyth/src/gmyth_monitor_handler.h	Thu Jun 14 18:19:52 2007 +0100
    26.3 @@ -49,67 +49,67 @@
    26.4  #define IS_GMYTH_MONITOR_HANDLER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE))
    26.5  #define GMYTH_MONITOR_HANDLER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass))
    26.6  #define GMYTHTV_MONITOR_HANDLER_READ_ERROR	-314
    26.7 -    enum
    26.8 -    {
    26.9 -        GMYTH_BACKEND_NO_MESSAGE = 0,
   26.10 -        GMYTH_BACKEND_PROGRAM_INFO_CHANGED,
   26.11 -        GMYTH_BACKEND_DONE_RECORDING,
   26.12 -        GMYTH_BACKEND_STOP_LIVETV
   26.13 -    };
   26.14 +  enum
   26.15 +{
   26.16 +  GMYTH_BACKEND_NO_MESSAGE = 0,
   26.17 +  GMYTH_BACKEND_PROGRAM_INFO_CHANGED,
   26.18 +  GMYTH_BACKEND_DONE_RECORDING,
   26.19 +  GMYTH_BACKEND_STOP_LIVETV
   26.20 +};
   26.21  
   26.22  typedef struct _GMythMonitorHandler GMythMonitorHandler;
   26.23  typedef struct _GMythMonitorHandlerClass GMythMonitorHandlerClass;
   26.24  
   26.25  struct _GMythMonitorHandlerClass
   26.26 -    {
   26.27 -        GObjectClass parent_class;
   26.28 +{
   26.29 +  GObjectClass parent_class;
   26.30  
   26.31 -        /* callbacks */
   26.32 -        guint backend_events_handler_signal_id;
   26.33 + /* callbacks */
   26.34 +  guint backend_events_handler_signal_id;
   26.35  
   26.36 -        /* signal default handlers */
   26.37 -        void ( *backend_events_handler ) ( GMythMonitorHandler * monitor,
   26.38 -                                           gint msg_code, gchar * message );
   26.39 -    };
   26.40 + /* signal default handlers */
   26.41 +  void (*backend_events_handler) (GMythMonitorHandler * monitor,
   26.42 +								  gint msg_code, gchar * message);
   26.43 +};
   26.44  
   26.45  struct _GMythMonitorHandler
   26.46 -    {
   26.47 -        GObject parent;
   26.48 +{
   26.49 +  GObject parent;
   26.50  
   26.51 -        /* MythTV version number */
   26.52 -        gint mythtv_version;
   26.53 + /* MythTV version number */
   26.54 +  gint mythtv_version;
   26.55  
   26.56 -        /* socket descriptors */
   26.57 -        GMythSocket *event_sock;
   26.58 + /* socket descriptors */
   26.59 +  GMythSocket *event_sock;
   26.60  
   26.61 -          gpointer ( *gmyth_monitor_handler_listener ) ( gpointer data );
   26.62 +    gpointer(*gmyth_monitor_handler_listener) (gpointer data);
   26.63  
   26.64 -        gchar *hostname;
   26.65 -        gint port;
   26.66 +  gchar *hostname;
   26.67 +  gint port;
   26.68  
   26.69 -        gint64 actual_index;
   26.70 +  gint64 actual_index;
   26.71  
   26.72 -        gboolean allow_msgs_listener;
   26.73 +  gboolean allow_msgs_listener;
   26.74  
   26.75 -        /* stores the messages coming from the backend */
   26.76 -        GHashTable *backend_msgs;
   26.77 + /* stores the messages coming from the backend */
   26.78 +  GHashTable *backend_msgs;
   26.79  
   26.80 -        GMutex *mutex;
   26.81 +  GMutex *mutex;
   26.82  
   26.83 -        GThread *th;
   26.84 +  GThread *th;
   26.85  
   26.86 -    };
   26.87 +};
   26.88  
   26.89 -GType gmyth_monitor_handler_get_type ( void );
   26.90 +GType gmyth_monitor_handler_get_type(void);
   26.91  
   26.92 -GMythMonitorHandler *gmyth_monitor_handler_new ( void );
   26.93 +GMythMonitorHandler *gmyth_monitor_handler_new(void);
   26.94  
   26.95 -gboolean gmyth_monitor_handler_open ( GMythMonitorHandler * monitor,
   26.96 -                                      const gchar * hostname, gint port );
   26.97 +gboolean gmyth_monitor_handler_open(GMythMonitorHandler * monitor,
   26.98 +									const gchar * hostname, gint port);
   26.99  
  26.100 -gboolean gmyth_monitor_handler_start ( GMythMonitorHandler * monitor );
  26.101 +gboolean gmyth_monitor_handler_start(GMythMonitorHandler * monitor);
  26.102  
  26.103 -void gmyth_monitor_handler_close ( GMythMonitorHandler * monitor );
  26.104 +void gmyth_monitor_handler_close(GMythMonitorHandler * monitor);
  26.105  
  26.106  G_END_DECLS
  26.107  #endif /* __GMYTH_MONITOR_HANDLER_H__ */
    27.1 --- a/gmyth/src/gmyth_programinfo.c	Wed Jun 13 18:18:42 2007 +0100
    27.2 +++ b/gmyth/src/gmyth_programinfo.c	Thu Jun 14 18:19:52 2007 +0100
    27.3 @@ -39,220 +39,220 @@
    27.4  #include "gmyth_util.h"
    27.5  #include "gmyth_debug.h"
    27.6  
    27.7 -static void gmyth_program_info_class_init ( GMythProgramInfoClass * klass );
    27.8 -static void gmyth_program_info_init ( GMythProgramInfo * object );
    27.9 +static void gmyth_program_info_class_init(GMythProgramInfoClass * klass);
   27.10 +static void gmyth_program_info_init(GMythProgramInfo * object);
   27.11  
   27.12 -static void gmyth_program_info_dispose ( GObject * object );
   27.13 -static void gmyth_program_info_finalize ( GObject * object );
   27.14 +static void gmyth_program_info_dispose(GObject * object);
   27.15 +static void gmyth_program_info_finalize(GObject * object);
   27.16  
   27.17 -G_DEFINE_TYPE ( GMythProgramInfo, gmyth_program_info, G_TYPE_OBJECT )
   27.18 -     static const gchar *gmyth_program_info_non_null_value ( const GString *
   27.19 -                                                             str );
   27.20 +G_DEFINE_TYPE(GMythProgramInfo, gmyth_program_info, G_TYPE_OBJECT)
   27.21 +	 static const gchar *gmyth_program_info_non_null_value(const GString *
   27.22 +														   str);
   27.23  
   27.24 -     static void gmyth_program_info_class_init ( GMythProgramInfoClass * klass )
   27.25 +	 static void gmyth_program_info_class_init(GMythProgramInfoClass * klass)
   27.26  {
   27.27 -    GObjectClass *gobject_class = G_OBJECT_CLASS ( klass );
   27.28 +  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
   27.29  
   27.30 -    gobject_class->dispose = gmyth_program_info_dispose;
   27.31 -    gobject_class->finalize = gmyth_program_info_finalize;
   27.32 +  gobject_class->dispose = gmyth_program_info_dispose;
   27.33 +  gobject_class->finalize = gmyth_program_info_finalize;
   27.34  }
   27.35  
   27.36  static void
   27.37 -gmyth_program_info_init ( GMythProgramInfo * gmyth_program_info )
   27.38 +gmyth_program_info_init(GMythProgramInfo * gmyth_program_info)
   27.39  {
   27.40 -    gmyth_program_info->chancommfree = 0;
   27.41 +  gmyth_program_info->chancommfree = 0;
   27.42  
   27.43 -    /** A flag informing if the program has video or not. */
   27.44 -    gmyth_program_info->isVideo = FALSE;
   27.45 -    gmyth_program_info->lenMins = 0;
   27.46 +	/** A flag informing if the program has video or not. */
   27.47 +  gmyth_program_info->isVideo = FALSE;
   27.48 +  gmyth_program_info->lenMins = 0;
   27.49  
   27.50 -    gmyth_program_info->stars = 0.0f;
   27.51 -    gmyth_program_info->repeat = 0;
   27.52 +  gmyth_program_info->stars = 0.0f;
   27.53 +  gmyth_program_info->repeat = 0;
   27.54  
   27.55 -    gmyth_program_info->hasAirDate = FALSE;
   27.56 +  gmyth_program_info->hasAirDate = FALSE;
   27.57  
   27.58 -    gmyth_program_info->spread = 0;
   27.59 -    gmyth_program_info->startCol = 0;
   27.60 +  gmyth_program_info->spread = 0;
   27.61 +  gmyth_program_info->startCol = 0;
   27.62  
   27.63 -    gmyth_program_info->recpriority2 = 0;
   27.64 -    gmyth_program_info->reactivate = 0;
   27.65 +  gmyth_program_info->recpriority2 = 0;
   27.66 +  gmyth_program_info->reactivate = 0;
   27.67  
   27.68 -    gmyth_program_info->recordid = 0;
   27.69 -    gmyth_program_info->parentid = 0;
   27.70 +  gmyth_program_info->recordid = 0;
   27.71 +  gmyth_program_info->parentid = 0;
   27.72  
   27.73 -    /** The backend video source id associated to this program.*/
   27.74 -    gmyth_program_info->sourceid = 0;
   27.75 -    /** the backend input id associated to this program.*/
   27.76 -    gmyth_program_info->inputid = 0;
   27.77 -    /** The backend card id associated to this program.*/
   27.78 -    gmyth_program_info->cardid = 0;
   27.79 -    gmyth_program_info->shareable = FALSE;
   27.80 -    gmyth_program_info->duplicate = FALSE;
   27.81 +	/** The backend video source id associated to this program.*/
   27.82 +  gmyth_program_info->sourceid = 0;
   27.83 +	/** the backend input id associated to this program.*/
   27.84 +  gmyth_program_info->inputid = 0;
   27.85 +	/** The backend card id associated to this program.*/
   27.86 +  gmyth_program_info->cardid = 0;
   27.87 +  gmyth_program_info->shareable = FALSE;
   27.88 +  gmyth_program_info->duplicate = FALSE;
   27.89  
   27.90 -    gmyth_program_info->findid = 0;
   27.91 +  gmyth_program_info->findid = 0;
   27.92  
   27.93 -    gmyth_program_info->programflags = 0;
   27.94 -    gmyth_program_info->transcoder = 0;
   27.95 +  gmyth_program_info->programflags = 0;
   27.96 +  gmyth_program_info->transcoder = 0;
   27.97  
   27.98 -    gmyth_program_info->recpriority = 0;
   27.99 +  gmyth_program_info->recpriority = 0;
  27.100  
  27.101 -    /** The file size of the recorded program.*/
  27.102 -    gmyth_program_info->filesize = -1;
  27.103 +	/** The file size of the recorded program.*/
  27.104 +  gmyth_program_info->filesize = -1;
  27.105  }
  27.106  
  27.107  static void
  27.108 -gmyth_program_info_dispose ( GObject * object )
  27.109 +gmyth_program_info_dispose(GObject * object)
  27.110  {
  27.111 -    GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO ( object );
  27.112 +  GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object);
  27.113  
  27.114 -    if ( gmyth_program_info->chanid != NULL )
  27.115 -    {
  27.116 -        g_string_free ( gmyth_program_info->chanid, TRUE );
  27.117 -        gmyth_program_info->chanid = NULL;
  27.118 -    }
  27.119 +  if (gmyth_program_info->chanid != NULL)
  27.120 +	{
  27.121 +	  g_string_free(gmyth_program_info->chanid, TRUE);
  27.122 +	  gmyth_program_info->chanid = NULL;
  27.123 +	}
  27.124  
  27.125 -    /** The program start time. */
  27.126 -    g_free ( gmyth_program_info->startts );
  27.127 +	/** The program start time. */
  27.128 +  g_free(gmyth_program_info->startts);
  27.129  
  27.130 -    /** The program end time. */
  27.131 -    g_free ( gmyth_program_info->endts );
  27.132 +	/** The program end time. */
  27.133 +  g_free(gmyth_program_info->endts);
  27.134  
  27.135 -    /** The recording schedule start time. */
  27.136 -    g_free ( gmyth_program_info->recstartts );
  27.137 +	/** The recording schedule start time. */
  27.138 +  g_free(gmyth_program_info->recstartts);
  27.139  
  27.140 -    /** The recording schedule end time */
  27.141 -    g_free ( gmyth_program_info->recendts );
  27.142 +	/** The recording schedule end time */
  27.143 +  g_free(gmyth_program_info->recendts);
  27.144  
  27.145 -    /** The program title. */
  27.146 -    if ( gmyth_program_info->title != NULL )
  27.147 -    {
  27.148 -        g_string_free ( gmyth_program_info->title, TRUE );
  27.149 -        gmyth_program_info->title = NULL;
  27.150 -    }
  27.151 +	/** The program title. */
  27.152 +  if (gmyth_program_info->title != NULL)
  27.153 +	{
  27.154 +	  g_string_free(gmyth_program_info->title, TRUE);
  27.155 +	  gmyth_program_info->title = NULL;
  27.156 +	}
  27.157  
  27.158 -    /** The program subtitle. */
  27.159 -    if ( gmyth_program_info->subtitle != NULL )
  27.160 -    {
  27.161 -        g_string_free ( gmyth_program_info->subtitle, TRUE );
  27.162 -        gmyth_program_info->subtitle = NULL;
  27.163 -    }
  27.164 +	/** The program subtitle. */
  27.165 +  if (gmyth_program_info->subtitle != NULL)
  27.166 +	{
  27.167 +	  g_string_free(gmyth_program_info->subtitle, TRUE);
  27.168 +	  gmyth_program_info->subtitle = NULL;
  27.169 +	}
  27.170  
  27.171 -    /** The program description. */
  27.172 -    if ( gmyth_program_info->description != NULL )
  27.173 -    {
  27.174 -        g_string_free ( gmyth_program_info->description, TRUE );
  27.175 -        gmyth_program_info->description = NULL;
  27.176 -    }
  27.177 +	/** The program description. */
  27.178 +  if (gmyth_program_info->description != NULL)
  27.179 +	{
  27.180 +	  g_string_free(gmyth_program_info->description, TRUE);
  27.181 +	  gmyth_program_info->description = NULL;
  27.182 +	}
  27.183  
  27.184 -    /** The program category. */
  27.185 -    if ( gmyth_program_info->category != NULL )
  27.186 -    {
  27.187 -        g_string_free ( gmyth_program_info->category, TRUE );
  27.188 -        gmyth_program_info->category = NULL;
  27.189 -    }
  27.190 +	/** The program category. */
  27.191 +  if (gmyth_program_info->category != NULL)
  27.192 +	{
  27.193 +	  g_string_free(gmyth_program_info->category, TRUE);
  27.194 +	  gmyth_program_info->category = NULL;
  27.195 +	}
  27.196  
  27.197 -    if ( gmyth_program_info->chanstr != NULL )
  27.198 -    {
  27.199 -        g_string_free ( gmyth_program_info->chanstr, TRUE );
  27.200 -        gmyth_program_info->chanstr = NULL;
  27.201 -    }
  27.202 +  if (gmyth_program_info->chanstr != NULL)
  27.203 +	{
  27.204 +	  g_string_free(gmyth_program_info->chanstr, TRUE);
  27.205 +	  gmyth_program_info->chanstr = NULL;
  27.206 +	}
  27.207  
  27.208 -    if ( gmyth_program_info->chansign != NULL )
  27.209 -    {
  27.210 -        g_string_free ( gmyth_program_info->chansign, TRUE );
  27.211 -        gmyth_program_info->chansign = NULL;
  27.212 -    }
  27.213 +  if (gmyth_program_info->chansign != NULL)
  27.214 +	{
  27.215 +	  g_string_free(gmyth_program_info->chansign, TRUE);
  27.216 +	  gmyth_program_info->chansign = NULL;
  27.217 +	}
  27.218  
  27.219 -    /** The associated channel name. */
  27.220 -    if ( gmyth_program_info->channame != NULL )
  27.221 -    {
  27.222 -        g_string_free ( gmyth_program_info->channame, TRUE );
  27.223 -        gmyth_program_info->channame = NULL;
  27.224 -    }
  27.225 +	/** The associated channel name. */
  27.226 +  if (gmyth_program_info->channame != NULL)
  27.227 +	{
  27.228 +	  g_string_free(gmyth_program_info->channame, TRUE);
  27.229 +	  gmyth_program_info->channame = NULL;
  27.230 +	}
  27.231  
  27.232 -    if ( gmyth_program_info->chanOutputFilters != NULL )
  27.233 -    {
  27.234 -        g_string_free ( gmyth_program_info->chanOutputFilters, TRUE );
  27.235 -        gmyth_program_info->chanOutputFilters = NULL;
  27.236 -    }
  27.237 +  if (gmyth_program_info->chanOutputFilters != NULL)
  27.238 +	{
  27.239 +	  g_string_free(gmyth_program_info->chanOutputFilters, TRUE);
  27.240 +	  gmyth_program_info->chanOutputFilters = NULL;
  27.241 +	}
  27.242  
  27.243 -    if ( gmyth_program_info->seriesid != NULL )
  27.244 -    {
  27.245 -        g_string_free ( gmyth_program_info->seriesid, TRUE );
  27.246 -        gmyth_program_info->chanOutputFilters = NULL;
  27.247 -    }
  27.248 +  if (gmyth_program_info->seriesid != NULL)
  27.249 +	{
  27.250 +	  g_string_free(gmyth_program_info->seriesid, TRUE);
  27.251 +	  gmyth_program_info->chanOutputFilters = NULL;
  27.252 +	}
  27.253  
  27.254 -    /** The program unique id. */
  27.255 -    if ( gmyth_program_info->programid != NULL )
  27.256 -    {
  27.257 -        g_string_free ( gmyth_program_info->programid, TRUE );
  27.258 -        gmyth_program_info->programid = NULL;
  27.259 -    }
  27.260 +	/** The program unique id. */
  27.261 +  if (gmyth_program_info->programid != NULL)
  27.262 +	{
  27.263 +	  g_string_free(gmyth_program_info->programid, TRUE);
  27.264 +	  gmyth_program_info->programid = NULL;
  27.265 +	}
  27.266  
  27.267 -    if ( gmyth_program_info->catType != NULL )
  27.268 -    {
  27.269 -        g_string_free ( gmyth_program_info->catType, TRUE );
  27.270 -        gmyth_program_info->catType = NULL;
  27.271 -    }
  27.272 +  if (gmyth_program_info->catType != NULL)
  27.273 +	{
  27.274 +	  g_string_free(gmyth_program_info->catType, TRUE);
  27.275 +	  gmyth_program_info->catType = NULL;
  27.276 +	}
  27.277  
  27.278 -    if ( gmyth_program_info->sortTitle != NULL )
  27.279 -    {
  27.280 -        g_string_free ( gmyth_program_info->sortTitle, TRUE );
  27.281 -        gmyth_program_info->sortTitle = NULL;
  27.282 -    }
  27.283 +  if (gmyth_program_info->sortTitle != NULL)
  27.284 +	{
  27.285 +	  g_string_free(gmyth_program_info->sortTitle, TRUE);
  27.286 +	  gmyth_program_info->sortTitle = NULL;
  27.287 +	}
  27.288  
  27.289 -    if ( gmyth_program_info->year != NULL )
  27.290 -    {
  27.291 -        g_string_free ( gmyth_program_info->year, TRUE );
  27.292 -        gmyth_program_info->year = NULL;
  27.293 -    }
  27.294 +  if (gmyth_program_info->year != NULL)
  27.295 +	{
  27.296 +	  g_string_free(gmyth_program_info->year, TRUE);
  27.297 +	  gmyth_program_info->year = NULL;
  27.298 +	}
  27.299  
  27.300 -    g_free ( gmyth_program_info->originalAirDate );
  27.301 +  g_free(gmyth_program_info->originalAirDate);
  27.302  
  27.303 -    g_free ( gmyth_program_info->lastmodified );
  27.304 +  g_free(gmyth_program_info->lastmodified);
  27.305  
  27.306 -    g_free ( gmyth_program_info->lastInUseTime );
  27.307 +  g_free(gmyth_program_info->lastInUseTime);
  27.308  
  27.309 -    if ( gmyth_program_info->schedulerid != NULL )
  27.310 -    {
  27.311 -        g_string_free ( gmyth_program_info->schedulerid, TRUE );
  27.312 -        gmyth_program_info->schedulerid = NULL;
  27.313 -    }
  27.314 +  if (gmyth_program_info->schedulerid != NULL)
  27.315 +	{
  27.316 +	  g_string_free(gmyth_program_info->schedulerid, TRUE);
  27.317 +	  gmyth_program_info->schedulerid = NULL;
  27.318 +	}
  27.319  
  27.320 -    if ( gmyth_program_info->recgroup != NULL )
  27.321 -    {
  27.322 -        g_string_free ( gmyth_program_info->recgroup, TRUE );
  27.323 -        gmyth_program_info->recgroup = NULL;
  27.324 -    }
  27.325 +  if (gmyth_program_info->recgroup != NULL)
  27.326 +	{
  27.327 +	  g_string_free(gmyth_program_info->recgroup, TRUE);
  27.328 +	  gmyth_program_info->recgroup = NULL;
  27.329 +	}
  27.330  
  27.331 -    if ( gmyth_program_info->playgroup != NULL )
  27.332 -    {
  27.333 -        g_string_free ( gmyth_program_info->playgroup, TRUE );
  27.334 -        gmyth_program_info->playgroup = NULL;
  27.335 -    }
  27.336 +  if (gmyth_program_info->playgroup != NULL)
  27.337 +	{
  27.338 +	  g_string_free(gmyth_program_info->playgroup, TRUE);
  27.339 +	  gmyth_program_info->playgroup = NULL;
  27.340 +	}
  27.341  
  27.342 -    /** The file name of the recorded program.*/
  27.343 -    if ( gmyth_program_info->pathname != NULL )
  27.344 -    {
  27.345 -        g_string_free ( gmyth_program_info->pathname, TRUE );
  27.346 -        gmyth_program_info->pathname = NULL;
  27.347 -    }
  27.348 +	/** The file name of the recorded program.*/
  27.349 +  if (gmyth_program_info->pathname != NULL)
  27.350 +	{
  27.351 +	  g_string_free(gmyth_program_info->pathname, TRUE);
  27.352 +	  gmyth_program_info->pathname = NULL;
  27.353 +	}
  27.354  
  27.355 -    if ( gmyth_program_info->hostname != NULL )
  27.356 -    {
  27.357 -        g_string_free ( gmyth_program_info->hostname, TRUE );
  27.358 -        gmyth_program_info->hostname = NULL;
  27.359 -    }
  27.360 +  if (gmyth_program_info->hostname != NULL)
  27.361 +	{
  27.362 +	  g_string_free(gmyth_program_info->hostname, TRUE);
  27.363 +	  gmyth_program_info->hostname = NULL;
  27.364 +	}
  27.365  
  27.366 -    G_OBJECT_CLASS ( gmyth_program_info_parent_class )->dispose ( object );
  27.367 +  G_OBJECT_CLASS(gmyth_program_info_parent_class)->dispose(object);
  27.368  }
  27.369  
  27.370  static void
  27.371 -gmyth_program_info_finalize ( GObject * object )
  27.372 +gmyth_program_info_finalize(GObject * object)
  27.373  {
  27.374 -    g_signal_handlers_destroy ( object );
  27.375 +  g_signal_handlers_destroy(object);
  27.376  
  27.377 -    G_OBJECT_CLASS ( gmyth_program_info_parent_class )->finalize ( object );
  27.378 +  G_OBJECT_CLASS(gmyth_program_info_parent_class)->finalize(object);
  27.379  }
  27.380  
  27.381  /**
  27.382 @@ -261,12 +261,12 @@
  27.383   * @return a new instance of GMythProgramInfo.
  27.384   */
  27.385  GMythProgramInfo *
  27.386 -gmyth_program_info_new ( void )
  27.387 +gmyth_program_info_new(void)
  27.388  {
  27.389 -    GMythProgramInfo *program_info =
  27.390 -        GMYTH_PROGRAM_INFO ( g_object_new ( GMYTH_PROGRAM_INFO_TYPE, NULL ) );
  27.391 +  GMythProgramInfo *program_info =
  27.392 +	GMYTH_PROGRAM_INFO(g_object_new(GMYTH_PROGRAM_INFO_TYPE, NULL));
  27.393  
  27.394 -    return program_info;
  27.395 +  return program_info;
  27.396  }
  27.397  
  27.398  /**
  27.399 @@ -280,68 +280,68 @@
  27.400   * @return a GMythStringList with the program info fields.
  27.401   */
  27.402  GMythStringList *
  27.403 -gmyth_program_info_to_string_list ( GMythProgramInfo * prog,
  27.404 -                                    GMythStringList * slist )
  27.405 +gmyth_program_info_to_string_list(GMythProgramInfo * prog,
  27.406 +								  GMythStringList * slist)
  27.407  {
  27.408 -    g_return_val_if_fail ( prog != NULL, NULL );
  27.409 -    g_return_val_if_fail ( slist != NULL, NULL );
  27.410 +  g_return_val_if_fail(prog != NULL, NULL);
  27.411 +  g_return_val_if_fail(slist != NULL, NULL);
  27.412  
  27.413 -    gmyth_string_list_append_string ( slist, prog->title ); /* 0 */
  27.414 -    gmyth_string_list_append_string ( slist, prog->subtitle );  /* 1 */
  27.415 -    gmyth_string_list_append_string ( slist, prog->description );   /* 2 */
  27.416 -    gmyth_string_list_append_string ( slist, prog->category );  /* 3 */
  27.417 -    gmyth_string_list_append_string ( slist, prog->chanid );    /* 4 */
  27.418 -    gmyth_string_list_append_string ( slist, prog->chanstr );   /* 5 */
  27.419 -    gmyth_string_list_append_string ( slist, prog->chansign );  /* 6 */
  27.420 -    gmyth_string_list_append_string ( slist, prog->channame );  /* 7 */
  27.421 -    gmyth_string_list_append_string ( slist, prog->pathname );  /* 8 */
  27.422 -    gmyth_string_list_append_int64 ( slist, 0 );    /* 9 */
  27.423 +  gmyth_string_list_append_string(slist, prog->title);	/* 0 */
  27.424 +  gmyth_string_list_append_string(slist, prog->subtitle);	/* 1 */
  27.425 +  gmyth_string_list_append_string(slist, prog->description);	/* 2 */
  27.426 +  gmyth_string_list_append_string(slist, prog->category);	/* 3 */
  27.427 +  gmyth_string_list_append_string(slist, prog->chanid);	/* 4 */
  27.428 +  gmyth_string_list_append_string(slist, prog->chanstr);	/* 5 */
  27.429 +  gmyth_string_list_append_string(slist, prog->chansign);	/* 6 */
  27.430 +  gmyth_string_list_append_string(slist, prog->channame);	/* 7 */
  27.431 +  gmyth_string_list_append_string(slist, prog->pathname);	/* 8 */
  27.432 +  gmyth_string_list_append_int64(slist, 0);	/* 9 */
  27.433  
  27.434 -    // fixme
  27.435 -    //gmyth_string_list_append_int64 (slist, 100/*prog->filesize*/); /* 9 */
  27.436 -    //gmyth_string_list_append_int (slist, 0); /* 10 */
  27.437 + // fixme
  27.438 + //gmyth_string_list_append_int64 (slist, 100/*prog->filesize*/); /* 9 */
  27.439 + //gmyth_string_list_append_int (slist, 0); /* 10 */
  27.440  
  27.441 -    if ( prog->startts )
  27.442 -        gmyth_string_list_append_int ( slist, prog->startts->tv_sec );  /* 11 *///DATETIME_TO_LIST(startts)
  27.443 -    else
  27.444 -        gmyth_string_list_append_int ( slist, 0 );
  27.445 +  if (prog->startts)
  27.446 +	gmyth_string_list_append_int(slist, prog->startts->tv_sec);	/* 11 *///DATETIME_TO_LIST(startts)
  27.447 +  else
  27.448 +	gmyth_string_list_append_int(slist, 0);
  27.449  
  27.450 -    if ( prog->endts )
  27.451 -        gmyth_string_list_append_int ( slist, prog->endts->tv_sec );    /* 12 *///DATETIME_TO_LIST(endts)
  27.452 -    else
  27.453 -        gmyth_string_list_append_int ( slist, 0 );
  27.454 +  if (prog->endts)
  27.455 +	gmyth_string_list_append_int(slist, prog->endts->tv_sec);	/* 12 *///DATETIME_TO_LIST(endts)
  27.456 +  else
  27.457 +	gmyth_string_list_append_int(slist, 0);
  27.458  
  27.459 -    gmyth_string_list_append_int ( slist, prog->duplicate );    /* 13 */
  27.460 -    gmyth_string_list_append_int ( slist, prog->shareable );    /* 14 */
  27.461 -    gmyth_string_list_append_int ( slist, prog->findid );   /* 15 */
  27.462 -    gmyth_string_list_append_string ( slist, prog->hostname );  /* 16 */
  27.463 -    gmyth_string_list_append_int ( slist, prog->sourceid ); /* 17 */
  27.464 -    gmyth_string_list_append_int ( slist, prog->cardid );   /* 18 */
  27.465 -    gmyth_string_list_append_int ( slist, prog->inputid );  /* 19 */
  27.466 -    gmyth_string_list_append_int ( slist, prog->recpriority );  /* 20 */
  27.467 -    gmyth_string_list_append_int ( slist, 0 /*prog->recstatus */  );    /* 21 */
  27.468 -    gmyth_string_list_append_int ( slist, prog->recordid ); /* 22 */
  27.469 -    gmyth_string_list_append_int ( slist, 0 /*prog->rectype */  );  /* 23 */
  27.470 -    gmyth_string_list_append_int ( slist, 0 /*prog->dupin */  );    /* 24 */
  27.471 -    gmyth_string_list_append_int ( slist, 0 /*prog->dupmethod */  );    /* 25 */
  27.472 -    gmyth_string_list_append_int ( slist, prog->recstartts != NULL ? prog->recstartts->tv_sec : 0 );    /* 26 *///DATETIME_TO_LIST(recstartts)
  27.473 -    gmyth_string_list_append_int ( slist, prog->recendts != NULL ? prog->recendts->tv_sec : 0 );    /* 27 *///DATETIME_TO_LIST(recendts)
  27.474 -    gmyth_string_list_append_int ( slist, prog->repeat );   /* 28 */
  27.475 -    gmyth_string_list_append_int ( slist, prog->programflags ); /* 29 */
  27.476 -    gmyth_string_list_append_char_array ( slist, "Default" );   /* 30 *///prog->(recgroup != "") ? recgroup : "Default")
  27.477 -    gmyth_string_list_append_int ( slist, prog->chancommfree ); /* 31 */
  27.478 -    gmyth_string_list_append_string ( slist, prog->chanOutputFilters ); /* 32 */
  27.479 -    gmyth_string_list_append_string ( slist, prog->seriesid );  /* 33 */
  27.480 -    gmyth_string_list_append_string ( slist, prog->programid ); /* 34 */
  27.481 -    gmyth_string_list_append_char_array ( slist, "" );  /* 35 */
  27.482 -    gmyth_string_list_append_int ( slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0 );    /* 36 *///DATETIME_TO_LIST(lastmodified)
  27.483 -    gmyth_string_list_append_int ( slist, 0 );  /* 37 *///FLOAT_TO_LIST(stars)
  27.484 -    gmyth_string_list_append_int ( slist, prog->originalAirDate != NULL ? prog->originalAirDate->tv_sec : 0 );  /* 38 *///DATETIME_TO_LIST(QDateTime(originalAirDate))
  27.485 -    gmyth_string_list_append_int ( slist, prog->hasAirDate );   /* 39 */
  27.486 -    gmyth_string_list_append_char_array ( slist, "Default" );   /* 40 *///prog->(playgroup != "") ? playgroup : "Default")
  27.487 -    gmyth_string_list_append_int ( slist, prog->recpriority2 ); /* 41 */
  27.488 +  gmyth_string_list_append_int(slist, prog->duplicate);	/* 13 */
  27.489 +  gmyth_string_list_append_int(slist, prog->shareable);	/* 14 */
  27.490 +  gmyth_string_list_append_int(slist, prog->findid);	/* 15 */
  27.491 +  gmyth_string_list_append_string(slist, prog->hostname);	/* 16 */
  27.492 +  gmyth_string_list_append_int(slist, prog->sourceid);	/* 17 */
  27.493 +  gmyth_string_list_append_int(slist, prog->cardid);	/* 18 */
  27.494 +  gmyth_string_list_append_int(slist, prog->inputid);	/* 19 */
  27.495 +  gmyth_string_list_append_int(slist, prog->recpriority);	/* 20 */
  27.496 +  gmyth_string_list_append_int(slist, 0 /*prog->recstatus */ );	/* 21 */
  27.497 +  gmyth_string_list_append_int(slist, prog->recordid);	/* 22 */
  27.498 +  gmyth_string_list_append_int(slist, 0 /*prog->rectype */ );	/* 23 */
  27.499 +  gmyth_string_list_append_int(slist, 0 /*prog->dupin */ );	/* 24 */
  27.500 +  gmyth_string_list_append_int(slist, 0 /*prog->dupmethod */ );	/* 25 */
  27.501 +  gmyth_string_list_append_int(slist, prog->recstartts != NULL ? prog->recstartts->tv_sec : 0);	/* 26 *///DATETIME_TO_LIST(recstartts)
  27.502 +  gmyth_string_list_append_int(slist, prog->recendts != NULL ? prog->recendts->tv_sec : 0);	/* 27 *///DATETIME_TO_LIST(recendts)
  27.503 +  gmyth_string_list_append_int(slist, prog->repeat);	/* 28 */
  27.504 +  gmyth_string_list_append_int(slist, prog->programflags);	/* 29 */
  27.505 +  gmyth_string_list_append_char_array(slist, "Default");	/* 30 *///prog->(recgroup != "") ? recgroup : "Default")
  27.506 +  gmyth_string_list_append_int(slist, prog->chancommfree);	/* 31 */
  27.507 +  gmyth_string_list_append_string(slist, prog->chanOutputFilters);	/* 32 */
  27.508 +  gmyth_string_list_append_string(slist, prog->seriesid);	/* 33 */
  27.509 +  gmyth_string_list_append_string(slist, prog->programid);	/* 34 */
  27.510 +  gmyth_string_list_append_char_array(slist, "");	/* 35 */
  27.511 +  gmyth_string_list_append_int(slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0);	/* 36 *///DATETIME_TO_LIST(lastmodified)
  27.512 +  gmyth_string_list_append_int(slist, 0);	/* 37 *///FLOAT_TO_LIST(stars)
  27.513 +  gmyth_string_list_append_int(slist, prog->originalAirDate != NULL ? prog->originalAirDate->tv_sec : 0);	/* 38 *///DATETIME_TO_LIST(QDateTime(originalAirDate))
  27.514 +  gmyth_string_list_append_int(slist, prog->hasAirDate);	/* 39 */
  27.515 +  gmyth_string_list_append_char_array(slist, "Default");	/* 40 *///prog->(playgroup != "") ? playgroup : "Default")
  27.516 +  gmyth_string_list_append_int(slist, prog->recpriority2);	/* 41 */
  27.517  
  27.518 -    return slist;
  27.519 +  return slist;
  27.520  }
  27.521  
  27.522  /**
  27.523 @@ -353,72 +353,72 @@
  27.524   * @return a GMythProgramInfo representing the string list got from network.
  27.525   */
  27.526  GMythProgramInfo *
  27.527 -gmyth_program_info_from_string_list_from_pos ( GMythStringList * slist,
  27.528 -                                               guint pos )
  27.529 +gmyth_program_info_from_string_list_from_pos(GMythStringList * slist,
  27.530 +											 guint pos)
  27.531  {
  27.532 -    GMythProgramInfo *prog = gmyth_program_info_new (  );
  27.533 +  GMythProgramInfo *prog = gmyth_program_info_new();
  27.534  
  27.535 -    g_return_val_if_fail ( slist != NULL &&
  27.536 -                           gmyth_string_list_get_string ( slist, pos ) != NULL,
  27.537 -                           NULL );
  27.538 +  g_return_val_if_fail(slist != NULL &&
  27.539 +					   gmyth_string_list_get_string(slist, pos) != NULL,
  27.540 +					   NULL);
  27.541  
  27.542 -    prog->title = gmyth_string_list_get_string ( slist, pos );
  27.543 -    prog->subtitle = gmyth_string_list_get_string ( slist, pos + 1 );
  27.544 -    prog->description = gmyth_string_list_get_string ( slist, pos + 2 );
  27.545 -    prog->category = gmyth_string_list_get_string ( slist, pos + 3 );
  27.546 -    prog->chanid = gmyth_string_list_get_string ( slist, pos + 4 );
  27.547 -    prog->channame = gmyth_string_list_get_string ( slist, pos + 5 );
  27.548 -    prog->chanstr = gmyth_string_list_get_string ( slist, pos + 6 );
  27.549 -    prog->chansign = gmyth_string_list_get_string ( slist, pos + 7 );
  27.550 -    prog->pathname = gmyth_string_list_get_string ( slist, pos + 8 );
  27.551 +  prog->title = gmyth_string_list_get_string(slist, pos);
  27.552 +  prog->subtitle = gmyth_string_list_get_string(slist, pos + 1);
  27.553 +  prog->description = gmyth_string_list_get_string(slist, pos + 2);
  27.554 +  prog->category = gmyth_string_list_get_string(slist, pos + 3);
  27.555 +  prog->chanid = gmyth_string_list_get_string(slist, pos + 4);
  27.556 +  prog->channame = gmyth_string_list_get_string(slist, pos + 5);
  27.557 +  prog->chanstr = gmyth_string_list_get_string(slist, pos + 6);
  27.558 +  prog->chansign = gmyth_string_list_get_string(slist, pos + 7);
  27.559 +  prog->pathname = gmyth_string_list_get_string(slist, pos + 8);
  27.560  
  27.561 -    prog->filesize = gmyth_string_list_get_int64 ( slist, pos + 9 );
  27.562 +  prog->filesize = gmyth_string_list_get_int64(slist, pos + 9);
  27.563  
  27.564 -    gmyth_debug ( "Prog info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s, %d ]\n",
  27.565 -                  gmyth_program_info_non_null_value ( prog->title ),
  27.566 -                  gmyth_program_info_non_null_value ( prog->subtitle ),
  27.567 -                  gmyth_program_info_non_null_value ( prog->description ),
  27.568 -                  gmyth_program_info_non_null_value ( prog->category ),
  27.569 -                  gmyth_program_info_non_null_value ( prog->chanid ),
  27.570 -                  gmyth_program_info_non_null_value ( prog->channame ),
  27.571 -                  gmyth_program_info_non_null_value ( prog->chanstr ),
  27.572 -                  gmyth_program_info_non_null_value ( prog->chansign ),
  27.573 -                  gmyth_program_info_non_null_value ( prog->pathname ),
  27.574 -                  gmyth_string_list_get_int ( slist, pos + 11 ) );
  27.575 +  gmyth_debug("Prog info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s, %d ]\n",
  27.576 +			  gmyth_program_info_non_null_value(prog->title),
  27.577 +			  gmyth_program_info_non_null_value(prog->subtitle),
  27.578 +			  gmyth_program_info_non_null_value(prog->description),
  27.579 +			  gmyth_program_info_non_null_value(prog->category),
  27.580 +			  gmyth_program_info_non_null_value(prog->chanid),
  27.581 +			  gmyth_program_info_non_null_value(prog->channame),
  27.582 +			  gmyth_program_info_non_null_value(prog->chanstr),
  27.583 +			  gmyth_program_info_non_null_value(prog->chansign),
  27.584 +			  gmyth_program_info_non_null_value(prog->pathname),
  27.585 +			  gmyth_string_list_get_int(slist, pos + 11));
  27.586  
  27.587 -    prog->startts = gmyth_util_string_to_time_val ( ( gmyth_util_time_to_isoformat ( ( time_t ) gmyth_string_list_get_int ( slist, pos + 11 ) ) )->str );   //DATETIME_TO_LIST(startts)
  27.588 -    prog->endts = gmyth_util_string_to_time_val ( ( gmyth_util_time_to_isoformat ( ( time_t ) gmyth_string_list_get_int ( slist, pos + 12 ) ) )->str ); //DATETIME_TO_LIST(endts)
  27.589 -    prog->duplicate = gmyth_string_list_get_int ( slist, pos + 13 );
  27.590 -    prog->shareable = gmyth_string_list_get_int ( slist, pos + 14 );
  27.591 -    prog->findid = gmyth_string_list_get_int ( slist, pos + 15 );
  27.592 -    prog->hostname = gmyth_string_list_get_string ( slist, pos + 16 );
  27.593 -    prog->sourceid = gmyth_string_list_get_int ( slist, pos + 17 );
  27.594 -    prog->cardid = gmyth_string_list_get_int ( slist, pos + 18 );
  27.595 -    prog->inputid = gmyth_string_list_get_int ( slist, pos + 19 );
  27.596 -    prog->recpriority = gmyth_string_list_get_int ( slist, pos + 20 );
  27.597 -    prog->reactivate = gmyth_string_list_get_int ( slist, pos + 21 );
  27.598 -    prog->recordid = gmyth_string_list_get_int ( slist, pos + 22 );
  27.599 -    gmyth_string_list_get_int ( slist, pos + 23 );
  27.600 -    gmyth_string_list_get_int ( slist, pos + 24 );
  27.601 -    gmyth_string_list_get_int ( slist, pos + 25 );
  27.602 -    prog->recstartts = gmyth_util_string_to_time_val ( ( gmyth_util_time_to_isoformat ( ( time_t ) gmyth_string_list_get_int ( slist, pos + 26 ) ) )->str );    //DATETIME_TO_LIST(recstartts)
  27.603 -    prog->recendts = gmyth_util_string_to_time_val ( ( gmyth_util_time_to_isoformat ( ( time_t ) gmyth_string_list_get_int ( slist, pos + 27 ) ) )->str );  //DATETIME_TO_LIST(recendts)
  27.604 -    prog->repeat = gmyth_string_list_get_int ( slist, pos + 28 );
  27.605 -    prog->programflags = gmyth_string_list_get_int ( slist, pos + 29 );
  27.606 -    prog->recgroup = gmyth_string_list_get_string ( slist, pos + 30 );  //prog->(recgroup != "") ? recgroup : "Default")
  27.607 -    prog->chancommfree = gmyth_string_list_get_int ( slist, pos + 31 );
  27.608 -    prog->chanOutputFilters = gmyth_string_list_get_string ( slist, pos + 32 );
  27.609 -    prog->seriesid = gmyth_string_list_get_string ( slist, pos + 33 );
  27.610 -    prog->programid = gmyth_string_list_get_string ( slist, pos + 34 );
  27.611 -    gmyth_string_list_get_string ( slist, pos + 35 );
  27.612 -    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)
  27.613 -    gmyth_string_list_get_int ( slist, pos + 37 );  //FLOAT_TO_LIST(stars)
  27.614 -    prog->originalAirDate = gmyth_util_string_to_time_val ( ( gmyth_util_time_to_isoformat ( ( time_t ) gmyth_string_list_get_int ( slist, pos + 38 ) ) )->str );   //DATETIME_TO_LIST(QDateTime(originalAirDate))
  27.615 -    prog->hasAirDate = gmyth_string_list_get_int ( slist, pos + 39 );
  27.616 -    prog->playgroup = gmyth_string_list_get_string ( slist, pos + 40 ); //prog->(playgroup != "") ? playgroup : "Default")
  27.617 -    prog->recpriority2 = gmyth_string_list_get_int ( slist, pos + 41 );
  27.618 +  prog->startts = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 11)))->str);	//DATETIME_TO_LIST(startts)
  27.619 +  prog->endts = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 12)))->str);	//DATETIME_TO_LIST(endts)
  27.620 +  prog->duplicate = gmyth_string_list_get_int(slist, pos + 13);
  27.621 +  prog->shareable = gmyth_string_list_get_int(slist, pos + 14);
  27.622 +  prog->findid = gmyth_string_list_get_int(slist, pos + 15);
  27.623 +  prog->hostname = gmyth_string_list_get_string(slist, pos + 16);
  27.624 +  prog->sourceid = gmyth_string_list_get_int(slist, pos + 17);
  27.625 +  prog->cardid = gmyth_string_list_get_int(slist, pos + 18);
  27.626 +  prog->inputid = gmyth_string_list_get_int(slist, pos + 19);
  27.627 +  prog->recpriority = gmyth_string_list_get_int(slist, pos + 20);
  27.628 +  prog->reactivate = gmyth_string_list_get_int(slist, pos + 21);
  27.629 +  prog->recordid = gmyth_string_list_get_int(slist, pos + 22);
  27.630 +  gmyth_string_list_get_int(slist, pos + 23);
  27.631 +  gmyth_string_list_get_int(slist, pos + 24);
  27.632 +  gmyth_string_list_get_int(slist, pos + 25);
  27.633 +  prog->recstartts = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 26)))->str);	//DATETIME_TO_LIST(recstartts)
  27.634 +  prog->recendts = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 27)))->str);	//DATETIME_TO_LIST(recendts)
  27.635 +  prog->repeat = gmyth_string_list_get_int(slist, pos + 28);
  27.636 +  prog->programflags = gmyth_string_list_get_int(slist, pos + 29);
  27.637 +  prog->recgroup = gmyth_string_list_get_string(slist, pos + 30);	//prog->(recgroup != "") ? recgroup : "Default")
  27.638 +  prog->chancommfree = gmyth_string_list_get_int(slist, pos + 31);
  27.639 +  prog->chanOutputFilters = gmyth_string_list_get_string(slist, pos + 32);
  27.640 +  prog->seriesid = gmyth_string_list_get_string(slist, pos + 33);
  27.641 +  prog->programid = gmyth_string_list_get_string(slist, pos + 34);
  27.642 +  gmyth_string_list_get_string(slist, pos + 35);
  27.643 +  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)
  27.644 +  gmyth_string_list_get_int(slist, pos + 37);	//FLOAT_TO_LIST(stars)
  27.645 +  prog->originalAirDate = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 38)))->str);	//DATETIME_TO_LIST(QDateTime(originalAirDate))
  27.646 +  prog->hasAirDate = gmyth_string_list_get_int(slist, pos + 39);
  27.647 +  prog->playgroup = gmyth_string_list_get_string(slist, pos + 40);	//prog->(playgroup != "") ? playgroup : "Default")
  27.648 +  prog->recpriority2 = gmyth_string_list_get_int(slist, pos + 41);
  27.649  
  27.650 -    return prog;
  27.651 +  return prog;
  27.652  }
  27.653  
  27.654  /**
  27.655 @@ -429,15 +429,15 @@
  27.656   * @return a GMythProgramInfo representing the string list got from network.
  27.657   */
  27.658  GMythProgramInfo *
  27.659 -gmyth_program_info_from_string_list ( GMythStringList * slist )
  27.660 +gmyth_program_info_from_string_list(GMythStringList * slist)
  27.661  {
  27.662 -    GMythProgramInfo *prog = NULL;
  27.663 +  GMythProgramInfo *prog = NULL;
  27.664  
  27.665 -    g_return_val_if_fail ( slist != NULL, NULL );
  27.666 +  g_return_val_if_fail(slist != NULL, NULL);
  27.667  
  27.668 -    prog = gmyth_program_info_from_string_list_from_pos ( slist, 0 );
  27.669 +  prog = gmyth_program_info_from_string_list_from_pos(slist, 0);
  27.670  
  27.671 -    return prog;
  27.672 +  return prog;
  27.673  }
  27.674  
  27.675  /**
  27.676 @@ -448,51 +448,51 @@
  27.677   * @return a GMythProgramInfo representing the string list got from network.
  27.678   */
  27.679  GMythProgramInfo *
  27.680 -gmyth_program_info_from_string_list_next_prog ( GMythStringList * slist )
  27.681 +gmyth_program_info_from_string_list_next_prog(GMythStringList * slist)
  27.682  {
  27.683 -    GMythProgramInfo *prog = gmyth_program_info_new (  );
  27.684 +  GMythProgramInfo *prog = gmyth_program_info_new();
  27.685  
  27.686 -    g_return_val_if_fail ( slist != NULL, NULL );
  27.687 +  g_return_val_if_fail(slist != NULL, NULL);
  27.688  
  27.689 -    /*    
  27.690 -       {Home Improvement[]:[]No, No, Godot[]:[]
  27.691 -       US sitcom about a DIY-obsessed father of three. When 
  27.692 -       Tim tries to sell off his extra ticket for an ice hockey game, he is arrested as a tout.[]:[]
  27.693 -       Sitcom[]:[]2007-04-18T15:30:00[]:[]2007-04-18T16:00:00[]:[]ABC1[]:[]
  27.694 -       /home/hmelo/.mythtv/channels/abc1.jpg[]:[]abc1[]:[]2000[]:[]25725844[]:[] }
  27.695 -     */
  27.696 + /*    
  27.697 +    {Home Improvement[]:[]No, No, Godot[]:[]
  27.698 +    US sitcom about a DIY-obsessed father of three. When 
  27.699 +    Tim tries to sell off his extra ticket for an ice hockey game, he is arrested as a tout.[]:[]
  27.700 +    Sitcom[]:[]2007-04-18T15:30:00[]:[]2007-04-18T16:00:00[]:[]ABC1[]:[]
  27.701 +    /home/hmelo/.mythtv/channels/abc1.jpg[]:[]abc1[]:[]2000[]:[]25725844[]:[] }
  27.702 +  */
  27.703  
  27.704 -    prog->title = gmyth_string_list_get_string ( slist, 0 );
  27.705 -    prog->subtitle = gmyth_string_list_get_string ( slist, 1 );
  27.706 -    prog->description = gmyth_string_list_get_string ( slist, 2 );
  27.707 -    prog->category = gmyth_string_list_get_string ( slist, 3 );
  27.708 -    prog->startts = gmyth_util_string_to_time_val ( gmyth_string_list_get_char_array ( slist, 4 ) );    //DATETIME_TO_LIST(startts)
  27.709 -    prog->endts = gmyth_util_string_to_time_val ( gmyth_string_list_get_char_array ( slist, 5 ) );  //DATETIME_TO_LIST(endts)
  27.710 -    prog->channame = gmyth_string_list_get_string ( slist, 6 );
  27.711 -    prog->chansign = gmyth_string_list_get_string ( slist, 7 );
  27.712 -    prog->chanstr = gmyth_string_list_get_string ( slist, 8 );
  27.713 -    prog->chanid = gmyth_string_list_get_string ( slist, 9 );
  27.714 -    prog->filesize = gmyth_string_list_get_int64 ( slist, 10 );
  27.715 +  prog->title = gmyth_string_list_get_string(slist, 0);
  27.716 +  prog->subtitle = gmyth_string_list_get_string(slist, 1);
  27.717 +  prog->description = gmyth_string_list_get_string(slist, 2);
  27.718 +  prog->category = gmyth_string_list_get_string(slist, 3);
  27.719 +  prog->startts = gmyth_util_string_to_time_val(gmyth_string_list_get_char_array(slist, 4));	//DATETIME_TO_LIST(startts)
  27.720 +  prog->endts = gmyth_util_string_to_time_val(gmyth_string_list_get_char_array(slist, 5));	//DATETIME_TO_LIST(endts)
  27.721 +  prog->channame = gmyth_string_list_get_string(slist, 6);
  27.722 +  prog->chansign = gmyth_string_list_get_string(slist, 7);
  27.723 +  prog->chanstr = gmyth_string_list_get_string(slist, 8);
  27.724 +  prog->chanid = gmyth_string_list_get_string(slist, 9);
  27.725 +  prog->filesize = gmyth_string_list_get_int64(slist, 10);
  27.726  
  27.727 -    gmyth_debug ( "NEXT program info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s ]\n",
  27.728 -                  gmyth_program_info_non_null_value ( prog->title ),
  27.729 -                  gmyth_program_info_non_null_value ( prog->subtitle ),
  27.730 -                  gmyth_program_info_non_null_value ( prog->description ),
  27.731 -                  gmyth_program_info_non_null_value ( prog->category ),
  27.732 -                  gmyth_program_info_non_null_value ( prog->chanid ),
  27.733 -                  gmyth_program_info_non_null_value ( prog->channame ),
  27.734 -                  gmyth_program_info_non_null_value ( prog->chanstr ),
  27.735 -                  gmyth_program_info_non_null_value ( prog->chansign ),
  27.736 -                  gmyth_program_info_non_null_value ( prog->pathname ) );
  27.737 +  gmyth_debug("NEXT program info: [ %s, %s, %s, %s, %s, %s, %s, %s, %s ]\n",
  27.738 +			  gmyth_program_info_non_null_value(prog->title),
  27.739 +			  gmyth_program_info_non_null_value(prog->subtitle),
  27.740 +			  gmyth_program_info_non_null_value(prog->description),
  27.741 +			  gmyth_program_info_non_null_value(prog->category),
  27.742 +			  gmyth_program_info_non_null_value(prog->chanid),
  27.743 +			  gmyth_program_info_non_null_value(prog->channame),
  27.744 +			  gmyth_program_info_non_null_value(prog->chanstr),
  27.745 +			  gmyth_program_info_non_null_value(prog->chansign),
  27.746 +			  gmyth_program_info_non_null_value(prog->pathname));
  27.747  
  27.748 -    return prog;
  27.749 +  return prog;
  27.750  }
  27.751  
  27.752  static const gchar *
  27.753 -gmyth_program_info_non_null_value ( const GString * str )
  27.754 +gmyth_program_info_non_null_value(const GString * str)
  27.755  {
  27.756 -    return ( str != NULL && str->str != NULL
  27.757 -             && strlen ( str->str ) > 0 ? str->str : " " );
  27.758 +  return (str != NULL && str->str != NULL
  27.759 +		  && strlen(str->str) > 0 ? str->str : " ");
  27.760  }
  27.761  
  27.762  /**
  27.763 @@ -503,45 +503,44 @@
  27.764   * @return a string representing the program info.
  27.765   */
  27.766  const gchar *
  27.767 -gmyth_program_info_to_string ( const GMythProgramInfo * prog )
  27.768 +gmyth_program_info_to_string(const GMythProgramInfo * prog)
  27.769  {
  27.770 -    return
  27.771 -        g_strdup_printf
  27.772 -        ( "Title: %s, Subtitle: %s, Description: %s, Category: %s, Channel ID: %s, "
  27.773 -          "Channel Name: %s, Chan str: %s, Channel Sign: %s, Path Name: %s, File Size: %lld, \n"
  27.774 -          "Start TS: %s, End TS: %s, Duplicate: %d, Shareable: %d, Find ID: %d, Hostname: %s, "
  27.775 -          "Source ID: %d, Vard ID: %d, Input ID: %d, Rec Priority: %d, Reactivate: %d, \n"
  27.776 -          "Record ID: %d, Rec Start TS: %s, Rec End TS: %s, Repeat: %d, Program Flags: %d, "
  27.777 -          "Rec Group: %s, Channel Comm Free: %d, Channel Output Filters: %s, Series ID: %s, \n"
  27.778 -          "Program ID: %s, Last Modified Date: %s, Original Air Date: %s, Has Air Date: %d, "
  27.779 -          "Play Group: %s.\n",
  27.780 -          gmyth_program_info_non_null_value ( prog->title ),
  27.781 -          gmyth_program_info_non_null_value ( prog->subtitle ),
  27.782 -          gmyth_program_info_non_null_value ( prog->description ),
  27.783 -          gmyth_program_info_non_null_value ( prog->category ),
  27.784 -          gmyth_program_info_non_null_value ( prog->chanid ),
  27.785 -          gmyth_program_info_non_null_value ( prog->channame ),
  27.786 -          gmyth_program_info_non_null_value ( prog->chanstr ),
  27.787 -          gmyth_program_info_non_null_value ( prog->chansign ),
  27.788 -          gmyth_program_info_non_null_value ( prog->pathname ), prog->filesize,
  27.789 -          gmyth_util_time_to_string_from_time_val ( prog->startts ),
  27.790 -          gmyth_util_time_to_string_from_time_val ( prog->endts ),
  27.791 -          prog->duplicate, prog->shareable, prog->findid,
  27.792 -          gmyth_program_info_non_null_value ( prog->hostname ), prog->sourceid,
  27.793 -          prog->cardid, prog->inputid, prog->recpriority, prog->reactivate,
  27.794 -          prog->recordid,
  27.795 -          gmyth_util_time_to_string_from_time_val ( prog->recstartts ),
  27.796 -          gmyth_util_time_to_string_from_time_val ( prog->recendts ),
  27.797 -          prog->repeat, prog->programflags,
  27.798 -          gmyth_program_info_non_null_value ( prog->recgroup ),
  27.799 -          prog->chancommfree,
  27.800 -          gmyth_program_info_non_null_value ( prog->chanOutputFilters ),
  27.801 -          gmyth_program_info_non_null_value ( prog->seriesid ),
  27.802 -          gmyth_program_info_non_null_value ( prog->programid ),
  27.803 -          gmyth_util_time_to_string_from_time_val ( prog->lastmodified ),
  27.804 -          gmyth_util_time_to_string_from_time_val ( prog->originalAirDate ),
  27.805 -          prog->hasAirDate,
  27.806 -          gmyth_program_info_non_null_value ( prog->playgroup ) );
  27.807 +  return
  27.808 +	g_strdup_printf
  27.809 +	("Title: %s, Subtitle: %s, Description: %s, Category: %s, Channel ID: %s, "
  27.810 +	 "Channel Name: %s, Chan str: %s, Channel Sign: %s, Path Name: %s, File Size: %lld, \n"
  27.811 +	 "Start TS: %s, End TS: %s, Duplicate: %d, Shareable: %d, Find ID: %d, Hostname: %s, "
  27.812 +	 "Source ID: %d, Vard ID: %d, Input ID: %d, Rec Priority: %d, Reactivate: %d, \n"
  27.813 +	 "Record ID: %d, Rec Start TS: %s, Rec End TS: %s, Repeat: %d, Program Flags: %d, "
  27.814 +	 "Rec Group: %s, Channel Comm Free: %d, Channel Output Filters: %s, Series ID: %s, \n"
  27.815 +	 "Program ID: %s, Last Modified Date: %s, Original Air Date: %s, Has Air Date: %d, "
  27.816 +	 "Play Group: %s.\n",
  27.817 +	 gmyth_program_info_non_null_value(prog->title),
  27.818 +	 gmyth_program_info_non_null_value(prog->subtitle),
  27.819 +	 gmyth_program_info_non_null_value(prog->description),
  27.820 +	 gmyth_program_info_non_null_value(prog->category),
  27.821 +	 gmyth_program_info_non_null_value(prog->chanid),
  27.822 +	 gmyth_program_info_non_null_value(prog->channame),
  27.823 +	 gmyth_program_info_non_null_value(prog->chanstr),
  27.824 +	 gmyth_program_info_non_null_value(prog->chansign),
  27.825 +	 gmyth_program_info_non_null_value(prog->pathname), prog->filesize,
  27.826 +	 gmyth_util_time_to_string_from_time_val(prog->startts),
  27.827 +	 gmyth_util_time_to_string_from_time_val(prog->endts),
  27.828 +	 prog->duplicate, prog->shareable, prog->findid,
  27.829 +	 gmyth_program_info_non_null_value(prog->hostname), prog->sourceid,
  27.830 +	 prog->cardid, prog->inputid, prog->recpriority, prog->reactivate,
  27.831 +	 prog->recordid,
  27.832 +	 gmyth_util_time_to_string_from_time_val(prog->recstartts),
  27.833 +	 gmyth_util_time_to_string_from_time_val(prog->recendts),
  27.834 +	 prog->repeat, prog->programflags,
  27.835 +	 gmyth_program_info_non_null_value(prog->recgroup),
  27.836 +	 prog->chancommfree,
  27.837 +	 gmyth_program_info_non_null_value(prog->chanOutputFilters),
  27.838 +	 gmyth_program_info_non_null_value(prog->seriesid),
  27.839 +	 gmyth_program_info_non_null_value(prog->programid),
  27.840 +	 gmyth_util_time_to_string_from_time_val(prog->lastmodified),
  27.841 +	 gmyth_util_time_to_string_from_time_val(prog->originalAirDate),
  27.842 +	 prog->hasAirDate, gmyth_program_info_non_null_value(prog->playgroup));
  27.843  }
  27.844  
  27.845  /**
  27.846 @@ -553,17 +552,17 @@
  27.847   * @return <code>true</code>, if the program infos are equals.
  27.848   */
  27.849  gboolean
  27.850 -gmyth_program_info_is_equals ( const GMythProgramInfo * prog1,
  27.851 -                               const GMythProgramInfo * prog2 )
  27.852 +gmyth_program_info_is_equals(const GMythProgramInfo * prog1,
  27.853 +							 const GMythProgramInfo * prog2)
  27.854  {
  27.855 -    if ( ( strcmp ( gmyth_program_info_non_null_value ( prog1->title ),
  27.856 -                    gmyth_program_info_non_null_value ( prog2->title ) ) == 0 )
  27.857 -         ||
  27.858 -         ( strcmp
  27.859 -           ( gmyth_program_info_non_null_value ( prog1->pathname ),
  27.860 -             gmyth_program_info_non_null_value ( prog2->pathname ) ) == 0 ) )
  27.861 -        return TRUE;
  27.862 -    else
  27.863 -        return FALSE;
  27.864 +  if ((strcmp(gmyth_program_info_non_null_value(prog1->title),
  27.865 +			  gmyth_program_info_non_null_value(prog2->title)) == 0)
  27.866 +	  ||
  27.867 +	  (strcmp
  27.868 +	   (gmyth_program_info_non_null_value(prog1->pathname),
  27.869 +		gmyth_program_info_non_null_value(prog2->pathname)) == 0))
  27.870 +	return TRUE;
  27.871 +  else
  27.872 +	return FALSE;
  27.873  
  27.874  }
    28.1 --- a/gmyth/src/gmyth_programinfo.h	Wed Jun 13 18:18:42 2007 +0100
    28.2 +++ b/gmyth/src/gmyth_programinfo.h	Thu Jun 14 18:19:52 2007 +0100
    28.3 @@ -46,11 +46,11 @@
    28.4  typedef struct _GMythProgramInfoClass GMythProgramInfoClass;
    28.5  
    28.6  struct _GMythProgramInfoClass
    28.7 -    {
    28.8 -        GObjectClass parent_class;
    28.9 +{
   28.10 +  GObjectClass parent_class;
   28.11  
   28.12 -        /* callbacks */
   28.13 -    };
   28.14 + /* callbacks */
   28.15 +};
   28.16  
   28.17  /**
   28.18   * The GMythProgramInfo structure represents a program information
   28.19 @@ -58,115 +58,115 @@
   28.20   * a program scheduled to be recorded, or a program already recorded.
   28.21   */
   28.22  struct _GMythProgramInfo
   28.23 -    {
   28.24 -        GObject parent;
   28.25 +{
   28.26 +  GObject parent;
   28.27  
   28.28 -    /** The channel unique ID. */
   28.29 -        GString *chanid;
   28.30 +	/** The channel unique ID. */
   28.31 +  GString *chanid;
   28.32  
   28.33 -    /** The program start time. */
   28.34 -        GTimeVal *startts;
   28.35 -    /** The program end time. */
   28.36 -        GTimeVal *endts;
   28.37 -    /** The recording schedule start time. */
   28.38 -        GTimeVal *recstartts;
   28.39 -    /** The recording schedule end time */
   28.40 -        GTimeVal *recendts;
   28.41 +	/** The program start time. */
   28.42 +  GTimeVal *startts;
   28.43 +	/** The program end time. */
   28.44 +  GTimeVal *endts;
   28.45 +	/** The recording schedule start time. */
   28.46 +  GTimeVal *recstartts;
   28.47 +	/** The recording schedule end time */
   28.48 +  GTimeVal *recendts;
   28.49  
   28.50 -    /** The program title. */
   28.51 -        GString *title;
   28.52 -    /** The program subtitle. */
   28.53 -        GString *subtitle;
   28.54 -    /** The program description. */
   28.55 -        GString *description;
   28.56 -    /** The program category. */
   28.57 -        GString *category;
   28.58 +	/** The program title. */
   28.59 +  GString *title;
   28.60 +	/** The program subtitle. */
   28.61 +  GString *subtitle;
   28.62 +	/** The program description. */
   28.63 +  GString *description;
   28.64 +	/** The program category. */
   28.65 +  GString *category;
   28.66  
   28.67 -        GString *chanstr;
   28.68 -        GString *chansign;
   28.69 -    /** The associated channel name. */
   28.70 -        GString *channame;
   28.71 -        gint chancommfree;
   28.72 -        GString *chanOutputFilters;
   28.73 +  GString *chanstr;
   28.74 +  GString *chansign;
   28.75 +	/** The associated channel name. */
   28.76 +  GString *channame;
   28.77 +  gint chancommfree;
   28.78 +  GString *chanOutputFilters;
   28.79  
   28.80 -        GString *seriesid;
   28.81 -    /** The program unique id. */
   28.82 -        GString *programid;
   28.83 -        GString *catType;
   28.84 +  GString *seriesid;
   28.85 +	/** The program unique id. */
   28.86 +  GString *programid;
   28.87 +  GString *catType;
   28.88  
   28.89 -        GString *sortTitle;
   28.90 +  GString *sortTitle;
   28.91  
   28.92 -    /** A flag informing if the program has video or not. */
   28.93 -        gboolean isVideo;
   28.94 -        gint lenMins;
   28.95 +	/** A flag informing if the program has video or not. */
   28.96 +  gboolean isVideo;
   28.97 +  gint lenMins;
   28.98  
   28.99 -        GString *year;
  28.100 -        gdouble stars;
  28.101 -        gint repeat;
  28.102 +  GString *year;
  28.103 +  gdouble stars;
  28.104 +  gint repeat;
  28.105  
  28.106 -        GTimeVal *originalAirDate;
  28.107 -        GTimeVal *lastmodified;
  28.108 -        GTimeVal *lastInUseTime;
  28.109 +  GTimeVal *originalAirDate;
  28.110 +  GTimeVal *lastmodified;
  28.111 +  GTimeVal *lastInUseTime;
  28.112  
  28.113 -        gboolean hasAirDate;
  28.114 +  gboolean hasAirDate;
  28.115  
  28.116 -        gint spread;
  28.117 -        gint startCol;
  28.118 +  gint spread;
  28.119 +  gint startCol;
  28.120  
  28.121 -        gint recpriority2;
  28.122 -        gint reactivate;
  28.123 +  gint recpriority2;
  28.124 +  gint reactivate;
  28.125  
  28.126 -        gint recordid;
  28.127 -        gint parentid;
  28.128 +  gint recordid;
  28.129 +  gint parentid;
  28.130  
  28.131 -    /** The backend video source id associated to this program.*/
  28.132 -        gint sourceid;
  28.133 -    /** the backend input id associated to this program.*/
  28.134 -        gint inputid;
  28.135 -    /** The backend card id associated to this program.*/
  28.136 -        gint cardid;
  28.137 -        gboolean shareable;
  28.138 -        gboolean duplicate;
  28.139 +	/** The backend video source id associated to this program.*/
  28.140 +  gint sourceid;
  28.141 +	/** the backend input id associated to this program.*/
  28.142 +  gint inputid;
  28.143 +	/** The backend card id associated to this program.*/
  28.144 +  gint cardid;
  28.145 +  gboolean shareable;
  28.146 +  gboolean duplicate;
  28.147  
  28.148 -        GString *schedulerid;
  28.149 -        gint findid;
  28.150 +  GString *schedulerid;
  28.151 +  gint findid;
  28.152  
  28.153 -        gint programflags;
  28.154 -        gint transcoder;
  28.155 +  gint programflags;
  28.156 +  gint transcoder;
  28.157  
  28.158 -        GString *recgroup;
  28.159 -        GString *playgroup;
  28.160 -        gint recpriority;
  28.161 +  GString *recgroup;
  28.162 +  GString *playgroup;
  28.163 +  gint recpriority;
  28.164  
  28.165 -    /** The file size of the recorded program.*/
  28.166 -        gint64 filesize;
  28.167 +	/** The file size of the recorded program.*/
  28.168 +  gint64 filesize;
  28.169  
  28.170 -    /** The file name of the recorded program.*/
  28.171 -        GString *pathname;
  28.172 -        GString *hostname;
  28.173 -    };
  28.174 +	/** The file name of the recorded program.*/
  28.175 +  GString *pathname;
  28.176 +  GString *hostname;
  28.177 +};
  28.178  
  28.179 -GType gmyth_program_info_type ( void );
  28.180 +GType gmyth_program_info_type(void);
  28.181  
  28.182 -GMythProgramInfo *gmyth_program_info_new ( void );
  28.183 +GMythProgramInfo *gmyth_program_info_new(void);
  28.184  
  28.185 -GMythStringList *gmyth_program_info_to_string_list ( GMythProgramInfo * prog,
  28.186 -                                                     GMythStringList * slist );
  28.187 +GMythStringList *gmyth_program_info_to_string_list(GMythProgramInfo * prog,
  28.188 +												   GMythStringList * slist);
  28.189  
  28.190 -GMythProgramInfo *gmyth_program_info_from_string_list_from_pos ( GMythStringList
  28.191 -                                                                 * slist,
  28.192 -                                                                 guint pos );
  28.193 +GMythProgramInfo *gmyth_program_info_from_string_list_from_pos(GMythStringList
  28.194 +															   * slist,
  28.195 +															   guint pos);
  28.196  
  28.197 -GMythProgramInfo *gmyth_program_info_from_string_list ( GMythStringList *
  28.198 -                                                        slist );
  28.199 +GMythProgramInfo *gmyth_program_info_from_string_list(GMythStringList *
  28.200 +													  slist);
  28.201  
  28.202  GMythProgramInfo
  28.203 -    * gmyth_program_info_from_string_list_next_prog ( GMythStringList * slist );
  28.204 +  * gmyth_program_info_from_string_list_next_prog(GMythStringList * slist);
  28.205  
  28.206 -const gchar *gmyth_program_info_to_string ( const GMythProgramInfo * prog );
  28.207 +const gchar *gmyth_program_info_to_string(const GMythProgramInfo * prog);
  28.208  
  28.209 -gboolean gmyth_program_info_is_equals ( const GMythProgramInfo * prog1,
  28.210 -                                        const GMythProgramInfo * prog2 );
  28.211 +gboolean gmyth_program_info_is_equals(const GMythProgramInfo * prog1,
  28.212 +									  const GMythProgramInfo * prog2);
  28.213  
  28.214  G_END_DECLS
  28.215  #endif /*_GMYTH_PROGRAMINFO_H*/
    29.1 --- a/gmyth/src/gmyth_query.c	Wed Jun 13 18:18:42 2007 +0100
    29.2 +++ b/gmyth/src/gmyth_query.c	Thu Jun 14 18:19:52 2007 +0100
    29.3 @@ -36,62 +36,62 @@
    29.4  #include "gmyth_query.h"
    29.5  #include "gmyth_debug.h"
    29.6  
    29.7 -static void gmyth_query_class_init ( GMythQueryClass * klass );
    29.8 -static void gmyth_query_init ( GMythQuery * object );
    29.9 +static void gmyth_query_class_init(GMythQueryClass * klass);
   29.10 +static void gmyth_query_init(GMythQuery * object);
   29.11  
   29.12 -static void gmyth_query_dispose ( GObject * object );
   29.13 -static void gmyth_query_finalize ( GObject * object );
   29.14 +static void gmyth_query_dispose(GObject * object);
   29.15 +static void gmyth_query_finalize(GObject * object);
   29.16  
   29.17 -static void gmyth_query_print_error ( MYSQL * conn, char *message );
   29.18 +static void gmyth_query_print_error(MYSQL * conn, char *message);
   29.19  
   29.20 -G_DEFINE_TYPE ( GMythQuery, gmyth_query, G_TYPE_OBJECT )
   29.21 -     static void gmyth_query_class_init ( GMythQueryClass * klass )
   29.22 +G_DEFINE_TYPE(GMythQuery, gmyth_query, G_TYPE_OBJECT)
   29.23 +	 static void gmyth_query_class_init(GMythQueryClass * klass)
   29.24  {
   29.25 -    GObjectClass *gobject_class;
   29.26 +  GObjectClass *gobject_class;
   29.27  
   29.28 -    gobject_class = ( GObjectClass * ) klass;
   29.29 +  gobject_class = (GObjectClass *) klass;
   29.30  
   29.31 -    gobject_class->dispose = gmyth_query_dispose;
   29.32 -    gobject_class->finalize = gmyth_query_finalize;
   29.33 +  gobject_class->dispose = gmyth_query_dispose;
   29.34 +  gobject_class->finalize = gmyth_query_finalize;
   29.35  }
   29.36  
   29.37  static void
   29.38 -gmyth_query_init ( GMythQuery * gmyth_query )
   29.39 +gmyth_query_init(GMythQuery * gmyth_query)
   29.40  {
   29.41 -    gmyth_query->backend_info = NULL;
   29.42 +  gmyth_query->backend_info = NULL;
   29.43  
   29.44 -    /* initialize connection handler */
   29.45 -    gmyth_query->conn = mysql_init ( NULL );
   29.46 + /* initialize connection handler */
   29.47 +  gmyth_query->conn = mysql_init(NULL);
   29.48  
   29.49 -    if ( !( gmyth_query->conn ) )
   29.50 -        g_warning ( "[%s] MSQL structure not initialized", __FUNCTION__ );
   29.51 +  if (!(gmyth_query->conn))
   29.52 +	g_warning("[%s] MSQL structure not initialized", __FUNCTION__);
   29.53  }
   29.54  
   29.55  static void
   29.56 -gmyth_query_dispose ( GObject * object )
   29.57 +gmyth_query_dispose(GObject * object)
   29.58  {
   29.59 -    GMythQuery *gmyth_query = GMYTH_QUERY ( object );
   29.60 +  GMythQuery *gmyth_query = GMYTH_QUERY(object);
   29.61  
   29.62 -    if ( gmyth_query->conn != NULL )
   29.63 -    {
   29.64 -        gmyth_query_disconnect ( gmyth_query );
   29.65 -    }
   29.66 +  if (gmyth_query->conn != NULL)
   29.67 +	{
   29.68 +	  gmyth_query_disconnect(gmyth_query);
   29.69 +	}
   29.70  
   29.71 -    if ( gmyth_query->backend_info )
   29.72 -    {
   29.73 -        g_object_unref ( gmyth_query->backend_info );
   29.74 -        gmyth_query->backend_info = NULL;
   29.75 -    }
   29.76 +  if (gmyth_query->backend_info)
   29.77 +	{
   29.78 +	  g_object_unref(gmyth_query->backend_info);
   29.79 +	  gmyth_query->backend_info = NULL;
   29.80 +	}
   29.81  
   29.82 -    G_OBJECT_CLASS ( gmyth_query_parent_class )->dispose ( object );
   29.83 +  G_OBJECT_CLASS(gmyth_query_parent_class)->dispose(object);
   29.84  }
   29.85  
   29.86  static void
   29.87 -gmyth_query_finalize ( GObject * object )
   29.88 +gmyth_query_finalize(GObject * object)
   29.89  {
   29.90 -    g_signal_handlers_destroy ( object );
   29.91 +  g_signal_handlers_destroy(object);
   29.92  
   29.93 -    G_OBJECT_CLASS ( gmyth_query_parent_class )->finalize ( object );
   29.94 +  G_OBJECT_CLASS(gmyth_query_parent_class)->finalize(object);
   29.95  }
   29.96  
   29.97  /** Creates a new instance of GMythQuery.
   29.98 @@ -99,34 +99,33 @@
   29.99   * @return a new instance of GMythQuery.
  29.100   */
  29.101  GMythQuery *
  29.102 -gmyth_query_new (  )
  29.103 +gmyth_query_new()
  29.104  {
  29.105 -    GMythQuery *sql_query =
  29.106 -        GMYTH_QUERY ( g_object_new ( GMYTH_QUERY_TYPE, NULL ) );
  29.107 +  GMythQuery *sql_query = GMYTH_QUERY(g_object_new(GMYTH_QUERY_TYPE, NULL));
  29.108  
  29.109 -    return sql_query;
  29.110 +  return sql_query;
  29.111  }
  29.112  
  29.113  gboolean
  29.114 -gmyth_query_connect_with_timeout ( GMythQuery * gmyth_query,
  29.115 -                                   GMythBackendInfo * backend_info,
  29.116 -                                   guint timeout )
  29.117 +gmyth_query_connect_with_timeout(GMythQuery * gmyth_query,
  29.118 +								 GMythBackendInfo * backend_info,
  29.119 +								 guint timeout)
  29.120  {
  29.121 -    assert ( gmyth_query );
  29.122 +  assert(gmyth_query);
  29.123  
  29.124 -    if ( gmyth_query->conn == NULL )
  29.125 -    {
  29.126 -        gmyth_query->conn = mysql_init ( NULL );
  29.127 -    }
  29.128 +  if (gmyth_query->conn == NULL)
  29.129 +	{
  29.130 +	  gmyth_query->conn = mysql_init(NULL);
  29.131 +	}
  29.132  
  29.133 -    if ( timeout != 0 )
  29.134 -    {
  29.135 -        /* sets connection timeout */
  29.136 -        mysql_options ( gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT,
  29.137 -                        ( gchar * ) & timeout );
  29.138 -    }
  29.139 +  if (timeout != 0)
  29.140 +	{
  29.141 +	 /* sets connection timeout */
  29.142 +	  mysql_options(gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT,
  29.143 +					(gchar *) & timeout);
  29.144 +	}
  29.145  
  29.146 -    return gmyth_query_connect ( gmyth_query, backend_info );
  29.147 +  return gmyth_query_connect(gmyth_query, backend_info);
  29.148  }
  29.149  
  29.150  /** Connects to the Mysql database in the backend. The backend address
  29.151 @@ -136,49 +135,47 @@
  29.152   * @return true if connection was success, false if failed.
  29.153   */
  29.154  gboolean
  29.155 -gmyth_query_connect ( GMythQuery * gmyth_query,
  29.156 -                      GMythBackendInfo * backend_info )
  29.157 +gmyth_query_connect(GMythQuery * gmyth_query, GMythBackendInfo * backend_info)
  29.158  {
  29.159 -    assert ( gmyth_query );
  29.160 -    g_return_val_if_fail ( backend_info != NULL, FALSE );
  29.161 -    g_return_val_if_fail ( backend_info->hostname != NULL, FALSE );
  29.162 -    g_return_val_if_fail ( backend_info->username != NULL, FALSE );
  29.163 -    g_return_val_if_fail ( backend_info->password != NULL, FALSE );
  29.164 -    g_return_val_if_fail ( backend_info->db_name != NULL, FALSE );
  29.165 +  assert(gmyth_query);
  29.166 +  g_return_val_if_fail(backend_info != NULL, FALSE);
  29.167 +  g_return_val_if_fail(backend_info->hostname != NULL, FALSE);
  29.168 +  g_return_val_if_fail(backend_info->username != NULL, FALSE);
  29.169 +  g_return_val_if_fail(backend_info->password != NULL, FALSE);
  29.170 +  g_return_val_if_fail(backend_info->db_name != NULL, FALSE);
  29.171  
  29.172 -    if ( gmyth_query->backend_info != NULL )
  29.173 -    {
  29.174 -        g_object_unref ( gmyth_query->backend_info );
  29.175 -    }
  29.176 -    gmyth_query->backend_info = g_object_ref ( backend_info );
  29.177 +  if (gmyth_query->backend_info != NULL)
  29.178 +	{
  29.179 +	  g_object_unref(gmyth_query->backend_info);
  29.180 +	}
  29.181 +  gmyth_query->backend_info = g_object_ref(backend_info);
  29.182  
  29.183 -    if ( gmyth_query->conn == NULL )
  29.184 -    {
  29.185 -        gmyth_query->conn = mysql_init ( NULL );
  29.186 -    }
  29.187 +  if (gmyth_query->conn == NULL)
  29.188 +	{
  29.189 +	  gmyth_query->conn = mysql_init(NULL);
  29.190 +	}
  29.191  
  29.192 -    /* connect to server */
  29.193 -    if ( mysql_real_connect ( gmyth_query->conn,
  29.194 -                              gmyth_query->backend_info->hostname,
  29.195 -                              gmyth_query->backend_info->username,
  29.196 -                              gmyth_query->backend_info->password,
  29.197 -                              gmyth_query->backend_info->db_name, 0, NULL,
  29.198 -                              0 ) == NULL )
  29.199 -    {
  29.200 -        gmyth_query_print_error ( gmyth_query->conn,
  29.201 -                                  "mysql_real_connect() failed" );
  29.202 -        return FALSE;
  29.203 -    }
  29.204 + /* connect to server */
  29.205 +  if (mysql_real_connect(gmyth_query->conn,
  29.206 +						 gmyth_query->backend_info->hostname,
  29.207 +						 gmyth_query->backend_info->username,
  29.208 +						 gmyth_query->backend_info->password,
  29.209 +						 gmyth_query->backend_info->db_name, 0, NULL,
  29.210 +						 0) == NULL)
  29.211 +	{
  29.212 +	  gmyth_query_print_error(gmyth_query->conn,
  29.213 +							  "mysql_real_connect() failed");
  29.214 +	  return FALSE;
  29.215 +	}
  29.216  
  29.217 -    gmyth_debug
  29.218 -        ( "[%s] Connection to Mysql server succeeded! (host = %s, user = %s, "
  29.219 -          "password = %s, db name = %s)", __FUNCTION__,
  29.220 -          gmyth_query->backend_info->hostname,
  29.221 -          gmyth_query->backend_info->username,
  29.222 -          gmyth_query->backend_info->password,
  29.223 -          gmyth_query->backend_info->db_name );
  29.224 +  gmyth_debug
  29.225 +	("[%s] Connection to Mysql server succeeded! (host = %s, user = %s, "
  29.226 +	 "password = %s, db name = %s)", __FUNCTION__,
  29.227 +	 gmyth_query->backend_info->hostname,
  29.228 +	 gmyth_query->backend_info->username,
  29.229 +	 gmyth_query->backend_info->password, gmyth_query->backend_info->db_name);
  29.230  
  29.231 -    return TRUE;
  29.232 +  return TRUE;
  29.233  }
  29.234  
  29.235  /** Disconnects from the Mysql database in the backend.
  29.236 @@ -187,36 +184,34 @@
  29.237   * @return true if disconnection was success, false if failed.
  29.238   */
  29.239  gboolean
  29.240 -gmyth_query_disconnect ( GMythQuery * gmyth_query )
  29.241 +gmyth_query_disconnect(GMythQuery * gmyth_query)
  29.242  {
  29.243 -    g_return_val_if_fail ( gmyth_query != NULL, FALSE );
  29.244 -    g_return_val_if_fail ( gmyth_query->conn != NULL, FALSE );
  29.245 +  g_return_val_if_fail(gmyth_query != NULL, FALSE);
  29.246 +  g_return_val_if_fail(gmyth_query->conn != NULL, FALSE);
  29.247  
  29.248 -    /* TODO: Check how to return error */
  29.249 -    gmyth_debug ( "[%s] Closing gmyth_query->conn", __FUNCTION__ );
  29.250 + /* TODO: Check how to return error */
  29.251 +  gmyth_debug("[%s] Closing gmyth_query->conn", __FUNCTION__);
  29.252  
  29.253 -    mysql_close ( gmyth_query->conn );
  29.254 -    gmyth_query->conn = NULL;
  29.255 +  mysql_close(gmyth_query->conn);
  29.256 +  gmyth_query->conn = NULL;
  29.257  
  29.258 -    return TRUE;
  29.259 +  return TRUE;
  29.260  }
  29.261  
  29.262  static void
  29.263 -gmyth_query_print_error ( MYSQL * conn, char *message )
  29.264 +gmyth_query_print_error(MYSQL * conn, char *message)
  29.265  {
  29.266 -    gmyth_debug ( "%s", message );
  29.267 +  gmyth_debug("%s", message);
  29.268  
  29.269 -    if ( conn != NULL )
  29.270 -    {
  29.271 +  if (conn != NULL)
  29.272 +	{
  29.273  #if MYSQL_VERSION_ID >= 40101
  29.274 -        gmyth_debug ( "Error %u (%s): %s\n",
  29.275 -                      mysql_errno ( conn ), mysql_sqlstate ( conn ),
  29.276 -                      mysql_error ( conn ) );
  29.277 +	  gmyth_debug("Error %u (%s): %s\n",
  29.278 +				  mysql_errno(conn), mysql_sqlstate(conn), mysql_error(conn));
  29.279  #else
  29.280 -        gmyth_debug ( "Error %u: %s\n", mysql_errno ( conn ),
  29.281 -                      mysql_error ( conn ) );
  29.282 +	  gmyth_debug("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
  29.283  #endif
  29.284 -    }
  29.285 +	}
  29.286  }
  29.287  
  29.288  /** Sends the given query to the backend returning the query result as
  29.289 @@ -230,48 +225,48 @@
  29.290   * @return the MYSQL_RES result pointer or NULL if any error happens.
  29.291   */
  29.292  MYSQL_RES *
  29.293 -gmyth_query_process_statement ( GMythQuery * gmyth_query, char *stmt_str )
  29.294 +gmyth_query_process_statement(GMythQuery * gmyth_query, char *stmt_str)
  29.295  {
  29.296 -    assert ( gmyth_query );
  29.297 +  assert(gmyth_query);
  29.298  
  29.299 -    gmyth_debug ( "[%s] Running mysql query %s", __FUNCTION__, stmt_str );
  29.300 +  gmyth_debug("[%s] Running mysql query %s", __FUNCTION__, stmt_str);
  29.301  
  29.302 -    if ( gmyth_query == NULL )
  29.303 -        return NULL;
  29.304 +  if (gmyth_query == NULL)
  29.305 +	return NULL;
  29.306  
  29.307 -    /* the statement failed */
  29.308 -    if ( mysql_query ( gmyth_query->conn, stmt_str ) != 0 )
  29.309 -    {
  29.310 -        gmyth_query_print_error ( gmyth_query->conn,
  29.311 -                                  "Could not execute statement" );
  29.312 -        return NULL;
  29.313 -    }
  29.314 + /* the statement failed */
  29.315 +  if (mysql_query(gmyth_query->conn, stmt_str) != 0)
  29.316 +	{
  29.317 +	  gmyth_query_print_error(gmyth_query->conn,
  29.318 +							  "Could not execute statement");
  29.319 +	  return NULL;
  29.320 +	}
  29.321  
  29.322 -    /* the statement succeeded; determine whether it returned data */
  29.323 -    return mysql_store_result ( gmyth_query->conn );
  29.324 + /* the statement succeeded; determine whether it returned data */
  29.325 +  return mysql_store_result(gmyth_query->conn);
  29.326  }
  29.327  
  29.328  MYSQL_RES *
  29.329 -gmyth_query_process_statement_with_increment ( GMythQuery * gmyth_query,
  29.330 -                                               char *stmt_str, gulong * id )
  29.331 +gmyth_query_process_statement_with_increment(GMythQuery * gmyth_query,
  29.332 +											 char *stmt_str, gulong * id)
  29.333  {
  29.334 -    assert ( gmyth_query );
  29.335 +  assert(gmyth_query);
  29.336  
  29.337 -    gmyth_debug ( "[%s] Running mysql query %s", __FUNCTION__, stmt_str );
  29.338 +  gmyth_debug("[%s] Running mysql query %s", __FUNCTION__, stmt_str);
  29.339  
  29.340 -    if ( gmyth_query == NULL )
  29.341 -        return NULL;
  29.342 +  if (gmyth_query == NULL)
  29.343 +	return NULL;
  29.344  
  29.345 -    /* the statement failed */
  29.346 -    if ( mysql_query ( gmyth_query->conn, stmt_str ) != 0 )
  29.347 -    {
  29.348 -        gmyth_query_print_error ( gmyth_query->conn,
  29.349 -                                  "Could not execute statement" );
  29.350 -        return NULL;
  29.351 -    }
  29.352 + /* the statement failed */
  29.353 +  if (mysql_query(gmyth_query->conn, stmt_str) != 0)
  29.354 +	{
  29.355 +	  gmyth_query_print_error(gmyth_query->conn,
  29.356 +							  "Could not execute statement");
  29.357 +	  return NULL;
  29.358 +	}
  29.359  
  29.360 -    *id = ( my_ulonglong ) mysql_insert_id ( gmyth_query->conn );
  29.361 +  *id = (my_ulonglong) mysql_insert_id(gmyth_query->conn);
  29.362  
  29.363 -    /* the statement succeeded; determine whether it returned data */
  29.364 -    return mysql_store_result ( gmyth_query->conn );
  29.365 + /* the statement succeeded; determine whether it returned data */
  29.366 +  return mysql_store_result(gmyth_query->conn);
  29.367  }
    30.1 --- a/gmyth/src/gmyth_query.h	Wed Jun 13 18:18:42 2007 +0100
    30.2 +++ b/gmyth/src/gmyth_query.h	Thu Jun 14 18:19:52 2007 +0100
    30.3 @@ -46,40 +46,40 @@
    30.4  typedef struct _GMythQueryClass GMythQueryClass;
    30.5  
    30.6  struct _GMythQueryClass
    30.7 -    {
    30.8 -        GObjectClass parent_class;
    30.9 +{
   30.10 +  GObjectClass parent_class;
   30.11  
   30.12 -        /* callbacks */
   30.13 -        /* no one for now */
   30.14 -    };
   30.15 + /* callbacks */
   30.16 + /* no one for now */
   30.17 +};
   30.18  
   30.19  struct _GMythQuery
   30.20 -    {
   30.21 -        GObject parent;
   30.22 +{
   30.23 +  GObject parent;
   30.24  
   30.25 -        GMythBackendInfo *backend_info;
   30.26 +  GMythBackendInfo *backend_info;
   30.27  
   30.28 -        /* pointer to connection handler */
   30.29 -        MYSQL *conn;
   30.30 -    };
   30.31 + /* pointer to connection handler */
   30.32 +  MYSQL *conn;
   30.33 +};
   30.34  
   30.35  
   30.36 -GType gmyth_query_get_type ( void );
   30.37 +GType gmyth_query_get_type(void);
   30.38  
   30.39 -GMythQuery *gmyth_query_new ( void );
   30.40 -MYSQL_RES *gmyth_query_process_statement ( GMythQuery * gmyth_query,
   30.41 -                                           gchar * stmt_str );
   30.42 -MYSQL_RES *gmyth_query_process_statement_with_increment ( GMythQuery *
   30.43 -                                                          gmyth_query,
   30.44 -                                                          char *stmt_str,
   30.45 -                                                          gulong * id );
   30.46 +GMythQuery *gmyth_query_new(void);
   30.47 +MYSQL_RES *gmyth_query_process_statement(GMythQuery * gmyth_query,
   30.48 +										 gchar * stmt_str);
   30.49 +MYSQL_RES *gmyth_query_process_statement_with_increment(GMythQuery *
   30.50 +														gmyth_query,
   30.51 +														char *stmt_str,
   30.52 +														gulong * id);
   30.53  
   30.54 -gboolean gmyth_query_connect ( GMythQuery * gmyth_query,
   30.55 -                               GMythBackendInfo * backend_info );
   30.56 -gboolean gmyth_query_connect_with_timeout ( GMythQuery * gmyth_query,
   30.57 -                                            GMythBackendInfo * backend_info,
   30.58 -                                            guint timeout );
   30.59 -gboolean gmyth_query_disconnect ( GMythQuery * gmyth_query );
   30.60 +gboolean gmyth_query_connect(GMythQuery * gmyth_query,
   30.61 +							 GMythBackendInfo * backend_info);
   30.62 +gboolean gmyth_query_connect_with_timeout(GMythQuery * gmyth_query,
   30.63 +										  GMythBackendInfo * backend_info,
   30.64 +										  guint timeout);
   30.65 +gboolean gmyth_query_disconnect(GMythQuery * gmyth_query);
   30.66  
   30.67  G_END_DECLS
   30.68  #endif /* __GMYTH_QUERY_H__ */
    31.1 --- a/gmyth/src/gmyth_recorder.c	Wed Jun 13 18:18:42 2007 +0100
    31.2 +++ b/gmyth/src/gmyth_recorder.c	Thu Jun 14 18:19:52 2007 +0100
    31.3 @@ -42,78 +42,78 @@
    31.4  
    31.5  #define	 GMYTHTV_RECORDER_HEADER			"QUERY_RECORDER"
    31.6  
    31.7 -static void gmyth_recorder_class_init ( GMythRecorderClass * klass );
    31.8 -static void gmyth_recorder_init ( GMythRecorder * object );
    31.9 +static void gmyth_recorder_class_init(GMythRecorderClass * klass);
   31.10 +static void gmyth_recorder_init(GMythRecorder * object);
   31.11  
   31.12 -static void gmyth_recorder_dispose ( GObject * object );
   31.13 -static void gmyth_recorder_finalize ( GObject * object );
   31.14 +static void gmyth_recorder_dispose(GObject * object);
   31.15 +static void gmyth_recorder_finalize(GObject * object);
   31.16  
   31.17 -G_DEFINE_TYPE ( GMythRecorder, gmyth_recorder, G_TYPE_OBJECT )
   31.18 -     static void gmyth_recorder_class_init ( GMythRecorderClass * klass )
   31.19 +G_DEFINE_TYPE(GMythRecorder, gmyth_recorder, G_TYPE_OBJECT)
   31.20 +	 static void gmyth_recorder_class_init(GMythRecorderClass * klass)
   31.21  {
   31.22 -    GObjectClass *gobject_class;
   31.23 +  GObjectClass *gobject_class;
   31.24  
   31.25 -    gobject_class = ( GObjectClass * ) klass;
   31.26 +  gobject_class = (GObjectClass *) klass;
   31.27  
   31.28 -    gobject_class->dispose = gmyth_recorder_dispose;
   31.29 -    gobject_class->finalize = gmyth_recorder_finalize;
   31.30 +  gobject_class->dispose = gmyth_recorder_dispose;
   31.31 +  gobject_class->finalize = gmyth_recorder_finalize;
   31.32  }
   31.33  
   31.34  static void
   31.35 -gmyth_recorder_init ( GMythRecorder * gmyth_remote_encoder )
   31.36 +gmyth_recorder_init(GMythRecorder * gmyth_remote_encoder)
   31.37  {
   31.38  }
   31.39  
   31.40  static void
   31.41 -gmyth_recorder_dispose ( GObject * object )
   31.42 +gmyth_recorder_dispose(GObject * object)
   31.43  {
   31.44 -    GMythRecorder *recorder = GMYTH_RECORDER ( object );
   31.45 +  GMythRecorder *recorder = GMYTH_RECORDER(object);
   31.46  
   31.47 -    gmyth_recorder_close ( recorder );
   31.48 +  gmyth_recorder_close(recorder);
   31.49  
   31.50 -    if ( recorder->mutex != NULL )
   31.51 -    {
   31.52 -        g_mutex_free ( recorder->mutex );
   31.53 -        recorder->mutex = NULL;
   31.54 -    }
   31.55 +  if (recorder->mutex != NULL)
   31.56 +	{
   31.57 +	  g_mutex_free(recorder->mutex);
   31.58 +	  recorder->mutex = NULL;
   31.59 +	}
   31.60  
   31.61 -    if ( recorder->myth_socket != NULL )
   31.62 -    {
   31.63 -        g_object_unref ( recorder->myth_socket );
   31.64 -        recorder->myth_socket = NULL;
   31.65 -    }
   31.66 +  if (recorder->myth_socket != NULL)
   31.67 +	{
   31.68 +	  g_object_unref(recorder->myth_socket);
   31.69 +	  recorder->myth_socket = NULL;
   31.70 +	}
   31.71  
   31.72 -    if ( recorder->progs_info_list != NULL )
   31.73 -        gmyth_free_program_list ( recorder->progs_info_list );
   31.74 +  if (recorder->progs_info_list != NULL)
   31.75 +	gmyth_free_program_list(recorder->progs_info_list);
   31.76  
   31.77 -    if ( recorder->hostname != NULL )
   31.78 -        g_string_free ( recorder->hostname, TRUE );
   31.79 +  if (recorder->hostname != NULL)
   31.80 +	g_string_free(recorder->hostname, TRUE);
   31.81  
   31.82 -    G_OBJECT_CLASS ( gmyth_recorder_parent_class )->dispose ( object );
   31.83 +  G_OBJECT_CLASS(gmyth_recorder_parent_class)->dispose(object);
   31.84  }
   31.85  
   31.86  static void
   31.87 -gmyth_recorder_finalize ( GObject * object )
   31.88 +gmyth_recorder_finalize(GObject * object)
   31.89  {
   31.90 -    g_signal_handlers_destroy ( object );
   31.91 +  g_signal_handlers_destroy(object);
   31.92  
   31.93 -    G_OBJECT_CLASS ( gmyth_recorder_parent_class )->finalize ( object );
   31.94 +  G_OBJECT_CLASS(gmyth_recorder_parent_class)->finalize(object);
   31.95  }
   31.96  
   31.97  void
   31.98 -gmyth_recorder_close ( GMythRecorder * recorder )
   31.99 +gmyth_recorder_close(GMythRecorder * recorder)
  31.100  {
  31.101 -    if ( recorder != NULL && recorder->recorder_num != -1 )
  31.102 -    {
  31.103 -        g_mutex_lock ( recorder->mutex );
  31.104 +  if (recorder != NULL && recorder->recorder_num != -1)
  31.105 +	{
  31.106 +	  g_mutex_lock(recorder->mutex);
  31.107  
  31.108 -        gmyth_recorder_stop_playing ( recorder );
  31.109 -        gmyth_recorder_stop_livetv ( recorder );
  31.110 -        gmyth_recorder_finish_recording ( recorder );
  31.111 -        gmyth_recorder_free_tuner ( recorder );
  31.112 +	  gmyth_recorder_stop_playing(recorder);
  31.113 +	  gmyth_recorder_stop_livetv(recorder);
  31.114 +	  gmyth_recorder_finish_recording(recorder);
  31.115 +	  gmyth_recorder_free_tuner(recorder);
  31.116  
  31.117 -        g_mutex_unlock ( recorder->mutex );
  31.118 -    }
  31.119 +	  g_mutex_unlock(recorder->mutex);
  31.120 +	}
  31.121  }
  31.122  
  31.123  /** Creates a new instance of GMythRecorder.
  31.124 @@ -121,20 +121,20 @@
  31.125   * @return a new instance of GMythRecorder.
  31.126   */
  31.127  GMythRecorder *
  31.128 -gmyth_recorder_new ( int num, GString * hostname, gshort port )
  31.129 +gmyth_recorder_new(int num, GString * hostname, gshort port)
  31.130  {
  31.131 -    GMythRecorder *encoder =
  31.132 -        GMYTH_RECORDER ( g_object_new ( GMYTH_RECORDER_TYPE, FALSE ) );
  31.133 +  GMythRecorder *encoder =
  31.134 +	GMYTH_RECORDER(g_object_new(GMYTH_RECORDER_TYPE, FALSE));
  31.135  
  31.136 -    encoder->recorder_num = num;
  31.137 -    encoder->hostname = g_string_new ( hostname->str );
  31.138 -    encoder->port = port;
  31.139 +  encoder->recorder_num = num;
  31.140 +  encoder->hostname = g_string_new(hostname->str);
  31.141 +  encoder->port = port;
  31.142  
  31.143 -    encoder->mutex = g_mutex_new (  );
  31.144 +  encoder->mutex = g_mutex_new();
  31.145  
  31.146 -    encoder->progs_info_list = NULL;
  31.147 +  encoder->progs_info_list = NULL;
  31.148  
  31.149 -    return encoder;
  31.150 +  return encoder;
  31.151  }
  31.152  
  31.153  /** Configures the remote encoder instance connecting it to Mythtv backend.
  31.154 @@ -144,30 +144,29 @@
  31.155   * @return TRUE if successfull, FALSE if any error happens.
  31.156   */
  31.157  gboolean
  31.158 -gmyth_recorder_setup ( GMythRecorder * recorder )
  31.159 +gmyth_recorder_setup(GMythRecorder * recorder)
  31.160  {
  31.161 -    assert ( recorder );
  31.162 -    gmyth_debug ( "[%s] Creating socket and connecting to backend",
  31.163 -                  __FUNCTION__ );
  31.164 +  assert(recorder);
  31.165 +  gmyth_debug("[%s] Creating socket and connecting to backend", __FUNCTION__);
  31.166  
  31.167 -    if ( recorder->myth_socket == NULL )
  31.168 -    {
  31.169 -        recorder->myth_socket = gmyth_socket_new (  );
  31.170 +  if (recorder->myth_socket == NULL)
  31.171 +	{
  31.172 +	  recorder->myth_socket = gmyth_socket_new();
  31.173  
  31.174 -        if ( !gmyth_socket_connect_to_backend ( recorder->myth_socket,
  31.175 -                                                recorder->hostname->str,
  31.176 -                                                recorder->port, TRUE ) )
  31.177 -        {
  31.178 -            gmyth_debug ( "GMythRemoteEncoder: Connection to backend failed" );
  31.179 -            return FALSE;
  31.180 -        }
  31.181 -    }
  31.182 -    else
  31.183 -    {
  31.184 -        gmyth_debug ( "Remote encoder socket already created\n" );
  31.185 -    }
  31.186 +	  if (!gmyth_socket_connect_to_backend(recorder->myth_socket,
  31.187 +										   recorder->hostname->str,
  31.188 +										   recorder->port, TRUE))
  31.189 +		{
  31.190 +		  gmyth_debug("GMythRemoteEncoder: Connection to backend failed");
  31.191 +		  return FALSE;
  31.192 +		}
  31.193 +	}
  31.194 +  else
  31.195 +	{
  31.196 +	  gmyth_debug("Remote encoder socket already created\n");
  31.197 +	}
  31.198  
  31.199 -    return TRUE;
  31.200 +  return TRUE;
  31.201  }
  31.202  
  31.203  /** Sends the SPAWN_LIVETV command through Mythtv protocol. This command
  31.204 @@ -178,56 +177,56 @@
  31.205   * @return true if success, false if any error happens.
  31.206   */
  31.207  gboolean
  31.208 -gmyth_recorder_spawntv ( GMythRecorder * recorder, GString * tvchain_id )
  31.209 +gmyth_recorder_spawntv(GMythRecorder * recorder, GString * tvchain_id)
  31.210  {
  31.211 -    GMythStringList *str_list;
  31.212 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.213 -    gboolean ret = TRUE;
  31.214 +  GMythStringList *str_list;
  31.215 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.216 +  gboolean ret = TRUE;
  31.217  
  31.218 -    gmyth_debug ( "[%s] Spawntv with tvchain_id = %s", __FUNCTION__,
  31.219 -                  tvchain_id->str );
  31.220 +  gmyth_debug("[%s] Spawntv with tvchain_id = %s", __FUNCTION__,
  31.221 +			  tvchain_id->str);
  31.222  
  31.223 -    str_list = gmyth_string_list_new (  );
  31.224 +  str_list = gmyth_string_list_new();
  31.225  
  31.226 -    g_mutex_lock ( recorder->mutex );
  31.227 +  g_mutex_lock(recorder->mutex);
  31.228  
  31.229 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.230 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.231  
  31.232 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.233 -    g_string_free ( tmp_str, TRUE );
  31.234 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.235 +  g_string_free(tmp_str, TRUE);
  31.236  
  31.237 -    gmyth_string_list_append_char_array ( str_list, "SPAWN_LIVETV" );
  31.238 +  gmyth_string_list_append_char_array(str_list, "SPAWN_LIVETV");
  31.239  
  31.240 -    gmyth_string_list_append_string ( str_list, tvchain_id );
  31.241 -    gmyth_string_list_append_int ( str_list, 0 );   // PIP = FALSE (0)
  31.242 +  gmyth_string_list_append_string(str_list, tvchain_id);
  31.243 +  gmyth_string_list_append_int(str_list, 0);	// PIP = FALSE (0)
  31.244  
  31.245 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.246 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.247  
  31.248 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.249 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.250  
  31.251 -    if ( tmp_str == NULL )
  31.252 -    {
  31.253 -        gmyth_debug ( "[%s] Spawntv request returned %s", __FUNCTION__,
  31.254 -                      tmp_str->str );
  31.255 -        ret = FALSE;
  31.256 -        goto cleanup;
  31.257 -    }
  31.258 +  if (tmp_str == NULL)
  31.259 +	{
  31.260 +	  gmyth_debug("[%s] Spawntv request returned %s", __FUNCTION__,
  31.261 +				  tmp_str->str);
  31.262 +	  ret = FALSE;
  31.263 +	  goto cleanup;
  31.264 +	}
  31.265  
  31.266 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) )
  31.267 -    {
  31.268 -        gmyth_debug ( "[%s] Spawntv request returned %s", __FUNCTION__,
  31.269 -                      tmp_str->str );
  31.270 -        ret = FALSE;
  31.271 -        goto cleanup;
  31.272 -    }
  31.273 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2))
  31.274 +	{
  31.275 +	  gmyth_debug("[%s] Spawntv request returned %s", __FUNCTION__,
  31.276 +				  tmp_str->str);
  31.277 +	  ret = FALSE;
  31.278 +	  goto cleanup;
  31.279 +	}
  31.280  
  31.281 -  cleanup:
  31.282 -    g_mutex_unlock ( recorder->mutex );
  31.283 +cleanup:
  31.284 +  g_mutex_unlock(recorder->mutex);
  31.285  
  31.286 -    g_string_free ( tmp_str, TRUE );
  31.287 -    g_object_unref ( str_list );
  31.288 +  g_string_free(tmp_str, TRUE);
  31.289 +  g_object_unref(str_list);
  31.290  
  31.291 -    return ret;
  31.292 +  return ret;
  31.293  }
  31.294  
  31.295  /** 
  31.296 @@ -239,52 +238,52 @@
  31.297   * @return true if success, false if any error happens.
  31.298   */
  31.299  gboolean
  31.300 -gmyth_recorder_spawntv_no_tvchain ( GMythRecorder * recorder )
  31.301 +gmyth_recorder_spawntv_no_tvchain(GMythRecorder * recorder)
  31.302  {
  31.303 -    GMythStringList *str_list;
  31.304 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.305 -    gboolean ret = TRUE;
  31.306 +  GMythStringList *str_list;
  31.307 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.308 +  gboolean ret = TRUE;
  31.309  
  31.310 -    gmyth_debug ( "[%s] Spawntv, no TV chain!", __FUNCTION__ );
  31.311 +  gmyth_debug("[%s] Spawntv, no TV chain!", __FUNCTION__);
  31.312  
  31.313 -    str_list = gmyth_string_list_new (  );
  31.314 +  str_list = gmyth_string_list_new();
  31.315  
  31.316 -    g_mutex_lock ( recorder->mutex );
  31.317 +  g_mutex_lock(recorder->mutex);
  31.318  
  31.319 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.320 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.321  
  31.322 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.323 -    g_string_free ( tmp_str, TRUE );
  31.324 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.325 +  g_string_free(tmp_str, TRUE);
  31.326  
  31.327 -    gmyth_string_list_append_char_array ( str_list, "SPAWN_LIVETV" );
  31.328 +  gmyth_string_list_append_char_array(str_list, "SPAWN_LIVETV");
  31.329  
  31.330 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.331 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.332  
  31.333 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.334 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.335  
  31.336 -    if ( tmp_str == NULL )
  31.337 -    {
  31.338 -        gmyth_debug ( "[%s] Spawntv request returned %s", __FUNCTION__,
  31.339 -                      tmp_str->str );
  31.340 -        ret = FALSE;
  31.341 -        goto cleanup;
  31.342 -    }
  31.343 +  if (tmp_str == NULL)
  31.344 +	{
  31.345 +	  gmyth_debug("[%s] Spawntv request returned %s", __FUNCTION__,
  31.346 +				  tmp_str->str);
  31.347 +	  ret = FALSE;
  31.348 +	  goto cleanup;
  31.349 +	}
  31.350  
  31.351 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) )
  31.352 -    {
  31.353 -        gmyth_debug ( "[%s] Spawntv request returned %s", __FUNCTION__,
  31.354 -                      tmp_str->str );
  31.355 -        ret = FALSE;
  31.356 -        goto cleanup;
  31.357 -    }
  31.358 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2))
  31.359 +	{
  31.360 +	  gmyth_debug("[%s] Spawntv request returned %s", __FUNCTION__,
  31.361 +				  tmp_str->str);
  31.362 +	  ret = FALSE;
  31.363 +	  goto cleanup;
  31.364 +	}
  31.365  
  31.366 -  cleanup:
  31.367 -    g_mutex_unlock ( recorder->mutex );
  31.368 +cleanup:
  31.369 +  g_mutex_unlock(recorder->mutex);
  31.370  
  31.371 -    g_string_free ( tmp_str, TRUE );
  31.372 -    g_object_unref ( str_list );
  31.373 +  g_string_free(tmp_str, TRUE);
  31.374 +  g_object_unref(str_list);
  31.375  
  31.376 -    return ret;
  31.377 +  return ret;
  31.378  }
  31.379  
  31.380  /** Sends the command STOP_LIVETV to Mythtv backend.
  31.381 @@ -293,40 +292,40 @@
  31.382   * @return true if success, false if any error happens.
  31.383   */
  31.384  gboolean
  31.385 -gmyth_recorder_stop_livetv ( GMythRecorder * recorder )
  31.386 +gmyth_recorder_stop_livetv(GMythRecorder * recorder)
  31.387  {
  31.388 -    GMythStringList *str_list;
  31.389 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.390 -    gboolean ret = TRUE;
  31.391 +  GMythStringList *str_list;
  31.392 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.393 +  gboolean ret = TRUE;
  31.394  
  31.395 -    gmyth_debug ( "[%s]", __FUNCTION__ );
  31.396 +  gmyth_debug("[%s]", __FUNCTION__);
  31.397  
  31.398 -    str_list = gmyth_string_list_new (  );
  31.399 +  str_list = gmyth_string_list_new();
  31.400  
  31.401 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.402 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.403  
  31.404 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.405 -    g_string_free ( tmp_str, TRUE );
  31.406 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.407 +  g_string_free(tmp_str, TRUE);
  31.408  
  31.409 -    gmyth_string_list_append_char_array ( str_list, "STOP_LIVETV" );
  31.410 +  gmyth_string_list_append_char_array(str_list, "STOP_LIVETV");
  31.411  
  31.412 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.413 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.414  
  31.415 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.416 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.417  
  31.418 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) )
  31.419 -    {
  31.420 -        gmyth_debug ( "[%s] Stop livetv request returned %s", __FUNCTION__,
  31.421 -                      tmp_str->str );
  31.422 -        ret = FALSE;
  31.423 -        goto cleanup;
  31.424 -    }
  31.425 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2))
  31.426 +	{
  31.427 +	  gmyth_debug("[%s] Stop livetv request returned %s", __FUNCTION__,
  31.428 +				  tmp_str->str);
  31.429 +	  ret = FALSE;
  31.430 +	  goto cleanup;
  31.431 +	}
  31.432  
  31.433 -  cleanup:
  31.434 -    g_string_free ( tmp_str, TRUE );
  31.435 -    g_object_unref ( str_list );
  31.436 +cleanup:
  31.437 +  g_string_free(tmp_str, TRUE);
  31.438 +  g_object_unref(str_list);
  31.439  
  31.440 -    return ret;
  31.441 +  return ret;
  31.442  }
  31.443  
  31.444  /** Sends the FRONTEND_READY command through Mythtv protocol. This command
  31.445 @@ -336,53 +335,53 @@
  31.446   * @return TRUE if success, FALSE if any error happens.
  31.447   */
  31.448  gboolean
  31.449 -gmyth_recorder_send_frontend_ready_command ( GMythRecorder * recorder )
  31.450 +gmyth_recorder_send_frontend_ready_command(GMythRecorder * recorder)
  31.451  {
  31.452 -    GMythStringList *str_list;
  31.453 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.454 -    gboolean ret = TRUE;
  31.455 +  GMythStringList *str_list;
  31.456 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.457 +  gboolean ret = TRUE;
  31.458  
  31.459 -    gmyth_debug ( "[%s] FRONTEND_READY with recorder id = %d", __FUNCTION__,
  31.460 -                  recorder->recorder_num );
  31.461 +  gmyth_debug("[%s] FRONTEND_READY with recorder id = %d", __FUNCTION__,
  31.462 +			  recorder->recorder_num);
  31.463  
  31.464 -    str_list = gmyth_string_list_new (  );
  31.465 +  str_list = gmyth_string_list_new();
  31.466  
  31.467 -    g_mutex_lock ( recorder->mutex );
  31.468 +  g_mutex_lock(recorder->mutex);
  31.469  
  31.470 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.471 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.472  
  31.473 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.474 -    g_string_free ( tmp_str, TRUE );
  31.475 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.476 +  g_string_free(tmp_str, TRUE);
  31.477  
  31.478 -    gmyth_string_list_append_char_array ( str_list, "FRONTEND_READY" );
  31.479 +  gmyth_string_list_append_char_array(str_list, "FRONTEND_READY");
  31.480  
  31.481 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.482 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.483  
  31.484 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.485 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.486  
  31.487 -    if ( tmp_str == NULL )
  31.488 -    {
  31.489 -        gmyth_debug
  31.490 -            ( "[%s] FRONTEND_READY command request couldn't returns, reason: %s",
  31.491 -              __FUNCTION__, tmp_str->str );
  31.492 -        ret = FALSE;
  31.493 -        goto cleanup;
  31.494 -    }
  31.495 +  if (tmp_str == NULL)
  31.496 +	{
  31.497 +	  gmyth_debug
  31.498 +		("[%s] FRONTEND_READY command request couldn't returns, reason: %s",
  31.499 +		 __FUNCTION__, tmp_str->str);
  31.500 +	  ret = FALSE;
  31.501 +	  goto cleanup;
  31.502 +	}
  31.503  
  31.504 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) )
  31.505 -    {
  31.506 -        gmyth_debug ( "[%s] FRONTEND_READY request returned %s", __FUNCTION__,
  31.507 -                      tmp_str->str );
  31.508 -        ret = FALSE;
  31.509 -        goto cleanup;
  31.510 -    }
  31.511 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2))
  31.512 +	{
  31.513 +	  gmyth_debug("[%s] FRONTEND_READY request returned %s", __FUNCTION__,
  31.514 +				  tmp_str->str);
  31.515 +	  ret = FALSE;
  31.516 +	  goto cleanup;
  31.517 +	}
  31.518  
  31.519 -  cleanup:
  31.520 -    g_mutex_unlock ( recorder->mutex );
  31.521 -    g_string_free ( tmp_str, TRUE );
  31.522 -    g_object_unref ( str_list );
  31.523 +cleanup:
  31.524 +  g_mutex_unlock(recorder->mutex);
  31.525 +  g_string_free(tmp_str, TRUE);
  31.526 +  g_object_unref(str_list);
  31.527  
  31.528 -    return ret;
  31.529 +  return ret;
  31.530  }
  31.531  
  31.532  /** Send a CHECK_CHANNEL command request to the backend, in order to find if a 
  31.533 @@ -393,55 +392,54 @@
  31.534   * @return true if success, false if any error happens.
  31.535   */
  31.536  gboolean
  31.537 -gmyth_recorder_check_channel_name ( GMythRecorder * recorder, gchar * channel )
  31.538 +gmyth_recorder_check_channel_name(GMythRecorder * recorder, gchar * channel)
  31.539  {
  31.540 -    GMythStringList *str_list;
  31.541 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.542 -    gboolean ret = TRUE;
  31.543 +  GMythStringList *str_list;
  31.544 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.545 +  gboolean ret = TRUE;
  31.546  
  31.547 -    gmyth_debug ( "[%s] CHECK_CHANNEL with channel = %s", __FUNCTION__,
  31.548 -                  channel );
  31.549 +  gmyth_debug("[%s] CHECK_CHANNEL with channel = %s", __FUNCTION__, channel);
  31.550  
  31.551 -    str_list = gmyth_string_list_new (  );
  31.552 +  str_list = gmyth_string_list_new();
  31.553  
  31.554 -    g_mutex_lock ( recorder->mutex );
  31.555 +  g_mutex_lock(recorder->mutex);
  31.556  
  31.557 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.558 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.559  
  31.560 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.561 -    g_string_free ( tmp_str, TRUE );
  31.562 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.563 +  g_string_free(tmp_str, TRUE);
  31.564  
  31.565 -    gmyth_string_list_append_char_array ( str_list, "CHECK_CHANNEL" );
  31.566 +  gmyth_string_list_append_char_array(str_list, "CHECK_CHANNEL");
  31.567  
  31.568 -    gmyth_string_list_append_char_array ( str_list, channel );
  31.569 +  gmyth_string_list_append_char_array(str_list, channel);
  31.570  
  31.571 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.572 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.573  
  31.574 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.575 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.576  
  31.577 -    if ( tmp_str == NULL )
  31.578 -    {
  31.579 -        gmyth_debug ( "[%s] CHECK_CHANNEL request returned %s", __FUNCTION__,
  31.580 -                      tmp_str->str );
  31.581 -        ret = FALSE;
  31.582 -        goto cleanup;
  31.583 -    }
  31.584 +  if (tmp_str == NULL)
  31.585 +	{
  31.586 +	  gmyth_debug("[%s] CHECK_CHANNEL request returned %s", __FUNCTION__,
  31.587 +				  tmp_str->str);
  31.588 +	  ret = FALSE;
  31.589 +	  goto cleanup;
  31.590 +	}
  31.591  
  31.592 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) == 0
  31.593 -         || g_ascii_strncasecmp ( tmp_str->str, "0", 1 ) == 0 )
  31.594 -    {
  31.595 -        gmyth_debug ( "[%s] CHECK_CHANNEL request returned %s", __FUNCTION__,
  31.596 -                      tmp_str->str );
  31.597 -        ret = FALSE;
  31.598 -        goto cleanup;
  31.599 -    }
  31.600 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2) == 0
  31.601 +	  || g_ascii_strncasecmp(tmp_str->str, "0", 1) == 0)
  31.602 +	{
  31.603 +	  gmyth_debug("[%s] CHECK_CHANNEL request returned %s", __FUNCTION__,
  31.604 +				  tmp_str->str);
  31.605 +	  ret = FALSE;
  31.606 +	  goto cleanup;
  31.607 +	}
  31.608  
  31.609 -  cleanup:
  31.610 -    g_mutex_unlock ( recorder->mutex );
  31.611 -    g_string_free ( tmp_str, TRUE );
  31.612 -    g_object_unref ( str_list );
  31.613 +cleanup:
  31.614 +  g_mutex_unlock(recorder->mutex);
  31.615 +  g_string_free(tmp_str, TRUE);
  31.616 +  g_object_unref(str_list);
  31.617  
  31.618 -    return ret;
  31.619 +  return ret;
  31.620  }
  31.621  
  31.622  /** Send a CHECK_CHANNEL command request to the backend, in order to find if a 
  31.623 @@ -452,10 +450,10 @@
  31.624   * @return true if success, false if any error happens.
  31.625   */
  31.626  gboolean
  31.627 -gmyth_recorder_check_channel ( GMythRecorder * recorder, gint channel )
  31.628 +gmyth_recorder_check_channel(GMythRecorder * recorder, gint channel)
  31.629  {
  31.630 -    return gmyth_recorder_check_channel_name ( recorder, g_strdup_printf ( "%d",
  31.631 -                                                                           channel ) );
  31.632 +  return gmyth_recorder_check_channel_name(recorder, g_strdup_printf("%d",
  31.633 +																	 channel));
  31.634  }
  31.635  
  31.636  /** Send a SET_CHANNEL command request to the backend, to start streaming on another 
  31.637 @@ -466,53 +464,53 @@
  31.638   * @return true if success, false if any error happens.
  31.639   */
  31.640  gboolean
  31.641 -gmyth_recorder_set_channel ( GMythRecorder * recorder, gint channel )
  31.642 +gmyth_recorder_set_channel(GMythRecorder * recorder, gint channel)
  31.643  {
  31.644 -    GMythStringList *str_list;
  31.645 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.646 -    gboolean ret = TRUE;
  31.647 +  GMythStringList *str_list;
  31.648 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.649 +  gboolean ret = TRUE;
  31.650  
  31.651 -    gmyth_debug ( "[%s] SET_CHANNEL with channel = %d", __FUNCTION__, channel );
  31.652 +  gmyth_debug("[%s] SET_CHANNEL with channel = %d", __FUNCTION__, channel);
  31.653  
  31.654 -    str_list = gmyth_string_list_new (  );
  31.655 +  str_list = gmyth_string_list_new();
  31.656  
  31.657 -    g_mutex_lock ( recorder->mutex );
  31.658 +  g_mutex_lock(recorder->mutex);
  31.659  
  31.660 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.661 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.662  
  31.663 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.664 -    g_string_free ( tmp_str, TRUE );
  31.665 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.666 +  g_string_free(tmp_str, TRUE);
  31.667  
  31.668 -    gmyth_string_list_append_char_array ( str_list, "SET_CHANNEL" );
  31.669 +  gmyth_string_list_append_char_array(str_list, "SET_CHANNEL");
  31.670  
  31.671 -    gmyth_string_list_append_int ( str_list, channel );
  31.672 +  gmyth_string_list_append_int(str_list, channel);
  31.673  
  31.674 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.675 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.676  
  31.677 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.678 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.679  
  31.680 -    if ( tmp_str == NULL )
  31.681 -    {
  31.682 -        gmyth_debug ( "[%s] SET_CHANNEL request returned %s", __FUNCTION__,
  31.683 -                      tmp_str->str );
  31.684 -        ret = FALSE;
  31.685 -        goto cleanup;
  31.686 -    }
  31.687 +  if (tmp_str == NULL)
  31.688 +	{
  31.689 +	  gmyth_debug("[%s] SET_CHANNEL request returned %s", __FUNCTION__,
  31.690 +				  tmp_str->str);
  31.691 +	  ret = FALSE;
  31.692 +	  goto cleanup;
  31.693 +	}
  31.694  
  31.695 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) )
  31.696 -    {
  31.697 -        gmyth_debug ( "[%s] SET_CHANNEL request returned %s", __FUNCTION__,
  31.698 -                      tmp_str->str );
  31.699 -        ret = FALSE;
  31.700 -        goto cleanup;
  31.701 -    }
  31.702 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2))
  31.703 +	{
  31.704 +	  gmyth_debug("[%s] SET_CHANNEL request returned %s", __FUNCTION__,
  31.705 +				  tmp_str->str);
  31.706 +	  ret = FALSE;
  31.707 +	  goto cleanup;
  31.708 +	}
  31.709  
  31.710 -  cleanup:
  31.711 -    g_mutex_unlock ( recorder->mutex );
  31.712 -    g_string_free ( tmp_str, TRUE );
  31.713 -    g_object_unref ( str_list );
  31.714 +cleanup:
  31.715 +  g_mutex_unlock(recorder->mutex);
  31.716 +  g_string_free(tmp_str, TRUE);
  31.717 +  g_object_unref(str_list);
  31.718  
  31.719 -    return ret;
  31.720 +  return ret;
  31.721  }
  31.722  
  31.723  /** Send a SET_CHANNEL command request to the backend, to start streaming on another 
  31.724 @@ -523,56 +521,56 @@
  31.725   * @return true if success, false if any error happens.
  31.726   */
  31.727  gboolean
  31.728 -gmyth_recorder_set_channel_name ( GMythRecorder * recorder,
  31.729 -                                  const gchar * channel )
  31.730 +gmyth_recorder_set_channel_name(GMythRecorder * recorder,
  31.731 +								const gchar * channel)
  31.732  {
  31.733 -    GMythStringList *str_list;
  31.734 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.735 -    gboolean ret = TRUE;
  31.736 +  GMythStringList *str_list;
  31.737 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.738 +  gboolean ret = TRUE;
  31.739  
  31.740 -    gmyth_debug ( "[%s] SET_CHANNEL with channel name = %s", __FUNCTION__,
  31.741 -                  channel );
  31.742 +  gmyth_debug("[%s] SET_CHANNEL with channel name = %s", __FUNCTION__,
  31.743 +			  channel);
  31.744  
  31.745 -    str_list = gmyth_string_list_new (  );
  31.746 +  str_list = gmyth_string_list_new();
  31.747  
  31.748 -    g_mutex_lock ( recorder->mutex );
  31.749 +  g_mutex_lock(recorder->mutex);
  31.750  
  31.751 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.752 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.753  
  31.754 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.755 -    g_string_free ( tmp_str, TRUE );
  31.756 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.757 +  g_string_free(tmp_str, TRUE);
  31.758  
  31.759 -    gmyth_string_list_append_char_array ( str_list, "SET_CHANNEL" );
  31.760 -    gmyth_string_list_append_char_array ( str_list, channel );
  31.761 +  gmyth_string_list_append_char_array(str_list, "SET_CHANNEL");
  31.762 +  gmyth_string_list_append_char_array(str_list, channel);
  31.763  
  31.764 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.765 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.766  
  31.767 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.768 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.769  
  31.770 -    if ( tmp_str == NULL )
  31.771 -    {
  31.772 -        gmyth_debug ( "[%s] SET_CHANNEL name request returned NULL!",
  31.773 -                      __FUNCTION__ );
  31.774 -        ret = FALSE;
  31.775 -        goto cleanup;
  31.776 -    }
  31.777 +  if (tmp_str == NULL)
  31.778 +	{
  31.779 +	  gmyth_debug("[%s] SET_CHANNEL name request returned NULL!",
  31.780 +				  __FUNCTION__);
  31.781 +	  ret = FALSE;
  31.782 +	  goto cleanup;
  31.783 +	}
  31.784  
  31.785 -    if ( tmp_str != NULL && g_ascii_strncasecmp ( tmp_str->str, "ok", 2 )
  31.786 -         /*|| g_ascii_strtoull( tmp_str->str, NULL, 10 ) == 0 */
  31.787 -         )
  31.788 -    {
  31.789 -        g_warning ( "[%s] SET_CHANNEL name request returned not ok",
  31.790 -                    __FUNCTION__ );
  31.791 -        ret = FALSE;
  31.792 -        goto cleanup;
  31.793 -    }
  31.794 +  if (tmp_str != NULL && g_ascii_strncasecmp(tmp_str->str, "ok", 2)
  31.795 +	 /*|| g_ascii_strtoull( tmp_str->str, NULL, 10 ) == 0 */
  31.796 +	)
  31.797 +	{
  31.798 +	  g_warning("[%s] SET_CHANNEL name request returned not ok",
  31.799 +				__FUNCTION__);
  31.800 +	  ret = FALSE;
  31.801 +	  goto cleanup;
  31.802 +	}
  31.803  
  31.804 -  cleanup:
  31.805 -    g_mutex_unlock ( recorder->mutex );
  31.806 -    g_string_free ( tmp_str, TRUE );
  31.807 -    g_object_unref ( str_list );
  31.808 +cleanup:
  31.809 +  g_mutex_unlock(recorder->mutex);
  31.810 +  g_string_free(tmp_str, TRUE);
  31.811 +  g_object_unref(str_list);
  31.812  
  31.813 -    return ret;
  31.814 +  return ret;
  31.815  }
  31.816  
  31.817  /**
  31.818 @@ -591,56 +589,56 @@
  31.819   * @return true if success, false if any error happens.
  31.820   */
  31.821  gboolean
  31.822 -gmyth_recorder_change_channel ( GMythRecorder * recorder,
  31.823 -                                const GMythRecorderChannelChangeDirection
  31.824 -                                direction )
  31.825 +gmyth_recorder_change_channel(GMythRecorder * recorder,
  31.826 +							  const GMythRecorderChannelChangeDirection
  31.827 +							  direction)
  31.828  {
  31.829 -    GMythStringList *str_list;
  31.830 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.831 -    gboolean ret = TRUE;
  31.832 +  GMythStringList *str_list;
  31.833 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.834 +  gboolean ret = TRUE;
  31.835  
  31.836 -    gmyth_debug ( "[%s] CHANGE_CHANNEL to the channel direction = %u",
  31.837 -                  __FUNCTION__, direction );
  31.838 +  gmyth_debug("[%s] CHANGE_CHANNEL to the channel direction = %u",
  31.839 +			  __FUNCTION__, direction);
  31.840  
  31.841 -    str_list = gmyth_string_list_new (  );
  31.842 +  str_list = gmyth_string_list_new();
  31.843  
  31.844 -    g_mutex_lock ( recorder->mutex );
  31.845 +  g_mutex_lock(recorder->mutex);
  31.846  
  31.847 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.848 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.849  
  31.850 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.851 -    g_string_free ( tmp_str, TRUE );
  31.852 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.853 +  g_string_free(tmp_str, TRUE);
  31.854  
  31.855 -    gmyth_string_list_append_char_array ( str_list, "CHANGE_CHANNEL" );
  31.856 -    gmyth_string_list_append_int ( str_list, direction );
  31.857 +  gmyth_string_list_append_char_array(str_list, "CHANGE_CHANNEL");
  31.858 +  gmyth_string_list_append_int(str_list, direction);
  31.859  
  31.860 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.861 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.862  
  31.863 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.864 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.865  
  31.866 -    if ( tmp_str == NULL )
  31.867 -    {
  31.868 -        gmyth_debug ( "[%s] CHANGE_CHANNEL name request returned %s",
  31.869 -                      __FUNCTION__, tmp_str->str );
  31.870 -        ret = FALSE;
  31.871 -        goto cleanup;
  31.872 -    }
  31.873 +  if (tmp_str == NULL)
  31.874 +	{
  31.875 +	  gmyth_debug("[%s] CHANGE_CHANNEL name request returned %s",
  31.876 +				  __FUNCTION__, tmp_str->str);
  31.877 +	  ret = FALSE;
  31.878 +	  goto cleanup;
  31.879 +	}
  31.880  
  31.881 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 )
  31.882 -         || g_ascii_strtoull ( tmp_str->str, NULL, 10 ) == 0 )
  31.883 -    {
  31.884 -        gmyth_debug ( "[%s] CHANGE_CHANNEL name request returned %s",
  31.885 -                      __FUNCTION__, tmp_str->str );
  31.886 -        ret = FALSE;
  31.887 -        goto cleanup;
  31.888 -    }
  31.889 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2)
  31.890 +	  || g_ascii_strtoull(tmp_str->str, NULL, 10) == 0)
  31.891 +	{
  31.892 +	  gmyth_debug("[%s] CHANGE_CHANNEL name request returned %s",
  31.893 +				  __FUNCTION__, tmp_str->str);
  31.894 +	  ret = FALSE;
  31.895 +	  goto cleanup;
  31.896 +	}
  31.897  
  31.898 -  cleanup:
  31.899 -    g_mutex_unlock ( recorder->mutex );
  31.900 -    g_string_free ( tmp_str, TRUE );
  31.901 -    g_object_unref ( str_list );
  31.902 +cleanup:
  31.903 +  g_mutex_unlock(recorder->mutex);
  31.904 +  g_string_free(tmp_str, TRUE);
  31.905 +  g_object_unref(str_list);
  31.906  
  31.907 -    return ret;
  31.908 +  return ret;
  31.909  }
  31.910  
  31.911  /** 
  31.912 @@ -651,27 +649,27 @@
  31.913   * @return a GList* instance with all the channel names.
  31.914   */
  31.915  GList *
  31.916 -gmyth_recorder_get_channel_list ( GMythRecorder * recorder )
  31.917 +gmyth_recorder_get_channel_list(GMythRecorder * recorder)
  31.918  {
  31.919  
  31.920 -    GList *channel_list = NULL;
  31.921 -    gchar *channel = NULL;
  31.922 -    guint i;
  31.923 +  GList *channel_list = NULL;
  31.924 +  gchar *channel = NULL;
  31.925 +  guint i;
  31.926  
  31.927 -    for ( i = 0; i < 1000; i++ )
  31.928 -    {
  31.929 -        channel = g_strdup_printf ( "%u", i );
  31.930 +  for (i = 0; i < 1000; i++)
  31.931 +	{
  31.932 +	  channel = g_strdup_printf("%u", i);
  31.933  
  31.934 -        if ( gmyth_recorder_check_channel_name ( recorder, channel ) )
  31.935 -        {
  31.936 -            channel_list = g_list_append ( channel_list, g_strdup ( channel ) );
  31.937 -        }
  31.938 +	  if (gmyth_recorder_check_channel_name(recorder, channel))
  31.939 +		{
  31.940 +		  channel_list = g_list_append(channel_list, g_strdup(channel));
  31.941 +		}
  31.942  
  31.943 -    }                           /* for - channel list */
  31.944 +	}							/* for - channel list */
  31.945  
  31.946 -    g_free ( channel );
  31.947 +  g_free(channel);
  31.948  
  31.949 -    return channel_list;
  31.950 +  return channel_list;
  31.951  
  31.952  }
  31.953  
  31.954 @@ -682,74 +680,72 @@
  31.955   * @return true if success, false if any error happens.
  31.956   */
  31.957  gboolean
  31.958 -gmyth_recorder_pause_recording ( GMythRecorder * recorder )
  31.959 +gmyth_recorder_pause_recording(GMythRecorder * recorder)
  31.960  {
  31.961 -    GMythStringList *str_list;
  31.962 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
  31.963 -    gboolean ret = TRUE;
  31.964 +  GMythStringList *str_list;
  31.965 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
  31.966 +  gboolean ret = TRUE;
  31.967  
  31.968 -    gmyth_debug ( "[%s] PAUSE", __FUNCTION__ );
  31.969 +  gmyth_debug("[%s] PAUSE", __FUNCTION__);
  31.970  
  31.971 -    str_list = gmyth_string_list_new (  );
  31.972 +  str_list = gmyth_string_list_new();
  31.973  
  31.974 -    g_mutex_lock ( recorder->mutex );
  31.975 +  g_mutex_lock(recorder->mutex);
  31.976  
  31.977 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
  31.978 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
  31.979  
  31.980 -    gmyth_string_list_append_string ( str_list, tmp_str );
  31.981 -    g_string_free ( tmp_str, TRUE );
  31.982 +  gmyth_string_list_append_string(str_list, tmp_str);
  31.983 +  g_string_free(tmp_str, TRUE);
  31.984  
  31.985 -    gmyth_string_list_append_char_array ( str_list, "PAUSE" );
  31.986 +  gmyth_string_list_append_char_array(str_list, "PAUSE");
  31.987  
  31.988 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
  31.989 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
  31.990  
  31.991 -    tmp_str = gmyth_string_list_get_string ( str_list, 0 );
  31.992 +  tmp_str = gmyth_string_list_get_string(str_list, 0);
  31.993  
  31.994 -    if ( tmp_str == NULL )
  31.995 -    {
  31.996 -        gmyth_debug ( "[%s] PAUSE name request returned %s", __FUNCTION__,
  31.997 -                      tmp_str->str );
  31.998 -        ret = FALSE;
  31.999 -        goto cleanup;
 31.1000 -    }
 31.1001 +  if (tmp_str == NULL)
 31.1002 +	{
 31.1003 +	  gmyth_debug("[%s] PAUSE name request returned %s", __FUNCTION__,
 31.1004 +				  tmp_str->str);
 31.1005 +	  ret = FALSE;
 31.1006 +	  goto cleanup;
 31.1007 +	}
 31.1008  
 31.1009 -    if ( g_ascii_strncasecmp ( tmp_str->str, "ok", 2 ) )
 31.1010 -    {
 31.1011 -        gmyth_debug ( "[%s] PAUSE name request returned %s", __FUNCTION__,
 31.1012 -                      tmp_str->str );
 31.1013 -        ret = FALSE;
 31.1014 -        goto cleanup;
 31.1015 -    }
 31.1016 +  if (g_ascii_strncasecmp(tmp_str->str, "ok", 2))
 31.1017 +	{
 31.1018 +	  gmyth_debug("[%s] PAUSE name request returned %s", __FUNCTION__,
 31.1019 +				  tmp_str->str);
 31.1020 +	  ret = FALSE;
 31.1021 +	  goto cleanup;
 31.1022 +	}
 31.1023  
 31.1024 -  cleanup:
 31.1025 -    g_mutex_unlock ( recorder->mutex );
 31.1026 -    g_string_free ( tmp_str, TRUE );
 31.1027 -    g_object_unref ( str_list );
 31.1028 +cleanup:
 31.1029 +  g_mutex_unlock(recorder->mutex);
 31.1030 +  g_string_free(tmp_str, TRUE);
 31.1031 +  g_object_unref(str_list);
 31.1032  
 31.1033 -    return ret;
 31.1034 +  return ret;
 31.1035  }
 31.1036  
 31.1037  static gboolean
 31.1038 -gmyth_recorder_find_if_program_exists ( GMythRecorder * recorder,
 31.1039 -                                        GMythProgramInfo * prog )
 31.1040 +gmyth_recorder_find_if_program_exists(GMythRecorder * recorder,
 31.1041 +									  GMythProgramInfo * prog)
 31.1042  {
 31.1043 -    GList *lst = NULL;
 31.1044 +  GList *lst = NULL;
 31.1045  
 31.1046 -    g_return_val_if_fail ( recorder != NULL
 31.1047 -                           && recorder->progs_info_list != NULL, FALSE );
 31.1048 +  g_return_val_if_fail(recorder != NULL
 31.1049 +					   && recorder->progs_info_list != NULL, FALSE);
 31.1050  
 31.1051 -    for ( lst = recorder->progs_info_list; lst != NULL;
 31.1052 -          lst = g_list_next ( lst ) )
 31.1053 -    {
 31.1054 -        gmyth_debug ( "Got program info from list = [%s]",
 31.1055 -                      gmyth_program_info_to_string ( ( GMythProgramInfo * )
 31.1056 -                                                     lst->data ) );
 31.1057 -        if ( gmyth_program_info_is_equals
 31.1058 -             ( prog, ( GMythProgramInfo * ) lst->data ) )
 31.1059 -            return TRUE;
 31.1060 -    }
 31.1061 +  for (lst = recorder->progs_info_list; lst != NULL; lst = g_list_next(lst))
 31.1062 +	{
 31.1063 +	  gmyth_debug("Got program info from list = [%s]",
 31.1064 +				  gmyth_program_info_to_string((GMythProgramInfo *)
 31.1065 +											   lst->data));
 31.1066 +	  if (gmyth_program_info_is_equals(prog, (GMythProgramInfo *) lst->data))
 31.1067 +		return TRUE;
 31.1068 +	}
 31.1069  
 31.1070 -    return FALSE;
 31.1071 +  return FALSE;
 31.1072  }
 31.1073  
 31.1074  /**
 31.1075 @@ -759,62 +755,60 @@
 31.1076   * @return The actual program info.
 31.1077   */
 31.1078  GMythProgramInfo *
 31.1079 -gmyth_recorder_get_current_program_info ( GMythRecorder * recorder )
 31.1080 +gmyth_recorder_get_current_program_info(GMythRecorder * recorder)
 31.1081  {
 31.1082 -    GMythStringList *str_list = NULL;
 31.1083 -    GMythProgramInfo *program_info = NULL;
 31.1084 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
 31.1085 +  GMythStringList *str_list = NULL;
 31.1086 +  GMythProgramInfo *program_info = NULL;
 31.1087 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
 31.1088  
 31.1089 -    str_list = gmyth_string_list_new (  );
 31.1090 +  str_list = gmyth_string_list_new();
 31.1091  
 31.1092 -    g_mutex_lock ( recorder->mutex );
 31.1093 +  g_mutex_lock(recorder->mutex);
 31.1094  
 31.1095 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
 31.1096 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
 31.1097  
 31.1098 -    gmyth_string_list_append_string ( str_list, tmp_str );
 31.1099 +  gmyth_string_list_append_string(str_list, tmp_str);
 31.1100  
 31.1101 -    if ( recorder->myth_socket->mythtv_version >= 26 )
 31.1102 -        gmyth_string_list_append_char_array ( str_list,
 31.1103 -                                              "GET_CURRENT_RECORDING" );
 31.1104 -    else
 31.1105 -        gmyth_string_list_append_char_array ( str_list, "GET_PROGRAM_INFO" );
 31.1106 +  if (recorder->myth_socket->mythtv_version >= 26)
 31.1107 +	gmyth_string_list_append_char_array(str_list, "GET_CURRENT_RECORDING");
 31.1108 +  else
 31.1109 +	gmyth_string_list_append_char_array(str_list, "GET_PROGRAM_INFO");
 31.1110  
 31.1111 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.1112 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.1113  
 31.1114 -    if ( str_list == NULL )
 31.1115 -    {
 31.1116 -        gmyth_debug
 31.1117 -            ( "[%s] GET_PROGRAM_INFO request returned. Error getting program info, string list equals to NULL!",
 31.1118 -              __FUNCTION__ );
 31.1119 -        goto cleanup;
 31.1120 -    }
 31.1121 +  if (str_list == NULL)
 31.1122 +	{
 31.1123 +	  gmyth_debug
 31.1124 +		("[%s] GET_PROGRAM_INFO request returned. Error getting program info, string list equals to NULL!",
 31.1125 +		 __FUNCTION__);
 31.1126 +	  goto cleanup;
 31.1127 +	}
 31.1128  
 31.1129 -    program_info = gmyth_program_info_from_string_list ( str_list );
 31.1130 +  program_info = gmyth_program_info_from_string_list(str_list);
 31.1131  
 31.1132 -    if ( NULL == program_info || NULL == program_info->pathname
 31.1133 -         || program_info->pathname->len <= 0 )
 31.1134 -    {
 31.1135 -        gmyth_debug
 31.1136 -            ( "GET_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!" );
 31.1137 +  if (NULL == program_info || NULL == program_info->pathname
 31.1138 +	  || program_info->pathname->len <= 0)
 31.1139 +	{
 31.1140 +	  gmyth_debug
 31.1141 +		("GET_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!");
 31.1142  
 31.1143 -        if ( program_info )
 31.1144 -            g_object_unref ( program_info );
 31.1145 +	  if (program_info)
 31.1146 +		g_object_unref(program_info);
 31.1147  
 31.1148 -        program_info = NULL;
 31.1149 +	  program_info = NULL;
 31.1150  
 31.1151 -        goto cleanup;
 31.1152 -    }
 31.1153 +	  goto cleanup;
 31.1154 +	}
 31.1155  
 31.1156 -    if ( !gmyth_recorder_find_if_program_exists ( recorder, program_info ) )
 31.1157 -        recorder->progs_info_list = g_list_append ( recorder->progs_info_list,
 31.1158 -                                                    g_object_ref
 31.1159 -                                                    ( program_info ) );
 31.1160 -  cleanup:
 31.1161 -    g_mutex_unlock ( recorder->mutex );
 31.1162 -    g_string_free ( tmp_str, TRUE );
 31.1163 -    g_object_unref ( str_list );
 31.1164 +  if (!gmyth_recorder_find_if_program_exists(recorder, program_info))
 31.1165 +	recorder->progs_info_list = g_list_append(recorder->progs_info_list,
 31.1166 +											  g_object_ref(program_info));
 31.1167 +cleanup:
 31.1168 +  g_mutex_unlock(recorder->mutex);
 31.1169 +  g_string_free(tmp_str, TRUE);
 31.1170 +  g_object_unref(str_list);
 31.1171  
 31.1172 -    return program_info;
 31.1173 +  return program_info;
 31.1174  }
 31.1175  
 31.1176  /**
 31.1177 @@ -824,84 +818,83 @@
 31.1178   * @return The GMythRecorder instance.
 31.1179   */
 31.1180  GMythRecorder *
 31.1181 -gmyth_recorder_get_recorder_from_num ( gint rec_id )
 31.1182 +gmyth_recorder_get_recorder_from_num(gint rec_id)
 31.1183  {
 31.1184 -    GMythRecorder *recorder = NULL;
 31.1185 -    GMythStringList *str_list;
 31.1186 -    GString *tmp_str = g_string_new ( "GET_RECORDER_FROM_NUM" );
 31.1187 -    gint command_size = 0;
 31.1188 +  GMythRecorder *recorder = NULL;
 31.1189 +  GMythStringList *str_list;
 31.1190 +  GString *tmp_str = g_string_new("GET_RECORDER_FROM_NUM");
 31.1191 +  gint command_size = 0;
 31.1192  
 31.1193 -    gchar *recorder_host = NULL;
 31.1194 -    gint recorder_port;
 31.1195 +  gchar *recorder_host = NULL;
 31.1196 +  gint recorder_port;
 31.1197  
 31.1198 -    str_list = gmyth_string_list_new (  );
 31.1199 +  str_list = gmyth_string_list_new();
 31.1200  
 31.1201 -    /* g_string_append_printf ( tmp_str, " %d", recorder->recorder_num ); */
 31.1202 + /* g_string_append_printf ( tmp_str, " %d", recorder->recorder_num ); */
 31.1203  
 31.1204 -    g_mutex_lock ( recorder->mutex );
 31.1205 +  g_mutex_lock(recorder->mutex);
 31.1206  
 31.1207 -    gmyth_string_list_append_string ( str_list, tmp_str );
 31.1208 +  gmyth_string_list_append_string(str_list, tmp_str);
 31.1209  
 31.1210 -    gmyth_string_list_append_int ( str_list, rec_id );
 31.1211 +  gmyth_string_list_append_int(str_list, rec_id);
 31.1212  
 31.1213 -    command_size = gmyth_socket_sendreceive_stringlist ( recorder->myth_socket,
 31.1214 -                                                         str_list );
 31.1215 +  command_size = gmyth_socket_sendreceive_stringlist(recorder->myth_socket,
 31.1216 +													 str_list);
 31.1217  
 31.1218 -    if ( str_list == NULL )
 31.1219 -    {
 31.1220 -        gmyth_debug
 31.1221 -            ( "[%s] GET_RECORDER_FROM_NUM request returned. Error getting recorder number %d, it is equals to NULL!!!",
 31.1222 -              __FUNCTION__, rec_id );
 31.1223 -        return NULL;
 31.1224 -    }
 31.1225 +  if (str_list == NULL)
 31.1226 +	{
 31.1227 +	  gmyth_debug
 31.1228 +		("[%s] GET_RECORDER_FROM_NUM request returned. Error getting recorder number %d, it is equals to NULL!!!",
 31.1229 +		 __FUNCTION__, rec_id);
 31.1230 +	  return NULL;
 31.1231 +	}
 31.1232  
 31.1233 -    if ( command_size > 0 )
 31.1234 -    {
 31.1235 -        recorder_host = gmyth_string_list_get_char_array ( str_list, 0 );
 31.1236 -        recorder_port = gmyth_string_list_get_int ( str_list, 1 );
 31.1237 +  if (command_size > 0)
 31.1238 +	{
 31.1239 +	  recorder_host = gmyth_string_list_get_char_array(str_list, 0);
 31.1240 +	  recorder_port = gmyth_string_list_get_int(str_list, 1);
 31.1241  
 31.1242 -        if ( g_strstr_len ( recorder_host, strlen ( recorder_host ), "nohost" )
 31.1243 -             != NULL )
 31.1244 -        {
 31.1245 -            gmyth_debug
 31.1246 -                ( "No available recorder with the recorder ID number %d!",
 31.1247 -                  rec_id );
 31.1248 -        }
 31.1249 -        else
 31.1250 -        {
 31.1251 +	  if (g_strstr_len(recorder_host, strlen(recorder_host), "nohost")
 31.1252 +		  != NULL)
 31.1253 +		{
 31.1254 +		  gmyth_debug
 31.1255 +			("No available recorder with the recorder ID number %d!", rec_id);
 31.1256 +		}
 31.1257 +	  else
 31.1258 +		{
 31.1259  
 31.1260 -            recorder = gmyth_recorder_new ( rec_id,
 31.1261 -                                            g_string_new ( recorder_host ),
 31.1262 -                                            ( gshort ) recorder_port );
 31.1263 +		  recorder = gmyth_recorder_new(rec_id,
 31.1264 +										g_string_new(recorder_host),
 31.1265 +										(gshort) recorder_port);
 31.1266  
 31.1267 -            if ( NULL == recorder )
 31.1268 -            {
 31.1269 -                gmyth_debug
 31.1270 -                    ( "[%s] GET_RECORDER_FROM_NUM request returned. Error getting recorder number %d, it is equals to NULL!!!",
 31.1271 -                      __FUNCTION__, rec_id );
 31.1272 -                g_object_unref ( recorder );
 31.1273 -                return NULL;
 31.1274 -            }
 31.1275 +		  if (NULL == recorder)
 31.1276 +			{
 31.1277 +			  gmyth_debug
 31.1278 +				("[%s] GET_RECORDER_FROM_NUM request returned. Error getting recorder number %d, it is equals to NULL!!!",
 31.1279 +				 __FUNCTION__, rec_id);
 31.1280 +			  g_object_unref(recorder);
 31.1281 +			  return NULL;
 31.1282 +			}
 31.1283  
 31.1284 -        }
 31.1285 +		}
 31.1286  
 31.1287 -    }
 31.1288 -    else
 31.1289 -    {
 31.1290 -        gmyth_debug
 31.1291 -            ( "Cannot find a valuable recorder with the recorder ID number %d, backend server error!",
 31.1292 -              rec_id );
 31.1293 -    }
 31.1294 +	}
 31.1295 +  else
 31.1296 +	{
 31.1297 +	  gmyth_debug
 31.1298 +		("Cannot find a valuable recorder with the recorder ID number %d, backend server error!",
 31.1299 +		 rec_id);
 31.1300 +	}
 31.1301  
 31.1302 -    g_mutex_unlock ( recorder->mutex );
 31.1303 +  g_mutex_unlock(recorder->mutex);
 31.1304  
 31.1305 -    g_object_unref ( str_list );
 31.1306 +  g_object_unref(str_list);
 31.1307  
 31.1308 -    g_string_free ( tmp_str, TRUE );
 31.1309 +  g_string_free(tmp_str, TRUE);
 31.1310  
 31.1311 -    g_free ( recorder_host );
 31.1312 +  g_free(recorder_host);
 31.1313  
 31.1314 -    return recorder;
 31.1315 +  return recorder;
 31.1316  
 31.1317  }
 31.1318  
 31.1319 @@ -915,99 +908,98 @@
 31.1320   * @return The GMythProgramInfo next program info instance.
 31.1321   */
 31.1322  GMythProgramInfo *
 31.1323 -gmyth_recorder_get_next_program_info ( GMythRecorder * recorder,
 31.1324 -                                       const GMythRecorderBrowseDirection
 31.1325 -                                       direction )
 31.1326 +gmyth_recorder_get_next_program_info(GMythRecorder * recorder,
 31.1327 +									 const GMythRecorderBrowseDirection
 31.1328 +									 direction)
 31.1329  {
 31.1330 -    GMythProgramInfo *actual_proginfo = NULL;
 31.1331 -    GMythProgramInfo *program_info = NULL;
 31.1332 -    GMythStringList *str_list;
 31.1333 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
 31.1334 +  GMythProgramInfo *actual_proginfo = NULL;
 31.1335 +  GMythProgramInfo *program_info = NULL;
 31.1336 +  GMythStringList *str_list;
 31.1337 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
 31.1338  
 31.1339 -    gchar *date = NULL;
 31.1340 -    struct tm *tm = NULL;
 31.1341 -    time_t t;
 31.1342 +  gchar *date = NULL;
 31.1343 +  struct tm *tm = NULL;
 31.1344 +  time_t t;
 31.1345  
 31.1346 -    actual_proginfo = gmyth_recorder_get_current_program_info ( recorder );
 31.1347 +  actual_proginfo = gmyth_recorder_get_current_program_info(recorder);
 31.1348  
 31.1349 -    str_list = gmyth_string_list_new (  );
 31.1350 +  str_list = gmyth_string_list_new();
 31.1351  
 31.1352 -    g_mutex_lock ( recorder->mutex );
 31.1353 +  g_mutex_lock(recorder->mutex);
 31.1354  
 31.1355 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
 31.1356 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
 31.1357  
 31.1358 -    t = time ( NULL );
 31.1359 -    tm = localtime ( &t );
 31.1360 -    date = g_strdup_printf ( "%.4d%.2d%.2d%.2d%.2d%.2d", tm->tm_year + 1900,
 31.1361 -                             tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
 31.1362 -                             tm->tm_min, tm->tm_sec );
 31.1363 +  t = time(NULL);
 31.1364 +  tm = localtime(&t);
 31.1365 +  date = g_strdup_printf("%.4d%.2d%.2d%.2d%.2d%.2d", tm->tm_year + 1900,
 31.1366 +						 tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
 31.1367 +						 tm->tm_min, tm->tm_sec);
 31.1368  
 31.1369 -    gmyth_string_list_append_string ( str_list, tmp_str );
 31.1370 -    gmyth_string_list_append_char_array ( str_list, "GET_NEXT_PROGRAM_INFO" );
 31.1371 -    gmyth_string_list_append_string ( str_list, actual_proginfo->channame );
 31.1372 -    gmyth_string_list_append_string ( str_list, actual_proginfo->chanid );
 31.1373 -    gmyth_string_list_append_int ( str_list, direction );
 31.1374 -    gmyth_string_list_append_char_array ( str_list, date );
 31.1375 +  gmyth_string_list_append_string(str_list, tmp_str);
 31.1376 +  gmyth_string_list_append_char_array(str_list, "GET_NEXT_PROGRAM_INFO");
 31.1377 +  gmyth_string_list_append_string(str_list, actual_proginfo->channame);
 31.1378 +  gmyth_string_list_append_string(str_list, actual_proginfo->chanid);
 31.1379 +  gmyth_string_list_append_int(str_list, direction);
 31.1380 +  gmyth_string_list_append_char_array(str_list, date);
 31.1381  
 31.1382 -    if ( gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list )
 31.1383 -         > 0 )
 31.1384 -    {
 31.1385 +  if (gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list)
 31.1386 +	  > 0)
 31.1387 +	{
 31.1388  
 31.1389 -        if ( str_list == NULL )
 31.1390 -        {
 31.1391 -            gmyth_debug
 31.1392 -                ( "[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!",
 31.1393 -                  __FUNCTION__ );
 31.1394 -            goto done;
 31.1395 -        }
 31.1396 -        program_info =
 31.1397 -            gmyth_program_info_from_string_list_next_prog ( str_list );
 31.1398 +	  if (str_list == NULL)
 31.1399 +		{
 31.1400 +		  gmyth_debug
 31.1401 +			("[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!",
 31.1402 +			 __FUNCTION__);
 31.1403 +		  goto done;
 31.1404 +		}
 31.1405 +	  program_info = gmyth_program_info_from_string_list_next_prog(str_list);
 31.1406  
 31.1407 -        if ( NULL == program_info )
 31.1408 -        {
 31.1409 -            gmyth_debug
 31.1410 -                ( "[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting next program info, it is equals to NULL!!!",
 31.1411 -                  __FUNCTION__ );
 31.1412 -            g_object_unref ( program_info );
 31.1413 -            goto done;
 31.1414 -        }
 31.1415 +	  if (NULL == program_info)
 31.1416 +		{
 31.1417 +		  gmyth_debug
 31.1418 +			("[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting next program info, it is equals to NULL!!!",
 31.1419 +			 __FUNCTION__);
 31.1420 +		  g_object_unref(program_info);
 31.1421 +		  goto done;
 31.1422 +		}
 31.1423  
 31.1424 -        if (                    /*( program_info->chanid != NULL && strlen( program_info->chanid->str ) > 0  ) && */
 31.1425 -                ( program_info->chansign != NULL
 31.1426 -                  && strlen ( program_info->chansign->str ) > 0 ) )
 31.1427 -        {
 31.1428 -            gmyth_debug ( "OK!!! Got the next program info... [%s].",
 31.1429 -                          program_info->chansign->str );
 31.1430 -        }
 31.1431 -        else
 31.1432 -        {
 31.1433 -            gmyth_debug
 31.1434 -                ( "GET_NEXT_PROGRAM_INFO request returned. Error getting next program info, it is equals to NULL!!!" );
 31.1435 -            g_object_unref ( program_info );
 31.1436 -            program_info = NULL;
 31.1437 -        }
 31.1438 +	  if (						/*( program_info->chanid != NULL && strlen( program_info->chanid->str ) > 0  ) && */
 31.1439 +		   (program_info->chansign != NULL
 31.1440 +			&& strlen(program_info->chansign->str) > 0))
 31.1441 +		{
 31.1442 +		  gmyth_debug("OK!!! Got the next program info... [%s].",
 31.1443 +					  program_info->chansign->str);
 31.1444 +		}
 31.1445 +	  else
 31.1446 +		{
 31.1447 +		  gmyth_debug
 31.1448 +			("GET_NEXT_PROGRAM_INFO request returned. Error getting next program info, it is equals to NULL!!!");
 31.1449 +		  g_object_unref(program_info);
 31.1450 +		  program_info = NULL;
 31.1451 +		}
 31.1452  
 31.1453 -    }
 31.1454 -    /* if */
 31.1455 -  done:
 31.1456 +	}
 31.1457 + /* if */
 31.1458 +done:
 31.1459  
 31.1460 -    g_mutex_unlock ( recorder->mutex );
 31.1461 +  g_mutex_unlock(recorder->mutex);
 31.1462  
 31.1463 -    if ( actual_proginfo != NULL )
 31.1464 -        g_object_unref ( actual_proginfo );
 31.1465 +  if (actual_proginfo != NULL)
 31.1466 +	g_object_unref(actual_proginfo);
 31.1467  
 31.1468 -    if ( str_list != NULL )
 31.1469 -        g_object_unref ( str_list );
 31.1470 +  if (str_list != NULL)
 31.1471 +	g_object_unref(str_list);
 31.1472  
 31.1473 -    if ( tmp_str != NULL )
 31.1474 -        g_string_free ( tmp_str, TRUE );
 31.1475 +  if (tmp_str != NULL)
 31.1476 +	g_string_free(tmp_str, TRUE);
 31.1477  
 31.1478 -    if ( date != NULL )
 31.1479 -        g_free ( date );
 31.1480 -    //if ( tm != NULL)
 31.1481 -    //    g_free (tm);
 31.1482 +  if (date != NULL)
 31.1483 +	g_free(date);
 31.1484 + //if ( tm != NULL)
 31.1485 + //    g_free (tm);
 31.1486  
 31.1487 -    return program_info;
 31.1488 +  return program_info;
 31.1489  }
 31.1490  
 31.1491  /**
 31.1492 @@ -1018,101 +1010,101 @@
 31.1493   * @return The GMythProgramInfo next program info instance.
 31.1494   */
 31.1495  GMythProgramInfo *
 31.1496 -gmyth_recorder_get_program_info_from_channel_name ( GMythRecorder * recorder,
 31.1497 -                                                    const gchar * channel )
 31.1498 +gmyth_recorder_get_program_info_from_channel_name(GMythRecorder * recorder,
 31.1499 +												  const gchar * channel)
 31.1500  {
 31.1501 -    //GMythProgramInfo* actual_proginfo=  NULL;
 31.1502 -    GMythProgramInfo *program_info = NULL;
 31.1503 -    GMythStringList *str_list;
 31.1504 -    GString *tmp_str = g_string_new ( GMYTHTV_RECORDER_HEADER );
 31.1505 + //GMythProgramInfo* actual_proginfo=  NULL;
 31.1506 +  GMythProgramInfo *program_info = NULL;
 31.1507 +  GMythStringList *str_list;
 31.1508 +  GString *tmp_str = g_string_new(GMYTHTV_RECORDER_HEADER);
 31.1509  
 31.1510 -    /*
 31.1511 -       gchar *date =  NULL;
 31.1512 -       struct tm *tm = NULL;
 31.1513 -       time_t t;
 31.1514 + /*
 31.1515 +    gchar *date =  NULL;
 31.1516 +    struct tm *tm = NULL;
 31.1517 +    time_t t;
 31.1518  
 31.1519 -       actual_proginfo = gmyth_recorder_get_current_program_info(recorder);
 31.1520 -     */
 31.1521 +    actual_proginfo = gmyth_recorder_get_current_program_info(recorder);
 31.1522 +  */
 31.1523  
 31.1524 -    str_list = gmyth_string_list_new (  );
 31.1525 +  str_list = gmyth_string_list_new();
 31.1526  
 31.1527 -    g_mutex_lock ( recorder->mutex );
 31.1528 +  g_mutex_lock(recorder->mutex);
 31.1529  
 31.1530 -    g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
 31.1531 +  g_string_append_printf(tmp_str, " %d", recorder->recorder_num);
 31.1532  
 31.1533 -    /*
 31.1534 -       t = time(NULL);
 31.1535 -       tm = localtime(&t);
 31.1536 -       date = g_strdup_printf("%.4d%.2d%.2d%.2d%.2d%.2d", tm->tm_year + 1900,
 31.1537 -       tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
 31.1538 -     */
 31.1539 + /*
 31.1540 +    t = time(NULL);
 31.1541 +    tm = localtime(&t);
 31.1542 +    date = g_strdup_printf("%.4d%.2d%.2d%.2d%.2d%.2d", tm->tm_year + 1900,
 31.1543 +    tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
 31.1544 +  */
 31.1545  
 31.1546 -    gmyth_string_list_append_string ( str_list, tmp_str );
 31.1547 -    gmyth_string_list_append_char_array ( str_list, "GET_NEXT_PROGRAM_INFO" );
 31.1548 -    gmyth_string_list_append_char_array ( str_list, channel );
 31.1549 -    gmyth_string_list_append_char_array ( str_list, "0" );
 31.1550 -    gmyth_string_list_append_int ( str_list, BROWSE_DIRECTION_UP );
 31.1551 -    gmyth_string_list_append_char_array ( str_list, "0" );
 31.1552 +  gmyth_string_list_append_string(str_list, tmp_str);
 31.1553 +  gmyth_string_list_append_char_array(str_list, "GET_NEXT_PROGRAM_INFO");
 31.1554 +  gmyth_string_list_append_char_array(str_list, channel);
 31.1555 +  gmyth_string_list_append_char_array(str_list, "0");
 31.1556 +  gmyth_string_list_append_int(str_list, BROWSE_DIRECTION_UP);
 31.1557 +  gmyth_string_list_append_char_array(str_list, "0");
 31.1558  
 31.1559 -    do
 31.1560 -    {
 31.1561 +  do
 31.1562 +	{
 31.1563  
 31.1564 -        if ( str_list != NULL &&
 31.1565 -             gmyth_socket_sendreceive_stringlist ( recorder->myth_socket,
 31.1566 -                                                   str_list ) > 0 )
 31.1567 -        {
 31.1568 +	  if (str_list != NULL &&
 31.1569 +		  gmyth_socket_sendreceive_stringlist(recorder->myth_socket,
 31.1570 +											  str_list) > 0)
 31.1571 +		{
 31.1572  
 31.1573 -            if ( str_list == NULL )
 31.1574 -            {
 31.1575 -                gmyth_debug
 31.1576 -                    ( "[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!",
 31.1577 -                      __FUNCTION__ );
 31.1578 -                goto done;
 31.1579 -            }
 31.1580 -            program_info =
 31.1581 -                gmyth_program_info_from_string_list_next_prog ( str_list );
 31.1582 +		  if (str_list == NULL)
 31.1583 +			{
 31.1584 +			  gmyth_debug
 31.1585 +				("[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting program info, it is equals to NULL!!!",
 31.1586 +				 __FUNCTION__);
 31.1587 +			  goto done;
 31.1588 +			}
 31.1589 +		  program_info =
 31.1590 +			gmyth_program_info_from_string_list_next_prog(str_list);
 31.1591  
 31.1592 -            if ( NULL == program_info )
 31.1593 -            {
 31.1594 -                gmyth_debug
 31.1595 -                    ( "[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting next program info, it is equals to NULL!!!",
 31.1596 -                      __FUNCTION__ );
 31.1597 -                g_object_unref ( program_info );
 31.1598 -                goto done;
 31.1599 -            }
 31.1600 +		  if (NULL == program_info)
 31.1601 +			{
 31.1602 +			  gmyth_debug
 31.1603 +				("[%s] GET_NEXT_PROGRAM_INFO request returned. Error getting next program info, it is equals to NULL!!!",
 31.1604 +				 __FUNCTION__);
 31.1605 +			  g_object_unref(program_info);
 31.1606 +			  goto done;
 31.1607 +			}
 31.1608  
 31.1609 -            if (                /*( program_info->chanid != NULL && strlen( program_info->chanid->str ) > 0  ) && */
 31.1610 -                    ( program_info->chansign != NULL
 31.1611 -                      && strlen ( program_info->chansign->str ) > 0 ) )
 31.1612 -            {
 31.1613 -                gmyth_debug ( "OK!!! Got the next program info... [%s].",
 31.1614 -                              program_info->chansign->str );
 31.1615 -            }
 31.1616 -            else
 31.1617 -            {
 31.1618 -                gmyth_debug
 31.1619 -                    ( "GET_NEXT_PROGRAM_INFO request returned. Error getting "
 31.1620 -                      "next program info, it is equals to NULL!!!" );
 31.1621 -                g_object_unref ( program_info );
 31.1622 -                program_info = NULL;
 31.1623 -            }
 31.1624 +		  if (					/*( program_info->chanid != NULL && strlen( program_info->chanid->str ) > 0  ) && */
 31.1625 +			   (program_info->chansign != NULL
 31.1626 +				&& strlen(program_info->chansign->str) > 0))
 31.1627 +			{
 31.1628 +			  gmyth_debug("OK!!! Got the next program info... [%s].",
 31.1629 +						  program_info->chansign->str);
 31.1630 +			}
 31.1631 +		  else
 31.1632 +			{
 31.1633 +			  gmyth_debug
 31.1634 +				("GET_NEXT_PROGRAM_INFO request returned. Error getting "
 31.1635 +				 "next program info, it is equals to NULL!!!");
 31.1636 +			  g_object_unref(program_info);
 31.1637 +			  program_info = NULL;
 31.1638 +			}
 31.1639  
 31.1640 -        }
 31.1641 -        /* if */
 31.1642 -    }
 31.1643 -    while ( str_list != NULL );
 31.1644 +		}
 31.1645 +	 /* if */
 31.1646 +	}
 31.1647 +  while (str_list != NULL);
 31.1648  
 31.1649 -  done:
 31.1650 +done:
 31.1651  
 31.1652 -    g_mutex_unlock ( recorder->mutex );
 31.1653 +  g_mutex_unlock(recorder->mutex);
 31.1654  
 31.1655 -    if ( str_list != NULL )
 31.1656 -        g_object_unref ( str_list );
 31.1657 +  if (str_list != NULL)
 31.1658 +	g_object_unref(str_list);
 31.1659  
 31.1660 -    if ( tmp_str != NULL )
 31.1661 -        g_string_free ( tmp_str, TRUE );
 31.1662 +  if (tmp_str != NULL)
 31.1663 +	g_string_free(tmp_str, TRUE);
 31.1664  
 31.1665 -    return program_info;
 31.1666 +  return program_info;
 31.1667  }
 31.1668  
 31.1669  /**
 31.1670 @@ -1123,43 +1115,43 @@
 31.1671   * @return The position, in bytes, of the offset to the read header.
 31.1672   */
 31.1673  gint64
 31.1674 -gmyth_recorder_get_file_position ( GMythRecorder * recorder )
 31.1675 +gmyth_recorder_get_file_position(GMythRecorder * recorder)
 31.1676  {
 31.1677 -    gint64 pos = 0;
 31.1678 -    GString *query = g_string_new ( GMYTHTV_RECORDER_HEADER );
 31.1679 +  gint64 pos = 0;
 31.1680 +  GString *query = g_string_new(GMYTHTV_RECORDER_HEADER);
 31.1681  
 31.1682 -    GMythStringList *str_list = gmyth_string_list_new (  );
 31.1683 +  GMythStringList *str_list = gmyth_string_list_new();
 31.1684  
 31.1685 -    g_mutex_lock ( recorder->mutex );
 31.1686 +  g_mutex_lock(recorder->mutex);
 31.1687  
 31.1688 -    g_string_append_printf ( query, " %d", recorder->recorder_num );
 31.1689 +  g_string_append_printf(query, " %d", recorder->recorder_num);
 31.1690  
 31.1691 -    gmyth_string_list_append_string ( str_list, query );
 31.1692 -    gmyth_string_list_append_char_array ( str_list, "GET_FILE_POSITION" );
 31.1693 +  gmyth_string_list_append_string(str_list, query);
 31.1694 +  gmyth_string_list_append_char_array(str_list, "GET_FILE_POSITION");
 31.1695  
 31.1696 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.1697 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.1698  
 31.1699 -    if ( str_list != NULL && gmyth_string_list_length ( str_list ) > 0 )
 31.1700 -    {
 31.1701 -        GString *str = NULL;
 31.1702 +  if (str_list != NULL && gmyth_string_list_length(str_list) > 0)
 31.1703 +	{
 31.1704 +	  GString *str = NULL;
 31.1705  
 31.1706 -        if ( ( str = gmyth_string_list_get_string ( str_list, 0 ) ) != NULL
 31.1707 -             && strstr ( str->str, "bad" ) == NULL )
 31.1708 -            pos = gmyth_string_list_get_int64 ( str_list, 0 );
 31.1709 -        g_string_free ( str, TRUE );
 31.1710 -    }
 31.1711 +	  if ((str = gmyth_string_list_get_string(str_list, 0)) != NULL
 31.1712 +		  && strstr(str->str, "bad") == NULL)
 31.1713 +		pos = gmyth_string_list_get_int64(str_list, 0);
 31.1714 +	  g_string_free(str, TRUE);
 31.1715 +	}
 31.1716  #ifndef GMYTHTV_ENABLE_DEBUG
 31.1717 -    gmyth_debug ( "[%s] Got file position = %lld\n", __FUNCTION__, pos );
 31.1718 +  gmyth_debug("[%s] Got file position = %lld\n", __FUNCTION__, pos);
 31.1719  #endif
 31.1720  
 31.1721 -    g_mutex_unlock ( recorder->mutex );
 31.1722 +  g_mutex_unlock(recorder->mutex);
 31.1723  
 31.1724 -    if ( str_list != NULL )
 31.1725 -        g_object_unref ( str_list );
 31.1726 +  if (str_list != NULL)
 31.1727 +	g_object_unref(str_list);
 31.1728  
 31.1729 -    g_string_free ( query, TRUE );
 31.1730 +  g_string_free(query, TRUE);
 31.1731  
 31.1732 -    return pos;
 31.1733 +  return pos;
 31.1734  }
 31.1735  
 31.1736  /**
 31.1737 @@ -1170,53 +1162,53 @@
 31.1738   * @return <code>true</code>, if the actual remote file is bein recorded.
 31.1739   */
 31.1740  gboolean
 31.1741 -gmyth_recorder_is_recording ( GMythRecorder * recorder )
 31.1742 +gmyth_recorder_is_recording(GMythRecorder * recorder)
 31.1743  {
 31.1744 -    gboolean ret = TRUE;
 31.1745 +  gboolean ret = TRUE;
 31.1746  
 31.1747 -    g_return_val_if_fail ( recorder != NULL, FALSE );
 31.1748 +  g_return_val_if_fail(recorder != NULL, FALSE);
 31.1749  
 31.1750 -    GMythStringList *str_list = gmyth_string_list_new (  );
 31.1751 -    GString *message = g_string_new ( "" );
 31.1752 +  GMythStringList *str_list = gmyth_string_list_new();
 31.1753 +  GString *message = g_string_new("");
 31.1754  
 31.1755 -    g_mutex_lock ( recorder->mutex );
 31.1756 +  g_mutex_lock(recorder->mutex);
 31.1757  
 31.1758 -    g_string_printf ( message, "%s %d", GMYTHTV_RECORDER_HEADER,
 31.1759 -                      recorder->recorder_num );
 31.1760 -    gmyth_string_list_append_string ( str_list, message );
 31.1761 -    gmyth_string_list_append_char_array ( str_list, "IS_RECORDING" );
 31.1762 +  g_string_printf(message, "%s %d", GMYTHTV_RECORDER_HEADER,
 31.1763 +				  recorder->recorder_num);
 31.1764 +  gmyth_string_list_append_string(str_list, message);
 31.1765 +  gmyth_string_list_append_char_array(str_list, "IS_RECORDING");
 31.1766  
 31.1767 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.1768 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.1769  
 31.1770 -    if ( str_list != NULL && gmyth_string_list_length ( str_list ) > 0 )
 31.1771 -    {
 31.1772 -        GString *str = NULL;
 31.1773 +  if (str_list != NULL && gmyth_string_list_length(str_list) > 0)
 31.1774 +	{
 31.1775 +	  GString *str = NULL;
 31.1776  
 31.1777 -        if ( ( str = gmyth_string_list_get_string ( str_list, 0 ) ) != NULL
 31.1778 -             && strcmp ( str->str, "bad" ) != 0 )
 31.1779 -        {
 31.1780 -            gint is_rec = gmyth_string_list_get_int ( str_list, 0 );
 31.1781 +	  if ((str = gmyth_string_list_get_string(str_list, 0)) != NULL
 31.1782 +		  && strcmp(str->str, "bad") != 0)
 31.1783 +		{
 31.1784 +		  gint is_rec = gmyth_string_list_get_int(str_list, 0);
 31.1785  
 31.1786 -            if ( is_rec != 0 )
 31.1787 -                ret = TRUE;
 31.1788 -            else
 31.1789 -                ret = FALSE;
 31.1790 -        }
 31.1791 -        g_string_free ( str, TRUE );
 31.1792 -    }
 31.1793 +		  if (is_rec != 0)
 31.1794 +			ret = TRUE;
 31.1795 +		  else
 31.1796 +			ret = FALSE;
 31.1797 +		}
 31.1798 +	  g_string_free(str, TRUE);
 31.1799 +	}
 31.1800  
 31.1801 -    gmyth_debug ( "%s, stream is %s being recorded!\n", ret ? "YES" : "NO",
 31.1802 -                  ret ? "" : "NOT" );
 31.1803 -    //g_static_mutex_unlock (&mutex);
 31.1804 +  gmyth_debug("%s, stream is %s being recorded!\n", ret ? "YES" : "NO",
 31.1805 +			  ret ? "" : "NOT");
 31.1806 + //g_static_mutex_unlock (&mutex);
 31.1807  
 31.1808 -    g_mutex_unlock ( recorder->mutex );
 31.1809 +  g_mutex_unlock(recorder->mutex);
 31.1810  
 31.1811 -    if ( str_list != NULL )
 31.1812 -        g_object_unref ( str_list );
 31.1813 +  if (str_list != NULL)
 31.1814 +	g_object_unref(str_list);
 31.1815  
 31.1816 -    g_string_free ( message, TRUE );
 31.1817 +  g_string_free(message, TRUE);
 31.1818  
 31.1819 -    return ret;
 31.1820 +  return ret;
 31.1821  
 31.1822  }
 31.1823  
 31.1824 @@ -1228,49 +1220,49 @@
 31.1825   * @return <code>true</code>, if the recording had been actually closed.
 31.1826   */
 31.1827  gboolean
 31.1828 -gmyth_recorder_finish_recording ( GMythRecorder * recorder )
 31.1829 +gmyth_recorder_finish_recording(GMythRecorder * recorder)
 31.1830  {
 31.1831 -    gboolean ret = TRUE;
 31.1832 +  gboolean ret = TRUE;
 31.1833  
 31.1834 -    g_return_val_if_fail ( recorder != NULL, FALSE );
 31.1835 +  g_return_val_if_fail(recorder != NULL, FALSE);
 31.1836  
 31.1837 -    GMythStringList *str_list = gmyth_string_list_new (  );
 31.1838 -    GString *message = g_string_new ( "" );
 31.1839 +  GMythStringList *str_list = gmyth_string_list_new();
 31.1840 +  GString *message = g_string_new("");
 31.1841  
 31.1842 -    g_string_printf ( message, "%s %d", GMYTHTV_RECORDER_HEADER,
 31.1843 -                      recorder->recorder_num );
 31.1844 -    gmyth_string_list_append_string ( str_list, message );
 31.1845 -    gmyth_string_list_append_char_array ( str_list, "FINISH_RECORDING" );
 31.1846 +  g_string_printf(message, "%s %d", GMYTHTV_RECORDER_HEADER,
 31.1847 +				  recorder->recorder_num);
 31.1848 +  gmyth_string_list_append_string(str_list, message);
 31.1849 +  gmyth_string_list_append_char_array(str_list, "FINISH_RECORDING");
 31.1850  
 31.1851 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.1852 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.1853  
 31.1854 -    if ( str_list != NULL && gmyth_string_list_length ( str_list ) > 0 )
 31.1855 -    {
 31.1856 -        GString *str = NULL;
 31.1857 +  if (str_list != NULL && gmyth_string_list_length(str_list) > 0)
 31.1858 +	{
 31.1859 +	  GString *str = NULL;
 31.1860  
 31.1861 -        if ( ( str = gmyth_string_list_get_string ( str_list, 0 ) ) != NULL &&
 31.1862 -             strcmp ( str->str, "ok" ) != 0 )
 31.1863 -        {
 31.1864 -            gint is_rec = gmyth_string_list_get_int ( str_list, 0 );
 31.1865 +	  if ((str = gmyth_string_list_get_string(str_list, 0)) != NULL &&
 31.1866 +		  strcmp(str->str, "ok") != 0)
 31.1867 +		{
 31.1868 +		  gint is_rec = gmyth_string_list_get_int(str_list, 0);
 31.1869  
 31.1870 -            if ( is_rec != 0 )
 31.1871 -                ret = TRUE;
 31.1872 -            else
 31.1873 -                ret = FALSE;
 31.1874 -        }
 31.1875 -        g_string_free ( str, TRUE );
 31.1876 -    }
 31.1877 +		  if (is_rec != 0)
 31.1878 +			ret = TRUE;
 31.1879 +		  else
 31.1880 +			ret = FALSE;
 31.1881 +		}
 31.1882 +	  g_string_free(str, TRUE);
 31.1883 +	}
 31.1884  
 31.1885 -    gmyth_debug ( "%s, stream is %s finished!\n", ret ? "YES" : "NO",
 31.1886 -                  ret ? "" : "NOT" );
 31.1887 -    //g_static_mutex_unlock (&mutex);
 31.1888 +  gmyth_debug("%s, stream is %s finished!\n", ret ? "YES" : "NO",
 31.1889 +			  ret ? "" : "NOT");
 31.1890 + //g_static_mutex_unlock (&mutex);
 31.1891  
 31.1892 -    if ( str_list != NULL )
 31.1893 -        g_object_unref ( str_list );
 31.1894 +  if (str_list != NULL)
 31.1895 +	g_object_unref(str_list);
 31.1896  
 31.1897 -    g_string_free ( message, TRUE );
 31.1898 +  g_string_free(message, TRUE);
 31.1899  
 31.1900 -    return ret;
 31.1901 +  return ret;
 31.1902  }
 31.1903  
 31.1904  
 31.1905 @@ -1282,48 +1274,48 @@
 31.1906   * @return <code>true</code>, if the recording had been actually stopped.
 31.1907   */
 31.1908  gboolean
 31.1909 -gmyth_recorder_stop_playing ( GMythRecorder * recorder )
 31.1910 +gmyth_recorder_stop_playing(GMythRecorder * recorder)
 31.1911  {
 31.1912 -    gboolean ret = TRUE;
 31.1913 +  gboolean ret = TRUE;
 31.1914  
 31.1915 -    g_return_val_if_fail ( recorder != NULL, FALSE );
 31.1916 +  g_return_val_if_fail(recorder != NULL, FALSE);
 31.1917  
 31.1918 -    GMythStringList *str_list = gmyth_string_list_new (  );
 31.1919 -    GString *message = g_string_new ( "" );
 31.1920 +  GMythStringList *str_list = gmyth_string_list_new();
 31.1921 +  GString *message = g_string_new("");
 31.1922  
 31.1923 -    g_string_printf ( message, "%s %d", GMYTHTV_RECORDER_HEADER,
 31.1924 -                      recorder->recorder_num );
 31.1925 -    gmyth_string_list_append_string ( str_list, message );
 31.1926 -    gmyth_string_list_append_char_array ( str_list, "STOP_PLAYING" );
 31.1927 +  g_string_printf(message, "%s %d", GMYTHTV_RECORDER_HEADER,
 31.1928 +				  recorder->recorder_num);
 31.1929 +  gmyth_string_list_append_string(str_list, message);
 31.1930 +  gmyth_string_list_append_char_array(str_list, "STOP_PLAYING");
 31.1931  
 31.1932 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.1933 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.1934  
 31.1935 -    if ( str_list != NULL && gmyth_string_list_length ( str_list ) > 0 )
 31.1936 -    {
 31.1937 -        GString *str = NULL;
 31.1938 +  if (str_list != NULL && gmyth_string_list_length(str_list) > 0)
 31.1939 +	{
 31.1940 +	  GString *str = NULL;
 31.1941  
 31.1942 -        if ( ( str = gmyth_string_list_get_string ( str_list, 0 ) ) != NULL &&
 31.1943 -             strcmp ( str->str, "ok" ) != 0 )
 31.1944 -        {
 31.1945 -            gint is_rec = gmyth_string_list_get_int ( str_list, 0 );
 31.1946 +	  if ((str = gmyth_string_list_get_string(str_list, 0)) != NULL &&
 31.1947 +		  strcmp(str->str, "ok") != 0)
 31.1948 +		{
 31.1949 +		  gint is_rec = gmyth_string_list_get_int(str_list, 0);
 31.1950  
 31.1951 -            if ( is_rec != 0 )
 31.1952 -                ret = TRUE;
 31.1953 -            else
 31.1954 -                ret = FALSE;
 31.1955 -        }
 31.1956 -        g_string_free ( str, TRUE );
 31.1957 -    }
 31.1958 +		  if (is_rec != 0)
 31.1959 +			ret = TRUE;
 31.1960 +		  else
 31.1961 +			ret = FALSE;
 31.1962 +		}
 31.1963 +	  g_string_free(str, TRUE);
 31.1964 +	}
 31.1965  
 31.1966 -    gmyth_debug ( "%s, stream is %s stopped!\n", ret ? "YES" : "NO",
 31.1967 -                  ret ? "" : "NOT" );
 31.1968 +  gmyth_debug("%s, stream is %s stopped!\n", ret ? "YES" : "NO",
 31.1969 +			  ret ? "" : "NOT");
 31.1970  
 31.1971 -    if ( str_list != NULL )
 31.1972 -        g_object_unref ( str_list );
 31.1973 +  if (str_list != NULL)
 31.1974 +	g_object_unref(str_list);
 31.1975  
 31.1976 -    g_string_free ( message, TRUE );
 31.1977 +  g_string_free(message, TRUE);
 31.1978  
 31.1979 -    return ret;
 31.1980 +  return ret;
 31.1981  }
 31.1982  
 31.1983  /**
 31.1984 @@ -1334,46 +1326,46 @@
 31.1985   * @return <code>true</code>, if the tuner had been freed.
 31.1986   */
 31.1987  gboolean
 31.1988 -gmyth_recorder_free_tuner ( GMythRecorder * recorder )
 31.1989 +gmyth_recorder_free_tuner(GMythRecorder * recorder)
 31.1990  {
 31.1991 -    gboolean ret = TRUE;
 31.1992 +  gboolean ret = TRUE;
 31.1993  
 31.1994 -    g_return_val_if_fail ( recorder != NULL, FALSE );
 31.1995 +  g_return_val_if_fail(recorder != NULL, FALSE);
 31.1996  
 31.1997 -    GMythStringList *str_list = gmyth_string_list_new (  );
 31.1998 -    GString *message = g_string_new ( "" );
 31.1999 +  GMythStringList *str_list = gmyth_string_list_new();
 31.2000 +  GString *message = g_string_new("");
 31.2001  
 31.2002 -    g_string_printf ( message, "%s %d", "FREE_TUNER", recorder->recorder_num );
 31.2003 -    gmyth_string_list_append_string ( str_list, message );
 31.2004 +  g_string_printf(message, "%s %d", "FREE_TUNER", recorder->recorder_num);
 31.2005 +  gmyth_string_list_append_string(str_list, message);
 31.2006  
 31.2007 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.2008 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.2009  
 31.2010 -    if ( str_list != NULL && gmyth_string_list_length ( str_list ) > 0 )
 31.2011 -    {
 31.2012 -        GString *str = NULL;
 31.2013 +  if (str_list != NULL && gmyth_string_list_length(str_list) > 0)
 31.2014 +	{
 31.2015 +	  GString *str = NULL;
 31.2016  
 31.2017 -        if ( ( str = gmyth_string_list_get_string ( str_list, 0 ) ) != NULL &&
 31.2018 -             g_ascii_strncasecmp ( str->str, "ok", 2 ) != 0 )
 31.2019 -        {
 31.2020 -            gint is_rec = gmyth_string_list_get_int ( str_list, 0 );
 31.2021 +	  if ((str = gmyth_string_list_get_string(str_list, 0)) != NULL &&
 31.2022 +		  g_ascii_strncasecmp(str->str, "ok", 2) != 0)
 31.2023 +		{
 31.2024 +		  gint is_rec = gmyth_string_list_get_int(str_list, 0);
 31.2025  
 31.2026 -            if ( is_rec != 0 )
 31.2027 -                ret = TRUE;
 31.2028 -            else
 31.2029 -                ret = FALSE;
 31.2030 -        }
 31.2031 -        g_string_free ( str, TRUE );
 31.2032 -    }
 31.2033 +		  if (is_rec != 0)
 31.2034 +			ret = TRUE;
 31.2035 +		  else
 31.2036 +			ret = FALSE;
 31.2037 +		}
 31.2038 +	  g_string_free(str, TRUE);
 31.2039 +	}
 31.2040  
 31.2041 -    gmyth_debug ( "%s, tuner is %s freed!\n", ret ? "YES" : "NO",
 31.2042 -                  ret ? "" : "NOT" );
 31.2043 +  gmyth_debug("%s, tuner is %s freed!\n", ret ? "YES" : "NO",
 31.2044 +			  ret ? "" : "NOT");
 31.2045  
 31.2046 -    if ( str_list != NULL )
 31.2047 -        g_object_unref ( str_list );
 31.2048 +  if (str_list != NULL)
 31.2049 +	g_object_unref(str_list);
 31.2050  
 31.2051 -    g_string_free ( message, TRUE );
 31.2052 +  g_string_free(message, TRUE);
 31.2053  
 31.2054 -    return ret;
 31.2055 +  return ret;
 31.2056  }
 31.2057  
 31.2058  /**
 31.2059 @@ -1385,43 +1377,43 @@
 31.2060   * @return The framerate (double value) of the current video.
 31.2061   */
 31.2062  gdouble
 31.2063 -gmyth_recorder_get_framerate ( GMythRecorder * recorder )
 31.2064 +gmyth_recorder_get_framerate(GMythRecorder * recorder)
 31.2065  {
 31.2066 -    gdouble fr = 0.0f;
 31.2067 -    GString *query = g_string_new ( GMYTHTV_RECORDER_HEADER );
 31.2068 +  gdouble fr = 0.0f;
 31.2069 +  GString *query = g_string_new(GMYTHTV_RECORDER_HEADER);
 31.2070  
 31.2071 -    GMythStringList *str_list = gmyth_string_list_new (  );
 31.2072 +  GMythStringList *str_list = gmyth_string_list_new();
 31.2073  
 31.2074 -    g_mutex_lock ( recorder->mutex );
 31.2075 +  g_mutex_lock(recorder->mutex);
 31.2076  
 31.2077 -    g_string_append_printf ( query, " %d", recorder->recorder_num );
 31.2078 +  g_string_append_printf(query, " %d", recorder->recorder_num);
 31.2079  
 31.2080 -    gmyth_string_list_append_string ( str_list, query );
 31.2081 -    gmyth_string_list_append_char_array ( str_list, "GET_FRAMERATE" );
 31.2082 +  gmyth_string_list_append_string(str_list, query);
 31.2083 +  gmyth_string_list_append_char_array(str_list, "GET_FRAMERATE");
 31.2084  
 31.2085 -    gmyth_socket_sendreceive_stringlist ( recorder->myth_socket, str_list );
 31.2086 +  gmyth_socket_sendreceive_stringlist(recorder->myth_socket, str_list);
 31.2087  
 31.2088 -    if ( str_list != NULL && gmyth_string_list_length ( str_list ) > 0 )
 31.2089 -    {
 31.2090 -        GString *str = NULL;
 31.2091 +  if (str_list != NULL && gmyth_string_list_length(str_list) > 0)
 31.2092 +	{
 31.2093 +	  GString *str = NULL;
 31.2094  
 31.2095 -        if ( ( str = gmyth_string_list_get_string ( str_list, 0 ) ) != NULL
 31.2096 -             && strstr ( str->str, "bad" ) == NULL )
 31.2097 -            fr = g_ascii_strtod ( str->str, NULL );
 31.2098 +	  if ((str = gmyth_string_list_get_string(str_list, 0)) != NULL
 31.2099 +		  && strstr(str->str, "bad") == NULL)
 31.2100 +		fr = g_ascii_strtod(str->str, NULL);
 31.2101  
 31.2102 -        g_string_free ( str, TRUE );
 31.2103 -    }
 31.2104 +	  g_string_free(str, TRUE);
 31.2105 +	}
 31.2106  #ifndef GMYTHTV_ENABLE_DEBUG
 31.2107 -    gmyth_debug ( "[%s] Got file position = %f\n", __FUNCTION__, fr );
 31.2108 +  gmyth_debug("[%s] Got file position = %f\n", __FUNCTION__, fr);
 31.2109  #endif
 31.2110  
 31.2111 -    g_mutex_unlock ( recorder->mutex );
 31.2112 +  g_mutex_unlock(recorder->mutex);
 31.2113  
 31.2114 -    if ( str_list != NULL )
 31.2115 -        g_object_unref ( str_list );
 31.2116 +  if (str_list != NULL)
 31.2117 +	g_object_unref(str_list);
 31.2118  
 31.2119 -    g_string_free ( query, TRUE );
 31.2120 +  g_string_free(query, TRUE);
 31.2121  
 31.2122 -    return fr;
 31.2123 +  return fr;
 31.2124  
 31.2125  }
    32.1 --- a/gmyth/src/gmyth_recorder.h	Wed Jun 13 18:18:42 2007 +0100
    32.2 +++ b/gmyth/src/gmyth_recorder.h	Thu Jun 14 18:19:52 2007 +0100
    32.3 @@ -53,106 +53,104 @@
    32.4  typedef struct _GMythRecorderClass GMythRecorderClass;
    32.5  
    32.6  struct _GMythRecorderClass
    32.7 -    {
    32.8 -        GObjectClass parent_class;
    32.9 +{
   32.10 +  GObjectClass parent_class;
   32.11  
   32.12 -        /* callbacks */
   32.13 -        /* no one for now */
   32.14 -    };
   32.15 + /* callbacks */
   32.16 + /* no one for now */
   32.17 +};
   32.18  
   32.19  struct _GMythRecorder
   32.20 -    {
   32.21 -        GObject parent;
   32.22 +{
   32.23 +  GObject parent;
   32.24  
   32.25 -        /* socket descriptor */
   32.26 -        GMythSocket *myth_socket;
   32.27 + /* socket descriptor */
   32.28 +  GMythSocket *myth_socket;
   32.29  
   32.30 -        gint recorder_num;
   32.31 -        GString *hostname;
   32.32 -        gint port;
   32.33 +  gint recorder_num;
   32.34 +  GString *hostname;
   32.35 +  gint port;
   32.36  
   32.37 -        GList *progs_info_list;
   32.38 +  GList *progs_info_list;
   32.39  
   32.40 -        GMutex *mutex;
   32.41 -    };
   32.42 +  GMutex *mutex;
   32.43 +};
   32.44  
   32.45  typedef enum _GMythRecorderChannelChangeDirection
   32.46 -    {
   32.47 -        CHANNEL_DIRECTION_UP = 0,
   32.48 -        CHANNEL_DIRECTION_DOWN,
   32.49 -        CHANNEL_DIRECTION_FAVORITE,
   32.50 -        CHANNEL_DIRECTION_SAME
   32.51 -    } GMythRecorderChannelChangeDirection;
   32.52 +{
   32.53 +  CHANNEL_DIRECTION_UP = 0,
   32.54 +  CHANNEL_DIRECTION_DOWN,
   32.55 +  CHANNEL_DIRECTION_FAVORITE,
   32.56 +  CHANNEL_DIRECTION_SAME
   32.57 +} GMythRecorderChannelChangeDirection;
   32.58  
   32.59  typedef enum _GMythRecorderBrowseDirection
   32.60 -    {
   32.61 -        BROWSE_DIRECTION_SAME = 0,  /* Stay in the same place */
   32.62 -        BROWSE_DIRECTION_UP,    /* Move up one slot (down one channel) */
   32.63 -        BROWSE_DIRECTION_DOWN,  /* Move down one slot (up one channel) */
   32.64 -        BROWSE_DIRECTION_LEFT,  /* Move left one slot (down one time slot) */
   32.65 -        BROWSE_DIRECTION_RIGHT, /* Move right one slot (up one time slot) */
   32.66 -        BROWSE_DIRECTION_FAVORITE   /* Move to the next favorite slot */
   32.67 -    } GMythRecorderBrowseDirection;
   32.68 +{
   32.69 +  BROWSE_DIRECTION_SAME = 0,	/* Stay in the same place */
   32.70 +  BROWSE_DIRECTION_UP,			/* Move up one slot (down one channel) */
   32.71 +  BROWSE_DIRECTION_DOWN,		/* Move down one slot (up one channel) */
   32.72 +  BROWSE_DIRECTION_LEFT,		/* Move left one slot (down one time slot) */
   32.73 +  BROWSE_DIRECTION_RIGHT,		/* Move right one slot (up one time slot) */
   32.74 +  BROWSE_DIRECTION_FAVORITE		/* Move to the next favorite slot */
   32.75 +} GMythRecorderBrowseDirection;
   32.76  
   32.77 -GType gmyth_recorder_get_type ( void );
   32.78 +GType gmyth_recorder_get_type(void);
   32.79  
   32.80 -GMythRecorder *gmyth_recorder_new ( int num, GString * hostname, gshort port );
   32.81 +GMythRecorder *gmyth_recorder_new(int num, GString * hostname, gshort port);
   32.82  
   32.83 -void gmyth_recorder_close ( GMythRecorder * recorder );
   32.84 +void gmyth_recorder_close(GMythRecorder * recorder);
   32.85  
   32.86 -gboolean gmyth_recorder_setup ( GMythRecorder * recorder );
   32.87 -gboolean gmyth_recorder_spawntv ( GMythRecorder * recorder,
   32.88 -                                  GString * tvchain_id );
   32.89 +gboolean gmyth_recorder_setup(GMythRecorder * recorder);
   32.90 +gboolean gmyth_recorder_spawntv(GMythRecorder * recorder,
   32.91 +								GString * tvchain_id);
   32.92  
   32.93 -gboolean gmyth_recorder_spawntv_no_tvchain ( GMythRecorder * recorder );
   32.94 +gboolean gmyth_recorder_spawntv_no_tvchain(GMythRecorder * recorder);
   32.95  
   32.96 -gboolean gmyth_recorder_stop_livetv ( GMythRecorder * recorder );
   32.97 +gboolean gmyth_recorder_stop_livetv(GMythRecorder * recorder);
   32.98  
   32.99 -gboolean gmyth_recorder_send_frontend_ready_command ( GMythRecorder *
  32.100 -                                                      recorder );
  32.101 +gboolean gmyth_recorder_send_frontend_ready_command(GMythRecorder * recorder);
  32.102  
  32.103 -gboolean gmyth_recorder_check_channel ( GMythRecorder * recorder,
  32.104 -                                        gint channel );
  32.105 +gboolean gmyth_recorder_check_channel(GMythRecorder * recorder, gint channel);
  32.106  
  32.107 -gboolean gmyth_recorder_check_channel_name ( GMythRecorder * recorder,
  32.108 -                                             gchar * channel );
  32.109 +gboolean gmyth_recorder_check_channel_name(GMythRecorder * recorder,
  32.110 +										   gchar * channel);
  32.111  
  32.112 -gboolean gmyth_recorder_set_channel ( GMythRecorder * recorder, gint channel );
  32.113 +gboolean gmyth_recorder_set_channel(GMythRecorder * recorder, gint channel);
  32.114  
  32.115 -gboolean gmyth_recorder_set_channel_name ( GMythRecorder * recorder,
  32.116 -                                           const gchar * channel );
  32.117 +gboolean gmyth_recorder_set_channel_name(GMythRecorder * recorder,
  32.118 +										 const gchar * channel);
  32.119  
  32.120 -gboolean gmyth_recorder_change_channel ( GMythRecorder * recorder,
  32.121 -                                         const
  32.122 -                                         GMythRecorderChannelChangeDirection
  32.123 -                                         direction );
  32.124 +gboolean gmyth_recorder_change_channel(GMythRecorder * recorder,
  32.125 +									   const
  32.126 +									   GMythRecorderChannelChangeDirection
  32.127 +									   direction);
  32.128  
  32.129 -GList *gmyth_recorder_get_channel_list ( GMythRecorder * recorder );
  32.130 +GList *gmyth_recorder_get_channel_list(GMythRecorder * recorder);
  32.131  
  32.132 -gboolean gmyth_recorder_pause_recording ( GMythRecorder * recorder );
  32.133 +gboolean gmyth_recorder_pause_recording(GMythRecorder * recorder);
  32.134  
  32.135 -GMythProgramInfo *gmyth_recorder_get_current_program_info ( GMythRecorder *
  32.136 -                                                            recorder );
  32.137 +GMythProgramInfo *gmyth_recorder_get_current_program_info(GMythRecorder *
  32.138 +														  recorder);
  32.139  
  32.140 -GMythProgramInfo *gmyth_recorder_get_next_program_info ( GMythRecorder *
  32.141 -                                                         recorder,
  32.142 -                                                         const
  32.143 -                                                         GMythRecorderBrowseDirection
  32.144 -                                                         direction );
  32.145 +GMythProgramInfo *gmyth_recorder_get_next_program_info(GMythRecorder *
  32.146 +													   recorder,
  32.147 +													   const
  32.148 +													   GMythRecorderBrowseDirection
  32.149 +													   direction);
  32.150  
  32.151 -GMythRecorder *gmyth_recorder_get_recorder_from_num ( gint rec_id );
  32.152 +GMythRecorder *gmyth_recorder_get_recorder_from_num(gint rec_id);
  32.153  
  32.154 -gint64 gmyth_recorder_get_file_position ( GMythRecorder * recorder );
  32.155 +gint64 gmyth_recorder_get_file_position(GMythRecorder * recorder);
  32.156  
  32.157 -gboolean gmyth_recorder_is_recording ( GMythRecorder * recorder );
  32.158 +gboolean gmyth_recorder_is_recording(GMythRecorder * recorder);
  32.159  
  32.160 -gboolean gmyth_recorder_finish_recording ( GMythRecorder * recorder );
  32.161 +gboolean gmyth_recorder_finish_recording(GMythRecorder * recorder);
  32.162  
  32.163 -gboolean gmyth_recorder_stop_playing ( GMythRecorder * recorder );
  32.164 +gboolean gmyth_recorder_stop_playing(GMythRecorder * recorder);
  32.165  
  32.166 -gboolean gmyth_recorder_free_tuner ( GMythRecorder * recorder );
  32.167 +gboolean gmyth_recorder_free_tuner(GMythRecorder * recorder);
  32.168  
  32.169 -gdouble gmyth_recorder_get_framerate ( GMythRecorder * recorder );
  32.170 +gdouble gmyth_recorder_get_framerate(GMythRecorder * recorder);
  32.171  
  32.172  G_END_DECLS
  32.173  #endif /* __GMYTH_REMOTE_ENCODER_H__ */
    33.1 --- a/gmyth/src/gmyth_recprofile.c	Wed Jun 13 18:18:42 2007 +0100
    33.2 +++ b/gmyth/src/gmyth_recprofile.c	Thu Jun 14 18:19:52 2007 +0100
    33.3 @@ -37,54 +37,54 @@
    33.4  #include "gmyth_debug.h"
    33.5  #include "gmyth_http.h"
    33.6  
    33.7 -static void gmyth_recprofile_class_init ( GMythRecProfileClass * klass );
    33.8 -static void gmyth_recprofile_init ( GMythRecProfile * object );
    33.9 +static void gmyth_recprofile_class_init(GMythRecProfileClass * klass);
   33.10 +static void gmyth_recprofile_init(GMythRecProfile * object);
   33.11  
   33.12 -static void gmyth_recprofile_dispose ( GObject * object );
   33.13 -static void gmyth_recprofile_finalize ( GObject * object );
   33.14 +static void gmyth_recprofile_dispose(GObject * object);
   33.15 +static void gmyth_recprofile_finalize(GObject * object);
   33.16  
   33.17 -G_DEFINE_TYPE ( GMythRecProfile, gmyth_recprofile, G_TYPE_OBJECT )
   33.18 -     static void gmyth_recprofile_class_init ( GMythRecProfileClass * klass )
   33.19 +G_DEFINE_TYPE(GMythRecProfile, gmyth_recprofile, G_TYPE_OBJECT)
   33.20 +	 static void gmyth_recprofile_class_init(GMythRecProfileClass * klass)
   33.21  {
   33.22 -    GObjectClass *gobject_class = G_OBJECT_CLASS ( klass );
   33.23 +  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
   33.24  
   33.25 -    gobject_class->dispose = gmyth_recprofile_dispose;
   33.26 -    gobject_class->finalize = gmyth_recprofile_finalize;
   33.27 +  gobject_class->dispose = gmyth_recprofile_dispose;
   33.28 +  gobject_class->finalize = gmyth_recprofile_finalize;
   33.29  }
   33.30  
   33.31  static void
   33.32 -gmyth_recprofile_init ( GMythRecProfile * recprofile )
   33.33 +gmyth_recprofile_init(GMythRecProfile * recprofile)
   33.34  {
   33.35  }
   33.36  
   33.37  static void
   33.38 -gmyth_recprofile_dispose ( GObject * object )
   33.39 +gmyth_recprofile_dispose(GObject * object)
   33.40  {
   33.41 -    GMythRecProfile *recprofile = GMYTH_RECPROFILE ( object );
   33.42 +  GMythRecProfile *recprofile = GMYTH_RECPROFILE(object);
   33.43  
   33.44 -    if ( recprofile->name )
   33.45 -        g_free ( recprofile->name );
   33.46 +  if (recprofile->name)
   33.47 +	g_free(recprofile->name);
   33.48  
   33.49 -    if ( recprofile->group )
   33.50 -        g_free ( recprofile->group );
   33.51 +  if (recprofile->group)
   33.52 +	g_free(recprofile->group);
   33.53  
   33.54 -    if ( recprofile->vcodec )
   33.55 -        g_free ( recprofile->vcodec );
   33.56 +  if (recprofile->vcodec)
   33.57 +	g_free(recprofile->vcodec);
   33.58  
   33.59 -    if ( recprofile->acodec )
   33.60 -        g_free ( recprofile->acodec );
   33.61 +  if (recprofile->acodec)
   33.62 +	g_free(recprofile->acodec);
   33.63  
   33.64 -    if ( recprofile->options )
   33.65 -        g_free ( recprofile->options );
   33.66 +  if (recprofile->options)
   33.67 +	g_free(recprofile->options);
   33.68  
   33.69 -    G_OBJECT_CLASS ( gmyth_recprofile_parent_class )->dispose ( object );
   33.70 +  G_OBJECT_CLASS(gmyth_recprofile_parent_class)->dispose(object);
   33.71  }
   33.72  
   33.73  static void
   33.74 -gmyth_recprofile_finalize ( GObject * object )
   33.75 +gmyth_recprofile_finalize(GObject * object)
   33.76  {
   33.77 -    g_signal_handlers_destroy ( object );
   33.78 -    G_OBJECT_CLASS ( gmyth_recprofile_parent_class )->finalize ( object );
   33.79 +  g_signal_handlers_destroy(object);
   33.80 +  G_OBJECT_CLASS(gmyth_recprofile_parent_class)->finalize(object);
   33.81  }
   33.82  
   33.83  /**
   33.84 @@ -93,19 +93,19 @@
   33.85   * @return a new instance of GMythRecProfile.
   33.86   **/
   33.87  GMythRecProfile *
   33.88 -gmyth_recprofile_new ( void )
   33.89 +gmyth_recprofile_new(void)
   33.90  {
   33.91 -    GMythRecProfile *recprofile = GMYTH_RECPROFILE
   33.92 -        ( g_object_new ( GMYTH_RECPROFILE_TYPE, NULL ) );
   33.93 +  GMythRecProfile *recprofile = GMYTH_RECPROFILE
   33.94 +	(g_object_new(GMYTH_RECPROFILE_TYPE, NULL));
   33.95  
   33.96 -    recprofile->id = 0;
   33.97 -    recprofile->name = NULL;
   33.98 -    recprofile->group = NULL;
   33.99 -    recprofile->vcodec = NULL;
  33.100 -    recprofile->acodec = NULL;
  33.101 -    recprofile->options = NULL;
  33.102 +  recprofile->id = 0;
  33.103 +  recprofile->name = NULL;
  33.104 +  recprofile->group = NULL;
  33.105 +  recprofile->vcodec = NULL;
  33.106 +  recprofile->acodec = NULL;
  33.107 +  recprofile->options = NULL;
  33.108  
  33.109 -    return recprofile;
  33.110 +  return recprofile;
  33.111  }
  33.112  
  33.113  
  33.114 @@ -118,9 +118,9 @@
  33.115   *
  33.116   **/
  33.117  GSList *
  33.118 -gmyth_recprofile_get_profile_list ( GMythBackendInfo * backend_info )
  33.119 +gmyth_recprofile_get_profile_list(GMythBackendInfo * backend_info)
  33.120  {
  33.121 -    return gmyth_http_retrieve_rec_profiles ( backend_info, "Transcoders" );
  33.122 +  return gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
  33.123  }
  33.124  
  33.125  /**
  33.126 @@ -133,10 +133,10 @@
  33.127   *
  33.128   **/
  33.129  gint
  33.130 -gmyth_recprofile_create_profile ( GMythBackendInfo * backend_info,
  33.131 -                                  GMythRecProfile * profile )
  33.132 +gmyth_recprofile_create_profile(GMythBackendInfo * backend_info,
  33.133 +								GMythRecProfile * profile)
  33.134  {
  33.135 -    return gmyth_http_create_rec_profile ( backend_info, profile );
  33.136 +  return gmyth_http_create_rec_profile(backend_info, profile);
  33.137  }
  33.138  
  33.139  /**
  33.140 @@ -149,9 +149,9 @@
  33.141   *
  33.142   **/
  33.143  gint
  33.144 -gmyth_recprofile_del_profile_list ( GMythBackendInfo * backend_info, gint id )
  33.145 +gmyth_recprofile_del_profile_list(GMythBackendInfo * backend_info, gint id)
  33.146  {
  33.147 -    return gmyth_http_del_rec_profile ( backend_info, id );
  33.148 +  return gmyth_http_del_rec_profile(backend_info, id);
  33.149  }
  33.150  
  33.151  /**
  33.152 @@ -164,10 +164,10 @@
  33.153   *
  33.154   **/
  33.155  gint
  33.156 -gmyth_recprofile_set_id ( GMythRecProfile * rec, gint id )
  33.157 +gmyth_recprofile_set_id(GMythRecProfile * rec, gint id)
  33.158  {
  33.159 -    rec->id = id;
  33.160 -    return 0;
  33.161 +  rec->id = id;
  33.162 +  return 0;
  33.163  }
  33.164  
  33.165  /**
  33.166 @@ -181,27 +181,27 @@
  33.167   *
  33.168   **/
  33.169  gint
  33.170 -gmyth_recprofile_set ( GMythRecProfile * rec, gchar * member, gchar * value )
  33.171 +gmyth_recprofile_set(GMythRecProfile * rec, gchar * member, gchar * value)
  33.172  {
  33.173 -    int ret = 0;
  33.174 +  int ret = 0;
  33.175  
  33.176 -    if ( value != NULL )
  33.177 -    {
  33.178 -        if ( g_ascii_strcasecmp ( member, "name" ) == 0 )
  33.179 -            rec->name = g_strndup ( value, strlen ( value ) );
  33.180 -        else if ( g_ascii_strcasecmp ( member, "group" ) == 0 )
  33.181 -            rec->group = g_strndup ( value, strlen ( value ) );
  33.182 -        else if ( g_ascii_strcasecmp ( member, "vcodec" ) == 0 )
  33.183 -            rec->vcodec = g_strndup ( value, strlen ( value ) );
  33.184 -        else if ( g_ascii_strcasecmp ( member, "acodec" ) == 0 )
  33.185 -            rec->acodec = g_strndup ( value, strlen ( value ) );
  33.186 -        else
  33.187 -            ret = -1;
  33.188 -    }
  33.189 -    else
  33.190 -        ret = -1;
  33.191 +  if (value != NULL)
  33.192 +	{
  33.193 +	  if (g_ascii_strcasecmp(member, "name") == 0)
  33.194 +		rec->name = g_strndup(value, strlen(value));
  33.195 +	  else if (g_ascii_strcasecmp(member, "group") == 0)
  33.196 +		rec->group = g_strndup(value, strlen(value));
  33.197 +	  else if (g_ascii_strcasecmp(member, "vcodec") == 0)
  33.198 +		rec->vcodec = g_strndup(value, strlen(value));
  33.199 +	  else if (g_ascii_strcasecmp(member, "acodec") == 0)
  33.200 +		rec->acodec = g_strndup(value, strlen(value));
  33.201 +	  else
  33.202 +		ret = -1;
  33.203 +	}
  33.204 +  else
  33.205 +	ret = -1;
  33.206  
  33.207 -    return ret;
  33.208 +  return ret;
  33.209  }
  33.210  
  33.211  /**
  33.212 @@ -214,9 +214,9 @@
  33.213   *
  33.214   **/
  33.215  gint
  33.216 -gmyth_recprofile_set_name ( GMythRecProfile * rec, gchar * name )
  33.217 +gmyth_recprofile_set_name(GMythRecProfile * rec, gchar * name)
  33.218  {
  33.219 -    return gmyth_recprofile_set ( rec, "name", name );
  33.220 +  return gmyth_recprofile_set(rec, "name", name);
  33.221  }
  33.222  
  33.223  /**
  33.224 @@ -229,9 +229,9 @@
  33.225   *
  33.226   **/
  33.227  gint
  33.228 -gmyth_recprofile_set_group ( GMythRecProfile * rec, gchar * group )
  33.229 +gmyth_recprofile_set_group(GMythRecProfile * rec, gchar * group)
  33.230  {
  33.231 -    return gmyth_recprofile_set ( rec, "group", group );
  33.232 +  return gmyth_recprofile_set(rec, "group", group);
  33.233  }
  33.234  
  33.235  /**
  33.236 @@ -244,9 +244,9 @@
  33.237   *
  33.238   **/
  33.239  gint
  33.240 -gmyth_recprofile_set_vcodec ( GMythRecProfile * rec, gchar * vcodec )
  33.241 +gmyth_recprofile_set_vcodec(GMythRecProfile * rec, gchar * vcodec)
  33.242  {
  33.243 -    return gmyth_recprofile_set ( rec, "vcodec", vcodec );
  33.244 +  return gmyth_recprofile_set(rec, "vcodec", vcodec);
  33.245  }
  33.246  
  33.247  /**
  33.248 @@ -259,7 +259,7 @@
  33.249   *
  33.250   **/
  33.251  gint
  33.252 -gmyth_recprofile_set_acodec ( GMythRecProfile * rec, gchar * acodec )
  33.253 +gmyth_recprofile_set_acodec(GMythRecProfile * rec, gchar * acodec)
  33.254  {
  33.255 -    return gmyth_recprofile_set ( rec, "acodec", acodec );
  33.256 +  return gmyth_recprofile_set(rec, "acodec", acodec);
  33.257  }
    34.1 --- a/gmyth/src/gmyth_recprofile.h	Wed Jun 13 18:18:42 2007 +0100
    34.2 +++ b/gmyth/src/gmyth_recprofile.h	Thu Jun 14 18:19:52 2007 +0100
    34.3 @@ -46,73 +46,73 @@
    34.4  typedef struct _GMythRecProfileClass GMythRecProfileClass;
    34.5  
    34.6  struct _GMythRecProfileClass
    34.7 -    {
    34.8 -        GObjectClass parent_class;
    34.9 -        gint teste;
   34.10 -        /* callbacks */
   34.11 -    };
   34.12 +{
   34.13 +  GObjectClass parent_class;
   34.14 +  gint teste;
   34.15 + /* callbacks */
   34.16 +};
   34.17  
   34.18  struct _GMythRecProfile
   34.19 -    {
   34.20 -        gint id;
   34.21 -        gchar *name;
   34.22 -        gchar *group;
   34.23 -        gchar *vcodec;
   34.24 -        gchar *acodec;
   34.25 -        Options *options;
   34.26 -    };
   34.27 +{
   34.28 +  gint id;
   34.29 +  gchar *name;
   34.30 +  gchar *group;
   34.31 +  gchar *vcodec;
   34.32 +  gchar *acodec;
   34.33 +  Options *options;
   34.34 +};
   34.35  
   34.36  struct _Options
   34.37 -    {
   34.38 -        gint transcodelossless;
   34.39 -        gint transcoderesize;
   34.40 -        gint width;
   34.41 -        gint height;
   34.42 -        gint rtjpegquality;
   34.43 -        gint rtjpeglumafilter;
   34.44 -        gint rtjpegchromafilter;
   34.45 -        gint mpeg4bitrate;
   34.46 -        gint mpeg4maxquality;
   34.47 -        gint mpeg4minquality;
   34.48 -        gint mpeg4qualdiff;
   34.49 -        gint mpeg4scalebitrate;
   34.50 -        gint mpeg4optionvhq;
   34.51 -        gint mpeg4option4mv;
   34.52 -        gint mpeg4optionidct;
   34.53 -        gint mpeg4optionime;
   34.54 -        gint hardwaremjpegquality;
   34.55 -        gint hardwaremjpeghdecimation;
   34.56 -        gint hardwaremjpegvdecimation;
   34.57 -        gchar *mpeg2streamtype;
   34.58 -        gchar *mpeg2aspectratio;
   34.59 -        gint mpeg2bitrate;
   34.60 -        gint mpeg2maxbitrate;
   34.61 -        gint samplerate;
   34.62 -        gint mp3quality;
   34.63 -        gint volume;
   34.64 -        gchar *mpeg2audtype;
   34.65 -        gint mpeg2audbitratel1;
   34.66 -        gint mpeg2audbitratel2;
   34.67 -        gint mpeg2audvolume;
   34.68 -    };
   34.69 +{
   34.70 +  gint transcodelossless;
   34.71 +  gint transcoderesize;
   34.72 +  gint width;
   34.73 +  gint height;
   34.74 +  gint rtjpegquality;
   34.75 +  gint rtjpeglumafilter;
   34.76 +  gint rtjpegchromafilter;
   34.77 +  gint mpeg4bitrate;
   34.78 +  gint mpeg4maxquality;
   34.79 +  gint mpeg4minquality;
   34.80 +  gint mpeg4qualdiff;
   34.81 +  gint mpeg4scalebitrate;
   34.82 +  gint mpeg4optionvhq;
   34.83 +  gint mpeg4option4mv;
   34.84 +  gint mpeg4optionidct;
   34.85 +  gint mpeg4optionime;
   34.86 +  gint hardwaremjpegquality;
   34.87 +  gint hardwaremjpeghdecimation;
   34.88 +  gint hardwaremjpegvdecimation;
   34.89 +  gchar *mpeg2streamtype;
   34.90 +  gchar *mpeg2aspectratio;
   34.91 +  gint mpeg2bitrate;
   34.92 +  gint mpeg2maxbitrate;
   34.93 +  gint samplerate;
   34.94 +  gint mp3quality;
   34.95 +  gint volume;
   34.96 +  gchar *mpeg2audtype;
   34.97 +  gint mpeg2audbitratel1;
   34.98 +  gint mpeg2audbitratel2;
   34.99 +  gint mpeg2audvolume;
  34.100 +};
  34.101  
  34.102 -GType gmyth_recprofile_type ( void );
  34.103 +GType gmyth_recprofile_type(void);
  34.104  
  34.105 -GMythRecProfile *gmyth_recprofile_new ( void );
  34.106 +GMythRecProfile *gmyth_recprofile_new(void);
  34.107  
  34.108 -GSList *gmyth_recprofile_get_profile_list ( GMythBackendInfo * backend_info );
  34.109 +GSList *gmyth_recprofile_get_profile_list(GMythBackendInfo * backend_info);
  34.110  
  34.111 -gint gmyth_recprofile_create_profile ( GMythBackendInfo * backend_info,
  34.112 -                                       GMythRecProfile * profile );
  34.113 +gint gmyth_recprofile_create_profile(GMythBackendInfo * backend_info,
  34.114 +									 GMythRecProfile * profile);
  34.115  
  34.116 -gint gmyth_recprofile_del_profile_list ( GMythBackendInfo * backend_info,
  34.117 -                                         gint id );
  34.118 +gint gmyth_recprofile_del_profile_list(GMythBackendInfo * backend_info,
  34.119 +									   gint id);
  34.120  
  34.121 -gint gmyth_recprofile_set_acodec ( GMythRecProfile * rec, gchar * acodec );
  34.122 -gint gmyth_recprofile_set_vcodec ( GMythRecProfile * rec, gchar * vcodec );
  34.123 -gint gmyth_recprofile_set_group ( GMythRecProfile * rec, gchar * group );
  34.124 -gint gmyth_recprofile_set_name ( GMythRecProfile * rec, gchar * name );
  34.125 -gint gmyth_recprofile_set_id ( GMythRecProfile * rec, gint id );
  34.126 +gint gmyth_recprofile_set_acodec(GMythRecProfile * rec, gchar * acodec);
  34.127 +gint gmyth_recprofile_set_vcodec(GMythRecProfile * rec, gchar * vcodec);
  34.128 +gint gmyth_recprofile_set_group(GMythRecProfile * rec, gchar * group);
  34.129 +gint gmyth_recprofile_set_name(GMythRecProfile * rec, gchar * name);
  34.130 +gint gmyth_recprofile_set_id(GMythRecProfile * rec, gint id);
  34.131  
  34.132  G_END_DECLS
  34.133  #endif /*_GMYTH_RECPROFILE_H*/
    35.1 --- a/gmyth/src/gmyth_remote_util.c	Wed Jun 13 18:18:42 2007 +0100
    35.2 +++ b/gmyth/src/gmyth_remote_util.c	Thu Jun 14 18:19:52 2007 +0100
    35.3 @@ -44,45 +44,44 @@
    35.4   * @return the remote encoder instance available, or NULL if any error happens.
    35.5   */
    35.6  GMythRecorder *
    35.7 -remote_request_next_free_recorder ( GMythSocket * socket, gint curr )
    35.8 +remote_request_next_free_recorder(GMythSocket * socket, gint curr)
    35.9  {
   35.10 -    GMythRecorder *recorder = NULL;
   35.11 -    GString *hostname;
   35.12 -    gint num, port;
   35.13 +  GMythRecorder *recorder = NULL;
   35.14 +  GString *hostname;
   35.15 +  gint num, port;
   35.16  
   35.17 -    GMythStringList *strlist = gmyth_string_list_new (  );
   35.18 +  GMythStringList *strlist = gmyth_string_list_new();
   35.19  
   35.20 -    gmyth_debug ( "[%s] Request next free recorder in the backend",
   35.21 -                  __FUNCTION__ );
   35.22 +  gmyth_debug("[%s] Request next free recorder in the backend", __FUNCTION__);
   35.23  
   35.24 -    gmyth_string_list_append_char_array ( strlist, "GET_NEXT_FREE_RECORDER" );
   35.25 -    gmyth_string_list_append_int ( strlist, curr );
   35.26 +  gmyth_string_list_append_char_array(strlist, "GET_NEXT_FREE_RECORDER");
   35.27 +  gmyth_string_list_append_int(strlist, curr);
   35.28  
   35.29 -    if ( !gmyth_socket_sendreceive_stringlist ( socket, strlist ) )
   35.30 -    {
   35.31 -        g_warning ( "GET_NEXT_FREE_RECORDER request error!\n" );
   35.32 -        return NULL;
   35.33 -    }
   35.34 +  if (!gmyth_socket_sendreceive_stringlist(socket, strlist))
   35.35 +	{
   35.36 +	  g_warning("GET_NEXT_FREE_RECORDER request error!\n");
   35.37 +	  return NULL;
   35.38 +	}
   35.39  
   35.40 -    num = gmyth_string_list_get_int ( strlist, 0 );
   35.41 -    hostname = gmyth_string_list_get_string ( strlist, 1 );
   35.42 -    port = gmyth_string_list_get_int ( strlist, 2 );
   35.43 +  num = gmyth_string_list_get_int(strlist, 0);
   35.44 +  hostname = gmyth_string_list_get_string(strlist, 1);
   35.45 +  port = gmyth_string_list_get_int(strlist, 2);
   35.46  
   35.47 -    if ( num < 0 || port < 0 )
   35.48 -        goto clean_up;
   35.49 +  if (num < 0 || port < 0)
   35.50 +	goto clean_up;
   35.51  
   35.52 -    gmyth_debug
   35.53 -        ( "[%s] Free recorder info received: num: %d, hostname: %s, port: %d",
   35.54 -          __FUNCTION__, num, hostname->str, port );
   35.55 +  gmyth_debug
   35.56 +	("[%s] Free recorder info received: num: %d, hostname: %s, port: %d",
   35.57 +	 __FUNCTION__, num, hostname->str, port);
   35.58  
   35.59 -    recorder = gmyth_recorder_new ( num, hostname, port );
   35.60 +  recorder = gmyth_recorder_new(num, hostname, port);
   35.61  
   35.62 -  clean_up:
   35.63 +clean_up:
   35.64  
   35.65 -    g_string_free ( hostname, TRUE );
   35.66 -    g_object_unref ( strlist );
   35.67 +  g_string_free(hostname, TRUE);
   35.68 +  g_object_unref(strlist);
   35.69  
   35.70 -    return recorder;
   35.71 +  return recorder;
   35.72  }
   35.73  
   35.74  /** 
   35.75 @@ -93,34 +92,33 @@
   35.76   * @return the number of remote encoders instance available, or 0 if no one is actually free..
   35.77   */
   35.78  gint
   35.79 -gmyth_remote_util_get_free_recorder_count ( GMythSocket * socket )
   35.80 +gmyth_remote_util_get_free_recorder_count(GMythSocket * socket)
   35.81  {
   35.82 -    gint num_recs = 0;
   35.83 +  gint num_recs = 0;
   35.84  
   35.85 -    GMythStringList *strlist = gmyth_string_list_new (  );
   35.86 +  GMythStringList *strlist = gmyth_string_list_new();
   35.87  
   35.88 -    gmyth_debug ( "[%s] Request next free recorder in the backend",
   35.89 -                  __FUNCTION__ );
   35.90 +  gmyth_debug("[%s] Request next free recorder in the backend", __FUNCTION__);
   35.91  
   35.92 -    gmyth_string_list_append_char_array ( strlist, "GET_FREE_RECORDER_COUNT" );
   35.93 +  gmyth_string_list_append_char_array(strlist, "GET_FREE_RECORDER_COUNT");
   35.94  
   35.95 -    if ( !gmyth_socket_sendreceive_stringlist ( socket, strlist ) )
   35.96 -    {
   35.97 -        gmyth_debug ( "GET_FREE_RECORDER_COUNT request error!" );
   35.98 -        return 0;
   35.99 -    }
  35.100 +  if (!gmyth_socket_sendreceive_stringlist(socket, strlist))
  35.101 +	{
  35.102 +	  gmyth_debug("GET_FREE_RECORDER_COUNT request error!");
  35.103 +	  return 0;
  35.104 +	}
  35.105  
  35.106 -    num_recs = gmyth_string_list_get_int ( strlist, 0 );
  35.107 +  num_recs = gmyth_string_list_get_int(strlist, 0);
  35.108  
  35.109 -    if ( num_recs < 0 )
  35.110 -        goto clean_up;
  35.111 +  if (num_recs < 0)
  35.112 +	goto clean_up;
  35.113  
  35.114 -    gmyth_debug ( "[%s] Free recorder info received: num recorders: %d",
  35.115 -                  __FUNCTION__, num_recs );
  35.116 +  gmyth_debug("[%s] Free recorder info received: num recorders: %d",
  35.117 +			  __FUNCTION__, num_recs);
  35.118  
  35.119 -  clean_up:
  35.120 +clean_up:
  35.121  
  35.122 -    g_object_unref ( strlist );
  35.123 +  g_object_unref(strlist);
  35.124  
  35.125 -    return num_recs;
  35.126 +  return num_recs;
  35.127  }
    36.1 --- a/gmyth/src/gmyth_remote_util.h	Wed Jun 13 18:18:42 2007 +0100
    36.2 +++ b/gmyth/src/gmyth_remote_util.h	Thu Jun 14 18:19:52 2007 +0100
    36.3 @@ -32,9 +32,9 @@
    36.4  #include "gmyth_socket.h"
    36.5  
    36.6  G_BEGIN_DECLS
    36.7 -    GMythRecorder * remote_request_next_free_recorder ( GMythSocket * socket,
    36.8 -                                                        gint curr );
    36.9 -gint gmyth_remote_util_get_free_recorder_count ( GMythSocket * socket );
   36.10 +  GMythRecorder * remote_request_next_free_recorder(GMythSocket * socket,
   36.11 +													gint curr);
   36.12 +gint gmyth_remote_util_get_free_recorder_count(GMythSocket * socket);
   36.13  
   36.14  G_END_DECLS
   36.15  #endif
    37.1 --- a/gmyth/src/gmyth_scheduler.c	Wed Jun 13 18:18:42 2007 +0100
    37.2 +++ b/gmyth/src/gmyth_scheduler.c	Thu Jun 14 18:19:52 2007 +0100
    37.3 @@ -39,96 +39,96 @@
    37.4  #include "gmyth_socket.h"
    37.5  #include "gmyth_debug.h"
    37.6  
    37.7 -static void gmyth_scheduler_class_init ( GMythSchedulerClass * klass );
    37.8 -static void gmyth_scheduler_init ( GMythScheduler * object );
    37.9 +static void gmyth_scheduler_class_init(GMythSchedulerClass * klass);
   37.10 +static void gmyth_scheduler_init(GMythScheduler * object);
   37.11  
   37.12 -static void gmyth_scheduler_dispose ( GObject * object );
   37.13 -static void gmyth_scheduler_finalize ( GObject * object );
   37.14 +static void gmyth_scheduler_dispose(GObject * object);
   37.15 +static void gmyth_scheduler_finalize(GObject * object);
   37.16  
   37.17 -static gint get_record_id_from_database ( GMythScheduler * scheduler );
   37.18 -static gboolean update_backend ( GMythScheduler * scheduler, gint record_id );
   37.19 +static gint get_record_id_from_database(GMythScheduler * scheduler);
   37.20 +static gboolean update_backend(GMythScheduler * scheduler, gint record_id);
   37.21  
   37.22 -G_DEFINE_TYPE ( GMythScheduler, gmyth_scheduler, G_TYPE_OBJECT )
   37.23 -     static void gmyth_scheduler_class_init ( GMythSchedulerClass * klass )
   37.24 +G_DEFINE_TYPE(GMythScheduler, gmyth_scheduler, G_TYPE_OBJECT)
   37.25 +	 static void gmyth_scheduler_class_init(GMythSchedulerClass * klass)
   37.26  {
   37.27 -    GObjectClass *gobject_class;
   37.28 +  GObjectClass *gobject_class;
   37.29  
   37.30 -    gobject_class = ( GObjectClass * ) klass;
   37.31 +  gobject_class = (GObjectClass *) klass;
   37.32  
   37.33 -    gobject_class->dispose = gmyth_scheduler_dispose;
   37.34 -    gobject_class->finalize = gmyth_scheduler_finalize;
   37.35 +  gobject_class->dispose = gmyth_scheduler_dispose;
   37.36 +  gobject_class->finalize = gmyth_scheduler_finalize;
   37.37  }
   37.38  
   37.39  static void
   37.40 -gmyth_scheduler_init ( GMythScheduler * sched )
   37.41 +gmyth_scheduler_init(GMythScheduler * sched)
   37.42  {
   37.43 -    sched->recordid = 0;
   37.44 -    sched->type = 0;
   37.45 -    sched->search = 0;
   37.46 -    sched->profile = g_string_new ( "" );
   37.47 +  sched->recordid = 0;
   37.48 +  sched->type = 0;
   37.49 +  sched->search = 0;
   37.50 +  sched->profile = g_string_new("");
   37.51  
   37.52 -    sched->dupin = 0;
   37.53 -    sched->dupmethod = 0;
   37.54 -    sched->autoexpire = 0;
   37.55 -    sched->autotranscode = 0;
   37.56 -    sched->transcoder = 0;
   37.57 +  sched->dupin = 0;
   37.58 +  sched->dupmethod = 0;
   37.59 +  sched->autoexpire = 0;
   37.60 +  sched->autotranscode = 0;
   37.61 +  sched->transcoder = 0;
   37.62  
   37.63 -    sched->autocommflag = 0;
   37.64 -    sched->autouserjob1 = 0;
   37.65 -    sched->autouserjob2 = 0;
   37.66 -    sched->autouserjob3 = 0;
   37.67 -    sched->autouserjob4 = 0;
   37.68 +  sched->autocommflag = 0;
   37.69 +  sched->autouserjob1 = 0;
   37.70 +  sched->autouserjob2 = 0;
   37.71 +  sched->autouserjob3 = 0;
   37.72 +  sched->autouserjob4 = 0;
   37.73  
   37.74 -    sched->startoffset = 0;
   37.75 -    sched->endoffset = 0;
   37.76 -    sched->maxepisodes = 0;
   37.77 -    sched->maxnewest = 0;
   37.78 +  sched->startoffset = 0;
   37.79 +  sched->endoffset = 0;
   37.80 +  sched->maxepisodes = 0;
   37.81 +  sched->maxnewest = 0;
   37.82  
   37.83 -    sched->recpriority = 0;
   37.84 -    sched->recgroup = g_string_new ( "" );
   37.85 -    sched->playgroup = g_string_new ( "" );
   37.86 +  sched->recpriority = 0;
   37.87 +  sched->recgroup = g_string_new("");
   37.88 +  sched->playgroup = g_string_new("");
   37.89  
   37.90 -    sched->prefinput = 0;
   37.91 -    sched->inactive = 0;
   37.92 +  sched->prefinput = 0;
   37.93 +  sched->inactive = 0;
   37.94  
   37.95 -    sched->search_type = g_string_new ( "" );
   37.96 -    sched->search_what = g_string_new ( "" );
   37.97 +  sched->search_type = g_string_new("");
   37.98 +  sched->search_what = g_string_new("");
   37.99  
  37.100 -    sched->msqlquery = gmyth_query_new (  );
  37.101 +  sched->msqlquery = gmyth_query_new();
  37.102  }
  37.103  
  37.104  static void
  37.105 -gmyth_scheduler_dispose ( GObject * object )
  37.106 +gmyth_scheduler_dispose(GObject * object)
  37.107  {
  37.108 -    GMythScheduler *scheduler = GMYTH_SCHEDULER ( object );
  37.109 +  GMythScheduler *scheduler = GMYTH_SCHEDULER(object);
  37.110  
  37.111 -    if ( scheduler->backend_info )
  37.112 -    {
  37.113 -        g_object_unref ( scheduler->backend_info );
  37.114 -        scheduler->backend_info = NULL;
  37.115 -    }
  37.116 +  if (scheduler->backend_info)
  37.117 +	{
  37.118 +	  g_object_unref(scheduler->backend_info);
  37.119 +	  scheduler->backend_info = NULL;
  37.120 +	}
  37.121  
  37.122 -    if ( scheduler->msqlquery )
  37.123 -    {
  37.124 -        g_object_unref ( scheduler->msqlquery );
  37.125 -        scheduler->msqlquery = NULL;
  37.126 -    }
  37.127 +  if (scheduler->msqlquery)
  37.128 +	{
  37.129 +	  g_object_unref(scheduler->msqlquery);
  37.130 +	  scheduler->msqlquery = NULL;
  37.131 +	}
  37.132  
  37.133 -    g_string_free ( scheduler->profile, TRUE );
  37.134 -    g_string_free ( scheduler->recgroup, TRUE );
  37.135 -    g_string_free ( scheduler->playgroup, TRUE );
  37.136 -    g_string_free ( scheduler->search_type, TRUE );
  37.137 -    g_string_free ( scheduler->search_what, TRUE );
  37.138 +  g_string_free(scheduler->profile, TRUE);
  37.139 +  g_string_free(scheduler->recgroup, TRUE);
  37.140 +  g_string_free(scheduler->playgroup, TRUE);
  37.141 +  g_string_free(scheduler->search_type, TRUE);
  37.142 +  g_string_free(scheduler->search_what, TRUE);
  37.143  
  37.144 -    G_OBJECT_CLASS ( gmyth_scheduler_parent_class )->dispose ( object );
  37.145 +  G_OBJECT_CLASS(gmyth_scheduler_parent_class)->dispose(object);
  37.146  }
  37.147  
  37.148  static void
  37.149 -gmyth_scheduler_finalize ( GObject * object )
  37.150 +gmyth_scheduler_finalize(GObject * object)
  37.151  {
  37.152 -    g_signal_handlers_destroy ( object );
  37.153 +  g_signal_handlers_destroy(object);
  37.154  
  37.155 -    G_OBJECT_CLASS ( gmyth_scheduler_parent_class )->finalize ( object );
  37.156 +  G_OBJECT_CLASS(gmyth_scheduler_parent_class)->finalize(object);
  37.157  }
  37.158  
  37.159  /** Creates a new instance of GMythScheduler.
  37.160 @@ -136,19 +136,19 @@
  37.161   * @return a new instance of GMythScheduler.
  37.162   */
  37.163  GMythScheduler *
  37.164 -gmyth_scheduler_new (  )
  37.165 +gmyth_scheduler_new()
  37.166  {
  37.167 -    GMythScheduler *scheduler =
  37.168 -        GMYTH_SCHEDULER ( g_object_new ( GMYTH_SCHEDULER_TYPE, NULL ) );
  37.169 +  GMythScheduler *scheduler =
  37.170 +	GMYTH_SCHEDULER(g_object_new(GMYTH_SCHEDULER_TYPE, NULL));
  37.171  
  37.172 -    return scheduler;
  37.173 +  return scheduler;
  37.174  }
  37.175  
  37.176  gboolean
  37.177 -gmyth_scheduler_connect ( GMythScheduler * scheduler,
  37.178 -                          GMythBackendInfo * backend_info )
  37.179 +gmyth_scheduler_connect(GMythScheduler * scheduler,
  37.180 +						GMythBackendInfo * backend_info)
  37.181  {
  37.182 -    return gmyth_scheduler_connect_with_timeout ( scheduler, backend_info, 0 );
  37.183 +  return gmyth_scheduler_connect_with_timeout(scheduler, backend_info, 0);
  37.184  }
  37.185  
  37.186  /** Connects to the Mysql database in the backend. The backend address
  37.187 @@ -158,33 +158,32 @@
  37.188   * @return true if connection was success, false if failed.
  37.189   */
  37.190  gboolean
  37.191 -gmyth_scheduler_connect_with_timeout ( GMythScheduler * scheduler,
  37.192 -                                       GMythBackendInfo * backend_info,
  37.193 -                                       guint timeout )
  37.194 +gmyth_scheduler_connect_with_timeout(GMythScheduler * scheduler,
  37.195 +									 GMythBackendInfo * backend_info,
  37.196 +									 guint timeout)
  37.197  {
  37.198 -    assert ( scheduler );
  37.199 -    g_return_val_if_fail ( backend_info != NULL, FALSE );
  37.200 +  assert(scheduler);
  37.201 +  g_return_val_if_fail(backend_info != NULL, FALSE);
  37.202  
  37.203 -    if ( scheduler->backend_info )
  37.204 -        g_object_unref ( scheduler->backend_info );
  37.205 +  if (scheduler->backend_info)
  37.206 +	g_object_unref(scheduler->backend_info);
  37.207  
  37.208 -    scheduler->backend_info = g_object_ref ( backend_info );
  37.209 +  scheduler->backend_info = g_object_ref(backend_info);
  37.210  
  37.211 -    if ( scheduler->msqlquery == NULL )
  37.212 -    {
  37.213 -        g_warning ( "[%s] GMythScheduler db initializing", __FUNCTION__ );
  37.214 -        scheduler->msqlquery = gmyth_query_new (  );
  37.215 -    }
  37.216 +  if (scheduler->msqlquery == NULL)
  37.217 +	{
  37.218 +	  g_warning("[%s] GMythScheduler db initializing", __FUNCTION__);
  37.219 +	  scheduler->msqlquery = gmyth_query_new();
  37.220 +	}
  37.221  
  37.222 -    if ( !gmyth_query_connect_with_timeout ( scheduler->msqlquery,
  37.223 -                                             scheduler->backend_info,
  37.224 -                                             timeout ) )
  37.225 -    {
  37.226 -        g_warning ( "[%s] Error while connecting to db", __FUNCTION__ );
  37.227 -        return FALSE;
  37.228 -    }
  37.229 +  if (!gmyth_query_connect_with_timeout(scheduler->msqlquery,
  37.230 +										scheduler->backend_info, timeout))
  37.231 +	{
  37.232 +	  g_warning("[%s] Error while connecting to db", __FUNCTION__);
  37.233 +	  return FALSE;
  37.234 +	}
  37.235  
  37.236 -    return TRUE;
  37.237 +  return TRUE;
  37.238  }
  37.239  
  37.240  /** Disconnects from the Mysql database in the backend.
  37.241 @@ -193,16 +192,16 @@
  37.242   * @return true if disconnection was success, false if failed.
  37.243   */
  37.244  gboolean
  37.245 -gmyth_scheduler_disconnect ( GMythScheduler * scheduler )
  37.246 +gmyth_scheduler_disconnect(GMythScheduler * scheduler)
  37.247  {
  37.248 -    assert ( scheduler );
  37.249 +  assert(scheduler);
  37.250  
  37.251 -    if ( scheduler->msqlquery != NULL )
  37.252 -    {
  37.253 -        gmyth_query_disconnect ( scheduler->msqlquery );
  37.254 -    }
  37.255 +  if (scheduler->msqlquery != NULL)
  37.256 +	{
  37.257 +	  gmyth_query_disconnect(scheduler->msqlquery);
  37.258 +	}
  37.259  
  37.260 -    return TRUE;
  37.261 +  return TRUE;
  37.262  }
  37.263  
  37.264  /** Retrieves from the backend Mysql database the list of recording schedules.
  37.265 @@ -212,74 +211,70 @@
  37.266   * @return The amount of schedules retrieved from database, or -1 if error.
  37.267   */
  37.268  gint
  37.269 -gmyth_scheduler_get_schedule_list ( GMythScheduler * scheduler,
  37.270 -                                    GList ** schedule_list )
  37.271 +gmyth_scheduler_get_schedule_list(GMythScheduler * scheduler,
  37.272 +								  GList ** schedule_list)
  37.273  {
  37.274 -    ScheduleInfo *schedule;
  37.275 -    MYSQL_RES *msql_res;
  37.276 -    GString *query_str = g_string_new ( "" );
  37.277 -    gchar *date_time = NULL;
  37.278 +  ScheduleInfo *schedule;
  37.279 +  MYSQL_RES *msql_res;
  37.280 +  GString *query_str = g_string_new("");
  37.281 +  gchar *date_time = NULL;
  37.282  
  37.283 -    assert ( scheduler );
  37.284 +  assert(scheduler);
  37.285  
  37.286 -    g_string_printf ( query_str,
  37.287 -                      "SELECT recordid,programid,chanid,starttime,startdate,"
  37.288 -                      "endtime,enddate,title,subtitle,description,category FROM record;" );
  37.289 +  g_string_printf(query_str,
  37.290 +				  "SELECT recordid,programid,chanid,starttime,startdate,"
  37.291 +				  "endtime,enddate,title,subtitle,description,category FROM record;");
  37.292  
  37.293 -    if ( scheduler->msqlquery == NULL )
  37.294 -    {
  37.295 -        g_warning ( "[%s] Scheduler db connection not initialized",
  37.296 -                    __FUNCTION__ );
  37.297 -        return -1;
  37.298 -    }
  37.299 -    msql_res =
  37.300 -        gmyth_query_process_statement ( scheduler->msqlquery, query_str->str );
  37.301 +  if (scheduler->msqlquery == NULL)
  37.302 +	{
  37.303 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
  37.304 +	  return -1;
  37.305 +	}
  37.306 +  msql_res =
  37.307 +	gmyth_query_process_statement(scheduler->msqlquery, query_str->str);
  37.308  
  37.309 -    if ( msql_res == NULL )
  37.310 -    {
  37.311 -        g_warning ( "DB retrieval of schedule list failed" );
  37.312 -        return -1;
  37.313 -    }
  37.314 -    else
  37.315 -    {
  37.316 -        MYSQL_ROW row;
  37.317 +  if (msql_res == NULL)
  37.318 +	{
  37.319 +	  g_warning("DB retrieval of schedule list failed");
  37.320 +	  return -1;
  37.321 +	}
  37.322 +  else
  37.323 +	{
  37.324 +	  MYSQL_ROW row;
  37.325  
  37.326 -        *schedule_list = NULL;
  37.327 +	  *schedule_list = NULL;
  37.328  
  37.329 -        while ( ( row = mysql_fetch_row ( msql_res ) ) != NULL )
  37.330 -        {
  37.331 -            schedule = g_new0 ( ScheduleInfo, 1 );
  37.332 +	  while ((row = mysql_fetch_row(msql_res)) != NULL)
  37.333 +		{
  37.334 +		  schedule = g_new0(ScheduleInfo, 1);
  37.335  
  37.336 -            schedule->schedule_id =
  37.337 -                ( guint ) g_ascii_strtoull ( row[0], NULL, 10 );
  37.338 -            schedule->program_id =
  37.339 -                ( guint ) g_ascii_strtoull ( row[1], NULL, 10 );
  37.340 -            schedule->channel_id =
  37.341 -                ( guint ) g_ascii_strtoull ( row[2], NULL, 10 );
  37.342 +		  schedule->schedule_id = (guint) g_ascii_strtoull(row[0], NULL, 10);
  37.343 +		  schedule->program_id = (guint) g_ascii_strtoull(row[1], NULL, 10);
  37.344 +		  schedule->channel_id = (guint) g_ascii_strtoull(row[2], NULL, 10);
  37.345  
  37.346 -            /* generate a time_t from a time and a date db field */
  37.347 -            date_time = g_strdup_printf ( "%sT%s", row[4], row[3] );
  37.348 -            schedule->start_time = gmyth_util_string_to_time_val ( date_time );
  37.349 -            g_free ( date_time );
  37.350 +		 /* generate a time_t from a time and a date db field */
  37.351 +		  date_time = g_strdup_printf("%sT%s", row[4], row[3]);
  37.352 +		  schedule->start_time = gmyth_util_string_to_time_val(date_time);
  37.353 +		  g_free(date_time);
  37.354  
  37.355 -            /* generate a time_t from a time and a date db field */
  37.356 -            date_time = g_strdup_printf ( "%sT%s", row[6], row[5] );
  37.357 -            schedule->end_time = gmyth_util_string_to_time_val ( date_time );
  37.358 -            g_free ( date_time );
  37.359 +		 /* generate a time_t from a time and a date db field */
  37.360 +		  date_time = g_strdup_printf("%sT%s", row[6], row[5]);
  37.361 +		  schedule->end_time = gmyth_util_string_to_time_val(date_time);
  37.362 +		  g_free(date_time);
  37.363  
  37.364 -            schedule->title = g_string_new ( row[7] );
  37.365 -            schedule->subtitle = g_string_new ( row[8] );
  37.366 -            schedule->description = g_string_new ( row[9] );
  37.367 -            schedule->category = g_string_new ( row[10] );
  37.368 +		  schedule->title = g_string_new(row[7]);
  37.369 +		  schedule->subtitle = g_string_new(row[8]);
  37.370 +		  schedule->description = g_string_new(row[9]);
  37.371 +		  schedule->category = g_string_new(row[10]);
  37.372  
  37.373 -            ( *schedule_list ) = g_list_append ( *( schedule_list ), schedule );
  37.374 -        }
  37.375 -    }
  37.376 +		  (*schedule_list) = g_list_append(*(schedule_list), schedule);
  37.377 +		}
  37.378 +	}
  37.379  
  37.380 -    mysql_free_result ( msql_res );
  37.381 -    g_string_free ( query_str, TRUE );
  37.382 +  mysql_free_result(msql_res);
  37.383 +  g_string_free(query_str, TRUE);
  37.384  
  37.385 -    return ( *schedule_list == NULL ) ? 0 : g_list_length ( *schedule_list );
  37.386 +  return (*schedule_list == NULL) ? 0 : g_list_length(*schedule_list);
  37.387  }
  37.388  
  37.389  /** Retrieves from the backend Mysql database the list of recorded programs.
  37.390 @@ -289,90 +284,87 @@
  37.391   * @return The amount of recorded retrieved from database, or -1 if error.
  37.392   */
  37.393  gint
  37.394 -gmyth_scheduler_get_recorded_list ( GMythScheduler * scheduler,
  37.395 -                                    GList ** recorded_list )
  37.396 +gmyth_scheduler_get_recorded_list(GMythScheduler * scheduler,
  37.397 +								  GList ** recorded_list)
  37.398  {
  37.399 -    RecordedInfo *record;
  37.400 -    MYSQL_RES *msql_res;
  37.401 -    GString *query_str = g_string_new ( "" );
  37.402 +  RecordedInfo *record;
  37.403 +  MYSQL_RES *msql_res;
  37.404 +  GString *query_str = g_string_new("");
  37.405  
  37.406 -    assert ( scheduler );
  37.407 +  assert(scheduler);
  37.408  
  37.409 -    g_string_printf ( query_str,
  37.410 -                      "SELECT recordid,programid,chanid,starttime,progstart,"
  37.411 -                      "endtime,progend,title,subtitle,description,category,"
  37.412 -                      "filesize,basename FROM recorded WHERE recgroup != 'LiveTV'" );
  37.413 +  g_string_printf(query_str,
  37.414 +				  "SELECT recordid,programid,chanid,starttime,progstart,"
  37.415 +				  "endtime,progend,title,subtitle,description,category,"
  37.416 +				  "filesize,basename FROM recorded WHERE recgroup != 'LiveTV'");
  37.417  
  37.418 -    if ( scheduler->msqlquery == NULL )
  37.419 -    {
  37.420 -        g_warning ( "[%s] Scheduler db connection not initialized",
  37.421 -                    __FUNCTION__ );
  37.422 -        return -1;
  37.423 -    }
  37.424 +  if (scheduler->msqlquery == NULL)
  37.425 +	{
  37.426 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
  37.427 +	  return -1;
  37.428 +	}
  37.429  
  37.430 -    msql_res =
  37.431 -        gmyth_query_process_statement ( scheduler->msqlquery, query_str->str );
  37.432 +  msql_res =
  37.433 +	gmyth_query_process_statement(scheduler->msqlquery, query_str->str);
  37.434  
  37.435 -    if ( msql_res == NULL )
  37.436 -    {
  37.437 -        g_warning ( "DB retrieval of recording list failed" );
  37.438 -        return -1;
  37.439 -    }
  37.440 -    else
  37.441 -    {
  37.442 -        MYSQL_ROW row;
  37.443 +  if (msql_res == NULL)
  37.444 +	{
  37.445 +	  g_warning("DB retrieval of recording list failed");
  37.446 +	  return -1;
  37.447 +	}
  37.448 +  else
  37.449 +	{
  37.450 +	  MYSQL_ROW row;
  37.451  
  37.452 -        ( *recorded_list ) = NULL;
  37.453 +	  (*recorded_list) = NULL;
  37.454  
  37.455 -        while ( ( row = mysql_fetch_row ( msql_res ) ) != NULL )
  37.456 -        {
  37.457 -            record = g_new0 ( RecordedInfo, 1 );
  37.458 +	  while ((row = mysql_fetch_row(msql_res)) != NULL)
  37.459 +		{
  37.460 +		  record = g_new0(RecordedInfo, 1);
  37.461  
  37.462 -            record->record_id = ( guint ) g_ascii_strtoull ( row[0], NULL, 10 );
  37.463 -            record->program_id =
  37.464 -                ( guint ) g_ascii_strtoull ( row[1], NULL, 10 );
  37.465 -            record->channel_id =
  37.466 -                ( guint ) g_ascii_strtoull ( row[2], NULL, 10 );
  37.467 +		  record->record_id = (guint) g_ascii_strtoull(row[0], NULL, 10);
  37.468 +		  record->program_id = (guint) g_ascii_strtoull(row[1], NULL, 10);
  37.469 +		  record->channel_id = (guint) g_ascii_strtoull(row[2], NULL, 10);
  37.470  
  37.471 -            record->start_time = gmyth_util_string_to_time_val ( row[3] );
  37.472 -            record->end_time = gmyth_util_string_to_time_val ( row[5] );
  37.473 +		  record->start_time = gmyth_util_string_to_time_val(row[3]);
  37.474 +		  record->end_time = gmyth_util_string_to_time_val(row[5]);
  37.475  
  37.476 -            record->title = g_string_new ( row[7] );
  37.477 -            record->subtitle = g_string_new ( row[8] );
  37.478 -            record->description = g_string_new ( row[9] );
  37.479 -            record->category = g_string_new ( row[10] );
  37.480 -            record->filesize = g_ascii_strtoull ( row[11], NULL, 10 );
  37.481 -            record->basename = g_string_new ( row[12] );
  37.482 +		  record->title = g_string_new(row[7]);
  37.483 +		  record->subtitle = g_string_new(row[8]);
  37.484 +		  record->description = g_string_new(row[9]);
  37.485 +		  record->category = g_string_new(row[10]);
  37.486 +		  record->filesize = g_ascii_strtoull(row[11], NULL, 10);
  37.487 +		  record->basename = g_string_new(row[12]);
  37.488  
  37.489 -            ( *recorded_list ) = g_list_append ( ( *recorded_list ), record );
  37.490 -        }
  37.491 -    }
  37.492 +		  (*recorded_list) = g_list_append((*recorded_list), record);
  37.493 +		}
  37.494 +	}
  37.495  
  37.496 -    mysql_free_result ( msql_res );
  37.497 -    g_string_free ( query_str, TRUE );
  37.498 +  mysql_free_result(msql_res);
  37.499 +  g_string_free(query_str, TRUE);
  37.500  
  37.501 -    return ( *recorded_list == NULL ) ? 0 : g_list_length ( *recorded_list );
  37.502 +  return (*recorded_list == NULL) ? 0 : g_list_length(*recorded_list);
  37.503  }
  37.504  
  37.505  static void
  37.506 -_set_value ( GMythQuery * myth_query, char *field, gchar * value, gint rec_id )
  37.507 +_set_value(GMythQuery * myth_query, char *field, gchar * value, gint rec_id)
  37.508  {
  37.509 -    gchar *query =
  37.510 -        g_strdup_printf
  37.511 -        ( "UPDATE record SET recordid = %d, %s = \"%s\" WHERE recordid = %d;",
  37.512 -          rec_id, field, value, rec_id );
  37.513 +  gchar *query =
  37.514 +	g_strdup_printf
  37.515 +	("UPDATE record SET recordid = %d, %s = \"%s\" WHERE recordid = %d;",
  37.516 +	 rec_id, field, value, rec_id);
  37.517  
  37.518 -    gmyth_query_process_statement ( myth_query, query );
  37.519 -    g_free ( query );
  37.520 +  gmyth_query_process_statement(myth_query, query);
  37.521 +  g_free(query);
  37.522  }
  37.523  
  37.524  static void
  37.525 -_set_int_value ( GMythQuery * myth_query, char *field, gint value, gint rec_id )
  37.526 +_set_int_value(GMythQuery * myth_query, char *field, gint value, gint rec_id)
  37.527  {
  37.528 -    gchar *str_value = g_strdup_printf ( "%d", value );
  37.529 +  gchar *str_value = g_strdup_printf("%d", value);
  37.530  
  37.531 -    _set_value ( myth_query, field, str_value, rec_id );
  37.532 -    g_free ( str_value );
  37.533 +  _set_value(myth_query, field, str_value, rec_id);
  37.534 +  g_free(str_value);
  37.535  }
  37.536  
  37.537  /** Requests the Mysql database in the backend to add a new schedule.
  37.538 @@ -384,105 +376,103 @@
  37.539   * @return gboolean returns FALSE if some error occurs, TRUE otherwise
  37.540   */
  37.541  gboolean
  37.542 -gmyth_scheduler_add_schedule ( GMythScheduler * scheduler,
  37.543 -                               ScheduleInfo * schedule_info )
  37.544 +gmyth_scheduler_add_schedule(GMythScheduler * scheduler,
  37.545 +							 ScheduleInfo * schedule_info)
  37.546  {
  37.547 -    MYSQL_RES *msql_res;
  37.548 -    gchar *query_str = "INSERT record (recordid) VALUE (0);";
  37.549 -    gchar *station = NULL;
  37.550 -    gulong rec_id;
  37.551 +  MYSQL_RES *msql_res;
  37.552 +  gchar *query_str = "INSERT record (recordid) VALUE (0);";
  37.553 +  gchar *station = NULL;
  37.554 +  gulong rec_id;
  37.555  
  37.556 -    assert ( scheduler );
  37.557 +  assert(scheduler);
  37.558  
  37.559 -    if ( scheduler->msqlquery == NULL )
  37.560 -    {
  37.561 -        g_warning ( "[%s] Scheduler db connection not initialized",
  37.562 -                    __FUNCTION__ );
  37.563 -        return FALSE;
  37.564 -    }
  37.565 +  if (scheduler->msqlquery == NULL)
  37.566 +	{
  37.567 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
  37.568 +	  return FALSE;
  37.569 +	}
  37.570  
  37.571 -    msql_res =
  37.572 -        gmyth_query_process_statement_with_increment ( scheduler->msqlquery,
  37.573 -                                                       query_str, &rec_id );
  37.574 -    mysql_free_result ( msql_res );
  37.575 +  msql_res =
  37.576 +	gmyth_query_process_statement_with_increment(scheduler->msqlquery,
  37.577 +												 query_str, &rec_id);
  37.578 +  mysql_free_result(msql_res);
  37.579  
  37.580 -    // Retrieves the station info
  37.581 -    query_str =
  37.582 -        g_strdup_printf ( "SELECT callsign FROM channel WHERE chanid = \"%d\";",
  37.583 -                          schedule_info->channel_id );
  37.584 -    msql_res =
  37.585 -        gmyth_query_process_statement ( scheduler->msqlquery, query_str );
  37.586 -    if ( msql_res == NULL )
  37.587 -    {
  37.588 -        g_warning ( "[%s] msql query returned NULL MYSQL_RES", __FUNCTION__ );
  37.589 -        return FALSE;
  37.590 -    }
  37.591 -    else
  37.592 -    {
  37.593 -        MYSQL_ROW row;
  37.594 + // Retrieves the station info
  37.595 +  query_str =
  37.596 +	g_strdup_printf("SELECT callsign FROM channel WHERE chanid = \"%d\";",
  37.597 +					schedule_info->channel_id);
  37.598 +  msql_res = gmyth_query_process_statement(scheduler->msqlquery, query_str);
  37.599 +  if (msql_res == NULL)
  37.600 +	{
  37.601 +	  g_warning("[%s] msql query returned NULL MYSQL_RES", __FUNCTION__);
  37.602 +	  return FALSE;
  37.603 +	}
  37.604 +  else
  37.605 +	{
  37.606 +	  MYSQL_ROW row;
  37.607  
  37.608 -        if ( ( row = mysql_fetch_row ( msql_res ) ) != NULL )
  37.609 -        {
  37.610 -            station = g_strdup ( row[0] );
  37.611 -        }
  37.612 -    }
  37.613 -    mysql_free_result ( msql_res );
  37.614 -    g_free ( query_str );
  37.615 +	  if ((row = mysql_fetch_row(msql_res)) != NULL)
  37.616 +		{
  37.617 +		  station = g_strdup(row[0]);
  37.618 +		}
  37.619 +	}
  37.620 +  mysql_free_result(msql_res);
  37.621 +  g_free(query_str);
  37.622  
  37.623 -    // _set_value (field, value, id);
  37.624 -    _set_int_value ( scheduler->msqlquery, "chanid", schedule_info->channel_id,
  37.625 -                     rec_id );
  37.626 -    _set_value ( scheduler->msqlquery, "station", station, rec_id );
  37.627 -    _set_value ( scheduler->msqlquery, "title", schedule_info->title->str,
  37.628 -                 rec_id );
  37.629 -    /// subtitle, description    
  37.630 -    _set_value ( scheduler->msqlquery, "starttime",
  37.631 -                 gmyth_util_time_to_string_only_time ( schedule_info->
  37.632 -                                                       start_time ), rec_id );
  37.633 -    _set_value ( scheduler->msqlquery, "startdate",
  37.634 -                 gmyth_util_time_to_string_only_date ( schedule_info->
  37.635 -                                                       start_time ), rec_id );
  37.636 -    _set_value ( scheduler->msqlquery, "endtime",
  37.637 -                 gmyth_util_time_to_string_only_time ( schedule_info->
  37.638 -                                                       end_time ), rec_id );
  37.639 -    _set_value ( scheduler->msqlquery, "enddate",
  37.640 -                 gmyth_util_time_to_string_only_date ( schedule_info->
  37.641 -                                                       end_time ), rec_id );
  37.642 -    /// category, series id, program id
  37.643 -    //_set_value (scheduler->msqlquery, "findday", (gmyth_util_time_val_to_date( schedule_info->start_time ))->tm_wday, rec_id);
  37.644 -    //_set_value (scheduler->msqlquery, "findtime", gmyth_util_time_to_string_only_time( schedule_info->start_time), rec_id);
  37.645 -    //_set_int_value (scheduler->msqlquery, "findid", (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528), rec_id);
  37.646 -    _set_value ( scheduler->msqlquery, "parentid", "0", rec_id );
  37.647 -    _set_value ( scheduler->msqlquery, "search", "0", rec_id );
  37.648 -    _set_value ( scheduler->msqlquery, "type", "1", rec_id );
  37.649 -    _set_value ( scheduler->msqlquery, "recpriority", "0", rec_id );
  37.650 -    _set_value ( scheduler->msqlquery, "startoffset", "0", rec_id );
  37.651 -    _set_value ( scheduler->msqlquery, "endoffset", "0", rec_id );
  37.652 -    _set_value ( scheduler->msqlquery, "dupmethod", "6", rec_id );  // ?
  37.653 -    _set_value ( scheduler->msqlquery, "dupin", "15", rec_id ); // ?
  37.654 + // _set_value (field, value, id);
  37.655 +  _set_int_value(scheduler->msqlquery, "chanid", schedule_info->channel_id,
  37.656 +				 rec_id);
  37.657 +  _set_value(scheduler->msqlquery, "station", station, rec_id);
  37.658 +  _set_value(scheduler->msqlquery, "title", schedule_info->title->str,
  37.659 +			 rec_id);
  37.660 + /// subtitle, description    
  37.661 +  _set_value(scheduler->msqlquery, "starttime",
  37.662 +			 gmyth_util_time_to_string_only_time(schedule_info->
  37.663 +												 start_time), rec_id);
  37.664 +  _set_value(scheduler->msqlquery, "startdate",
  37.665 +			 gmyth_util_time_to_string_only_date(schedule_info->
  37.666 +												 start_time), rec_id);
  37.667 +  _set_value(scheduler->msqlquery, "endtime",
  37.668 +			 gmyth_util_time_to_string_only_time(schedule_info->
  37.669 +												 end_time), rec_id);
  37.670 +  _set_value(scheduler->msqlquery, "enddate",
  37.671 +			 gmyth_util_time_to_string_only_date(schedule_info->
  37.672 +												 end_time), rec_id);
  37.673 + /// category, series id, program id
  37.674 + //_set_value (scheduler->msqlquery, "findday", (gmyth_util_time_val_to_date( schedule_info->start_time ))->tm_wday, rec_id);
  37.675 + //_set_value (scheduler->msqlquery, "findtime", gmyth_util_time_to_string_only_time( schedule_info->start_time), rec_id);
  37.676 + //_set_int_value (scheduler->msqlquery, "findid", (gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528), rec_id);
  37.677 +  _set_value(scheduler->msqlquery, "parentid", "0", rec_id);
  37.678 +  _set_value(scheduler->msqlquery, "search", "0", rec_id);
  37.679 +  _set_value(scheduler->msqlquery, "type", "1", rec_id);
  37.680 +  _set_value(scheduler->msqlquery, "recpriority", "0", rec_id);
  37.681 +  _set_value(scheduler->msqlquery, "startoffset", "0", rec_id);
  37.682 +  _set_value(scheduler->msqlquery, "endoffset", "0", rec_id);
  37.683 +  _set_value(scheduler->msqlquery, "dupmethod", "6", rec_id);	// ?
  37.684 +  _set_value(scheduler->msqlquery, "dupin", "15", rec_id);	// ?
  37.685  
  37.686 -    _set_value ( scheduler->msqlquery, "prefinput", "0", rec_id );
  37.687 -    _set_value ( scheduler->msqlquery, "inactive", "0", rec_id );
  37.688 -    _set_value ( scheduler->msqlquery, "profile", "Default", rec_id );
  37.689 -    _set_value ( scheduler->msqlquery, "recgroup", "Default", rec_id );
  37.690 -    _set_value ( scheduler->msqlquery, "storagegroup", "Default", rec_id );
  37.691 -    _set_value ( scheduler->msqlquery, "playgroup", "Default", rec_id );
  37.692 -    _set_value ( scheduler->msqlquery, "autoexpire", "1", rec_id );
  37.693 -    _set_value ( scheduler->msqlquery, "maxepisodes", "0", rec_id );
  37.694 -    _set_value ( scheduler->msqlquery, "maxnewest", "0", rec_id );
  37.695 -    _set_value ( scheduler->msqlquery, "autocommflag", "1", rec_id );
  37.696 -    _set_value ( scheduler->msqlquery, "autotranscode", "0", rec_id );
  37.697 -    _set_value ( scheduler->msqlquery, "transcoder", "0", rec_id );
  37.698 +  _set_value(scheduler->msqlquery, "prefinput", "0", rec_id);
  37.699 +  _set_value(scheduler->msqlquery, "inactive", "0", rec_id);
  37.700 +  _set_value(scheduler->msqlquery, "profile", "Default", rec_id);
  37.701 +  _set_value(scheduler->msqlquery, "recgroup", "Default", rec_id);
  37.702 +  _set_value(scheduler->msqlquery, "storagegroup", "Default", rec_id);
  37.703 +  _set_value(scheduler->msqlquery, "playgroup", "Default", rec_id);
  37.704 +  _set_value(scheduler->msqlquery, "autoexpire", "1", rec_id);
  37.705 +  _set_value(scheduler->msqlquery, "maxepisodes", "0", rec_id);
  37.706 +  _set_value(scheduler->msqlquery, "maxnewest", "0", rec_id);
  37.707 +  _set_value(scheduler->msqlquery, "autocommflag", "1", rec_id);
  37.708 +  _set_value(scheduler->msqlquery, "autotranscode", "0", rec_id);
  37.709 +  _set_value(scheduler->msqlquery, "transcoder", "0", rec_id);
  37.710  
  37.711 -    _set_value ( scheduler->msqlquery, "autouserjob1", "0", rec_id );
  37.712 -    _set_value ( scheduler->msqlquery, "autouserjob2", "0", rec_id );
  37.713 -    _set_value ( scheduler->msqlquery, "autouserjob3", "0", rec_id );
  37.714 -    _set_value ( scheduler->msqlquery, "autouserjob4", "0", rec_id );
  37.715 +  _set_value(scheduler->msqlquery, "autouserjob1", "0", rec_id);
  37.716 +  _set_value(scheduler->msqlquery, "autouserjob2", "0", rec_id);
  37.717 +  _set_value(scheduler->msqlquery, "autouserjob3", "0", rec_id);
  37.718 +  _set_value(scheduler->msqlquery, "autouserjob4", "0", rec_id);
  37.719  
  37.720 -    schedule_info->schedule_id = rec_id;
  37.721 +  schedule_info->schedule_id = rec_id;
  37.722  
  37.723 -    /* Notify the backend of changes */
  37.724 -    return update_backend ( scheduler, rec_id );
  37.725 + /* Notify the backend of changes */
  37.726 +  return update_backend(scheduler, rec_id);
  37.727  }
  37.728  
  37.729  /** Requests the Mysql database in the backend to remove an existing schedule.
  37.730 @@ -492,33 +482,32 @@
  37.731   * @return gboolean TRUE if success, FALSE if error
  37.732   */
  37.733  gboolean
  37.734 -gmyth_scheduler_delete_schedule ( GMythScheduler * scheduler, gint record_id )
  37.735 +gmyth_scheduler_delete_schedule(GMythScheduler * scheduler, gint record_id)
  37.736  {
  37.737  
  37.738 -    MYSQL_RES *msql_res;
  37.739 -    GString *query_str = g_string_new ( "" );
  37.740 +  MYSQL_RES *msql_res;
  37.741 +  GString *query_str = g_string_new("");
  37.742  
  37.743 -    assert ( scheduler );
  37.744 +  assert(scheduler);
  37.745  
  37.746 -    if ( scheduler->msqlquery == NULL )
  37.747 -    {
  37.748 -        g_warning ( "[%s] Scheduler db connection not initialized",
  37.749 -                    __FUNCTION__ );
  37.750 -        return FALSE;
  37.751 -    }
  37.752 -    //========================================
  37.753 -    g_string_printf ( query_str,
  37.754 -                      "DELETE FROM record WHERE recordid=%d", record_id );
  37.755 +  if (scheduler->msqlquery == NULL)
  37.756 +	{
  37.757 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
  37.758 +	  return FALSE;
  37.759 +	}
  37.760 + //========================================
  37.761 +  g_string_printf(query_str,
  37.762 +				  "DELETE FROM record WHERE recordid=%d", record_id);
  37.763  
  37.764 -    msql_res =
  37.765 -        gmyth_query_process_statement ( scheduler->msqlquery, query_str->str );
  37.766 +  msql_res =
  37.767 +	gmyth_query_process_statement(scheduler->msqlquery, query_str->str);
  37.768  
  37.769  
  37.770 -    mysql_free_result ( msql_res );
  37.771 -    g_string_free ( query_str, TRUE );
  37.772 +  mysql_free_result(msql_res);
  37.773 +  g_string_free(query_str, TRUE);
  37.774  
  37.775 -    // Notify the backend of the changes
  37.776 -    return update_backend ( scheduler, record_id );
  37.777 + // Notify the backend of the changes
  37.778 +  return update_backend(scheduler, record_id);
  37.779  }
  37.780  
  37.781  /** Requests the Mysql database in the backend to remove an existing recorded item.
  37.782 @@ -528,35 +517,34 @@
  37.783   * @return gboolean TRUE if success, FALSE if error
  37.784   */
  37.785  gboolean
  37.786 -gmyth_scheduler_delete_recorded ( GMythScheduler * scheduler, gint record_id )
  37.787 +gmyth_scheduler_delete_recorded(GMythScheduler * scheduler, gint record_id)
  37.788  {
  37.789  
  37.790 -    MYSQL_RES *msql_res;
  37.791 +  MYSQL_RES *msql_res;
  37.792  
  37.793 -    GString *query_str = g_string_new ( "" );
  37.794 +  GString *query_str = g_string_new("");
  37.795  
  37.796 -    assert ( scheduler );
  37.797 +  assert(scheduler);
  37.798  
  37.799 -    if ( scheduler->msqlquery == NULL )
  37.800 -    {
  37.801 -        g_warning ( "[%s] Scheduler db connection not initialized",
  37.802 -                    __FUNCTION__ );
  37.803 -        return FALSE;
  37.804 -    }
  37.805 -    //========================================
  37.806 -    g_string_printf ( query_str,
  37.807 -                      "DELETE FROM recorded WHERE recordid=%d", record_id );
  37.808 +  if (scheduler->msqlquery == NULL)
  37.809 +	{
  37.810 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
  37.811 +	  return FALSE;
  37.812 +	}
  37.813 + //========================================
  37.814 +  g_string_printf(query_str,
  37.815 +				  "DELETE FROM recorded WHERE recordid=%d", record_id);
  37.816  
  37.817 -    // FIXME: Mythtv implementation runs also: DELETE FROM oldfind WHERE recordid = x
  37.818 + // FIXME: Mythtv implementation runs also: DELETE FROM oldfind WHERE recordid = x
  37.819  
  37.820 -    msql_res =
  37.821 -        gmyth_query_process_statement ( scheduler->msqlquery, query_str->str );
  37.822 +  msql_res =
  37.823 +	gmyth_query_process_statement(scheduler->msqlquery, query_str->str);
  37.824  
  37.825 -    mysql_free_result ( msql_res );
  37.826 -    g_string_free ( query_str, TRUE );
  37.827 +  mysql_free_result(msql_res);
  37.828 +  g_string_free(query_str, TRUE);
  37.829  
  37.830 -    // Notify the backend of the changes
  37.831 -    return update_backend ( scheduler, record_id );
  37.832 + // Notify the backend of the changes
  37.833 +  return update_backend(scheduler, record_id);
  37.834  }
  37.835  
  37.836  /** Retrieves an existing recorded item information from database. The information
  37.837 @@ -569,111 +557,108 @@
  37.838   * information, or NULL if error.
  37.839   */
  37.840  GMythProgramInfo *
  37.841 -gmyth_scheduler_get_recorded ( GMythScheduler * scheduler,
  37.842 -                               GString * channel, GTimeVal * starttime )
  37.843 +gmyth_scheduler_get_recorded(GMythScheduler * scheduler,
  37.844 +							 GString * channel, GTimeVal * starttime)
  37.845  {
  37.846 -    MYSQL_RES *msql_res;
  37.847 -    GMythProgramInfo *proginfo = NULL;
  37.848 -    GString *query_str = g_string_new ( "" );
  37.849 -    gchar *time_str = gmyth_util_time_to_string_from_time_val ( starttime );
  37.850 +  MYSQL_RES *msql_res;
  37.851 +  GMythProgramInfo *proginfo = NULL;
  37.852 +  GString *query_str = g_string_new("");
  37.853 +  gchar *time_str = gmyth_util_time_to_string_from_time_val(starttime);
  37.854  
  37.855 -    assert ( scheduler );
  37.856 +  assert(scheduler);
  37.857  
  37.858 -    gmyth_debug ( "[%s] channel: %s", __FUNCTION__, channel->str );
  37.859 +  gmyth_debug("[%s] channel: %s", __FUNCTION__, channel->str);
  37.860  
  37.861 -    if ( scheduler->msqlquery == NULL )
  37.862 -    {
  37.863 -        g_warning ( "[%s] Scheduler db connection not initialized",
  37.864 -                    __FUNCTION__ );
  37.865 -        return NULL;
  37.866 -    }
  37.867 +  if (scheduler->msqlquery == NULL)
  37.868 +	{
  37.869 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
  37.870 +	  return NULL;
  37.871 +	}
  37.872  
  37.873 -    g_string_printf ( query_str,
  37.874 -                      "SELECT recorded.chanid,starttime,endtime,title, "
  37.875 -                      "subtitle,description,channel.channum, "
  37.876 -                      "channel.callsign,channel.name,channel.commfree, "
  37.877 -                      "channel.outputfilters,seriesid,programid,filesize, "
  37.878 -                      "lastmodified,stars,previouslyshown,originalairdate, "
  37.879 -                      "hostname,recordid,transcoder,playgroup, "
  37.880 -                      "recorded.recpriority,progstart,progend,basename,recgroup "
  37.881 -                      "FROM recorded " "LEFT JOIN channel "
  37.882 -                      "ON recorded.chanid = channel.chanid "
  37.883 -                      "WHERE recorded.chanid = \"%s\" "
  37.884 -                      "AND starttime = \"%s\" ;", channel->str, time_str );
  37.885 +  g_string_printf(query_str,
  37.886 +				  "SELECT recorded.chanid,starttime,endtime,title, "
  37.887 +				  "subtitle,description,channel.channum, "
  37.888 +				  "channel.callsign,channel.name,channel.commfree, "
  37.889 +				  "channel.outputfilters,seriesid,programid,filesize, "
  37.890 +				  "lastmodified,stars,previouslyshown,originalairdate, "
  37.891 +				  "hostname,recordid,transcoder,playgroup, "
  37.892 +				  "recorded.recpriority,progstart,progend,basename,recgroup "
  37.893 +				  "FROM recorded " "LEFT JOIN channel "
  37.894 +				  "ON recorded.chanid = channel.chanid "
  37.895 +				  "WHERE recorded.chanid = \"%s\" "
  37.896 +				  "AND starttime = \"%s\" ;", channel->str, time_str);
  37.897  
  37.898 -    msql_res =
  37.899 -        gmyth_query_process_statement ( scheduler->msqlquery, query_str->str );
  37.900 +  msql_res =
  37.901 +	gmyth_query_process_statement(scheduler->msqlquery, query_str->str);
  37.902  
  37.903 -    if ( msql_res /*&& query.size() > 0 */  )
  37.904 -    {
  37.905 -        MYSQL_ROW msql_row = mysql_fetch_row ( msql_res );
  37.906 +  if (msql_res /*&& query.size() > 0 */ )
  37.907 +	{
  37.908 +	  MYSQL_ROW msql_row = mysql_fetch_row(msql_res);
  37.909  
  37.910 -        if ( msql_row )
  37.911 -        {
  37.912 -            proginfo = gmyth_program_info_new (  );
  37.913 +	  if (msql_row)
  37.914 +		{
  37.915 +		  proginfo = gmyth_program_info_new();
  37.916  
  37.917 -            proginfo->chanid = g_string_new ( msql_row[0] );
  37.918 -            proginfo->startts = gmyth_util_string_to_time_val ( msql_row[23] );
  37.919 -            proginfo->endts = gmyth_util_string_to_time_val ( msql_row[24] );
  37.920 -            proginfo->recstartts =
  37.921 -                gmyth_util_string_to_time_val ( msql_row[1] );
  37.922 -            proginfo->recendts = gmyth_util_string_to_time_val ( msql_row[2] );
  37.923 -            proginfo->title = g_string_new ( msql_row[3] );
  37.924 -            proginfo->subtitle = g_string_new ( msql_row[4] );
  37.925 -            proginfo->description = g_string_new ( msql_row[5] );
  37.926 +		  proginfo->chanid = g_string_new(msql_row[0]);
  37.927 +		  proginfo->startts = gmyth_util_string_to_time_val(msql_row[23]);
  37.928 +		  proginfo->endts = gmyth_util_string_to_time_val(msql_row[24]);
  37.929 +		  proginfo->recstartts = gmyth_util_string_to_time_val(msql_row[1]);
  37.930 +		  proginfo->recendts = gmyth_util_string_to_time_val(msql_row[2]);
  37.931 +		  proginfo->title = g_string_new(msql_row[3]);
  37.932 +		  proginfo->subtitle = g_string_new(msql_row[4]);
  37.933 +		  proginfo->description = g_string_new(msql_row[5]);
  37.934  
  37.935 -            proginfo->chanstr = g_string_new ( msql_row[6] );
  37.936 -            proginfo->chansign = g_string_new ( msql_row[7] );
  37.937 -            proginfo->channame = g_string_new ( msql_row[0] );
  37.938 -            proginfo->chancommfree =
  37.939 -                ( gint ) g_ascii_strtoull ( msql_row[9], NULL, 10 );
  37.940 -            proginfo->chanOutputFilters = g_string_new ( msql_row[10] );
  37.941 -            proginfo->seriesid = g_string_new ( msql_row[11] );
  37.942 -            proginfo->programid = g_string_new ( msql_row[12] );
  37.943 -            proginfo->filesize = g_ascii_strtoull ( msql_row[13], NULL, 10 );
  37.944 +		  proginfo->chanstr = g_string_new(msql_row[6]);
  37.945 +		  proginfo->chansign = g_string_new(msql_row[7]);
  37.946 +		  proginfo->channame = g_string_new(msql_row[0]);
  37.947 +		  proginfo->chancommfree =
  37.948 +			(gint) g_ascii_strtoull(msql_row[9], NULL, 10);
  37.949 +		  proginfo->chanOutputFilters = g_string_new(msql_row[10]);
  37.950 +		  proginfo->seriesid = g_string_new(msql_row[11]);
  37.951 +		  proginfo->programid = g_string_new(msql_row[12]);
  37.952 +		  proginfo->filesize = g_ascii_strtoull(msql_row[13], NULL, 10);
  37.953  
  37.954 -            proginfo->lastmodified =
  37.955 -                gmyth_util_string_to_time_val ( msql_row[14] );
  37.956 -            proginfo->stars = g_ascii_strtod ( msql_row[15], NULL );
  37.957 -            proginfo->repeat =
  37.958 -                ( gint ) g_ascii_strtoull ( msql_row[16], NULL, 10 );
  37.959 +		  proginfo->lastmodified =
  37.960 +			gmyth_util_string_to_time_val(msql_row[14]);
  37.961 +		  proginfo->stars = g_ascii_strtod(msql_row[15], NULL);
  37.962 +		  proginfo->repeat = (gint) g_ascii_strtoull(msql_row[16], NULL, 10);
  37.963  
  37.964 -            if ( msql_row[17] == NULL )
  37.965 -            {
  37.966 -                proginfo->originalAirDate = 0;
  37.967 -                proginfo->hasAirDate = FALSE;
  37.968 -            }
  37.969 -            else
  37.970 -            {
  37.971 -                proginfo->originalAirDate =
  37.972 -                    gmyth_util_string_to_time_val ( msql_row[17] );
  37.973 -                proginfo->hasAirDate = TRUE;
  37.974 -            }
  37.975 +		  if (msql_row[17] == NULL)
  37.976 +			{
  37.977 +			  proginfo->originalAirDate = 0;
  37.978 +			  proginfo->hasAirDate = FALSE;
  37.979 +			}
  37.980 +		  else
  37.981 +			{
  37.982 +			  proginfo->originalAirDate =
  37.983 +				gmyth_util_string_to_time_val(msql_row[17]);
  37.984 +			  proginfo->hasAirDate = TRUE;
  37.985 +			}
  37.986  
  37.987 -            proginfo->hostname = g_string_new ( msql_row[18] );
  37.988 -            proginfo->recordid =
  37.989 -                ( gint ) g_ascii_strtoull ( msql_row[19], NULL, 10 );
  37.990 -            proginfo->transcoder =
  37.991 -                ( gint ) g_ascii_strtoull ( msql_row[20], NULL, 10 );
  37.992 -            //proginfo->spread = -1;
  37.993 -            //proginfo->programflags = proginfo->getProgramFlags();
  37.994 +		  proginfo->hostname = g_string_new(msql_row[18]);
  37.995 +		  proginfo->recordid =
  37.996 +			(gint) g_ascii_strtoull(msql_row[19], NULL, 10);
  37.997 +		  proginfo->transcoder =
  37.998 +			(gint) g_ascii_strtoull(msql_row[20], NULL, 10);
  37.999 +		 //proginfo->spread = -1;
 37.1000 +		 //proginfo->programflags = proginfo->getProgramFlags();
 37.1001  
 37.1002 -            proginfo->recgroup = g_string_new ( msql_row[26] );
 37.1003 -            proginfo->playgroup = g_string_new ( msql_row[21] );
 37.1004 -            proginfo->recpriority =
 37.1005 -                ( gint ) g_ascii_strtoull ( msql_row[22], NULL, 10 );
 37.1006 +		  proginfo->recgroup = g_string_new(msql_row[26]);
 37.1007 +		  proginfo->playgroup = g_string_new(msql_row[21]);
 37.1008 +		  proginfo->recpriority =
 37.1009 +			(gint) g_ascii_strtoull(msql_row[22], NULL, 10);
 37.1010  
 37.1011 -            proginfo->pathname = g_string_new ( g_strdup ( msql_row[25] ) );
 37.1012 +		  proginfo->pathname = g_string_new(g_strdup(msql_row[25]));
 37.1013  
 37.1014 -            gmyth_debug ( "One program info loaded from mysql database\n" );
 37.1015 -        }
 37.1016 -    }
 37.1017 +		  gmyth_debug("One program info loaded from mysql database\n");
 37.1018 +		}
 37.1019 +	}
 37.1020  
 37.1021 -    mysql_free_result ( msql_res );
 37.1022 -    g_string_free ( query_str, TRUE );
 37.1023 -    g_free ( time_str );
 37.1024 +  mysql_free_result(msql_res);
 37.1025 +  g_string_free(query_str, TRUE);
 37.1026 +  g_free(time_str);
 37.1027  
 37.1028 -    return proginfo;
 37.1029 +  return proginfo;
 37.1030  }
 37.1031  
 37.1032  /** Retrieves the next record id.
 37.1033 @@ -682,22 +667,21 @@
 37.1034   * @return gint record_id if success, -1 otherwise 
 37.1035   */
 37.1036  static gint
 37.1037 -get_record_id_from_database ( GMythScheduler * scheduler )
 37.1038 +get_record_id_from_database(GMythScheduler * scheduler)
 37.1039  {
 37.1040 -    gint record_id;
 37.1041 +  gint record_id;
 37.1042  
 37.1043 -    assert ( scheduler );
 37.1044 +  assert(scheduler);
 37.1045  
 37.1046 -    if ( scheduler->msqlquery == NULL )
 37.1047 -    {
 37.1048 -        g_warning ( "[%s] Scheduler db connection not initialized",
 37.1049 -                    __FUNCTION__ );
 37.1050 -        return 0;
 37.1051 -    }
 37.1052 +  if (scheduler->msqlquery == NULL)
 37.1053 +	{
 37.1054 +	  g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__);
 37.1055 +	  return 0;
 37.1056 +	}
 37.1057  
 37.1058 -    record_id = mysql_insert_id ( scheduler->msqlquery->conn );
 37.1059 +  record_id = mysql_insert_id(scheduler->msqlquery->conn);
 37.1060  
 37.1061 -    return record_id;
 37.1062 +  return record_id;
 37.1063  }
 37.1064  
 37.1065  /** Notifies the backend of an update in the db.
 37.1066 @@ -705,124 +689,124 @@
 37.1067   * @param record_id the id of the modified recording.
 37.1068   */
 37.1069  static gboolean
 37.1070 -update_backend ( GMythScheduler * scheduler, gint record_id )   //fixme: put void and discovery record_id inside
 37.1071 +update_backend(GMythScheduler * scheduler, gint record_id)	//fixme: put void and discovery record_id inside
 37.1072  {
 37.1073 -    GMythSocket *socket;
 37.1074 -    GMythStringList *strlist = gmyth_string_list_new (  );
 37.1075 -    GString *datastr = g_string_new ( "RESCHEDULE_RECORDINGS " );
 37.1076 -    gboolean ret = FALSE;
 37.1077 +  GMythSocket *socket;
 37.1078 +  GMythStringList *strlist = gmyth_string_list_new();
 37.1079 +  GString *datastr = g_string_new("RESCHEDULE_RECORDINGS ");
 37.1080 +  gboolean ret = FALSE;
 37.1081  
 37.1082 -    g_string_append_printf ( datastr, "%d", record_id );
 37.1083 -    gmyth_string_list_append_string ( strlist, datastr );
 37.1084 +  g_string_append_printf(datastr, "%d", record_id);
 37.1085 +  gmyth_string_list_append_string(strlist, datastr);
 37.1086  
 37.1087 -    socket = gmyth_socket_new (  );
 37.1088 -    if ( gmyth_socket_connect_to_backend
 37.1089 -         ( socket, scheduler->backend_info->hostname,
 37.1090 -           scheduler->backend_info->port, TRUE ) )
 37.1091 -    {
 37.1092 -        ret = ( gmyth_socket_sendreceive_stringlist ( socket, strlist ) > 0 );
 37.1093 -    }
 37.1094 -    else
 37.1095 -    {
 37.1096 -        g_warning ( "[%s] Connection to backend failed!", __FUNCTION__ );
 37.1097 -    }
 37.1098 +  socket = gmyth_socket_new();
 37.1099 +  if (gmyth_socket_connect_to_backend
 37.1100 +	  (socket, scheduler->backend_info->hostname,
 37.1101 +	   scheduler->backend_info->port, TRUE))
 37.1102 +	{
 37.1103 +	  ret = (gmyth_socket_sendreceive_stringlist(socket, strlist) > 0);
 37.1104 +	}
 37.1105 +  else
 37.1106 +	{
 37.1107 +	  g_warning("[%s] Connection to backend failed!", __FUNCTION__);
 37.1108 +	}
 37.1109  
 37.1110 -    g_string_free ( datastr, TRUE );
 37.1111 -    g_object_unref ( strlist );
 37.1112 +  g_string_free(datastr, TRUE);
 37.1113 +  g_object_unref(strlist);
 37.1114  
 37.1115 -    return ret;
 37.1116 +  return ret;
 37.1117  }
 37.1118  
 37.1119  void
 37.1120 -gmyth_scheduler_recorded_info_get_preview ( RecordedInfo * info,
 37.1121 -                                            GByteArray * data )
 37.1122 +gmyth_scheduler_recorded_info_get_preview(RecordedInfo * info,
 37.1123 +										  GByteArray * data)
 37.1124  {
 37.1125  }
 37.1126  
 37.1127  void
 37.1128 -gmyth_recorded_info_free ( RecordedInfo * info )
 37.1129 +gmyth_recorded_info_free(RecordedInfo * info)
 37.1130  {
 37.1131 -    if ( info->title != NULL )
 37.1132 -        g_string_free ( info->title, TRUE );
 37.1133 +  if (info->title != NULL)
 37.1134 +	g_string_free(info->title, TRUE);
 37.1135  
 37.1136 -    if ( info->subtitle != NULL )
 37.1137 -        g_string_free ( info->subtitle, TRUE );
 37.1138 +  if (info->subtitle != NULL)
 37.1139 +	g_string_free(info->subtitle, TRUE);
 37.1140  
 37.1141 -    if ( info->description != NULL )
 37.1142 -        g_string_free ( info->description, TRUE );
 37.1143 +  if (info->description != NULL)
 37.1144 +	g_string_free(info->description, TRUE);
 37.1145  
 37.1146 -    if ( info->category != NULL )
 37.1147 -        g_string_free ( info->category, TRUE );
 37.1148 +  if (info->category != NULL)
 37.1149 +	g_string_free(info->category, TRUE);
 37.1150  
 37.1151 -    if ( info->basename != NULL )
 37.1152 -        g_string_free ( info->basename, TRUE );
 37.1153 +  if (info->basename != NULL)
 37.1154 +	g_string_free(info->basename, TRUE);
 37.1155  
 37.1156 -    if ( info != NULL )
 37.1157 -        g_free ( info->start_time );
 37.1158 +  if (info != NULL)
 37.1159 +	g_free(info->start_time);
 37.1160  
 37.1161 -    if ( info != NULL )
 37.1162 -        g_free ( info->end_time );
 37.1163 +  if (info != NULL)
 37.1164 +	g_free(info->end_time);
 37.1165  
 37.1166 -    g_free ( info );
 37.1167 +  g_free(info);
 37.1168  }
 37.1169  
 37.1170  static void
 37.1171 -free_recorded_info_item ( gpointer data, gpointer user_data )
 37.1172 +free_recorded_info_item(gpointer data, gpointer user_data)
 37.1173  {
 37.1174 -    RecordedInfo *info = ( RecordedInfo * ) data;
 37.1175 +  RecordedInfo *info = (RecordedInfo *) data;
 37.1176  
 37.1177 -    gmyth_recorded_info_free ( info );
 37.1178 +  gmyth_recorded_info_free(info);
 37.1179  }
 37.1180  
 37.1181  void
 37.1182 -gmyth_recorded_info_list_free ( GList * list )
 37.1183 +gmyth_recorded_info_list_free(GList * list)
 37.1184  {
 37.1185 -    g_return_if_fail ( list != NULL );
 37.1186 +  g_return_if_fail(list != NULL);
 37.1187  
 37.1188 -    g_list_foreach ( list, free_recorded_info_item, NULL );
 37.1189 -    g_list_free ( list );
 37.1190 +  g_list_foreach(list, free_recorded_info_item, NULL);
 37.1191 +  g_list_free(list);
 37.1192  }
 37.1193  
 37.1194  void
 37.1195 -gmyth_schedule_info_free ( ScheduleInfo * info )
 37.1196 +gmyth_schedule_info_free(ScheduleInfo * info)
 37.1197  {
 37.1198  
 37.1199 -    g_return_if_fail ( info != NULL );
 37.1200 +  g_return_if_fail(info != NULL);
 37.1201  
 37.1202 -    if ( info->title != NULL )
 37.1203 -        g_string_free ( info->title, TRUE );
 37.1204 +  if (info->title != NULL)
 37.1205 +	g_string_free(info->title, TRUE);
 37.1206  
 37.1207 -    if ( info->subtitle != NULL )
 37.1208 -        g_string_free ( info->subtitle, TRUE );
 37.1209 +  if (info->subtitle != NULL)
 37.1210 +	g_string_free(info->subtitle, TRUE);
 37.1211  
 37.1212 -    if ( info->description != NULL )
 37.1213 -        g_string_free ( info->description, TRUE );
 37.1214 +  if (info->description != NULL)
 37.1215 +	g_string_free(info->description, TRUE);
 37.1216  
 37.1217 -    if ( info->category != NULL )
 37.1218 -        g_string_free ( info->category, TRUE );
 37.1219 +  if (info->category != NULL)
 37.1220 +	g_string_free(info->category, TRUE);
 37.1221  
 37.1222 -    if ( info != NULL )
 37.1223 -        g_free ( info->start_time );
 37.1224 +  if (info != NULL)
 37.1225 +	g_free(info->start_time);
 37.1226  
 37.1227 -    if ( info != NULL )
 37.1228 -        g_free ( info->end_time );
 37.1229 +  if (info != NULL)
 37.1230 +	g_free(info->end_time);
 37.1231  
 37.1232 -    g_free ( info );
 37.1233 +  g_free(info);
 37.1234  }
 37.1235  
 37.1236  static void
 37.1237 -free_schedule_info_item ( gpointer data, gpointer user_data )
 37.1238 +free_schedule_info_item(gpointer data, gpointer user_data)
 37.1239  {
 37.1240 -    ScheduleInfo *info = ( ScheduleInfo * ) data;
 37.1241 +  ScheduleInfo *info = (ScheduleInfo *) data;
 37.1242  
 37.1243 -    gmyth_schedule_info_free ( info );
 37.1244 +  gmyth_schedule_info_free(info);
 37.1245  }
 37.1246  
 37.1247  void
 37.1248 -gmyth_schedule_info_list_free ( GList * list )
 37.1249 +gmyth_schedule_info_list_free(GList * list)
 37.1250  {
 37.1251 -    g_return_if_fail ( list != NULL );
 37.1252 +  g_return_if_fail(list != NULL);
 37.1253  
 37.1254 -    g_list_foreach ( list, free_schedule_info_item, NULL );
 37.1255 -    g_list_free ( list );
 37.1256 +  g_list_foreach(list, free_schedule_info_item, NULL);
 37.1257 +  g_list_free(list);
 37.1258  }
    38.1 --- a/gmyth/src/gmyth_scheduler.h	Wed Jun 13 18:18:42 2007 +0100
    38.2 +++ b/gmyth/src/gmyth_scheduler.h	Thu Jun 14 18:19:52 2007 +0100
    38.3 @@ -46,125 +46,125 @@
    38.4  typedef struct _GMythSchedulerClass GMythSchedulerClass;
    38.5  
    38.6  struct _GMythSchedulerClass
    38.7 -    {
    38.8 -        GObjectClass parent_class;
    38.9 +{
   38.10 +  GObjectClass parent_class;
   38.11  
   38.12 -        /* callbacks */
   38.13 -        /* no one for now */
   38.14 -    };
   38.15 + /* callbacks */
   38.16 + /* no one for now */
   38.17 +};
   38.18  
   38.19  struct _GMythScheduler
   38.20 -    {
   38.21 -        GObject parent;
   38.22 +{
   38.23 +  GObject parent;
   38.24  
   38.25 -        unsigned long recordid;
   38.26 -        unsigned long type;
   38.27 -        unsigned long search;
   38.28 -        GString *profile;
   38.29 +  unsigned long recordid;
   38.30 +  unsigned long type;
   38.31 +  unsigned long search;
   38.32 +  GString *profile;
   38.33  
   38.34 -        long dupin;
   38.35 -        long dupmethod;
   38.36 -        long autoexpire;
   38.37 -        short int autotranscode;
   38.38 -        long transcoder;
   38.39 +  long dupin;
   38.40 +  long dupmethod;
   38.41 +  long autoexpire;
   38.42 +  short int autotranscode;
   38.43 +  long transcoder;
   38.44  
   38.45 -        short int autocommflag;
   38.46 -        short int autouserjob1;
   38.47 -        short int autouserjob2;
   38.48 -        short int autouserjob3;
   38.49 -        short int autouserjob4;
   38.50 +  short int autocommflag;
   38.51 +  short int autouserjob1;
   38.52 +  short int autouserjob2;
   38.53 +  short int autouserjob3;
   38.54 +  short int autouserjob4;
   38.55  
   38.56 -        long startoffset;
   38.57 -        long endoffset;
   38.58 -        long maxepisodes;
   38.59 -        long maxnewest;
   38.60 +  long startoffset;
   38.61 +  long endoffset;
   38.62 +  long maxepisodes;
   38.63 +  long maxnewest;
   38.64  
   38.65 -        long recpriority;
   38.66 -        GString *recgroup;
   38.67 -        GString *playgroup;
   38.68 +  long recpriority;
   38.69 +  GString *recgroup;
   38.70 +  GString *playgroup;
   38.71  
   38.72 -        long prefinput;
   38.73 -        short int inactive;
   38.74 +  long prefinput;
   38.75 +  short int inactive;
   38.76  
   38.77 -        GString *search_type;
   38.78 -        GString *search_what;
   38.79 +  GString *search_type;
   38.80 +  GString *search_what;
   38.81  
   38.82 -        GMythQuery *msqlquery;
   38.83 -        GMythBackendInfo *backend_info;
   38.84 -    };
   38.85 +  GMythQuery *msqlquery;
   38.86 +  GMythBackendInfo *backend_info;
   38.87 +};
   38.88  
   38.89  typedef struct
   38.90 -    {
   38.91 -        guint schedule_id;
   38.92 -        guint program_id;
   38.93 -        guint channel_id;
   38.94 +{
   38.95 +  guint schedule_id;
   38.96 +  guint program_id;
   38.97 +  guint channel_id;
   38.98  
   38.99 -        GTimeVal *start_time;
  38.100 -        GTimeVal *end_time;
  38.101 +  GTimeVal *start_time;
  38.102 +  GTimeVal *end_time;
  38.103  
  38.104 -        GString *title;
  38.105 -        GString *subtitle;
  38.106 -        GString *description;
  38.107 -        GString *category;
  38.108 +  GString *title;
  38.109 +  GString *subtitle;
  38.110 +  GString *description;
  38.111 +  GString *category;
  38.112  
  38.113 -    } ScheduleInfo;
  38.114 +} ScheduleInfo;
  38.115  
  38.116  typedef struct
  38.117 -    {
  38.118 -        guint record_id;
  38.119 -        guint program_id;
  38.120 -        guint channel_id;
  38.121 +{
  38.122 +  guint record_id;
  38.123 +  guint program_id;
  38.124 +  guint channel_id;
  38.125  
  38.126 -        GTimeVal *start_time;
  38.127 -        GTimeVal *end_time;
  38.128 +  GTimeVal *start_time;
  38.129 +  GTimeVal *end_time;
  38.130  
  38.131 -        GString *title;
  38.132 -        GString *subtitle;
  38.133 -        GString *description;
  38.134 -        GString *category;
  38.135 +  GString *title;
  38.136 +  GString *subtitle;
  38.137 +  GString *description;
  38.138 +  GString *category;
  38.139  
  38.140 -        GString *basename;
  38.141 +  GString *basename;
  38.142  
  38.143 -        guint64 filesize;
  38.144 +  guint64 filesize;
  38.145  
  38.146 -    } RecordedInfo;
  38.147 +} RecordedInfo;
  38.148  
  38.149  
  38.150 -GType gmyth_scheduler_get_type ( void );
  38.151 +GType gmyth_scheduler_get_type(void);
  38.152  
  38.153 -GMythScheduler *gmyth_scheduler_new (  );
  38.154 -gboolean gmyth_scheduler_connect ( GMythScheduler * scheduler,
  38.155 -                                   GMythBackendInfo * backend_info );
  38.156 -gboolean gmyth_scheduler_connect_with_timeout ( GMythScheduler * scheduler,
  38.157 -                                                GMythBackendInfo * backend_info,
  38.158 -                                                guint timeout );
  38.159 -gboolean gmyth_scheduler_disconnect ( GMythScheduler * scheduler );
  38.160 +GMythScheduler *gmyth_scheduler_new();
  38.161 +gboolean gmyth_scheduler_connect(GMythScheduler * scheduler,
  38.162 +								 GMythBackendInfo * backend_info);
  38.163 +gboolean gmyth_scheduler_connect_with_timeout(GMythScheduler * scheduler,
  38.164 +											  GMythBackendInfo * backend_info,
  38.165 +											  guint timeout);
  38.166 +gboolean gmyth_scheduler_disconnect(GMythScheduler * scheduler);
  38.167  
  38.168 -gint gmyth_scheduler_get_schedule_list ( GMythScheduler * scheduler,
  38.169 -                                         GList ** sched_list );
  38.170 -gint gmyth_scheduler_get_recorded_list ( GMythScheduler * scheduler,
  38.171 -                                         GList ** rec_list );
  38.172 +gint gmyth_scheduler_get_schedule_list(GMythScheduler * scheduler,
  38.173 +									   GList ** sched_list);
  38.174 +gint gmyth_scheduler_get_recorded_list(GMythScheduler * scheduler,
  38.175 +									   GList ** rec_list);
  38.176  
  38.177 -GMythProgramInfo *gmyth_scheduler_get_recorded ( GMythScheduler * scheduler,
  38.178 -                                                 GString * channel,
  38.179 -                                                 GTimeVal * starttime );
  38.180 +GMythProgramInfo *gmyth_scheduler_get_recorded(GMythScheduler * scheduler,
  38.181 +											   GString * channel,
  38.182 +											   GTimeVal * starttime);
  38.183  
  38.184 -gint gmyth_scheduler_add_schedule ( GMythScheduler * scheduler,
  38.185 -                                    ScheduleInfo * schedule_info );
  38.186 +gint gmyth_scheduler_add_schedule(GMythScheduler * scheduler,
  38.187 +								  ScheduleInfo * schedule_info);
  38.188  
  38.189 -gint gmyth_scheduler_delete_schedule ( GMythScheduler * scheduler,
  38.190 -                                       gint record_id );
  38.191 -gint gmyth_scheduler_delete_recorded ( GMythScheduler * scheduler,
  38.192 -                                       gint record_id );
  38.193 +gint gmyth_scheduler_delete_schedule(GMythScheduler * scheduler,
  38.194 +									 gint record_id);
  38.195 +gint gmyth_scheduler_delete_recorded(GMythScheduler * scheduler,
  38.196 +									 gint record_id);
  38.197  
  38.198 -void gmyth_scheduler_recorded_info_get_preview ( RecordedInfo * info,
  38.199 -                                                 GByteArray * data );
  38.200 +void gmyth_scheduler_recorded_info_get_preview(RecordedInfo * info,
  38.201 +											   GByteArray * data);
  38.202  
  38.203 -void gmyth_recorded_info_free ( RecordedInfo * info );
  38.204 -void gmyth_schedule_info_free ( ScheduleInfo * info );
  38.205 +void gmyth_recorded_info_free(RecordedInfo * info);
  38.206 +void gmyth_schedule_info_free(ScheduleInfo * info);
  38.207  
  38.208 -void gmyth_recorded_info_list_free ( GList * list );
  38.209 -void gmyth_schedule_info_list_free ( GList * list );
  38.210 +void gmyth_recorded_info_list_free(GList * list);
  38.211 +void gmyth_schedule_info_list_free(GList * list);
  38.212  
  38.213  G_END_DECLS
  38.214  #endif /* __GMYTH_SCHEDULER_H__ */
    39.1 --- a/gmyth/src/gmyth_socket.c	Wed Jun 13 18:18:42 2007 +0100
    39.2 +++ b/gmyth/src/gmyth_socket.c	Thu Jun 14 18:19:52 2007 +0100
    39.3 @@ -75,28 +75,28 @@
    39.4  
    39.5  static gchar *local_hostname = NULL;
    39.6  
    39.7 -static void gmyth_socket_class_init ( GMythSocketClass * klass );
    39.8 -static void gmyth_socket_init ( GMythSocket * object );
    39.9 +static void gmyth_socket_class_init(GMythSocketClass * klass);
   39.10 +static void gmyth_socket_init(GMythSocket * object);
   39.11  
   39.12 -static void gmyth_socket_dispose ( GObject * object );
   39.13 -static void gmyth_socket_finalize ( GObject * object );
   39.14 +static void gmyth_socket_dispose(GObject * object);
   39.15 +static void gmyth_socket_finalize(GObject * object);
   39.16  
   39.17 -G_DEFINE_TYPE ( GMythSocket, gmyth_socket, G_TYPE_OBJECT )
   39.18 -     static void gmyth_socket_class_init ( GMythSocketClass * klass )
   39.19 +G_DEFINE_TYPE(GMythSocket, gmyth_socket, G_TYPE_OBJECT)
   39.20 +	 static void gmyth_socket_class_init(GMythSocketClass * klass)
   39.21  {
   39.22 -    GObjectClass *gobject_class;
   39.23 +  GObjectClass *gobject_class;
   39.24  
   39.25 -    gobject_class = ( GObjectClass * ) klass;
   39.26 +  gobject_class = (GObjectClass *) klass;
   39.27  
   39.28 -    gobject_class->dispose = gmyth_socket_dispose;
   39.29 -    gobject_class->finalize = gmyth_socket_finalize;
   39.30 +  gobject_class->dispose = gmyth_socket_dispose;
   39.31 +  gobject_class->finalize = gmyth_socket_finalize;
   39.32  }
   39.33  
   39.34  static void
   39.35 -gmyth_socket_init ( GMythSocket * gmyth_socket )
   39.36 +gmyth_socket_init(GMythSocket * gmyth_socket)
   39.37  {
   39.38  
   39.39 -    /* gmyth_socket->local_hostname = NULL; */
   39.40 + /* gmyth_socket->local_hostname = NULL; */
   39.41  
   39.42  }
   39.43  
   39.44 @@ -106,36 +106,36 @@
   39.45   * @return gint that represents the error number from getaddrinfo(). 
   39.46   */
   39.47  static gint
   39.48 -gmyth_socket_toaddrinfo ( const gchar * addr, gint port,
   39.49 -                          struct addrinfo **addrInfo )
   39.50 +gmyth_socket_toaddrinfo(const gchar * addr, gint port,
   39.51 +						struct addrinfo **addrInfo)
   39.52  {
   39.53 -    struct addrinfo hints;
   39.54 -    gchar *portStr = NULL;
   39.55 -    gint errorn = EADDRNOTAVAIL;
   39.56 +  struct addrinfo hints;
   39.57 +  gchar *portStr = NULL;
   39.58 +  gint errorn = EADDRNOTAVAIL;
   39.59  
   39.60 -    g_return_val_if_fail ( addr != NULL, -1 );
   39.61 +  g_return_val_if_fail(addr != NULL, -1);
   39.62  
   39.63 -    memset ( &hints, 0, sizeof ( struct addrinfo ) );
   39.64 -    hints.ai_family = AF_INET;
   39.65 -    hints.ai_socktype = SOCK_STREAM;
   39.66 -    /* hints.ai_flags = AI_NUMERICHOST; */
   39.67 +  memset(&hints, 0, sizeof(struct addrinfo));
   39.68 +  hints.ai_family = AF_INET;
   39.69 +  hints.ai_socktype = SOCK_STREAM;
   39.70 + /* hints.ai_flags = AI_NUMERICHOST; */
   39.71  
   39.72 -    if ( port != -1 )
   39.73 -        portStr = g_strdup_printf ( "%d", port );
   39.74 -    else
   39.75 -        portStr = NULL;
   39.76 +  if (port != -1)
   39.77 +	portStr = g_strdup_printf("%d", port);
   39.78 +  else
   39.79 +	portStr = NULL;
   39.80  
   39.81 -    gmyth_debug ( "Getting name resolution for: %s, %d\n", addr, port );
   39.82 +  gmyth_debug("Getting name resolution for: %s, %d\n", addr, port);
   39.83  
   39.84 -    if ( ( errorn = getaddrinfo ( addr, portStr, &hints, addrInfo ) ) != 0 )
   39.85 -    {
   39.86 -        gmyth_debug ( "[%s] Socket ERROR: %s\n", __FUNCTION__,
   39.87 -                      gai_strerror ( errorn ) );
   39.88 -    }
   39.89 +  if ((errorn = getaddrinfo(addr, portStr, &hints, addrInfo)) != 0)
   39.90 +	{
   39.91 +	  gmyth_debug("[%s] Socket ERROR: %s\n", __FUNCTION__,
   39.92 +				  gai_strerror(errorn));
   39.93 +	}
   39.94  
   39.95 -    g_free ( portStr );
   39.96 +  g_free(portStr);
   39.97  
   39.98 -    return errorn;
   39.99 +  return errorn;
  39.100  }
  39.101  
  39.102  /*
  39.103 @@ -160,85 +160,84 @@
  39.104   * @return List with all the local net interfaces. 
  39.105   */
  39.106  GList *
  39.107 -gmyth_socket_get_local_addrs ( GList * current_connections )
  39.108 +gmyth_socket_get_local_addrs(GList * current_connections)
  39.109  {
  39.110  
  39.111 -    GList *local_addrs = NULL;
  39.112 -    FILE *fd;
  39.113 -    gint s;
  39.114 -    gchar buffer[256 + 1];
  39.115 -    gchar ifaddr[20 + 1];
  39.116 -    gchar *ifname;
  39.117 -    gchar *sep;
  39.118 +  GList *local_addrs = NULL;
  39.119 +  FILE *fd;
  39.120 +  gint s;
  39.121 +  gchar buffer[256 + 1];
  39.122 +  gchar ifaddr[20 + 1];
  39.123 +  gchar *ifname;
  39.124 +  gchar *sep;
  39.125  
  39.126 -    s = socket ( AF_INET, SOCK_DGRAM, 0 );
  39.127 -    if ( s < 0 )
  39.128 -        return 0;
  39.129 -    fd = fopen ( PATH_PROC_NET_DEV, "r" );
  39.130 -    fgets ( buffer, sizeof ( buffer ) - 1, fd );
  39.131 -    fgets ( buffer, sizeof ( buffer ) - 1, fd );
  39.132 -    while ( !feof ( fd ) )
  39.133 -    {
  39.134 -        ifname = buffer;
  39.135 +  s = socket(AF_INET, SOCK_DGRAM, 0);
  39.136 +  if (s < 0)
  39.137 +	return 0;
  39.138 +  fd = fopen(PATH_PROC_NET_DEV, "r");
  39.139 +  fgets(buffer, sizeof(buffer) - 1, fd);
  39.140 +  fgets(buffer, sizeof(buffer) - 1, fd);
  39.141 +  while (!feof(fd))
  39.142 +	{
  39.143 +	  ifname = buffer;
  39.144  
  39.145 -        if ( fgets ( buffer, sizeof ( buffer ) - 1, fd ) == NULL )
  39.146 -            break;
  39.147 -        sep = strrchr ( buffer, ':' );
  39.148 -        if ( sep )
  39.149 -            *sep = 0;
  39.150 -        while ( *ifname == ' ' )
  39.151 -            ifname++;
  39.152 -        struct ifreq req;
  39.153 +	  if (fgets(buffer, sizeof(buffer) - 1, fd) == NULL)
  39.154 +		break;
  39.155 +	  sep = strrchr(buffer, ':');
  39.156 +	  if (sep)
  39.157 +		*sep = 0;
  39.158 +	  while (*ifname == ' ')
  39.159 +		ifname++;
  39.160 +	  struct ifreq req;
  39.161  
  39.162 -        strcpy ( req.ifr_name, ifname );
  39.163 -        if ( ioctl ( s, SIOCGIFFLAGS, &req ) < 0 )
  39.164 -            continue;
  39.165 -        if ( !( req.ifr_flags & IFF_UP ) )
  39.166 -            continue;
  39.167 -        if ( req.ifr_flags & IFF_LOOPBACK )
  39.168 -            continue;
  39.169 -        if ( ioctl ( s, SIOCGIFADDR, &req ) < 0 )
  39.170 -            continue;
  39.171 -        g_strlcpy ( ifaddr,
  39.172 -                    inet_ntoa ( ( ( struct sockaddr_in * ) &req.ifr_addr )->
  39.173 -                                sin_addr ), sizeof ( struct ifaddr ) - 1 );
  39.174 -        local_addrs = g_list_append ( local_addrs, g_strdup ( ifaddr ) );
  39.175 +	  strcpy(req.ifr_name, ifname);
  39.176 +	  if (ioctl(s, SIOCGIFFLAGS, &req) < 0)
  39.177 +		continue;
  39.178 +	  if (!(req.ifr_flags & IFF_UP))
  39.179 +		continue;
  39.180 +	  if (req.ifr_flags & IFF_LOOPBACK)
  39.181 +		continue;
  39.182 +	  if (ioctl(s, SIOCGIFADDR, &req) < 0)
  39.183 +		continue;
  39.184 +	  g_strlcpy(ifaddr,
  39.185 +				inet_ntoa(((struct sockaddr_in *) &req.ifr_addr)->
  39.186 +						  sin_addr), sizeof(struct ifaddr) - 1);
  39.187 +	  local_addrs = g_list_append(local_addrs, g_strdup(ifaddr));
  39.188  
  39.189 -        gmyth_debug
  39.190 -            ( "( from the /proc/net/dev) Interface name: %s, address: %s\n",
  39.191 -              ifname, ifaddr );
  39.192 -    }
  39.193 -    fclose ( fd );
  39.194 -    close ( s );
  39.195 -    return local_addrs;
  39.196 +	  gmyth_debug
  39.197 +		("( from the /proc/net/dev) Interface name: %s, address: %s\n",
  39.198 +		 ifname, ifaddr);
  39.199 +	}
  39.200 +  fclose(fd);
  39.201 +  close(s);
  39.202 +  return local_addrs;
  39.203  }
  39.204  
  39.205  /**
  39.206   * Get only the local addresses from the primary interface
  39.207   */
  39.208  gchar *
  39.209 -gmyth_socket_get_primary_addr ( void )
  39.210 +gmyth_socket_get_primary_addr(void)
  39.211  {
  39.212 -    gchar *if_eth0 = g_new0 ( gchar, sizeof ( struct ifaddr ) - 1 );
  39.213 -    GList *if_tmp = NULL;
  39.214 +  gchar *if_eth0 = g_new0(gchar, sizeof(struct ifaddr) - 1);
  39.215 +  GList *if_tmp = NULL;
  39.216  
  39.217 -    GList *interfs = gmyth_socket_get_local_addrs ( NULL );
  39.218 +  GList *interfs = gmyth_socket_get_local_addrs(NULL);
  39.219  
  39.220 -    if ( interfs != NULL && ( g_list_length ( interfs ) > 0 ) )
  39.221 -    {
  39.222 -        // get the first occurrence (primary interface) 
  39.223 -        if_tmp = g_list_first ( interfs );
  39.224 +  if (interfs != NULL && (g_list_length(interfs) > 0))
  39.225 +	{
  39.226 +	 // get the first occurrence (primary interface) 
  39.227 +	  if_tmp = g_list_first(interfs);
  39.228  
  39.229 -        if ( if_tmp != NULL )
  39.230 -            g_strlcpy ( if_eth0, ( gchar * ) if_tmp->data,
  39.231 -                        sizeof ( struct ifaddr ) - 1 );
  39.232 +	  if (if_tmp != NULL)
  39.233 +		g_strlcpy(if_eth0, (gchar *) if_tmp->data, sizeof(struct ifaddr) - 1);
  39.234  
  39.235 -    }
  39.236 +	}
  39.237  
  39.238 -    if ( interfs != NULL )
  39.239 -        g_list_free ( interfs );
  39.240 +  if (interfs != NULL)
  39.241 +	g_list_free(interfs);
  39.242  
  39.243 -    return if_eth0;
  39.244 +  return if_eth0;
  39.245  }
  39.246  
  39.247  /** This function retrieves the local hostname of the 
  39.248 @@ -247,134 +246,134 @@
  39.249   * @return GString* get local hostname.
  39.250   */
  39.251  GString *
  39.252 -gmyth_socket_get_local_hostname ( void )
  39.253 +gmyth_socket_get_local_hostname(void)
  39.254  {
  39.255 -    char hname[50];
  39.256 -    gint res = gethostname ( hname, 50 );
  39.257 +  char hname[50];
  39.258 +  gint res = gethostname(hname, 50);
  39.259  
  39.260 -    if ( res == -1 )
  39.261 -    {
  39.262 -        gmyth_debug ( "Error while getting hostname" );
  39.263 -        return g_string_new ( "default" );
  39.264 -    }
  39.265 +  if (res == -1)
  39.266 +	{
  39.267 +	  gmyth_debug("Error while getting hostname");
  39.268 +	  return g_string_new("default");
  39.269 +	}
  39.270  
  39.271 -    return g_string_new ( hname );
  39.272 +  return g_string_new(hname);
  39.273  
  39.274  #if 0
  39.275 -    GString *str = NULL;
  39.276 +  GString *str = NULL;
  39.277  
  39.278 -    if ( local_hostname != NULL && strlen ( local_hostname ) > 0 )
  39.279 -        return g_string_new ( local_hostname );
  39.280 +  if (local_hostname != NULL && strlen(local_hostname) > 0)
  39.281 +	return g_string_new(local_hostname);
  39.282  
  39.283 -    gchar *localaddr = NULL;
  39.284 -    gboolean found_addr = FALSE;
  39.285 -    struct addrinfo *addr_info_data = NULL, *addr_info0 = NULL;
  39.286 -    struct sockaddr_in *sa = NULL;
  39.287 -    gchar localhostname[MAXHOSTNAMELEN];
  39.288 +  gchar *localaddr = NULL;
  39.289 +  gboolean found_addr = FALSE;
  39.290 +  struct addrinfo *addr_info_data = NULL, *addr_info0 = NULL;
  39.291 +  struct sockaddr_in *sa = NULL;
  39.292 +  gchar localhostname[MAXHOSTNAMELEN];
  39.293  
  39.294  
  39.295 -    if ( gethostname ( localhostname, MAXHOSTNAMELEN ) != 0 )
  39.296 -    {
  39.297 -        gmyth_debug ( "Error on gethostname" );
  39.298 -    }
  39.299 -    localhostname[MAXHOSTNAMELEN - 1] = 0;
  39.300 +  if (gethostname(localhostname, MAXHOSTNAMELEN) != 0)
  39.301 +	{
  39.302 +	  gmyth_debug("Error on gethostname");
  39.303 +	}
  39.304 +  localhostname[MAXHOSTNAMELEN - 1] = 0;
  39.305  
  39.306 -    gint err = gmyth_socket_toaddrinfo ( localhostname, -1, &addr_info_data );
  39.307 +  gint err = gmyth_socket_toaddrinfo(localhostname, -1, &addr_info_data);
  39.308  
  39.309 -    if ( err == EADDRNOTAVAIL )
  39.310 -    {
  39.311 -        gmyth_debug ( "[%s] Address (%s) not available. (reason = %d)\n",
  39.312 -                      __FUNCTION__, localhostname, err );
  39.313 -        return str;
  39.314 -    }
  39.315 +  if (err == EADDRNOTAVAIL)
  39.316 +	{
  39.317 +	  gmyth_debug("[%s] Address (%s) not available. (reason = %d)\n",
  39.318 +				  __FUNCTION__, localhostname, err);
  39.319 +	  return str;
  39.320 +	}
  39.321  
  39.322 -    g_mutex_lock ( gmyth_socket->mutex );
  39.323 +  g_mutex_lock(gmyth_socket->mutex);
  39.324  
  39.325 -    addr_info0 = addr_info_data;
  39.326 +  addr_info0 = addr_info_data;
  39.327  
  39.328 -    while ( addr_info0 != NULL && addr_info0->ai_addr != NULL &&
  39.329 -            ( sa = ( struct sockaddr_in * ) addr_info0->ai_addr ) != NULL
  39.330 -            && !found_addr )
  39.331 -    {
  39.332 -        localaddr = inet_ntoa ( sa->sin_addr );
  39.333 +  while (addr_info0 != NULL && addr_info0->ai_addr != NULL &&
  39.334 +		 (sa = (struct sockaddr_in *) addr_info0->ai_addr) != NULL
  39.335 +		 && !found_addr)
  39.336 +	{
  39.337 +	  localaddr = inet_ntoa(sa->sin_addr);
  39.338  
  39.339 -        if ( localaddr != NULL && ( g_strrstr ( localaddr, "127" ) == NULL ) )
  39.340 -        {
  39.341 -            str = g_string_new ( localaddr );
  39.342 -            found_addr = TRUE;
  39.343 -            g_free ( localaddr );
  39.344 -            break;
  39.345 -        }
  39.346 -        /*
  39.347 -           if (localaddr != NULL) {
  39.348 -           g_free (localaddr);
  39.349 -           localaddr = NULL;
  39.350 -           }
  39.351 -         */
  39.352 +	  if (localaddr != NULL && (g_strrstr(localaddr, "127") == NULL))
  39.353 +		{
  39.354 +		  str = g_string_new(localaddr);
  39.355 +		  found_addr = TRUE;
  39.356 +		  g_free(localaddr);
  39.357 +		  break;
  39.358 +		}
  39.359 +	 /*
  39.360 +	    if (localaddr != NULL) {
  39.361 +	    g_free (localaddr);
  39.362 +	    localaddr = NULL;
  39.363 +	    }
  39.364 +	  */
  39.365  
  39.366 -        addr_info0 = addr_info0->ai_next;
  39.367 -    };
  39.368 +	  addr_info0 = addr_info0->ai_next;
  39.369 +	};
  39.370  
  39.371 -    freeaddrinfo ( addr_info_data );
  39.372 -    addr_info_data = NULL;
  39.373 +  freeaddrinfo(addr_info_data);
  39.374 +  addr_info_data = NULL;
  39.375  
  39.376 -    if ( found_addr == FALSE )
  39.377 -    {
  39.378 -        gchar *prim_addr = gmyth_socket_get_primary_addr (  );
  39.379 +  if (found_addr == FALSE)
  39.380 +	{
  39.381 +	  gchar *prim_addr = gmyth_socket_get_primary_addr();
  39.382  
  39.383 -        if ( prim_addr != NULL )
  39.384 -        {
  39.385 -            gmyth_debug
  39.386 -                ( "[%s] Could not determine the local alphanumerical hostname. Setting to %s\n",
  39.387 -                  __FUNCTION__, prim_addr );
  39.388 +	  if (prim_addr != NULL)
  39.389 +		{
  39.390 +		  gmyth_debug
  39.391 +			("[%s] Could not determine the local alphanumerical hostname. Setting to %s\n",
  39.392 +			 __FUNCTION__, prim_addr);
  39.393  
  39.394 -            str = g_string_new ( prim_addr );
  39.395 -            g_free ( prim_addr );
  39.396 -        }
  39.397 -        else
  39.398 -        {
  39.399 -            str = g_string_new ( localhostname );
  39.400 -        }
  39.401 -    }
  39.402 +		  str = g_string_new(prim_addr);
  39.403 +		  g_free(prim_addr);
  39.404 +		}
  39.405 +	  else
  39.406 +		{
  39.407 +		  str = g_string_new(localhostname);
  39.408 +		}
  39.409 +	}
  39.410  
  39.411 -    g_mutex_unlock ( gmyth_socket->mutex );
  39.412 +  g_mutex_unlock(gmyth_socket->mutex);
  39.413  
  39.414 -    if ( str != NULL && str->str != NULL )
  39.415 -        local_hostname = g_strdup ( str->str );
  39.416 +  if (str != NULL && str->str != NULL)
  39.417 +	local_hostname = g_strdup(str->str);
  39.418  
  39.419 -    return str;
  39.420 +  return str;
  39.421  #endif
  39.422  }
  39.423  
  39.424  static void
  39.425 -gmyth_socket_dispose ( GObject * object )
  39.426 +gmyth_socket_dispose(GObject * object)
  39.427  {
  39.428 -    GMythSocket *gmyth_socket = GMYTH_SOCKET ( object );
  39.429 +  GMythSocket *gmyth_socket = GMYTH_SOCKET(object);
  39.430  
  39.431 -    /* disconnect socket */
  39.432 -    gmyth_socket_close_connection ( gmyth_socket );
  39.433 + /* disconnect socket */
  39.434 +  gmyth_socket_close_connection(gmyth_socket);
  39.435  
  39.436 -    g_free ( gmyth_socket->hostname );
  39.437 +  g_free(gmyth_socket->hostname);
  39.438  
  39.439 -    g_free ( local_hostname );
  39.440 +  g_free(local_hostname);
  39.441  
  39.442 -    local_hostname = NULL;
  39.443 +  local_hostname = NULL;
  39.444  
  39.445 -    if ( gmyth_socket->mutex != NULL )
  39.446 -    {
  39.447 -        g_mutex_free ( gmyth_socket->mutex );
  39.448 -        gmyth_socket->mutex = NULL;
  39.449 -    }
  39.450 +  if (gmyth_socket->mutex != NULL)
  39.451 +	{
  39.452 +	  g_mutex_free(gmyth_socket->mutex);
  39.453 +	  gmyth_socket->mutex = NULL;
  39.454 +	}
  39.455  
  39.456 -    G_OBJECT_CLASS ( gmyth_socket_parent_class )->dispose ( object );
  39.457 +  G_OBJECT_CLASS(gmyth_socket_parent_class)->dispose(object);
  39.458  }
  39.459  
  39.460  static void
  39.461 -gmyth_socket_finalize ( GObject * object )
  39.462 +gmyth_socket_finalize(GObject * object)
  39.463  {
  39.464 -    g_signal_handlers_destroy ( object );
  39.465 +  g_signal_handlers_destroy(object);
  39.466  
  39.467 -    G_OBJECT_CLASS ( gmyth_socket_parent_class )->finalize ( object );
  39.468 +  G_OBJECT_CLASS(gmyth_socket_parent_class)->finalize(object);
  39.469  }
  39.470  
  39.471  /** Creates a new instance of GMythSocket.
  39.472 @@ -382,16 +381,16 @@
  39.473   * @return a new instance of GMythSocket.
  39.474   */
  39.475  GMythSocket *
  39.476 -gmyth_socket_new (  )
  39.477 +gmyth_socket_new()
  39.478  {
  39.479 -    GMythSocket *gmyth_socket =
  39.480 -        GMYTH_SOCKET ( g_object_new ( GMYTH_SOCKET_TYPE, NULL ) );
  39.481 +  GMythSocket *gmyth_socket =
  39.482 +	GMYTH_SOCKET(g_object_new(GMYTH_SOCKET_TYPE, NULL));
  39.483  
  39.484 -    gmyth_socket->mythtv_version = MYTHTV_VERSION_DEFAULT;
  39.485 +  gmyth_socket->mythtv_version = MYTHTV_VERSION_DEFAULT;
  39.486  
  39.487 -    gmyth_socket->mutex = g_mutex_new (  );
  39.488 +  gmyth_socket->mutex = g_mutex_new();
  39.489  
  39.490 -    return gmyth_socket;
  39.491 +  return gmyth_socket;
  39.492  }
  39.493  
  39.494  /** Try to open an asynchronous connection to the MythTV backend.
  39.495 @@ -404,103 +403,103 @@
  39.496   * @return Any numerical value below 0, if an error had been found.
  39.497   */
  39.498  static gint
  39.499 -gmyth_socket_try_connect ( gint fd, struct sockaddr *remote, gint len,
  39.500 -                           struct timeval *timeout, gint * err )
  39.501 +gmyth_socket_try_connect(gint fd, struct sockaddr *remote, gint len,
  39.502 +						 struct timeval *timeout, gint * err)
  39.503  {
  39.504 -    /*g_return_val_if_fail( timeout != NULL, 0 ); */
  39.505 -    gint saveflags, ret, back_err;
  39.506 + /*g_return_val_if_fail( timeout != NULL, 0 ); */
  39.507 +  gint saveflags, ret, back_err;
  39.508  
  39.509 -    fd_set fd_w;
  39.510 +  fd_set fd_w;
  39.511  
  39.512 -    saveflags = fcntl ( fd, F_GETFL, 0 );
  39.513 -    if ( saveflags < 0 )
  39.514 -    {
  39.515 -        gmyth_debug ( "[%s] Problems when getting socket flags on fcntl.\n",
  39.516 -                      __FUNCTION__ );
  39.517 -        *err = errno;
  39.518 -        return -1;
  39.519 -    }
  39.520 +  saveflags = fcntl(fd, F_GETFL, 0);
  39.521 +  if (saveflags < 0)
  39.522 +	{
  39.523 +	  gmyth_debug("[%s] Problems when getting socket flags on fcntl.\n",
  39.524 +				  __FUNCTION__);
  39.525 +	  *err = errno;
  39.526 +	  return -1;
  39.527 +	}
  39.528  
  39.529 -    /* Set non blocking */
  39.530 -    if ( fcntl ( fd, F_SETFL, saveflags | O_NONBLOCK ) < 0 )
  39.531 -    {
  39.532 -        gmyth_debug ( "[%s] Problems when setting non-blocking using fcntl.\n",
  39.533 -                      __FUNCTION__ );
  39.534 -        *err = errno;
  39.535 -        return -1;
  39.536 -    }
  39.537 + /* Set non blocking */
  39.538 +  if (fcntl(fd, F_SETFL, saveflags | O_NONBLOCK) < 0)
  39.539 +	{
  39.540 +	  gmyth_debug("[%s] Problems when setting non-blocking using fcntl.\n",
  39.541 +				  __FUNCTION__);
  39.542 +	  *err = errno;
  39.543 +	  return -1;
  39.544 +	}
  39.545  
  39.546 -    /* This will return immediately */
  39.547 -    *err = connect ( fd, remote, len );
  39.548 -    back_err = errno;
  39.549 + /* This will return immediately */
  39.550 +  *err = connect(fd, remote, len);
  39.551 +  back_err = errno;
  39.552  
  39.553 -    /* restore flags */
  39.554 -    if ( fcntl ( fd, F_SETFL, saveflags ) < 0 )
  39.555 -    {
  39.556 -        gmyth_debug
  39.557 -            ( "[%s] Problems when trying to restore flags with fcntl.\n",
  39.558 -              __FUNCTION__ );
  39.559 -        *err = errno;
  39.560 -        return -1;
  39.561 -    }
  39.562 + /* restore flags */
  39.563 +  if (fcntl(fd, F_SETFL, saveflags) < 0)
  39.564 +	{
  39.565 +	  gmyth_debug
  39.566 +		("[%s] Problems when trying to restore flags with fcntl.\n",
  39.567 +		 __FUNCTION__);
  39.568 +	  *err = errno;
  39.569 +	  return -1;
  39.570 +	}
  39.571  
  39.572 -    /* return unless the connection was successful or the connect is
  39.573 -       still in progress. */
  39.574 -    if ( *err < 0 && back_err != EINPROGRESS )
  39.575 -    {
  39.576 -        gmyth_debug
  39.577 -            ( "[%s] Connection unsucessfully (it is not in progress).\n",
  39.578 -              __FUNCTION__ );
  39.579 -        *err = errno;
  39.580 -        return -1;
  39.581 -    }
  39.582 + /* return unless the connection was successful or the connect is
  39.583 +    still in progress. */
  39.584 +  if (*err < 0 && back_err != EINPROGRESS)
  39.585 +	{
  39.586 +	  gmyth_debug
  39.587 +		("[%s] Connection unsucessfully (it is not in progress).\n",
  39.588 +		 __FUNCTION__);
  39.589 +	  *err = errno;
  39.590 +	  return -1;
  39.591 +	}
  39.592  
  39.593 -    FD_ZERO ( &fd_w );
  39.594 -    FD_SET ( fd, &fd_w );
  39.595 +  FD_ZERO(&fd_w);
  39.596 +  FD_SET(fd, &fd_w);
  39.597  
  39.598 -    *err = select ( FD_SETSIZE, NULL, &fd_w, NULL, timeout );
  39.599 -    if ( *err < 0 )
  39.600 -    {
  39.601 -        gmyth_debug ( "[%s] Connection unsucessfull (timed out).\n",
  39.602 -                      __FUNCTION__ );
  39.603 -        *err = errno;
  39.604 -        return -1;
  39.605 -    }
  39.606 +  *err = select(FD_SETSIZE, NULL, &fd_w, NULL, timeout);
  39.607 +  if (*err < 0)
  39.608 +	{
  39.609 +	  gmyth_debug("[%s] Connection unsucessfull (timed out).\n",
  39.610 +				  __FUNCTION__);
  39.611 +	  *err = errno;
  39.612 +	  return -1;
  39.613 +	}
  39.614  
  39.615 -    /* 0 means it timeout out & no fds changed */
  39.616 -    if ( *err == 0 )
  39.617 -    {
  39.618 -        gmyth_debug
  39.619 -            ( "[%s] Connection unsucessfull [%d] - 0 means it timeout out & no fds changed\n",
  39.620 -              __FUNCTION__, *err );
  39.621 -        close ( fd );
  39.622 -        *err = ETIMEDOUT;
  39.623 -        return -1;
  39.624 -    }
  39.625 + /* 0 means it timeout out & no fds changed */
  39.626 +  if (*err == 0)
  39.627 +	{
  39.628 +	  gmyth_debug
  39.629 +		("[%s] Connection unsucessfull [%d] - 0 means it timeout out & no fds changed\n",
  39.630 +		 __FUNCTION__, *err);
  39.631 +	  close(fd);
  39.632 +	  *err = ETIMEDOUT;
  39.633 +	  return -1;
  39.634 +	}
  39.635  
  39.636 -    /* Get the return code from the connect */
  39.637 -    len = sizeof ( ret );
  39.638 -    *err = getsockopt ( fd, SOL_SOCKET, SO_ERROR, &ret, ( socklen_t * ) & len );
  39.639 + /* Get the return code from the connect */
  39.640 +  len = sizeof(ret);
  39.641 +  *err = getsockopt(fd, SOL_SOCKET, SO_ERROR, &ret, (socklen_t *) & len);
  39.642  
  39.643 -    if ( *err < 0 )
  39.644 -    {
  39.645 -        gmyth_debug ( "[%s] Connection unsucessfull.\n", __FUNCTION__ );
  39.646 -        *err = errno;
  39.647 -        return -1;
  39.648 -    }
  39.649 +  if (*err < 0)
  39.650 +	{
  39.651 +	  gmyth_debug("[%s] Connection unsucessfull.\n", __FUNCTION__);
  39.652 +	  *err = errno;
  39.653 +	  return -1;
  39.654 +	}
  39.655  
  39.656 -    /* ret=0 means success, otherwise it contains the errno */
  39.657 -    if ( ret )
  39.658 -    {
  39.659 -        gmyth_debug
  39.660 -            ( "[%s] Connection unsucessfull - Couldn't connect to remote host!!!\n",
  39.661 -              __FUNCTION__ );
  39.662 -        *err = ret;
  39.663 -        return -1;
  39.664 -    }
  39.665 + /* ret=0 means success, otherwise it contains the errno */
  39.666 +  if (ret)
  39.667 +	{
  39.668 +	  gmyth_debug
  39.669 +		("[%s] Connection unsucessfull - Couldn't connect to remote host!!!\n",
  39.670 +		 __FUNCTION__);
  39.671 +	  *err = ret;
  39.672 +	  return -1;
  39.673 +	}
  39.674  
  39.675 -    *err = 0;
  39.676 -    return 0;
  39.677 +  *err = 0;
  39.678 +  return 0;
  39.679  }
  39.680  
  39.681  /** Connects to the backend.
  39.682 @@ -513,141 +512,139 @@
  39.683  
  39.684  
  39.685  gboolean
  39.686 -gmyth_socket_connect ( GMythSocket * gmyth_socket,
  39.687 -                       const gchar * hostname, gint port )
  39.688 +gmyth_socket_connect(GMythSocket * gmyth_socket,
  39.689 +					 const gchar * hostname, gint port)
  39.690  {
  39.691 -    return gmyth_socket_connect_with_timeout ( gmyth_socket, hostname, port,
  39.692 -                                               0 );
  39.693 +  return gmyth_socket_connect_with_timeout(gmyth_socket, hostname, port, 0);
  39.694  }
  39.695  
  39.696  gboolean
  39.697 -gmyth_socket_connect_with_timeout ( GMythSocket * gmyth_socket,
  39.698 -                                    const gchar * hostname, gint port,
  39.699 -                                    guint timeout )
  39.700 +gmyth_socket_connect_with_timeout(GMythSocket * gmyth_socket,
  39.701 +								  const gchar * hostname, gint port,
  39.702 +								  guint timeout)
  39.703  {
  39.704 -    struct addrinfo *addr_info_data = NULL, *addr_info0 = NULL;
  39.705 -    struct linger ling;
  39.706 -    gchar *tmp_str;
  39.707 -    gint ret_code = 0;          /* -1 */
  39.708 +  struct addrinfo *addr_info_data = NULL, *addr_info0 = NULL;
  39.709 +  struct linger ling;
  39.710 +  gchar *tmp_str;
  39.711 +  gint ret_code = 0;			/* -1 */
  39.712  
  39.713 -    /* FIXME: add as function parameter */
  39.714 -    gint err;
  39.715 -    gint errno;
  39.716 -    gboolean ret = TRUE;
  39.717 + /* FIXME: add as function parameter */
  39.718 +  gint err;
  39.719 +  gint errno;
  39.720 +  gboolean ret = TRUE;
  39.721  
  39.722 -    gmyth_debug ( "CONNECTING %s:%d", hostname, port );
  39.723 +  gmyth_debug("CONNECTING %s:%d", hostname, port);
  39.724  
  39.725 -    if ( hostname == NULL )
  39.726 -        gmyth_debug ( "Invalid hostname parameter!\n" );
  39.727 +  if (hostname == NULL)
  39.728 +	gmyth_debug("Invalid hostname parameter!\n");
  39.729  
  39.730 -    /* store hostname and port number */
  39.731 -    gmyth_debug ( "CONNECTING %s:%d", hostname, port );
  39.732 + /* store hostname and port number */
  39.733 +  gmyth_debug("CONNECTING %s:%d", hostname, port);
  39.734  
  39.735 -    errno = gmyth_socket_toaddrinfo ( hostname, port, &addr_info_data );
  39.736 +  errno = gmyth_socket_toaddrinfo(hostname, port, &addr_info_data);
  39.737  
  39.738 -    g_return_val_if_fail ( addr_info_data != NULL && hostname != NULL, FALSE );
  39.739 +  g_return_val_if_fail(addr_info_data != NULL && hostname != NULL, FALSE);
  39.740  
  39.741 -    /* hack to avoid deleting the hostname when
  39.742 -     * gmyth_socket->hostname == hostname */
  39.743 -    tmp_str = gmyth_socket->hostname;
  39.744 + /* hack to avoid deleting the hostname when
  39.745 +  * gmyth_socket->hostname == hostname */
  39.746 +  tmp_str = gmyth_socket->hostname;
  39.747  
  39.748 -    gmyth_socket->hostname = g_strdup ( hostname );
  39.749 -    gmyth_socket->port = port;
  39.750 +  gmyth_socket->hostname = g_strdup(hostname);
  39.751 +  gmyth_socket->port = port;
  39.752  
  39.753 -    g_free ( tmp_str );
  39.754 +  g_free(tmp_str);
  39.755  
  39.756 -    for ( addr_info0 = addr_info_data; addr_info0;
  39.757 -          addr_info0 = addr_info_data->ai_next )
  39.758 -    {
  39.759 -        /* init socket descriptor */
  39.760 -        gmyth_socket->sd =
  39.761 -            socket ( addr_info0->ai_family, addr_info0->ai_socktype,
  39.762 -                     addr_info0->ai_protocol );
  39.763 +  for (addr_info0 = addr_info_data; addr_info0;
  39.764 +	   addr_info0 = addr_info_data->ai_next)
  39.765 +	{
  39.766 +	 /* init socket descriptor */
  39.767 +	  gmyth_socket->sd =
  39.768 +		socket(addr_info0->ai_family, addr_info0->ai_socktype,
  39.769 +			   addr_info0->ai_protocol);
  39.770  
  39.771 -        if ( gmyth_socket->sd < 0 )
  39.772 -            continue;
  39.773 +	  if (gmyth_socket->sd < 0)
  39.774 +		continue;
  39.775  
  39.776 -        struct timeval *timeout_val = g_new0 ( struct timeval, 1 );
  39.777 +	  struct timeval *timeout_val = g_new0(struct timeval, 1);
  39.778  
  39.779 -        if ( timeout != 0 )
  39.780 -        {
  39.781 -            timeout_val->tv_sec = timeout;
  39.782 -            timeout_val->tv_usec = 0;
  39.783 -        }
  39.784 -        else
  39.785 -        {
  39.786 -            timeout_val->tv_sec = 5;
  39.787 -            timeout_val->tv_usec = 100;
  39.788 -        }
  39.789 +	  if (timeout != 0)
  39.790 +		{
  39.791 +		  timeout_val->tv_sec = timeout;
  39.792 +		  timeout_val->tv_usec = 0;
  39.793 +		}
  39.794 +	  else
  39.795 +		{
  39.796 +		  timeout_val->tv_sec = 5;
  39.797 +		  timeout_val->tv_usec = 100;
  39.798 +		}
  39.799  
  39.800 -        if ( gmyth_socket_try_connect
  39.801 -             ( gmyth_socket->sd, ( struct sockaddr * ) addr_info0->ai_addr,
  39.802 -               addr_info0->ai_addrlen, timeout_val, &ret_code ) < 0 )
  39.803 -        {
  39.804 -            gmyth_debug ( "[%s] Error connecting to backend!\n", __FUNCTION__ );
  39.805 -            if ( ret_code == ETIMEDOUT )
  39.806 -                gmyth_debug ( "[%s]\tBackend host unreachable!\n",
  39.807 -                              __FUNCTION__ );
  39.808 +	  if (gmyth_socket_try_connect
  39.809 +		  (gmyth_socket->sd, (struct sockaddr *) addr_info0->ai_addr,
  39.810 +		   addr_info0->ai_addrlen, timeout_val, &ret_code) < 0)
  39.811 +		{
  39.812 +		  gmyth_debug("[%s] Error connecting to backend!\n", __FUNCTION__);
  39.813 +		  if (ret_code == ETIMEDOUT)
  39.814 +			gmyth_debug("[%s]\tBackend host unreachable!\n", __FUNCTION__);
  39.815  
  39.816 -            close ( gmyth_socket->sd );
  39.817 -            gmyth_socket->sd = -1;
  39.818 -            gmyth_debug ( "ERROR: %s\n", gai_strerror ( ret_code ) );
  39.819 -            g_free ( timeout_val );
  39.820 -            continue;
  39.821 -        }
  39.822 +		  close(gmyth_socket->sd);
  39.823 +		  gmyth_socket->sd = -1;
  39.824 +		  gmyth_debug("ERROR: %s\n", gai_strerror(ret_code));
  39.825 +		  g_free(timeout_val);
  39.826 +		  continue;
  39.827 +		}
  39.828  
  39.829 -        g_free ( timeout_val );
  39.830 +	  g_free(timeout_val);
  39.831  
  39.832 -        /* only will be reached if none of the error above occurred */
  39.833 -        break;
  39.834 -    }
  39.835 +	 /* only will be reached if none of the error above occurred */
  39.836 +	  break;
  39.837 +	}
  39.838  
  39.839 -    freeaddrinfo ( addr_info_data );
  39.840 -    addr_info_data = NULL;
  39.841 +  freeaddrinfo(addr_info_data);
  39.842 +  addr_info_data = NULL;
  39.843  
  39.844 -    if ( gmyth_socket->sd_io_ch != NULL )
  39.845 -    {
  39.846 -        g_io_channel_unref ( gmyth_socket->sd_io_ch );
  39.847 -        gmyth_socket->sd_io_ch = NULL;
  39.848 -    }
  39.849 +  if (gmyth_socket->sd_io_ch != NULL)
  39.850 +	{
  39.851 +	  g_io_channel_unref(gmyth_socket->sd_io_ch);
  39.852 +	  gmyth_socket->sd_io_ch = NULL;
  39.853 +	}
  39.854  
  39.855  
  39.856 -    memset ( &ling, 0, sizeof ( struct linger ) );
  39.857 -    ling.l_onoff = TRUE;
  39.858 -    ling.l_linger = 1;
  39.859 +  memset(&ling, 0, sizeof(struct linger));
  39.860 +  ling.l_onoff = TRUE;
  39.861 +  ling.l_linger = 1;
  39.862  
  39.863 -    err =
  39.864 -        setsockopt ( gmyth_socket->sd, SOL_SOCKET, SO_LINGER, &ling,
  39.865 -                     sizeof ( struct linger ) );
  39.866 +  err =
  39.867 +	setsockopt(gmyth_socket->sd, SOL_SOCKET, SO_LINGER, &ling,
  39.868 +			   sizeof(struct linger));
  39.869  
  39.870 -    if ( err < 0 )
  39.871 -    {
  39.872 -        gmyth_debug ( "[%s] Setting connection unsucessfull.\n", __FUNCTION__ );
  39.873 -        err = errno;
  39.874 -        ret = FALSE;
  39.875 -        goto cleanup;
  39.876 -    }
  39.877 +  if (err < 0)
  39.878 +	{
  39.879 +	  gmyth_debug("[%s] Setting connection unsucessfull.\n", __FUNCTION__);
  39.880 +	  err = errno;
  39.881 +	  ret = FALSE;
  39.882 +	  goto cleanup;
  39.883 +	}
  39.884  
  39.885 -    gmyth_socket->sd_io_ch = g_io_channel_unix_new ( gmyth_socket->sd );
  39.886 +  gmyth_socket->sd_io_ch = g_io_channel_unix_new(gmyth_socket->sd);
  39.887  
  39.888 -    g_io_channel_set_close_on_unref ( gmyth_socket->sd_io_ch, TRUE );
  39.889 -    //g_io_channel_set_encoding (gmyth_socket->sd_io_ch, NULL, NULL );
  39.890 +  g_io_channel_set_close_on_unref(gmyth_socket->sd_io_ch, TRUE);
  39.891 + //g_io_channel_set_encoding (gmyth_socket->sd_io_ch, NULL, NULL );
  39.892  
  39.893 -    GIOFlags flags = g_io_channel_get_flags ( gmyth_socket->sd_io_ch );
  39.894 +  GIOFlags flags = g_io_channel_get_flags(gmyth_socket->sd_io_ch);
  39.895  
  39.896 -    /* unset the nonblock flag */
  39.897 -    flags &= ~G_IO_FLAG_NONBLOCK;
  39.898 -    /* unset the nonblocking stuff for some time, because GNUTLS doesn't like
  39.899 -     * that */
  39.900 -    g_io_channel_set_flags ( gmyth_socket->sd_io_ch, flags, NULL );
  39.901 + /* unset the nonblock flag */
  39.902 +  flags &= ~G_IO_FLAG_NONBLOCK;
  39.903 + /* unset the nonblocking stuff for some time, because GNUTLS doesn't like
  39.904 +  * that */
  39.905 +  g_io_channel_set_flags(gmyth_socket->sd_io_ch, flags, NULL);
  39.906  
  39.907 -    ret = ( ret_code == 0 ) ? TRUE : FALSE;
  39.908 +  ret = (ret_code == 0) ? TRUE : FALSE;
  39.909  
  39.910 -  cleanup:
  39.911 -    if ( !ret )
  39.912 -        gmyth_debug ( "GMythSocket error - return code error!" );
  39.913 +cleanup:
  39.914 +  if (!ret)
  39.915 +	gmyth_debug("GMythSocket error - return code error!");
  39.916  
  39.917 -    return ret;
  39.918 +  return ret;
  39.919  }
  39.920  
  39.921  /** Gets the GIOChannel associated to the given GMythSocket.
  39.922 @@ -655,11 +652,11 @@
  39.923   * @param gmyth_socket The GMythSocket instance.
  39.924   */
  39.925  GIOChannel *
  39.926 -gmyth_socket_get_io_channel ( GMythSocket * gmyth_socket )
  39.927 +gmyth_socket_get_io_channel(GMythSocket * gmyth_socket)
  39.928  {
  39.929 -    g_return_val_if_fail ( gmyth_socket != NULL, NULL );
  39.930 +  g_return_val_if_fail(gmyth_socket != NULL, NULL);
  39.931  
  39.932 -    return gmyth_socket->sd_io_ch;
  39.933 +  return gmyth_socket->sd_io_ch;
  39.934  }
  39.935  
  39.936  /** Verifies if the socket is able to read.
  39.937 @@ -668,22 +665,22 @@
  39.938   * @return TRUE if the socket is able to read, FALSE if not.
  39.939   */
  39.940  gboolean
  39.941 -gmyth_socket_is_able_to_read ( GMythSocket * gmyth_socket )
  39.942 +gmyth_socket_is_able_to_read(GMythSocket * gmyth_socket)
  39.943  {
  39.944 -    gboolean ret = TRUE;
  39.945 +  gboolean ret = TRUE;
  39.946  
  39.947 -    /* verify if the input (read) buffer is ready to receive data */
  39.948 -    GIOCondition io_cond =
  39.949 -        g_io_channel_get_buffer_condition ( gmyth_socket->sd_io_ch );
  39.950 + /* verify if the input (read) buffer is ready to receive data */
  39.951 +  GIOCondition io_cond =
  39.952 +	g_io_channel_get_buffer_condition(gmyth_socket->sd_io_ch);
  39.953  
  39.954 -    if ( ( io_cond & G_IO_IN ) == 0 )
  39.955 -    {
  39.956 -        gmyth_debug ( "[%s] IO channel is not able to send data!\n",
  39.957 -                      __FUNCTION__ );
  39.958 -        ret = FALSE;
  39.959 -    }
  39.960 +  if ((io_cond & G_IO_IN) == 0)
  39.961 +	{
  39.962 +	  gmyth_debug("[%s] IO channel is not able to send data!\n",
  39.963 +				  __FUNCTION__);
  39.964 +	  ret = FALSE;
  39.965 +	}
  39.966  
  39.967 -    return ret;
  39.968 +  return ret;
  39.969  
  39.970  }
  39.971  
  39.972 @@ -693,22 +690,22 @@
  39.973   * @return TRUE if the socket is able to write, FALSE if not.
  39.974   */
  39.975  gboolean
  39.976 -gmyth_socket_is_able_to_write ( GMythSocket * gmyth_socket )
  39.977 +gmyth_socket_is_able_to_write(GMythSocket * gmyth_socket)
  39.978  {
  39.979 -    gboolean ret = TRUE;
  39.980 +  gboolean ret = TRUE;
  39.981  
  39.982 -    /* verify if the input (read) buffer is ready to receive data */
  39.983 -    GIOCondition io_cond =
  39.984 -        g_io_channel_get_buffer_condition ( gmyth_socket->sd_io_ch );
  39.985 + /* verify if the input (read) buffer is ready to receive data */
  39.986 +  GIOCondition io_cond =
  39.987 +	g_io_channel_get_buffer_condition(gmyth_socket->sd_io_ch);
  39.988  
  39.989 -    if ( ( ( io_cond & G_IO_OUT ) == 0 ) || ( ( io_cond & G_IO_HUP ) == 0 ) )
  39.990 -    {
  39.991 -        gmyth_debug ( "[%s] IO channel is not able to send data!\n",
  39.992 -                      __FUNCTION__ );
  39.993 -        ret = FALSE;
  39.994 -    }
  39.995 +  if (((io_cond & G_IO_OUT) == 0) || ((io_cond & G_IO_HUP) == 0))
  39.996 +	{
  39.997 +	  gmyth_debug("[%s] IO channel is not able to send data!\n",
  39.998 +				  __FUNCTION__);
  39.999 +	  ret = FALSE;
 39.1000 +	}
 39.1001  
 39.1002 -    return ret;
 39.1003 +  return ret;
 39.1004  
 39.1005  }
 39.1006  
 39.1007 @@ -718,80 +715,78 @@
 39.1008   * @param command The string command to be sent.
 39.1009   */
 39.1010  gboolean
 39.1011 -gmyth_socket_send_command ( GMythSocket * gmyth_socket, GString * command )
 39.1012 +gmyth_socket_send_command(GMythSocket * gmyth_socket, GString * command)
 39.1013  {
 39.1014 -    gboolean ret = TRUE;
 39.1015 +  gboolean ret = TRUE;
 39.1016  
 39.1017 -    GIOStatus io_status = G_IO_STATUS_NORMAL;
 39.1018 +  GIOStatus io_status = G_IO_STATUS_NORMAL;
 39.1019  
 39.1020 -    //GIOCondition io_cond;
 39.1021 -    GError *error = NULL;
 39.1022 + //GIOCondition io_cond;
 39.1023 +  GError *error = NULL;
 39.1024  
 39.1025 -    gchar *buffer = NULL;
 39.1026 +  gchar *buffer = NULL;
 39.1027  
 39.1028 -    gsize bytes_written = 0;
 39.1029 +  gsize bytes_written = 0;
 39.1030  
 39.1031 -    g_return_val_if_fail ( gmyth_socket->sd_io_ch != NULL, FALSE );
 39.1032 +  g_return_val_if_fail(gmyth_socket->sd_io_ch != NULL, FALSE);
 39.1033  
 39.1034 -    if ( command == NULL || ( command->len <= 0 ) || command->str == NULL )
 39.1035 -    {
 39.1036 -        gmyth_debug ( "[%s] Invalid NULL command parameter!\n", __FUNCTION__ );
 39.1037 -        ret = FALSE;
 39.1038 -        goto done;
 39.1039 -    }
 39.1040 +  if (command == NULL || (command->len <= 0) || command->str == NULL)
 39.1041 +	{
 39.1042 +	  gmyth_debug("[%s] Invalid NULL command parameter!\n", __FUNCTION__);
 39.1043 +	  ret = FALSE;
 39.1044 +	  goto done;
 39.1045 +	}
 39.1046  
 39.1047 -    g_mutex_lock ( gmyth_socket->mutex );
 39.1048 -    gmyth_debug ( "Sending command to backend: %s\n", command->str );
 39.1049 +  g_mutex_lock(gmyth_socket->mutex);
 39.1050 +  gmyth_debug("Sending command to backend: %s\n", command->str);
 39.1051  
 39.1052 -    buffer = g_strnfill ( BUFLEN, ' ' );
 39.1053 -    g_snprintf ( buffer, MYTH_PROTOCOL_FIELD_SIZE + 1, "%-8d", command->len );
 39.1054 +  buffer = g_strnfill(BUFLEN, ' ');
 39.1055 +  g_snprintf(buffer, MYTH_PROTOCOL_FIELD_SIZE + 1, "%-8d", command->len);
 39.1056  
 39.1057 -    command = g_string_prepend ( command, buffer );
 39.1058 +  command = g_string_prepend(command, buffer);
 39.1059  
 39.1060 -    /* write bytes to socket */
 39.1061 -    io_status = g_io_channel_write_chars ( gmyth_socket->sd_io_ch, command->str,
 39.1062 -                                           command->len, &bytes_written,
 39.1063 -                                           &error );
 39.1064 + /* write bytes to socket */
 39.1065 +  io_status = g_io_channel_write_chars(gmyth_socket->sd_io_ch, command->str,
 39.1066 +									   command->len, &bytes_written, &error);
 39.1067  
 39.1068  
 39.1069 -    if ( ( io_status == G_IO_STATUS_ERROR ) || ( bytes_written <= 0 ) )
 39.1070 -    {
 39.1071 -        gmyth_debug ( "[%s] Error while writing to socket", __FUNCTION__ );
 39.1072 -        ret = FALSE;
 39.1073 -    }
 39.1074 -    else if ( bytes_written < command->len )
 39.1075 -    {
 39.1076 -        gmyth_debug ( "[%s] Not all data was written socket", __FUNCTION__ );
 39.1077 -        ret = FALSE;
 39.1078 -    }
 39.1079 +  if ((io_status == G_IO_STATUS_ERROR) || (bytes_written <= 0))
 39.1080 +	{
 39.1081 +	  gmyth_debug("[%s] Error while writing to socket", __FUNCTION__);
 39.1082 +	  ret = FALSE;
 39.1083 +	}
 39.1084 +  else if (bytes_written < command->len)
 39.1085 +	{
 39.1086 +	  gmyth_debug("[%s] Not all data was written socket", __FUNCTION__);
 39.1087 +	  ret = FALSE;
 39.1088 +	}
 39.1089  
 39.1090 -    io_status = g_io_channel_flush ( gmyth_socket->sd_io_ch, &error );
 39.1091 +  io_status = g_io_channel_flush(gmyth_socket->sd_io_ch, &error);
 39.1092  
 39.1093 -    if ( ( bytes_written != command->len )
 39.1094 -         || ( io_status == G_IO_STATUS_ERROR ) )
 39.1095 -    {
 39.1096 -        gmyth_debug
 39.1097 -            ( "[%s] Some problem occurred when sending data to the socket\n",
 39.1098 -              __FUNCTION__ );
 39.1099 +  if ((bytes_written != command->len) || (io_status == G_IO_STATUS_ERROR))
 39.1100 +	{
 39.1101 +	  gmyth_debug
 39.1102 +		("[%s] Some problem occurred when sending data to the socket\n",
 39.1103 +		 __FUNCTION__);
 39.1104  
 39.1105 -        ret = TRUE;
 39.1106 -    }
 39.1107 +	  ret = TRUE;
 39.1108 +	}
 39.1109  
 39.1110 -    g_mutex_unlock ( gmyth_socket->mutex );
 39.1111 -  done:
 39.1112 -    if ( error != NULL )
 39.1113 -    {
 39.1114 -        gmyth_debug
 39.1115 -            ( "[%s] Error found reading data from IO channel: (%d, %s)\n",
 39.1116 -              __FUNCTION__, error->code, error->message );
 39.1117 -        ret = FALSE;
 39.1118 -        g_error_free ( error );
 39.1119 -    }
 39.1120 +  g_mutex_unlock(gmyth_socket->mutex);
 39.1121 +done:
 39.1122 +  if (error != NULL)
 39.1123 +	{
 39.1124 +	  gmyth_debug
 39.1125 +		("[%s] Error found reading data from IO channel: (%d, %s)\n",
 39.1126 +		 __FUNCTION__, error->code, error->message);
 39.1127 +	  ret = FALSE;
 39.1128 +	  g_error_free(error);
 39.1129 +	}
 39.1130  
 39.1131 -    if ( buffer != NULL )
 39.1132 -        g_free ( buffer );
 39.1133 +  if (buffer != NULL)
 39.1134 +	g_free(buffer);
 39.1135  
 39.1136 -    return ret;
 39.1137 +  return ret;
 39.1138  }
 39.1139  
 39.1140  /** Starts Mythtv protocol level connection. Checks Mythtv protocol version
 39.1141 @@ -805,56 +800,56 @@
 39.1142   * 										backend connection. 
 39.1143   */
 39.1144  static gboolean
 39.1145 -gmyth_socket_connect_to_backend_and_events ( GMythSocket * gmyth_socket,
 39.1146 -                                             const gchar * hostname_backend,
 39.1147 -                                             gint port,
 39.1148 -                                             gboolean blocking_client,
 39.1149 -                                             gboolean with_events )
 39.1150 +gmyth_socket_connect_to_backend_and_events(GMythSocket * gmyth_socket,
 39.1151 +										   const gchar * hostname_backend,
 39.1152 +										   gint port,
 39.1153 +										   gboolean blocking_client,
 39.1154 +										   gboolean with_events)
 39.1155  {
 39.1156 -    if ( !gmyth_socket_connect ( gmyth_socket, hostname_backend, port ) )
 39.1157 -    {
 39.1158 -        gmyth_debug ( "[%s] Could not open socket to backend machine [%s]\n",
 39.1159 -                      __FUNCTION__, hostname_backend );
 39.1160 -        return FALSE;
 39.1161 -    }
 39.1162 +  if (!gmyth_socket_connect(gmyth_socket, hostname_backend, port))
 39.1163 +	{
 39.1164 +	  gmyth_debug("[%s] Could not open socket to backend machine [%s]\n",
 39.1165 +				  __FUNCTION__, hostname_backend);
 39.1166 +	  return FALSE;
 39.1167 +	}
 39.1168  
 39.1169 -    if ( gmyth_socket_check_protocol_version ( gmyth_socket ) )
 39.1170 -    {
 39.1171 -        GString *result;
 39.1172 -        GString *base_str = g_string_new ( "" );
 39.1173 -        GString *hostname = NULL;
 39.1174 +  if (gmyth_socket_check_protocol_version(gmyth_socket))
 39.1175 +	{
 39.1176 +	  GString *result;
 39.1177 +	  GString *base_str = g_string_new("");
 39.1178 +	  GString *hostname = NULL;
 39.1179  
 39.1180 -        hostname = gmyth_socket_get_local_hostname (  );
 39.1181 -        if ( hostname == NULL )
 39.1182 -        {
 39.1183 -            gmyth_debug ( "Hostname not available, setting to n800frontend\n" );
 39.1184 -            hostname = g_string_new ( "n800frontend" );
 39.1185 -        }
 39.1186 +	  hostname = gmyth_socket_get_local_hostname();
 39.1187 +	  if (hostname == NULL)
 39.1188 +		{
 39.1189 +		  gmyth_debug("Hostname not available, setting to n800frontend\n");
 39.1190 +		  hostname = g_string_new("n800frontend");
 39.1191 +		}
 39.1192  
 39.1193 -        g_string_printf ( base_str, "ANN %s %s %u",
 39.1194 -                          ( blocking_client ? "Playback" : "Monitor" ),
 39.1195 -                          hostname->str, with_events );
 39.1196 +	  g_string_printf(base_str, "ANN %s %s %u",
 39.1197 +					  (blocking_client ? "Playback" : "Monitor"),
 39.1198 +					  hostname->str, with_events);
 39.1199  
 39.1200 -        gmyth_socket_send_command ( gmyth_socket, base_str );
 39.1201 -        result = gmyth_socket_receive_response ( gmyth_socket );
 39.1202 +	  gmyth_socket_send_command(gmyth_socket, base_str);
 39.1203 +	  result = gmyth_socket_receive_response(gmyth_socket);
 39.1204  
 39.1205 -        if ( result != NULL )
 39.1206 -        {
 39.1207 -            gmyth_debug ( "Response received from backend: %s", result->str );
 39.1208 -            g_string_free ( result, TRUE );
 39.1209 -        }
 39.1210 +	  if (result != NULL)
 39.1211 +		{
 39.1212 +		  gmyth_debug("Response received from backend: %s", result->str);
 39.1213 +		  g_string_free(result, TRUE);
 39.1214 +		}
 39.1215  
 39.1216 -        g_string_free ( hostname, TRUE );
 39.1217 -        g_string_free ( base_str, TRUE );
 39.1218 +	  g_string_free(hostname, TRUE);
 39.1219 +	  g_string_free(base_str, TRUE);
 39.1220  
 39.1221 -        return TRUE;
 39.1222 -    }
 39.1223 -    else
 39.1224 -    {
 39.1225 -        gmyth_debug ( "[%s] GMythSocket could not connect to the backend",
 39.1226 -                      __FUNCTION__ );
 39.1227 -        return FALSE;
 39.1228 -    }
 39.1229 +	  return TRUE;
 39.1230 +	}
 39.1231 +  else
 39.1232 +	{
 39.1233 +	  gmyth_debug("[%s] GMythSocket could not connect to the backend",
 39.1234 +				  __FUNCTION__);
 39.1235 +	  return FALSE;
 39.1236 +	}
 39.1237  }
 39.1238  
 39.1239  /** Starts Mythtv protocol level connection. Checks Mythtv protocol version
 39.1240 @@ -866,19 +861,19 @@
 39.1241   * @param blocking_client A flag to choose between blocking and non-blocking 
 39.1242   */
 39.1243  gboolean
 39.1244 -gmyth_socket_connect_to_backend ( GMythSocket * gmyth_socket,
 39.1245 -                                  const gchar * hostname_backend, gint port,
 39.1246 -                                  gboolean blocking_client )
 39.1247 +gmyth_socket_connect_to_backend(GMythSocket * gmyth_socket,
 39.1248 +								const gchar * hostname_backend, gint port,
 39.1249 +								gboolean blocking_client)
 39.1250  {
 39.1251 -    if ( !gmyth_socket_connect_to_backend_and_events
 39.1252 -         ( gmyth_socket, hostname_backend, port, blocking_client, FALSE ) )
 39.1253 -    {
 39.1254 -        gmyth_debug ( "Could not open socket to backend machine [%s]\n",
 39.1255 -                      hostname_backend );
 39.1256 -        return FALSE;
 39.1257 -    }
 39.1258 +  if (!gmyth_socket_connect_to_backend_and_events
 39.1259 +	  (gmyth_socket, hostname_backend, port, blocking_client, FALSE))
 39.1260 +	{
 39.1261 +	  gmyth_debug("Could not open socket to backend machine [%s]\n",
 39.1262 +				  hostname_backend);
 39.1263 +	  return FALSE;
 39.1264 +	}
 39.1265  
 39.1266 -    return TRUE;
 39.1267 +  return TRUE;
 39.1268  
 39.1269  }
 39.1270  
 39.1271 @@ -891,20 +886,20 @@
 39.1272   * @param blocking_client A flag to choose between blocking and non-blocking 
 39.1273   */
 39.1274  gboolean
 39.1275 -gmyth_socket_connect_to_backend_events ( GMythSocket * gmyth_socket,
 39.1276 -                                         const gchar * hostname_backend,
 39.1277 -                                         gint port, gboolean blocking_client )
 39.1278 +gmyth_socket_connect_to_backend_events(GMythSocket * gmyth_socket,
 39.1279 +									   const gchar * hostname_backend,
 39.1280 +									   gint port, gboolean blocking_client)
 39.1281  {
 39.1282 -    if ( !gmyth_socket_connect_to_backend_and_events
 39.1283 -         ( gmyth_socket, hostname_backend, port, blocking_client, TRUE ) )
 39.1284 -    {
 39.1285 -        gmyth_debug
 39.1286 -            ( "Could not open socket to backend machine in order to receive events [%s]\n",
 39.1287 -              hostname_backend );
 39.1288 -        return FALSE;
 39.1289 -    }
 39.1290 +  if (!gmyth_socket_connect_to_backend_and_events
 39.1291 +	  (gmyth_socket, hostname_backend, port, blocking_client, TRUE))
 39.1292 +	{
 39.1293 +	  gmyth_debug
 39.1294 +		("Could not open socket to backend machine in order to receive events [%s]\n",
 39.1295 +		 hostname_backend);
 39.1296 +	  return FALSE;
 39.1297 +	}
 39.1298  
 39.1299 -    return TRUE;
 39.1300 +  return TRUE;
 39.1301  }
 39.1302  
 39.1303  /** Closes the socket connection to the backend.
 39.1304 @@ -912,22 +907,22 @@
 39.1305   * @param gmyth_socket The GMythSocket instance.
 39.1306   */
 39.1307  void
 39.1308 -gmyth_socket_close_connection ( GMythSocket * gmyth_socket )
 39.1309 +gmyth_socket_close_connection(GMythSocket * gmyth_socket)
 39.1310  {
 39.1311 -    /*
 39.1312 -       if ( gmyth_socket->sd != -1 ) {
 39.1313 -       close (gmyth_socket->sd);    
 39.1314 -       gmyth_socket->sd = -1;
 39.1315 -       }
 39.1316 -     */
 39.1317 + /*
 39.1318 +    if ( gmyth_socket->sd != -1 ) {
 39.1319 +    close (gmyth_socket->sd);    
 39.1320 +    gmyth_socket->sd = -1;
 39.1321 +    }
 39.1322 +  */
 39.1323  
 39.1324 -    if ( gmyth_socket->sd_io_ch != NULL )
 39.1325 -    {
 39.1326 -        g_io_channel_shutdown ( gmyth_socket->sd_io_ch, TRUE, NULL );
 39.1327 -        g_io_channel_unref ( gmyth_socket->sd_io_ch );
 39.1328 -        gmyth_socket->sd_io_ch = NULL;
 39.1329 -        gmyth_socket->sd = -1;
 39.1330 -    }
 39.1331 +  if (gmyth_socket->sd_io_ch != NULL)
 39.1332 +	{
 39.1333 +	  g_io_channel_shutdown(gmyth_socket->sd_io_ch, TRUE, NULL);
 39.1334 +	  g_io_channel_unref(gmyth_socket->sd_io_ch);
 39.1335 +	  gmyth_socket->sd_io_ch = NULL;
 39.1336 +	  gmyth_socket->sd = -1;
 39.1337 +	}
 39.1338  
 39.1339  }
 39.1340  
 39.1341 @@ -942,81 +937,81 @@
 39.1342   * @return The actual MythTV the client is connected to.
 39.1343   */
 39.1344  gint
 39.1345 -gmyth_socket_check_protocol_version_number ( GMythSocket * gmyth_socket,
 39.1346 -                                             gint mythtv_version )
 39.1347 +gmyth_socket_check_protocol_version_number(GMythSocket * gmyth_socket,
 39.1348 +										   gint mythtv_version)
 39.1349  {
 39.1350 -    GString *response = NULL;
 39.1351 -    GString *payload = NULL;
 39.1352 -    gboolean res = TRUE;
 39.1353 -    gint mythtv_new_version = MYTHTV_CANNOT_NEGOTIATE_VERSION;
 39.1354 -    guint max_iterations = MYTHTV_MAX_VERSION_CHECKS;
 39.1355 +  GString *response = NULL;
 39.1356 +  GString *payload = NULL;
 39.1357 +  gboolean res = TRUE;
 39.1358 +  gint mythtv_new_version = MYTHTV_CANNOT_NEGOTIATE_VERSION;
 39.1359 +  guint max_iterations = MYTHTV_MAX_VERSION_CHECKS;
 39.1360  
 39.1361 -    assert ( gmyth_socket );
 39.1362 +  assert(gmyth_socket);
 39.1363  
 39.1364 -  try_new_version:
 39.1365 -    payload = g_string_new ( "MYTH_PROTO_VERSION" );
 39.1366 -    g_string_append_printf ( payload, " %d", mythtv_version );
 39.1367 +try_new_version:
 39.1368 +  payload = g_string_new("MYTH_PROTO_VERSION");
 39.1369 +  g_string_append_printf(payload, " %d", mythtv_version);
 39.1370  
 39.1371 -    gmyth_socket_send_command ( gmyth_socket, payload );
 39.1372 -    response = gmyth_socket_receive_response ( gmyth_socket );
 39.1373 +  gmyth_socket_send_command(gmyth_socket, payload);
 39.1374 +  response = gmyth_socket_receive_response(gmyth_socket);
 39.1375  
 39.1376 -    if ( response == NULL )
 39.1377 -    {
 39.1378 -        gmyth_debug ( "[%s] Check protocol version error! Not answered!",
 39.1379 -                      __FUNCTION__ );
 39.1380 -        res = FALSE;
 39.1381 -        goto done;
 39.1382 -    }
 39.1383 +  if (response == NULL)
 39.1384 +	{
 39.1385 +	  gmyth_debug("[%s] Check protocol version error! Not answered!",
 39.1386 +				  __FUNCTION__);
 39.1387 +	  res = FALSE;
 39.1388 +	  goto done;
 39.1389 +	}
 39.1390  
 39.1391 -    res = g_str_has_prefix ( response->str, "ACCEPT" );
 39.1392 -    if ( !res )
 39.1393 -    {
 39.1394 -        gmyth_debug ( "[%s] Protocol version request error: %s", __FUNCTION__,
 39.1395 -                      response->str );
 39.1396 -        /* get the version number returned by the REJECT message */
 39.1397 -        if ( ( res = g_str_has_prefix ( response->str, "REJECT" ) ) == TRUE )
 39.1398 -        {
 39.1399 -            gchar *new_version = NULL;
 39.1400 +  res = g_str_has_prefix(response->str, "ACCEPT");
 39.1401 +  if (!res)
 39.1402 +	{
 39.1403 +	  gmyth_debug("[%s] Protocol version request error: %s", __FUNCTION__,
 39.1404 +				  response->str);
 39.1405 +	 /* get the version number returned by the REJECT message */
 39.1406 +	  if ((res = g_str_has_prefix(response->str, "REJECT")) == TRUE)
 39.1407 +		{
 39.1408 +		  gchar *new_version = NULL;
 39.1409  
 39.1410 -            new_version = g_strrstr ( response->str, "]" );
 39.1411 -            if ( new_version != NULL )
 39.1412 -            {
 39.1413 -                ++new_version;  /* skip ']' character */
 39.1414 -                if ( new_version != NULL )
 39.1415 -                {
 39.1416 -                    gmyth_debug ( "[%s] got MythTV version = %s.\n",
 39.1417 -                                  __FUNCTION__, new_version );
 39.1418 -                    mythtv_version =
 39.1419 -                        ( gint ) g_ascii_strtoull ( new_version, NULL, 10 );
 39.1420 -                    /* do reconnection to the socket (socket is closed if the MythTV version was wrong) */
 39.1421 -                    gmyth_socket_connect ( gmyth_socket, gmyth_socket->hostname,
 39.1422 -                                           gmyth_socket->port );
 39.1423 -                    new_version = NULL;
 39.1424 -                    if ( --max_iterations > 0 )
 39.1425 -                    {
 39.1426 -                        g_string_free ( payload, TRUE );
 39.1427 -                        g_string_free ( response, TRUE );
 39.1428 -                        goto try_new_version;
 39.1429 -                    }
 39.1430 -                    else
 39.1431 -                        goto done;
 39.1432 -                }
 39.1433 -            }
 39.1434 -        }
 39.1435 -    }
 39.1436 +		  new_version = g_strrstr(response->str, "]");
 39.1437 +		  if (new_version != NULL)
 39.1438 +			{
 39.1439 +			  ++new_version;	/* skip ']' character */
 39.1440 +			  if (new_version != NULL)
 39.1441 +				{
 39.1442 +				  gmyth_debug("[%s] got MythTV version = %s.\n",
 39.1443 +							  __FUNCTION__, new_version);
 39.1444 +				  mythtv_version =
 39.1445 +					(gint) g_ascii_strtoull(new_version, NULL, 10);
 39.1446 +				 /* do reconnection to the socket (socket is closed if the MythTV version was wrong) */
 39.1447 +				  gmyth_socket_connect(gmyth_socket, gmyth_socket->hostname,
 39.1448 +									   gmyth_socket->port);
 39.1449 +				  new_version = NULL;
 39.1450 +				  if (--max_iterations > 0)
 39.1451 +					{
 39.1452 +					  g_string_free(payload, TRUE);
 39.1453 +					  g_string_free(response, TRUE);
 39.1454 +					  goto try_new_version;
 39.1455 +					}
 39.1456 +				  else
 39.1457 +					goto done;
 39.1458 +				}
 39.1459 +			}
 39.1460 +		}
 39.1461 +	}
 39.1462  
 39.1463 -    /* change the return value to a valid one */
 39.1464 -    if ( res )
 39.1465 -    {
 39.1466 -        mythtv_new_version = mythtv_version;
 39.1467 -        gmyth_socket->mythtv_version = mythtv_new_version;
 39.1468 -    }
 39.1469 + /* change the return value to a valid one */
 39.1470 +  if (res)
 39.1471 +	{
 39.1472 +	  mythtv_new_version = mythtv_version;
 39.1473 +	  gmyth_socket->mythtv_version = mythtv_new_version;
 39.1474 +	}
 39.1475  
 39.1476 -  done:
 39.1477 -    g_string_free ( payload, TRUE );
 39.1478 -    g_string_free ( response, TRUE );
 39.1479 +done:
 39.1480 +  g_string_free(payload, TRUE);
 39.1481 +  g_string_free(response, TRUE);
 39.1482  
 39.1483 -    return mythtv_new_version;
 39.1484 +  return mythtv_new_version;
 39.1485  }
 39.1486  
 39.1487  /** Verifies if the Mythtv backend supported the GMyth supported version.
 39.1488 @@ -1025,12 +1020,12 @@
 39.1489   * @return TRUE if supports, FALSE if not.
 39.1490   */
 39.1491  gboolean
 39.1492 -gmyth_socket_check_protocol_version ( GMythSocket * gmyth_socket )
 39.1493 +gmyth_socket_check_protocol_version(GMythSocket * gmyth_socket)
 39.1494  {
 39.1495 -    return ( ( gmyth_socket->mythtv_version =
 39.1496 -               gmyth_socket_check_protocol_version_number ( gmyth_socket,
 39.1497 -                                                            MYTHTV_VERSION_DEFAULT ) )
 39.1498 -             != MYTHTV_CANNOT_NEGOTIATE_VERSION );
 39.1499 +  return ((gmyth_socket->mythtv_version =
 39.1500 +		   gmyth_socket_check_protocol_version_number(gmyth_socket,
 39.1501 +													  MYTHTV_VERSION_DEFAULT))
 39.1502 +		  != MYTHTV_CANNOT_NEGOTIATE_VERSION);
 39.1503  }
 39.1504  
 39.1505  /** Returns the Mythtv backend supported version.
 39.1506 @@ -1039,9 +1034,9 @@
 39.1507   * @return The actual MythTV version number.
 39.1508   */
 39.1509  gint
 39.1510 -gmyth_socket_get_protocol_version ( GMythSocket * gmyth_socket )
 39.1511 +gmyth_socket_get_protocol_version(GMythSocket * gmyth_socket)
 39.1512  {
 39.1513 -    return gmyth_socket->mythtv_version;
 39.1514 +  return gmyth_socket->mythtv_version;
 39.1515  }
 39.1516  
 39.1517  /** Receives a backend answer after a gmyth_socket_send_command_call ().
 39.1518 @@ -1050,122 +1045,121 @@
 39.1519   * @return The response received, or NULL if error or nothing was received.
 39.1520   */
 39.1521  GString *
 39.1522 -gmyth_socket_receive_response ( GMythSocket * gmyth_socket )
 39.1523 +gmyth_socket_receive_response(GMythSocket * gmyth_socket)
 39.1524  {
 39.1525 -    GIOStatus io_status = G_IO_STATUS_NORMAL;
 39.1526 -    GError *error = NULL;
 39.1527 -    gchar *buffer = NULL;
 39.1528 +  GIOStatus io_status = G_IO_STATUS_NORMAL;
 39.1529 +  GError *error = NULL;
 39.1530 +  gchar *buffer = NULL;
 39.1531  
 39.1532 -    GString *str = NULL;
 39.1533 +  GString *str = NULL;
 39.1534  
 39.1535 -    gsize bytes_read = 0;
 39.1536 -    gint len = 0;
 39.1537 +  gsize bytes_read = 0;
 39.1538 +  gint len = 0;
 39.1539  
 39.1540 -    if ( gmyth_socket == NULL )
 39.1541 -        return NULL;
 39.1542 +  if (gmyth_socket == NULL)
 39.1543 +	return NULL;
 39.1544  
 39.1545 -    GIOCondition io_cond;
 39.1546 +  GIOCondition io_cond;
 39.1547  
 39.1548 -    /* verify if the input (read) buffer is ready to receive data */
 39.1549 -    g_mutex_lock ( gmyth_socket->mutex );
 39.1550 + /* verify if the input (read) buffer is ready to receive data */
 39.1551 +  g_mutex_lock(gmyth_socket->mutex);
 39.1552  
 39.1553 -    buffer = g_strnfill ( MYTH_PROTOCOL_FIELD_SIZE, ' ' );
 39.1554 -    if ( NULL == gmyth_socket->sd_io_ch )
 39.1555 -    {
 39.1556 -        gmyth_socket_connect ( gmyth_socket, gmyth_socket->hostname,
 39.1557 -                               gmyth_socket->port );
 39.1558 -    }
 39.1559 +  buffer = g_strnfill(MYTH_PROTOCOL_FIELD_SIZE, ' ');
 39.1560 +  if (NULL == gmyth_socket->sd_io_ch)
 39.1561 +	{
 39.1562 +	  gmyth_socket_connect(gmyth_socket, gmyth_socket->hostname,
 39.1563 +						   gmyth_socket->port);
 39.1564 +	}
 39.1565  
 39.1566 -    io_cond = g_io_channel_get_buffer_condition ( gmyth_socket->sd_io_ch );
 39.1567 -    /*          
 39.1568 -       if ( NULL == gmyth_socket->sd_io_ch->read_buf || ( NULL == gmyth_socket->sd_io_ch->read_buf->str ) )
 39.1569 -       gmyth_socket->sd_io_ch = g_io_channel_unix_new( gmyth_socket->sd ); 
 39.1570 -     */
 39.1571 +  io_cond = g_io_channel_get_buffer_condition(gmyth_socket->sd_io_ch);
 39.1572 + /*          
 39.1573 +    if ( NULL == gmyth_socket->sd_io_ch->read_buf || ( NULL == gmyth_socket->sd_io_ch->read_buf->str ) )
 39.1574 +    gmyth_socket->sd_io_ch = g_io_channel_unix_new( gmyth_socket->sd ); 
 39.1575 +  */
 39.1576  
 39.1577 -    if ( gmyth_socket->sd_io_ch->
 39.1578 -         is_readable /*&& !( ( io_cond & G_IO_IN ) == 0 ) */  )
 39.1579 -        io_status =
 39.1580 -            g_io_channel_read_chars ( gmyth_socket->sd_io_ch, buffer,
 39.1581 -                                      MYTH_PROTOCOL_FIELD_SIZE, &bytes_read,
 39.1582 -                                      &error );
 39.1583 -    else
 39.1584 -        return g_string_new ( "" );
 39.1585 +  if (gmyth_socket->sd_io_ch->
 39.1586 +	  is_readable /*&& !( ( io_cond & G_IO_IN ) == 0 ) */ )
 39.1587 +	io_status =
 39.1588 +	  g_io_channel_read_chars(gmyth_socket->sd_io_ch, buffer,
 39.1589 +							  MYTH_PROTOCOL_FIELD_SIZE, &bytes_read, &error);
 39.1590 +  else
 39.1591 +	return g_string_new("");
 39.1592  
 39.1593 -    /* verify if the input (read) buffer is ready to receive data */
 39.1594 -    io_cond = g_io_channel_get_buffer_condition ( gmyth_socket->sd_io_ch );
 39.1595 + /* verify if the input (read) buffer is ready to receive data */
 39.1596 +  io_cond = g_io_channel_get_buffer_condition(gmyth_socket->sd_io_ch);
 39.1597  
 39.1598 -    //if ( ( io_cond & G_IO_IN ) == 0 ) 
 39.1599 -    // return NULL;         
 39.1600 + //if ( ( io_cond & G_IO_IN ) == 0 ) 
 39.1601 + // return NULL;         
 39.1602  
 39.1603 -    gmyth_debug ( "[%s] Bytes read = %d\n", __FUNCTION__, bytes_read );
 39.1604 +  gmyth_debug("[%s] Bytes read = %d\n", __FUNCTION__, bytes_read);
 39.1605  
 39.1606 -    if ( ( io_status == G_IO_STATUS_ERROR ) || ( bytes_read <= 0 ) )
 39.1607 -    {
 39.1608 -        gmyth_debug ( "[%s] Error in mythprotocol response from backend\n",
 39.1609 -                      __FUNCTION__ );
 39.1610 -        str = NULL;
 39.1611 -        //return NULL;
 39.1612 -    }
 39.1613 -    else if ( buffer != NULL && strlen ( buffer ) > 0 )
 39.1614 -    {
 39.1615 +  if ((io_status == G_IO_STATUS_ERROR) || (bytes_read <= 0))
 39.1616 +	{
 39.1617 +	  gmyth_debug("[%s] Error in mythprotocol response from backend\n",
 39.1618 +				  __FUNCTION__);
 39.1619 +	  str = NULL;
 39.1620 +	 //return NULL;
 39.1621 +	}
 39.1622 +  else if (buffer != NULL && strlen(buffer) > 0)
 39.1623 +	{
 39.1624  
 39.1625 -        //io_status = g_io_channel_flush( gmyth_socket->sd_io_ch, &error );
 39.1626 -        /* verify if the input (read) buffer is ready to receive data */
 39.1627 -        //io_cond = g_io_channel_get_buffer_condition( gmyth_socket->sd_io_ch );
 39.1628 +	 //io_status = g_io_channel_flush( gmyth_socket->sd_io_ch, &error );
 39.1629 +	 /* verify if the input (read) buffer is ready to receive data */
 39.1630 +	 //io_cond = g_io_channel_get_buffer_condition( gmyth_socket->sd_io_ch );
 39.1631  
 39.1632 -        //if ( ( io_cond & G_IO_IN ) != 0 ) {
 39.1633 -        //gchar *buffer_aux = NULL;
 39.1634 +	 //if ( ( io_cond & G_IO_IN ) != 0 ) {
 39.1635 +	 //gchar *buffer_aux = NULL;
 39.1636  
 39.1637 -        /* removes trailing whitespace */
 39.1638 -        //buffer_aux = g_strstrip (buffer);
 39.1639 -        len = ( gint ) g_ascii_strtoull ( g_strstrip ( buffer ), NULL, 10 );
 39.1640 +	 /* removes trailing whitespace */
 39.1641 +	 //buffer_aux = g_strstrip (buffer);
 39.1642 +	  len = (gint) g_ascii_strtoull(g_strstrip(buffer), NULL, 10);
 39.1643  
 39.1644 -        g_free ( buffer );
 39.1645 +	  g_free(buffer);
 39.1646  
 39.1647 -        /*            
 39.1648 -           if (buffer_aux != NULL) {
 39.1649 -           g_free (buffer_aux);
 39.1650 -           buffer_aux = NULL;
 39.1651 -           }
 39.1652 -         */
 39.1653 +	 /*            
 39.1654 +	    if (buffer_aux != NULL) {
 39.1655 +	    g_free (buffer_aux);
 39.1656 +	    buffer_aux = NULL;
 39.1657 +	    }
 39.1658 +	  */
 39.1659  
 39.1660 -        buffer = g_new0 ( gchar, len + 1 );
 39.1661 +	  buffer = g_new0(gchar, len + 1);
 39.1662  
 39.1663 -        bytes_read = 0;
 39.1664 -        if ( !( gmyth_socket != NULL && gmyth_socket->sd_io_ch != NULL ) )
 39.1665 -            return NULL;
 39.1666 +	  bytes_read = 0;
 39.1667 +	  if (!(gmyth_socket != NULL && gmyth_socket->sd_io_ch != NULL))
 39.1668 +		return NULL;
 39.1669  
 39.1670 -        if ( gmyth_socket->sd_io_ch->is_readable )
 39.1671 -            io_status =
 39.1672 -                g_io_channel_read_chars ( gmyth_socket->sd_io_ch, buffer, len,
 39.1673 -                                          &bytes_read, &error );
 39.1674 -        else
 39.1675 -            return g_string_new ( "" );
 39.1676 +	  if (gmyth_socket->sd_io_ch->is_readable)
 39.1677 +		io_status =
 39.1678 +		  g_io_channel_read_chars(gmyth_socket->sd_io_ch, buffer, len,
 39.1679 +								  &bytes_read, &error);
 39.1680 +	  else
 39.1681 +		return g_string_new("");
 39.1682  
 39.1683 -        buffer[bytes_read] = '\0';
 39.1684 -        //}
 39.1685 -    }
 39.1686 +	  buffer[bytes_read] = '\0';
 39.1687 +	 //}
 39.1688 +	}
 39.1689  
 39.1690 -    g_mutex_unlock ( gmyth_socket->mutex );
 39.1691 -    //g_static_rw_lock_reader_unlock (&rwlock);
 39.1692 +  g_mutex_unlock(gmyth_socket->mutex);
 39.1693 + //g_static_rw_lock_reader_unlock (&rwlock);
 39.1694  
 39.1695 -    gmyth_debug ( "Response received from backend: ----- {%s}\n", buffer );
 39.1696 -    if ( ( bytes_read != len ) || ( io_status == G_IO_STATUS_ERROR ) )
 39.1697 -        str = NULL;
 39.1698 -    else
 39.1699 -        str = g_string_new ( buffer );
 39.1700 +  gmyth_debug("Response received from backend: ----- {%s}\n", buffer);
 39.1701 +  if ((bytes_read != len) || (io_status == G_IO_STATUS_ERROR))
 39.1702 +	str = NULL;
 39.1703 +  else
 39.1704 +	str = g_string_new(buffer);
 39.1705  
 39.1706 -    if ( error != NULL )
 39.1707 -    {
 39.1708 -        gmyth_debug
 39.1709 -            ( "[%s] Error found receiving response from the IO channel: (%d, %s)\n",
 39.1710 -              __FUNCTION__, error->code, error->message );
 39.1711 -        str = NULL;
 39.1712 -        g_error_free ( error );
 39.1713 -    }
 39.1714 +  if (error != NULL)
 39.1715 +	{
 39.1716 +	  gmyth_debug
 39.1717 +		("[%s] Error found receiving response from the IO channel: (%d, %s)\n",
 39.1718 +		 __FUNCTION__, error->code, error->message);
 39.1719 +	  str = NULL;
 39.1720 +	  g_error_free(error);
 39.1721 +	}
 39.1722  
 39.1723 -    g_free ( buffer );
 39.1724 -    return str;
 39.1725 +  g_free(buffer);
 39.1726 +  return str;
 39.1727  }
 39.1728  
 39.1729  /** Format a Mythtv command from the str_list entries and send it to backend.
 39.1730 @@ -1175,58 +1169,55 @@
 39.1731   * @return TRUE if command was sent, FALSE if any error happens.
 39.1732   */
 39.1733  gboolean
 39.1734 -gmyth_socket_write_stringlist ( GMythSocket * gmyth_socket,
 39.1735 -                                GMythStringList * str_list )
 39.1736 +gmyth_socket_write_stringlist(GMythSocket * gmyth_socket,
 39.1737 +							  GMythStringList * str_list)
 39.1738  {
 39.1739  
 39.1740 -    GList *tmp_list = NULL;
 39.1741 -    GPtrArray *ptr_array = NULL;
 39.1742 -    gchar *str_array = NULL;
 39.1743 +  GList *tmp_list = NULL;
 39.1744 +  GPtrArray *ptr_array = NULL;
 39.1745 +  gchar *str_array = NULL;
 39.1746  
 39.1747 -    g_mutex_lock ( gmyth_socket->mutex );
 39.1748 -    //g_static_rw_lock_writer_lock (&rwlock);
 39.1749 +  g_mutex_lock(gmyth_socket->mutex);
 39.1750 + //g_static_rw_lock_writer_lock (&rwlock);
 39.1751  
 39.1752 -    ptr_array = g_ptr_array_sized_new ( g_list_length ( str_list->glist ) );
 39.1753 +  ptr_array = g_ptr_array_sized_new(g_list_length(str_list->glist));
 39.1754  
 39.1755 -    // FIXME: change this implementation!
 39.1756 -    tmp_list = str_list->glist;
 39.1757 -    for ( ; tmp_list; tmp_list = tmp_list->next )
 39.1758 -    {
 39.1759 -        if ( tmp_list->data != NULL )
 39.1760 -        {
 39.1761 -            g_ptr_array_add ( ptr_array,
 39.1762 -                              ( ( GString * ) tmp_list->data )->str );
 39.1763 -        }
 39.1764 -        else
 39.1765 -        {
 39.1766 -            g_ptr_array_add ( ptr_array, "" );
 39.1767 -        }
 39.1768 -    }
 39.1769 -    g_ptr_array_add ( ptr_array, NULL );    // g_str_joinv() needs a NULL terminated string
 39.1770 + // FIXME: change this implementation!
 39.1771 +  tmp_list = str_list->glist;
 39.1772 +  for (; tmp_list; tmp_list = tmp_list->next)
 39.1773 +	{
 39.1774 +	  if (tmp_list->data != NULL)
 39.1775 +		{
 39.1776 +		  g_ptr_array_add(ptr_array, ((GString *) tmp_list->data)->str);
 39.1777 +		}
 39.1778 +	  else
 39.1779 +		{
 39.1780 +		  g_ptr_array_add(ptr_array, "");
 39.1781 +		}
 39.1782 +	}
 39.1783 +  g_ptr_array_add(ptr_array, NULL);	// g_str_joinv() needs a NULL terminated string
 39.1784  
 39.1785 -    str_array =
 39.1786 -        g_strjoinv ( MYTH_SEPARATOR, ( gchar ** ) ( ptr_array->pdata ) );
 39.1787 +  str_array = g_strjoinv(MYTH_SEPARATOR, (gchar **) (ptr_array->pdata));
 39.1788  
 39.1789 -    g_mutex_unlock ( gmyth_socket->mutex );
 39.1790 -    //g_static_rw_lock_writer_unlock (&rwlock);
 39.1791 +  g_mutex_unlock(gmyth_socket->mutex);
 39.1792 + //g_static_rw_lock_writer_unlock (&rwlock);
 39.1793  
 39.1794 -    gmyth_debug ( "[%s] Sending socket request: %s\n", __FUNCTION__,
 39.1795 -                  str_array );
 39.1796 +  gmyth_debug("[%s] Sending socket request: %s\n", __FUNCTION__, str_array);
 39.1797  
 39.1798 -    // Sends message to backend 
 39.1799 -    // TODO: implement looping to send remaining data, and add timeout testing!    
 39.1800 -    GString *command = g_string_new ( str_array );
 39.1801 + // Sends message to backend 
 39.1802 + // TODO: implement looping to send remaining data, and add timeout testing!    
 39.1803 +  GString *command = g_string_new(str_array);
 39.1804  
 39.1805 -    gmyth_socket_send_command ( gmyth_socket, command );
 39.1806 +  gmyth_socket_send_command(gmyth_socket, command);
 39.1807  
 39.1808 -    g_string_free ( command, TRUE );
 39.1809 +  g_string_free(command, TRUE);
 39.1810  
 39.1811 -    g_free ( str_array );
 39.1812 +  g_free(str_array);
 39.1813  
 39.1814 -    /* ptr_array is pointing to data inside str_list->glist */
 39.1815 -    g_ptr_array_free ( ptr_array, TRUE );
 39.1816 + /* ptr_array is pointing to data inside str_list->glist */
 39.1817 +  g_ptr_array_free(ptr_array, TRUE);
 39.1818  
 39.1819 -    return TRUE;
 39.1820 +  return TRUE;
 39.1821  }
 39.1822  
 39.1823  /* Receives a backend command response and split it into the given string list.
 39.1824 @@ -1236,36 +1227,36 @@
 39.1825   * @return The number of received strings.
 39.1826   */
 39.1827  gint
 39.1828 -gmyth_socket_read_stringlist ( GMythSocket * gmyth_socket,
 39.1829 -                               GMythStringList * str_list )
 39.1830 +gmyth_socket_read_stringlist(GMythSocket * gmyth_socket,
 39.1831 +							 GMythStringList * str_list)
 39.1832  {
 39.1833 -    GString *response;
 39.1834 -    gint i;
 39.1835 +  GString *response;
 39.1836 +  gint i;
 39.1837  
 39.1838 -    gmyth_string_list_clear_all ( str_list );
 39.1839 +  gmyth_string_list_clear_all(str_list);
 39.1840  
 39.1841 -    response = gmyth_socket_receive_response ( gmyth_socket );
 39.1842 -    if ( response != NULL && response->str != NULL && response->len > 0 )
 39.1843 -    {
 39.1844 -        gchar **str_array;
 39.1845 +  response = gmyth_socket_receive_response(gmyth_socket);
 39.1846 +  if (response != NULL && response->str != NULL && response->len > 0)
 39.1847 +	{
 39.1848 +	  gchar **str_array;
 39.1849  
 39.1850 -        g_mutex_lock ( gmyth_socket->mutex );
 39.1851 +	  g_mutex_lock(gmyth_socket->mutex);
 39.1852  
 39.1853 -        str_array = g_strsplit ( response->str, MYTH_SEPARATOR, -1 );
 39.1854 +	  str_array = g_strsplit(response->str, MYTH_SEPARATOR, -1);
 39.1855  
 39.1856 -        for ( i = 0; i < g_strv_length ( str_array ); i++ )
 39.1857 -        {
 39.1858 -            //if ( str_array[i] != NULL && strlen( str_array[i] ) > 0 )
 39.1859 -            gmyth_string_list_append_char_array ( str_list, str_array[i] );
 39.1860 -        }
 39.1861 +	  for (i = 0; i < g_strv_length(str_array); i++)
 39.1862 +		{
 39.1863 +		 //if ( str_array[i] != NULL && strlen( str_array[i] ) > 0 )
 39.1864 +		  gmyth_string_list_append_char_array(str_list, str_array[i]);
 39.1865 +		}
 39.1866  
 39.1867 -        g_mutex_unlock ( gmyth_socket->mutex );
 39.1868 -        g_strfreev ( str_array );
 39.1869 -    }
 39.1870 +	  g_mutex_unlock(gmyth_socket->mutex);
 39.1871 +	  g_strfreev(str_array);
 39.1872 +	}
 39.1873  
 39.1874 -    g_string_free ( response, TRUE );
 39.1875 +  g_string_free(response, TRUE);
 39.1876  
 39.1877 -    return gmyth_string_list_length ( str_list );
 39.1878 +  return gmyth_string_list_length(str_list);
 39.1879  }
 39.1880  
 39.1881  /** Formats a Mythtv protocol command based on str_list and sends it to
 39.1882 @@ -1278,10 +1269,10 @@
 39.1883   * error happens.
 39.1884   */
 39.1885  gint
 39.1886 -gmyth_socket_sendreceive_stringlist ( GMythSocket * gmyth_socket,
 39.1887 -                                      GMythStringList * str_list )
 39.1888 +gmyth_socket_sendreceive_stringlist(GMythSocket * gmyth_socket,
 39.1889 +									GMythStringList * str_list)
 39.1890  {
 39.1891 -    gmyth_socket_write_stringlist ( gmyth_socket, str_list );
 39.1892 +  gmyth_socket_write_stringlist(gmyth_socket, str_list);
 39.1893  
 39.1894 -    return gmyth_socket_read_stringlist ( gmyth_socket, str_list );
 39.1895 +  return gmyth_socket_read_stringlist(gmyth_socket, str_list);
 39.1896  }
    40.1 --- a/gmyth/src/gmyth_socket.h	Wed Jun 13 18:18:42 2007 +0100
    40.2 +++ b/gmyth/src/gmyth_socket.h	Thu Jun 14 18:19:52 2007 +0100
    40.3 @@ -53,77 +53,76 @@
    40.4  typedef struct _GMythSocketClass GMythSocketClass;
    40.5  
    40.6  struct _GMythSocketClass
    40.7 -    {
    40.8 -        GObjectClass parent_class;
    40.9 +{
   40.10 +  GObjectClass parent_class;
   40.11  
   40.12 -        /* callbacks */
   40.13 -        /* no one for now */
   40.14 -    };
   40.15 + /* callbacks */
   40.16 + /* no one for now */
   40.17 +};
   40.18  
   40.19  struct _GMythSocket
   40.20 -    {
   40.21 -        GObject parent;
   40.22 +{
   40.23 +  GObject parent;
   40.24  
   40.25 -        GMutex *mutex;
   40.26 +  GMutex *mutex;
   40.27  
   40.28 -        /* socket descriptor */
   40.29 -        gint sd;
   40.30 -        GIOChannel *sd_io_ch;
   40.31 + /* socket descriptor */
   40.32 +  gint sd;
   40.33 +  GIOChannel *sd_io_ch;
   40.34  
   40.35 -        gchar *hostname;
   40.36 -        gint port;
   40.37 -        gint mythtv_version;
   40.38 -    };
   40.39 +  gchar *hostname;
   40.40 +  gint port;
   40.41 +  gint mythtv_version;
   40.42 +};
   40.43  
   40.44  /* used when no protocol version number was negotiated */
   40.45  #define	MYTHTV_CANNOT_NEGOTIATE_VERSION		0
   40.46  
   40.47 -GType gmyth_socket_get_type ( void );
   40.48 +GType gmyth_socket_get_type(void);
   40.49  
   40.50 -GMythSocket *gmyth_socket_new (  );
   40.51 +GMythSocket *gmyth_socket_new();
   40.52  
   40.53 -GIOChannel *gmyth_socket_get_io_channel ( GMythSocket * gmyth_socket );
   40.54 +GIOChannel *gmyth_socket_get_io_channel(GMythSocket * gmyth_socket);
   40.55  
   40.56 -gboolean gmyth_socket_is_able_to_read ( GMythSocket * gmyth_socket );
   40.57 -gboolean gmyth_socket_is_able_to_write ( GMythSocket * gmyth_socket );
   40.58 +gboolean gmyth_socket_is_able_to_read(GMythSocket * gmyth_socket);
   40.59 +gboolean gmyth_socket_is_able_to_write(GMythSocket * gmyth_socket);
   40.60  
   40.61 -gboolean gmyth_socket_send_command ( GMythSocket * gmyth_socket,
   40.62 -                                     GString * command );
   40.63 -GString *gmyth_socket_receive_response ( GMythSocket * gmyth_socket );
   40.64 -gint gmyth_socket_sendreceive_stringlist ( GMythSocket * gmyth_socket,
   40.65 -                                           GMythStringList * str_list );
   40.66 +gboolean gmyth_socket_send_command(GMythSocket * gmyth_socket,
   40.67 +								   GString * command);
   40.68 +GString *gmyth_socket_receive_response(GMythSocket * gmyth_socket);
   40.69 +gint gmyth_socket_sendreceive_stringlist(GMythSocket * gmyth_socket,
   40.70 +										 GMythStringList * str_list);
   40.71  
   40.72 -gboolean gmyth_socket_connect ( GMythSocket * gmyth_socket,
   40.73 -                                const gchar * hostname, gint port );
   40.74 -gboolean gmyth_socket_connect_with_timeout ( GMythSocket * gmyth_socket,
   40.75 -                                             const gchar * hostname, gint port,
   40.76 -                                             guint timeout );
   40.77 +gboolean gmyth_socket_connect(GMythSocket * gmyth_socket,
   40.78 +							  const gchar * hostname, gint port);
   40.79 +gboolean gmyth_socket_connect_with_timeout(GMythSocket * gmyth_socket,
   40.80 +										   const gchar * hostname, gint port,
   40.81 +										   guint timeout);
   40.82  
   40.83 -gboolean gmyth_socket_connect_to_backend ( GMythSocket * gmyth_socket,
   40.84 -                                           const gchar * hostname_backend,
   40.85 -                                           gint port,
   40.86 -                                           gboolean blocking_client );
   40.87 +gboolean gmyth_socket_connect_to_backend(GMythSocket * gmyth_socket,
   40.88 +										 const gchar * hostname_backend,
   40.89 +										 gint port, gboolean blocking_client);
   40.90  
   40.91 -gboolean gmyth_socket_connect_to_backend_events ( GMythSocket * gmyth_socket,
   40.92 -                                                  const gchar *
   40.93 -                                                  hostname_backend, gint port,
   40.94 -                                                  gboolean blocking_client );
   40.95 +gboolean gmyth_socket_connect_to_backend_events(GMythSocket * gmyth_socket,
   40.96 +												const gchar *
   40.97 +												hostname_backend, gint port,
   40.98 +												gboolean blocking_client);
   40.99  
  40.100 -gchar *gmyth_socket_get_primary_addr ( void );
  40.101 +gchar *gmyth_socket_get_primary_addr(void);
  40.102  
  40.103 -GString *gmyth_socket_get_local_hostname ( void );
  40.104 +GString *gmyth_socket_get_local_hostname(void);
  40.105  
  40.106 -void gmyth_socket_close_connection ( GMythSocket * gmyth_socket );
  40.107 +void gmyth_socket_close_connection(GMythSocket * gmyth_socket);
  40.108  
  40.109 -gboolean gmyth_socket_check_protocol_version ( GMythSocket * gmyth_socket );
  40.110 -gint gmyth_socket_check_protocol_version_number ( GMythSocket * gmyth_socket,
  40.111 -                                                  gint mythtv_version );
  40.112 +gboolean gmyth_socket_check_protocol_version(GMythSocket * gmyth_socket);
  40.113 +gint gmyth_socket_check_protocol_version_number(GMythSocket * gmyth_socket,
  40.114 +												gint mythtv_version);
  40.115  
  40.116 -gint gmyth_socket_get_protocol_version ( GMythSocket * gmyth_socket );
  40.117 +gint gmyth_socket_get_protocol_version(GMythSocket * gmyth_socket);
  40.118  
  40.119 -gboolean gmyth_socket_write_stringlist ( GMythSocket * gmyth_socket,
  40.120 -                                         GMythStringList * str_list );
  40.121 -gint gmyth_socket_read_stringlist ( GMythSocket * gmyth_socket,
  40.122 -                                    GMythStringList * str_list );
  40.123 +gboolean gmyth_socket_write_stringlist(GMythSocket * gmyth_socket,
  40.124 +									   GMythStringList * str_list);
  40.125 +gint gmyth_socket_read_stringlist(GMythSocket * gmyth_socket,
  40.126 +								  GMythStringList * str_list);
  40.127  G_END_DECLS
  40.128  #endif /* __GMYTH_SOCKET_H__ */
    41.1 --- a/gmyth/src/gmyth_stringlist.c	Wed Jun 13 18:18:42 2007 +0100
    41.2 +++ b/gmyth/src/gmyth_stringlist.c	Thu Jun 14 18:19:52 2007 +0100
    41.3 @@ -33,47 +33,47 @@
    41.4  
    41.5  #include "gmyth_debug.h"
    41.6  
    41.7 -static void gmyth_string_list_class_init ( GMythStringListClass * klass );
    41.8 -static void gmyth_string_list_init ( GMythStringList * object );
    41.9 +static void gmyth_string_list_class_init(GMythStringListClass * klass);
   41.10 +static void gmyth_string_list_init(GMythStringList * object);
   41.11  
   41.12 -static void gmyth_string_list_dispose ( GObject * object );
   41.13 -static void gmyth_string_list_finalize ( GObject * object );
   41.14 +static void gmyth_string_list_dispose(GObject * object);
   41.15 +static void gmyth_string_list_finalize(GObject * object);
   41.16  
   41.17 -G_DEFINE_TYPE ( GMythStringList, gmyth_string_list, G_TYPE_OBJECT )
   41.18 -     static void gmyth_string_list_class_init ( GMythStringListClass * klass )
   41.19 +G_DEFINE_TYPE(GMythStringList, gmyth_string_list, G_TYPE_OBJECT)
   41.20 +	 static void gmyth_string_list_class_init(GMythStringListClass * klass)
   41.21  {
   41.22 -    GObjectClass *gobject_class;
   41.23 +  GObjectClass *gobject_class;
   41.24  
   41.25 -    gobject_class = ( GObjectClass * ) klass;
   41.26 +  gobject_class = (GObjectClass *) klass;
   41.27  
   41.28 -    gobject_class->dispose = gmyth_string_list_dispose;
   41.29 -    gobject_class->finalize = gmyth_string_list_finalize;
   41.30 +  gobject_class->dispose = gmyth_string_list_dispose;
   41.31 +  gobject_class->finalize = gmyth_string_list_finalize;
   41.32  }
   41.33  
   41.34  static void
   41.35 -gmyth_string_list_init ( GMythStringList * gmyth_string_list )
   41.36 +gmyth_string_list_init(GMythStringList * gmyth_string_list)
   41.37  {
   41.38 -    gmyth_string_list->glist = NULL;
   41.39 +  gmyth_string_list->glist = NULL;
   41.40  }
   41.41  
   41.42  static void
   41.43 -gmyth_string_list_dispose ( GObject * object )
   41.44 +gmyth_string_list_dispose(GObject * object)
   41.45  {
   41.46 -    GMythStringList *gmyth_string_list = GMYTH_STRING_LIST ( object );
   41.47 +  GMythStringList *gmyth_string_list = GMYTH_STRING_LIST(object);
   41.48  
   41.49 -    gmyth_string_list_clear_all ( gmyth_string_list );
   41.50 +  gmyth_string_list_clear_all(gmyth_string_list);
   41.51  
   41.52 -    G_OBJECT_CLASS ( gmyth_string_list_parent_class )->dispose ( object );
   41.53 +  G_OBJECT_CLASS(gmyth_string_list_parent_class)->dispose(object);
   41.54  }
   41.55  
   41.56  static void
   41.57 -gmyth_string_list_finalize ( GObject * object )
   41.58 +gmyth_string_list_finalize(GObject * object)
   41.59  {
   41.60 -    //GMythStringList *gmyth_string_list = GMYTH_STRING_LIST(object);
   41.61 + //GMythStringList *gmyth_string_list = GMYTH_STRING_LIST(object);
   41.62  
   41.63 -    g_signal_handlers_destroy ( object );
   41.64 +  g_signal_handlers_destroy(object);
   41.65  
   41.66 -    G_OBJECT_CLASS ( gmyth_string_list_parent_class )->finalize ( object );
   41.67 +  G_OBJECT_CLASS(gmyth_string_list_parent_class)->finalize(object);
   41.68  }
   41.69  
   41.70  /** Creates a new instance of GStringList.
   41.71 @@ -81,12 +81,12 @@
   41.72   * @return a new instance of GStringList.
   41.73   */
   41.74  GMythStringList *
   41.75 -gmyth_string_list_new (  )
   41.76 +gmyth_string_list_new()
   41.77  {
   41.78 -    GMythStringList *gmyth_string_list =
   41.79 -        GMYTH_STRING_LIST ( g_object_new ( GMYTH_STRING_LIST_TYPE, NULL ) );
   41.80 +  GMythStringList *gmyth_string_list =
   41.81 +	GMYTH_STRING_LIST(g_object_new(GMYTH_STRING_LIST_TYPE, NULL));
   41.82  
   41.83 -    return gmyth_string_list;
   41.84 +  return gmyth_string_list;
   41.85  }
   41.86  
   41.87  /** Appends a guint64 to the string list.
   41.88 @@ -97,15 +97,15 @@
   41.89   * @return The appended guint64 converted to a GString object.
   41.90   */
   41.91  GString *
   41.92 -gmyth_string_list_append_int ( GMythStringList * strlist, const gint value )
   41.93 +gmyth_string_list_append_int(GMythStringList * strlist, const gint value)
   41.94  {
   41.95 -    GString *value_str = g_string_new ( "" );
   41.96 +  GString *value_str = g_string_new("");
   41.97  
   41.98 -    g_string_printf ( value_str, "%d", value );
   41.99 +  g_string_printf(value_str, "%d", value);
  41.100  
  41.101 -    strlist->glist = g_list_append ( strlist->glist, value_str );
  41.102 +  strlist->glist = g_list_append(strlist->glist, value_str);
  41.103  
  41.104 -    return value_str;
  41.105 +  return value_str;
  41.106  }
  41.107  
  41.108  /** Appends a guint64 to the string list.
  41.109 @@ -116,32 +116,32 @@
  41.110   * @return The appended guint64 converted to a GString object.
  41.111   */
  41.112  GString *
  41.113 -gmyth_string_list_append_uint64 ( GMythStringList * strlist,
  41.114 -                                  const guint64 value )
  41.115 +gmyth_string_list_append_uint64(GMythStringList * strlist,
  41.116 +								const guint64 value)
  41.117  {
  41.118 -    GString *tmp_str1 = g_string_new ( "" );
  41.119 -    GString *tmp_str2 = g_string_new ( "" );
  41.120 +  GString *tmp_str1 = g_string_new("");
  41.121 +  GString *tmp_str2 = g_string_new("");
  41.122  
  41.123 -    gmyth_debug ( "value = %llu.\n", value );
  41.124 +  gmyth_debug("value = %llu.\n", value);
  41.125  
  41.126 -    gulong l2 = ( ( guint64 ) value & 0xffffffff );
  41.127 -    gulong l1 = ( ( guint64 ) value >> 32 );
  41.128 +  gulong l2 = ((guint64) value & 0xffffffff);
  41.129 +  gulong l1 = ((guint64) value >> 32);
  41.130  
  41.131 -    /* high order part of guint64 value */
  41.132 -    g_string_printf ( tmp_str1, "%lu", l1 );
  41.133 + /* high order part of guint64 value */
  41.134 +  g_string_printf(tmp_str1, "%lu", l1);
  41.135  
  41.136 -    gmyth_debug ( "[%s] uint64 (high) = %s\n", __FUNCTION__, tmp_str1->str );
  41.137 +  gmyth_debug("[%s] uint64 (high) = %s\n", __FUNCTION__, tmp_str1->str);
  41.138  
  41.139 -    strlist->glist = g_list_append ( strlist->glist, tmp_str1 );
  41.140 +  strlist->glist = g_list_append(strlist->glist, tmp_str1);
  41.141  
  41.142 -    /* low order part of guint64 value */
  41.143 -    g_string_printf ( tmp_str2, "%lu", l2 );
  41.144 + /* low order part of guint64 value */
  41.145 +  g_string_printf(tmp_str2, "%lu", l2);
  41.146  
  41.147 -    gmyth_debug ( "[%s] uint64 (low) = %s\n", __FUNCTION__, tmp_str2->str );
  41.148 +  gmyth_debug("[%s] uint64 (low) = %s\n", __FUNCTION__, tmp_str2->str);
  41.149  
  41.150 -    strlist->glist = g_list_append ( strlist->glist, tmp_str2 );
  41.151 +  strlist->glist = g_list_append(strlist->glist, tmp_str2);
  41.152  
  41.153 -    return tmp_str2;
  41.154 +  return tmp_str2;
  41.155  }
  41.156  
  41.157  /** Appends a gint64 to the string list.
  41.158 @@ -152,31 +152,31 @@
  41.159   * @return The appended gint64 converted to a GString object.
  41.160   */
  41.161  GString *
  41.162 -gmyth_string_list_append_int64 ( GMythStringList * strlist, const gint64 value )
  41.163 +gmyth_string_list_append_int64(GMythStringList * strlist, const gint64 value)
  41.164  {
  41.165 -    GString *tmp_str1 = g_string_new ( "" );
  41.166 -    GString *tmp_str2 = g_string_new ( "" );
  41.167 +  GString *tmp_str1 = g_string_new("");
  41.168 +  GString *tmp_str2 = g_string_new("");
  41.169  
  41.170 -    gmyth_debug ( "value = %lld.\n", value );
  41.171 +  gmyth_debug("value = %lld.\n", value);
  41.172  
  41.173 -    glong l2 = ( ( gint64 ) value & 0xffffffff );
  41.174 -    glong l1 = ( ( gint64 ) value >> 32 );
  41.175 +  glong l2 = ((gint64) value & 0xffffffff);
  41.176 +  glong l1 = ((gint64) value >> 32);
  41.177  
  41.178 -    /* high order part of gint64 value */
  41.179 -    g_string_printf ( tmp_str1, "%ld", l1 );
  41.180 + /* high order part of gint64 value */
  41.181 +  g_string_printf(tmp_str1, "%ld", l1);
  41.182  
  41.183 -    gmyth_debug ( "[%s] int64 (high) = %s\n", __FUNCTION__, tmp_str1->str );
  41.184 +  gmyth_debug("[%s] int64 (high) = %s\n", __FUNCTION__, tmp_str1->str);
  41.185  
  41.186 -    strlist->glist = g_list_append ( strlist->glist, tmp_str1 );
  41.187 +  strlist->glist = g_list_append(strlist->glist, tmp_str1);
  41.188  
  41.189 -    /* low order part of gint64 value */
  41.190 -    g_string_printf ( tmp_str2, "%ld", l2 );
  41.191 + /* low order part of gint64 value */
  41.192 +  g_string_printf(tmp_str2, "%ld", l2);
  41.193  
  41.194 -    gmyth_debug ( "[%s] int64 (low) = %s\n", __FUNCTION__, tmp_str2->str );
  41.195 +  gmyth_debug("[%s] int64 (low) = %s\n", __FUNCTION__, tmp_str2->str);
  41.196  
  41.197 -    strlist->glist = g_list_append ( strlist->glist, tmp_str2 );
  41.198 +  strlist->glist = g_list_append(strlist->glist, tmp_str2);
  41.199  
  41.200 -    return tmp_str2;
  41.201 +  return tmp_str2;
  41.202  }
  41.203  
  41.204  /** Appends a char array to the string list.
  41.205 @@ -187,18 +187,18 @@
  41.206   * @return The appended char array converted to a GString object.
  41.207   */
  41.208  GString *
  41.209 -gmyth_string_list_append_char_array ( GMythStringList * strlist,
  41.210 -                                      const gchar * value )
  41.211 +gmyth_string_list_append_char_array(GMythStringList * strlist,
  41.212 +									const gchar * value)
  41.213  {
  41.214 -    GString *tmp_str = NULL;
  41.215 +  GString *tmp_str = NULL;
  41.216  
  41.217 -    g_return_val_if_fail ( strlist != NULL, NULL );
  41.218 +  g_return_val_if_fail(strlist != NULL, NULL);
  41.219  
  41.220 -    tmp_str = g_string_new ( value );
  41.221 +  tmp_str = g_string_new(value);
  41.222  
  41.223 -    strlist->glist = g_list_append ( strlist->glist, tmp_str );
  41.224 +  strlist->glist = g_list_append(strlist->glist, tmp_str);
  41.225  
  41.226 -    return tmp_str;
  41.227 +  return tmp_str;
  41.228  }
  41.229  
  41.230  /** Appends a string to the string list.
  41.231 @@ -209,21 +209,21 @@
  41.232   * @return The appended string itself. 
  41.233   */
  41.234  GString *
  41.235 -gmyth_string_list_append_string ( GMythStringList * strlist, GString * value )
  41.236 +gmyth_string_list_append_string(GMythStringList * strlist, GString * value)
  41.237  {
  41.238 -    g_return_val_if_fail ( strlist != NULL, NULL );
  41.239 +  g_return_val_if_fail(strlist != NULL, NULL);
  41.240  
  41.241 -    if ( value != NULL )
  41.242 -    {
  41.243 -        strlist->glist =
  41.244 -            g_list_append ( strlist->glist, g_string_new ( value->str ) );
  41.245 -    }
  41.246 -    else
  41.247 -    {
  41.248 -        strlist->glist = g_list_append ( strlist->glist, NULL );
  41.249 -    }
  41.250 +  if (value != NULL)
  41.251 +	{
  41.252 +	  strlist->glist =
  41.253 +		g_list_append(strlist->glist, g_string_new(value->str));
  41.254 +	}
  41.255 +  else
  41.256 +	{
  41.257 +	  strlist->glist = g_list_append(strlist->glist, NULL);
  41.258 +	}
  41.259  
  41.260 -    return value;
  41.261 +  return value;
  41.262  }
  41.263  
  41.264  /** Gets an integer value from the string list at the given position.
  41.265 @@ -233,21 +233,20 @@
  41.266   * @return The integer value.
  41.267   */
  41.268  gint
  41.269 -gmyth_string_list_get_int ( GMythStringList * strlist, const gint index )
  41.270 +gmyth_string_list_get_int(GMythStringList * strlist, const gint index)
  41.271  {
  41.272 -    //TODO: Create static method check_index()
  41.273 -    GString *tmp_str = NULL;
  41.274 + //TODO: Create static method check_index()
  41.275 +  GString *tmp_str = NULL;
  41.276  
  41.277 -    g_return_val_if_fail ( strlist != NULL, 0 );
  41.278 +  g_return_val_if_fail(strlist != NULL, 0);
  41.279  
  41.280 -    tmp_str = ( GString * ) g_list_nth_data ( strlist->glist, index );
  41.281 +  tmp_str = (GString *) g_list_nth_data(strlist->glist, index);
  41.282  
  41.283 -    if ( NULL == tmp_str || NULL == tmp_str->str
  41.284 -         || strlen ( tmp_str->str ) <= 0 )
  41.285 -        return 0;
  41.286 +  if (NULL == tmp_str || NULL == tmp_str->str || strlen(tmp_str->str) <= 0)
  41.287 +	return 0;
  41.288  
  41.289 -    return ( gint ) (           /* 0x00000000ffffffffL &  (gint64) */
  41.290 -                         g_ascii_strtoull ( tmp_str->str, NULL, 10 ) );
  41.291 +  return (gint) (				/* 0x00000000ffffffffL &  (gint64) */
  41.292 +				  g_ascii_strtoull(tmp_str->str, NULL, 10));
  41.293  }
  41.294  
  41.295  /** Gets a guint64 value from the string list at the given position.
  41.296 @@ -260,56 +259,52 @@
  41.297   * @return The guint64 value.
  41.298   */
  41.299  guint64
  41.300 -gmyth_string_list_get_uint64 ( GMythStringList * strlist, const gint index )
  41.301 +gmyth_string_list_get_uint64(GMythStringList * strlist, const gint index)
  41.302  {
  41.303 -    //TODO: Create static method check_index()
  41.304 -    guint64 ret_value = 0;
  41.305 -    guint64 l2 = 0;
  41.306 + //TODO: Create static method check_index()
  41.307 +  guint64 ret_value = 0;
  41.308 +  guint64 l2 = 0;
  41.309  
  41.310 -    g_return_val_if_fail ( strlist != NULL, 0 );
  41.311 +  g_return_val_if_fail(strlist != NULL, 0);
  41.312  
  41.313 -    const GString *tmp_str1 =
  41.314 -        ( GString * ) g_list_nth_data ( strlist->glist, index );
  41.315 -    const GString *tmp_str2 =
  41.316 -        ( GString * ) g_list_nth_data ( strlist->glist, index + 1 );
  41.317 +  const GString *tmp_str1 =
  41.318 +	(GString *) g_list_nth_data(strlist->glist, index);
  41.319 +  const GString *tmp_str2 =
  41.320 +	(GString *) g_list_nth_data(strlist->glist, index + 1);
  41.321  
  41.322 -    if ( tmp_str1 != NULL )
  41.323 -        gmyth_debug ( "[%s] seek high bytes = %s\n", __FUNCTION__,
  41.324 -                      tmp_str1->str );
  41.325 -    if ( tmp_str2 == NULL || strlen ( tmp_str2->str ) > 0 )
  41.326 -    {
  41.327 -    }
  41.328 -    else
  41.329 -    {
  41.330 -        gmyth_debug ( "[%s] seek low bytes = %s\n", __FUNCTION__,
  41.331 -                      tmp_str2->str );
  41.332 -    }
  41.333 +  if (tmp_str1 != NULL)
  41.334 +	gmyth_debug("[%s] seek high bytes = %s\n", __FUNCTION__, tmp_str1->str);
  41.335 +  if (tmp_str2 == NULL || strlen(tmp_str2->str) > 0)
  41.336 +	{
  41.337 +	}
  41.338 +  else
  41.339 +	{
  41.340 +	  gmyth_debug("[%s] seek low bytes = %s\n", __FUNCTION__, tmp_str2->str);
  41.341 +	}
  41.342  
  41.343 -    guint64 l1 = ( ( guint64 ) g_ascii_strtoull ( tmp_str1->str, NULL, 10 ) /*& 0xffffffff */
  41.344 -         );
  41.345 +  guint64 l1 = ((guint64) g_ascii_strtoull(tmp_str1->str, NULL, 10)	/*& 0xffffffff */
  41.346 +	);
  41.347  
  41.348 -    if ( tmp_str2 != NULL && tmp_str2->str != NULL
  41.349 -         && strlen ( tmp_str2->str ) > 0 )
  41.350 -    {
  41.351 -        l2 = ( ( guint64 ) g_ascii_strtoull ( tmp_str2->str, NULL, 10 )
  41.352 -               /*& 0xffffffff */
  41.353 -             );
  41.354 -    }
  41.355 -    else
  41.356 -    {
  41.357 -        l2 = l1;
  41.358 -        l1 = 0;
  41.359 -    }
  41.360 +  if (tmp_str2 != NULL && tmp_str2->str != NULL && strlen(tmp_str2->str) > 0)
  41.361 +	{
  41.362 +	  l2 = ((guint64) g_ascii_strtoull(tmp_str2->str, NULL, 10)
  41.363 +		   /*& 0xffffffff */
  41.364 +		);
  41.365 +	}
  41.366 +  else
  41.367 +	{
  41.368 +	  l2 = l1;
  41.369 +	  l1 = 0;
  41.370 +	}
  41.371  
  41.372 -    gmyth_debug ( "[%s]\t[l1 == %llu, l2 == %llu]\n", __FUNCTION__, l1, l2 );
  41.373 +  gmyth_debug("[%s]\t[l1 == %llu, l2 == %llu]\n", __FUNCTION__, l1, l2);
  41.374  
  41.375 -    ret_value =
  41.376 -        ( ( guint64 ) ( l2 ) /*& 0xffffffff */  ) | ( ( guint64 ) l1 << 32 );
  41.377 +  ret_value = ((guint64) (l2) /*& 0xffffffff */ ) | ((guint64) l1 << 32);
  41.378  
  41.379 -    gmyth_debug ( "[%s] returning uint64 value = %llu\n", __FUNCTION__,
  41.380 -                  ret_value );
  41.381 +  gmyth_debug("[%s] returning uint64 value = %llu\n", __FUNCTION__,
  41.382 +			  ret_value);
  41.383  
  41.384 -    return ret_value;
  41.385 +  return ret_value;
  41.386  }
  41.387  
  41.388  /** Gets a gint64 value from the string list at the given position.
  41.389 @@ -322,56 +317,51 @@
  41.390   * @return The gint64 value.
  41.391   */
  41.392  gint64
  41.393 -gmyth_string_list_get_int64 ( GMythStringList * strlist, const gint index )
  41.394 +gmyth_string_list_get_int64(GMythStringList * strlist, const gint index)
  41.395  {
  41.396 -    //TODO: Create static method check_index()
  41.397 -    gint64 ret_value = 0;
  41.398 -    gint64 l2 = 0;
  41.399 + //TODO: Create static method check_index()
  41.400 +  gint64 ret_value = 0;
  41.401 +  gint64 l2 = 0;
  41.402  
  41.403 -    g_return_val_if_fail ( strlist != NULL, 0 );
  41.404 +  g_return_val_if_fail(strlist != NULL, 0);
  41.405  
  41.406 -    const GString *tmp_str1 =
  41.407 -        ( GString * ) g_list_nth_data ( strlist->glist, index );
  41.408 -    const GString *tmp_str2 =
  41.409 -        ( GString * ) g_list_nth_data ( strlist->glist, index + 1 );
  41.410 +  const GString *tmp_str1 =
  41.411 +	(GString *) g_list_nth_data(strlist->glist, index);
  41.412 +  const GString *tmp_str2 =
  41.413 +	(GString *) g_list_nth_data(strlist->glist, index + 1);
  41.414  
  41.415 -    if ( tmp_str1 != NULL )
  41.416 -        gmyth_debug ( "[%s] seek high bytes = %s\n", __FUNCTION__,
  41.417 -                      tmp_str1->str );
  41.418 -    if ( tmp_str2 == NULL || strlen ( tmp_str2->str ) > 0 )
  41.419 -    {
  41.420 -    }
  41.421 -    else
  41.422 -    {
  41.423 -        gmyth_debug ( "[%s] seek low bytes = %s\n", __FUNCTION__,
  41.424 -                      tmp_str2->str );
  41.425 -    }
  41.426 +  if (tmp_str1 != NULL)
  41.427 +	gmyth_debug("[%s] seek high bytes = %s\n", __FUNCTION__, tmp_str1->str);
  41.428 +  if (tmp_str2 == NULL || strlen(tmp_str2->str) > 0)
  41.429 +	{
  41.430 +	}
  41.431 +  else
  41.432 +	{
  41.433 +	  gmyth_debug("[%s] seek low bytes = %s\n", __FUNCTION__, tmp_str2->str);
  41.434 +	}
  41.435  
  41.436 -    gint64 l1 = ( ( guint64 ) g_ascii_strtoull ( tmp_str1->str, NULL, 10 )  /*& 0xffffffff */
  41.437 -         );
  41.438 +  gint64 l1 = ((guint64) g_ascii_strtoull(tmp_str1->str, NULL, 10)	/*& 0xffffffff */
  41.439 +	);
  41.440  
  41.441 -    if ( tmp_str2 != NULL && tmp_str2->str != NULL
  41.442 -         && strlen ( tmp_str2->str ) > 0 )
  41.443 -    {
  41.444 -        l2 = ( ( gint64 ) g_ascii_strtoull ( tmp_str2->str, NULL, 10 )
  41.445 -               /*& 0xffffffff */
  41.446 -             );
  41.447 -    }
  41.448 -    else
  41.449 -    {
  41.450 -        l2 = l1;
  41.451 -        l1 = 0;
  41.452 -    }
  41.453 +  if (tmp_str2 != NULL && tmp_str2->str != NULL && strlen(tmp_str2->str) > 0)
  41.454 +	{
  41.455 +	  l2 = ((gint64) g_ascii_strtoull(tmp_str2->str, NULL, 10)
  41.456 +		   /*& 0xffffffff */
  41.457 +		);
  41.458 +	}
  41.459 +  else
  41.460 +	{
  41.461 +	  l2 = l1;
  41.462 +	  l1 = 0;
  41.463 +	}
  41.464  
  41.465 -    gmyth_debug ( "[%s]\t[l1 == %lld, l2 == %lld]\n", __FUNCTION__, l1, l2 );
  41.466 +  gmyth_debug("[%s]\t[l1 == %lld, l2 == %lld]\n", __FUNCTION__, l1, l2);
  41.467  
  41.468 -    ret_value =
  41.469 -        ( ( gint64 ) ( l2 ) /*& 0xffffffff */  ) | ( ( gint64 ) l1 << 32 );
  41.470 +  ret_value = ((gint64) (l2) /*& 0xffffffff */ ) | ((gint64) l1 << 32);
  41.471  
  41.472 -    gmyth_debug ( "[%s] returning int64 value = %lld\n", __FUNCTION__,
  41.473 -                  ret_value );
  41.474 +  gmyth_debug("[%s] returning int64 value = %lld\n", __FUNCTION__, ret_value);
  41.475  
  41.476 -    return ret_value;
  41.477 +  return ret_value;
  41.478  }
  41.479  
  41.480  
  41.481 @@ -382,27 +372,27 @@
  41.482   * @return A pointer to the string data.
  41.483   */
  41.484  GString *
  41.485 -gmyth_string_list_get_string ( GMythStringList * strlist, const gint index )
  41.486 +gmyth_string_list_get_string(GMythStringList * strlist, const gint index)
  41.487  {
  41.488 -    GString *ret;
  41.489 +  GString *ret;
  41.490  
  41.491 -    if ( !strlist || !( strlist->glist ) )
  41.492 -    {
  41.493 -        gmyth_debug ( "%s received Null arguments", __FUNCTION__ );
  41.494 -        return NULL;
  41.495 -    }
  41.496 +  if (!strlist || !(strlist->glist))
  41.497 +	{
  41.498 +	  gmyth_debug("%s received Null arguments", __FUNCTION__);
  41.499 +	  return NULL;
  41.500 +	}
  41.501  
  41.502 -    ret = ( GString * ) g_list_nth_data ( strlist->glist, index );
  41.503 +  ret = (GString *) g_list_nth_data(strlist->glist, index);
  41.504  
  41.505 -    return g_string_new ( ret->str );
  41.506 +  return g_string_new(ret->str);
  41.507  }
  41.508  
  41.509  
  41.510  static void
  41.511 -gmyth_string_list_clear_element ( GString * str_elem, void *data_aux )
  41.512 +gmyth_string_list_clear_element(GString * str_elem, void *data_aux)
  41.513  {
  41.514 -    if ( str_elem != NULL )
  41.515 -        g_string_free ( str_elem, TRUE );
  41.516 +  if (str_elem != NULL)
  41.517 +	g_string_free(str_elem, TRUE);
  41.518  }
  41.519  
  41.520  /** Removes all strings from the string list.
  41.521 @@ -410,15 +400,15 @@
  41.522   * @param strlist The GMythStringList instance.
  41.523   */
  41.524  void
  41.525 -gmyth_string_list_clear_all ( GMythStringList * strlist )
  41.526 +gmyth_string_list_clear_all(GMythStringList * strlist)
  41.527  {
  41.528 -    if ( strlist != NULL && strlist->glist )
  41.529 -    {
  41.530 -        g_list_foreach ( strlist->glist,
  41.531 -                         ( GFunc ) gmyth_string_list_clear_element, NULL );
  41.532 -        g_list_free ( strlist->glist );
  41.533 -        strlist->glist = NULL;
  41.534 -    }
  41.535 +  if (strlist != NULL && strlist->glist)
  41.536 +	{
  41.537 +	  g_list_foreach(strlist->glist,
  41.538 +					 (GFunc) gmyth_string_list_clear_element, NULL);
  41.539 +	  g_list_free(strlist->glist);
  41.540 +	  strlist->glist = NULL;
  41.541 +	}
  41.542  }
  41.543  
  41.544  /** Retrieves the number of elements in the string list.
  41.545 @@ -427,10 +417,10 @@
  41.546   * @return the string list length.
  41.547   */
  41.548  gint
  41.549 -gmyth_string_list_length ( GMythStringList * strlist )
  41.550 +gmyth_string_list_length(GMythStringList * strlist)
  41.551  {
  41.552 -    if ( !( strlist != NULL && strlist->glist != NULL ) )
  41.553 -        return 0;
  41.554 +  if (!(strlist != NULL && strlist->glist != NULL))
  41.555 +	return 0;
  41.556  
  41.557 -    return g_list_length ( strlist->glist );
  41.558 +  return g_list_length(strlist->glist);
  41.559  }
    42.1 --- a/gmyth/src/gmyth_stringlist.h	Wed Jun 13 18:18:42 2007 +0100
    42.2 +++ b/gmyth/src/gmyth_stringlist.h	Thu Jun 14 18:19:52 2007 +0100
    42.3 @@ -48,49 +48,49 @@
    42.4  typedef struct _GMythStringListClass GMythStringListClass;
    42.5  
    42.6  struct _GMythStringListClass
    42.7 -    {
    42.8 -        GObjectClass parent_class;
    42.9 +{
   42.10 +  GObjectClass parent_class;
   42.11  
   42.12 -        /* callbacks */
   42.13 -        /* no one for now */
   42.14 -    };
   42.15 + /* callbacks */
   42.16 + /* no one for now */
   42.17 +};
   42.18  
   42.19  struct _GMythStringList
   42.20 -    {
   42.21 -        GObject parent;
   42.22 +{
   42.23 +  GObject parent;
   42.24  
   42.25 -        /* string list */
   42.26 -        GList *glist;
   42.27 -    };
   42.28 + /* string list */
   42.29 +  GList *glist;
   42.30 +};
   42.31  
   42.32  
   42.33 -GType gmyth_string_list_get_type ( void );
   42.34 +GType gmyth_string_list_get_type(void);
   42.35  
   42.36 -GMythStringList *gmyth_string_list_new ( void );
   42.37 +GMythStringList *gmyth_string_list_new(void);
   42.38  
   42.39 -void gmyth_string_list_clear_all ( GMythStringList * strlist );
   42.40 -int gmyth_string_list_length ( GMythStringList * strlist );
   42.41 +void gmyth_string_list_clear_all(GMythStringList * strlist);
   42.42 +int gmyth_string_list_length(GMythStringList * strlist);
   42.43  
   42.44 -GString *gmyth_string_list_append_int ( GMythStringList * strlist,
   42.45 -                                        const gint value );
   42.46 -GString *gmyth_string_list_append_uint64 ( GMythStringList * strlist,
   42.47 -                                           const guint64 value );
   42.48 +GString *gmyth_string_list_append_int(GMythStringList * strlist,
   42.49 +									  const gint value);
   42.50 +GString *gmyth_string_list_append_uint64(GMythStringList * strlist,
   42.51 +										 const guint64 value);
   42.52  
   42.53 -GString *gmyth_string_list_append_int64 ( GMythStringList * strlist,
   42.54 -                                          const gint64 value );
   42.55 +GString *gmyth_string_list_append_int64(GMythStringList * strlist,
   42.56 +										const gint64 value);
   42.57  
   42.58 -GString *gmyth_string_list_append_char_array ( GMythStringList * strlist,
   42.59 -                                               const char *value );
   42.60 -GString *gmyth_string_list_append_string ( GMythStringList * strlist,
   42.61 -                                           GString * value );
   42.62 +GString *gmyth_string_list_append_char_array(GMythStringList * strlist,
   42.63 +											 const char *value);
   42.64 +GString *gmyth_string_list_append_string(GMythStringList * strlist,
   42.65 +										 GString * value);
   42.66  
   42.67 -int gmyth_string_list_get_int ( GMythStringList * strlist, const gint index );
   42.68 -guint64 gmyth_string_list_get_uint64 ( GMythStringList * strlist,
   42.69 -                                       const gint index );
   42.70 -gint64 gmyth_string_list_get_int64 ( GMythStringList * strlist,
   42.71 -                                     const gint index );
   42.72 -GString *gmyth_string_list_get_string ( GMythStringList * strlist,
   42.73 -                                        const gint index );
   42.74 +int gmyth_string_list_get_int(GMythStringList * strlist, const gint index);
   42.75 +guint64 gmyth_string_list_get_uint64(GMythStringList * strlist,
   42.76 +									 const gint index);
   42.77 +gint64 gmyth_string_list_get_int64(GMythStringList * strlist,
   42.78 +								   const gint index);
   42.79 +GString *gmyth_string_list_get_string(GMythStringList * strlist,
   42.80 +									  const gint index);
   42.81  
   42.82  #define gmyth_string_list_get_char_array(strlist, index) \
   42.83  	(gmyth_string_list_get_string(strlist, index))->str
    43.1 --- a/gmyth/src/gmyth_transcoder.c	Wed Jun 13 18:18:42 2007 +0100
    43.2 +++ b/gmyth/src/gmyth_transcoder.c	Thu Jun 14 18:19:52 2007 +0100
    43.3 @@ -39,48 +39,48 @@
    43.4  #include "gmyth_jobqueue.h"
    43.5  #include "gmyth_transcoder.h"
    43.6  
    43.7 -static void gmyth_transcoder_class_init ( GMythTranscoderClass * klass );
    43.8 -static void gmyth_transcoder_init ( GMythTranscoder * object );
    43.9 +static void gmyth_transcoder_class_init(GMythTranscoderClass * klass);
   43.10 +static void gmyth_transcoder_init(GMythTranscoder * object);
   43.11  
   43.12 -static void gmyth_transcoder_dispose ( GObject * object );
   43.13 -static void gmyth_transcoder_finalize ( GObject * object );
   43.14 +static void gmyth_transcoder_dispose(GObject * object);
   43.15 +static void gmyth_transcoder_finalize(GObject * object);
   43.16  
   43.17 -G_DEFINE_TYPE ( GMythTranscoder, gmyth_transcoder, G_TYPE_OBJECT )
   43.18 -     static void gmyth_transcoder_class_init ( GMythTranscoderClass * klass )
   43.19 +G_DEFINE_TYPE(GMythTranscoder, gmyth_transcoder, G_TYPE_OBJECT)
   43.20 +	 static void gmyth_transcoder_class_init(GMythTranscoderClass * klass)
   43.21  {
   43.22 -    GObjectClass *gobject_class = G_OBJECT_CLASS ( klass );
   43.23 +  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
   43.24  
   43.25 -    gobject_class->dispose = gmyth_transcoder_dispose;
   43.26 -    gobject_class->finalize = gmyth_transcoder_finalize;
   43.27 +  gobject_class->dispose = gmyth_transcoder_dispose;
   43.28 +  gobject_class->finalize = gmyth_transcoder_finalize;
   43.29  }
   43.30  
   43.31  static void
   43.32 -gmyth_transcoder_init ( GMythTranscoder * transcoder )
   43.33 +gmyth_transcoder_init(GMythTranscoder * transcoder)
   43.34  {
   43.35 -    transcoder->started = FALSE;
   43.36 +  transcoder->started = FALSE;
   43.37  }
   43.38  
   43.39  static void
   43.40 -gmyth_transcoder_dispose ( GObject * object )
   43.41 +gmyth_transcoder_dispose(GObject * object)
   43.42  {
   43.43 -    GMythTranscoder *transcoder = GMYTH_TRANSCODER ( object );
   43.44 +  GMythTranscoder *transcoder = GMYTH_TRANSCODER(object);
   43.45  
   43.46 -    g_free ( transcoder->output_filename );
   43.47 -    g_free ( transcoder->filename );
   43.48 -    g_free ( transcoder->profile );
   43.49 -    g_free ( transcoder->starttime );
   43.50 +  g_free(transcoder->output_filename);
   43.51 +  g_free(transcoder->filename);
   43.52 +  g_free(transcoder->profile);
   43.53 +  g_free(transcoder->starttime);
   43.54  
   43.55 -    if ( transcoder->backend_info )
   43.56 -        g_object_unref ( transcoder->backend_info );
   43.57 +  if (transcoder->backend_info)
   43.58 +	g_object_unref(transcoder->backend_info);
   43.59  
   43.60 -    G_OBJECT_CLASS ( gmyth_transcoder_parent_class )->dispose ( object );
   43.61 +  G_OBJECT_CLASS(gmyth_transcoder_parent_class)->dispose(object);
   43.62  }
   43.63  
   43.64  static void
   43.65 -gmyth_transcoder_finalize ( GObject * object )
   43.66 +gmyth_transcoder_finalize(GObject * object)
   43.67  {
   43.68 -    g_signal_handlers_destroy ( object );
   43.69 -    G_OBJECT_CLASS ( gmyth_transcoder_parent_class )->finalize ( object );
   43.70 +  g_signal_handlers_destroy(object);
   43.71 +  G_OBJECT_CLASS(gmyth_transcoder_parent_class)->finalize(object);
   43.72  }
   43.73  
   43.74  /**
   43.75 @@ -89,18 +89,18 @@
   43.76   * @return a new instance of GMythTranscoder.
   43.77   **/
   43.78  GMythTranscoder *
   43.79 -gmyth_transcoder_new ( GMythBackendInfo * backend_info )
   43.80 +gmyth_transcoder_new(GMythBackendInfo * backend_info)
   43.81  {
   43.82 -    GMythTranscoder *transcoder = GMYTH_TRANSCODER
   43.83 -        ( g_object_new ( GMYTH_TRANSCODER_TYPE, NULL ) );
   43.84 +  GMythTranscoder *transcoder = GMYTH_TRANSCODER
   43.85 +	(g_object_new(GMYTH_TRANSCODER_TYPE, NULL));
   43.86  
   43.87 -    if ( backend_info != NULL )
   43.88 -    {
   43.89 -        g_object_ref ( backend_info );
   43.90 -        transcoder->backend_info = backend_info;
   43.91 -    }
   43.92 +  if (backend_info != NULL)
   43.93 +	{
   43.94 +	  g_object_ref(backend_info);
   43.95 +	  transcoder->backend_info = backend_info;
   43.96 +	}
   43.97  
   43.98 -    return transcoder;
   43.99 +  return transcoder;
  43.100  }
  43.101  
  43.102  /**
  43.103 @@ -112,43 +112,43 @@
  43.104   *
  43.105   **/
  43.106  static gchar *
  43.107 -gmyth_transcoder_date_change_format ( gchar * date_s, int format )
  43.108 +gmyth_transcoder_date_change_format(gchar * date_s, int format)
  43.109  {
  43.110 -    if ( date_s != NULL )
  43.111 -    {
  43.112 -        gint length = strlen ( date_s );
  43.113 +  if (date_s != NULL)
  43.114 +	{
  43.115 +	  gint length = strlen(date_s);
  43.116  
  43.117 -        //create the right date format
  43.118 -        gchar *src = ( gchar * ) g_malloc0 ( sizeof ( gchar ) * length );
  43.119 +	 //create the right date format
  43.120 +	  gchar *src = (gchar *) g_malloc0(sizeof(gchar) * length);
  43.121  
  43.122 -        strncpy ( src, date_s, length );
  43.123 +	  strncpy(src, date_s, length);
  43.124  
  43.125 -        gchar *dst;
  43.126 +	  gchar *dst;
  43.127  
  43.128 -        if ( format == DATE_FILE )
  43.129 -        {
  43.130 -            dst = ( gchar * ) g_malloc0 ( sizeof ( gchar ) * 16 );
  43.131 -            snprintf ( dst, 16, "%.4s%.2s%.2s%.2s%.2s%.2s", src, src + 5,
  43.132 -                       src + 7, src + 9, src + 11, src + 13 );
  43.133 -            dst[15] = '\0';
  43.134 -        }
  43.135 -        else if ( format == DATE_ISO )
  43.136 -        {
  43.137 -            dst = ( gchar * ) g_malloc0 ( sizeof ( gchar ) * 20 );
  43.138 -            snprintf ( dst, 20, "%.4s-%.2s-%.2sT%.2s:%.2s:%.2s", src, src + 4,
  43.139 -                       src + 6, src + 8, src + 10, src + 12 );
  43.140 -            dst[19] = '\0';
  43.141 -        }
  43.142 +	  if (format == DATE_FILE)
  43.143 +		{
  43.144 +		  dst = (gchar *) g_malloc0(sizeof(gchar) * 16);
  43.145 +		  snprintf(dst, 16, "%.4s%.2s%.2s%.2s%.2s%.2s", src, src + 5,
  43.146 +				   src + 7, src + 9, src + 11, src + 13);
  43.147 +		  dst[15] = '\0';
  43.148 +		}
  43.149 +	  else if (format == DATE_ISO)
  43.150 +		{
  43.151 +		  dst = (gchar *) g_malloc0(sizeof(gchar) * 20);
  43.152 +		  snprintf(dst, 20, "%.4s-%.2s-%.2sT%.2s:%.2s:%.2s", src, src + 4,
  43.153 +				   src + 6, src + 8, src + 10, src + 12);
  43.154 +		  dst[19] = '\0';
  43.155 +		}
  43.156  
  43.157 -        gchar *ret = g_strdup ( dst );
  43.158 +	  gchar *ret = g_strdup(dst);
  43.159  
  43.160 -        g_free ( src );
  43.161 -        g_free ( dst );
  43.162 +	  g_free(src);
  43.163 +	  g_free(dst);
  43.164  
  43.165 -        return ret;
  43.166 -    }
  43.167 -    else
  43.168 -        return NULL;
  43.169 +	  return ret;
  43.170 +	}
  43.171 +  else
  43.172 +	return NULL;
  43.173  }
  43.174  
  43.175  /**
  43.176 @@ -160,11 +160,11 @@
  43.177   *
  43.178   **/
  43.179  void
  43.180 -gmyth_transcoder_set_output ( GMythTranscoder * transcoder,
  43.181 -                              gboolean value, const gchar * outputfile )
  43.182 +gmyth_transcoder_set_output(GMythTranscoder * transcoder,
  43.183 +							gboolean value, const gchar * outputfile)
  43.184  {
  43.185 -    transcoder->output = value;
  43.186 -    transcoder->output_filename = g_strdup ( outputfile );
  43.187 +  transcoder->output = value;
  43.188 +  transcoder->output_filename = g_strdup(outputfile);
  43.189  }
  43.190  
  43.191  /**
  43.192 @@ -175,26 +175,26 @@
  43.193   *
  43.194   **/
  43.195  void
  43.196 -gmyth_transcoder_set_filename ( GMythTranscoder * transcoder,
  43.197 -                                const gchar * file )
  43.198 +gmyth_transcoder_set_filename(GMythTranscoder * transcoder,
  43.199 +							  const gchar * file)
  43.200  {
  43.201 -    // fixme: if this method is called twice, memory will not be dealocated
  43.202 -    // one transcoder can be used only for one file request?
  43.203 -    if ( file != NULL )
  43.204 -    {
  43.205 -        gchar **splited = g_strsplit ( file, "_", 2 );
  43.206 + // fixme: if this method is called twice, memory will not be dealocated
  43.207 + // one transcoder can be used only for one file request?
  43.208 +  if (file != NULL)
  43.209 +	{
  43.210 +	  gchar **splited = g_strsplit(file, "_", 2);
  43.211  
  43.212 -        // Get chanid
  43.213 -        sscanf ( splited[0], "%d", &( transcoder->chanid ) );
  43.214 +	 // Get chanid
  43.215 +	  sscanf(splited[0], "%d", &(transcoder->chanid));
  43.216  
  43.217 -        // Get starttime
  43.218 -        gchar **date = g_strsplit ( splited[1], ".", 2 );
  43.219 +	 // Get starttime
  43.220 +	  gchar **date = g_strsplit(splited[1], ".", 2);
  43.221  
  43.222 -        transcoder->starttime =
  43.223 -            gmyth_transcoder_date_change_format ( date[0], DATE_ISO );
  43.224 +	  transcoder->starttime =
  43.225 +		gmyth_transcoder_date_change_format(date[0], DATE_ISO);
  43.226  
  43.227 -        transcoder->filename = g_strdup ( file );
  43.228 -    }
  43.229 +	  transcoder->filename = g_strdup(file);
  43.230 +	}
  43.231  }
  43.232  
  43.233  
  43.234 @@ -208,74 +208,74 @@
  43.235   *
  43.236   **/
  43.237  gint
  43.238 -gmyth_transcoder_set_profile ( GMythTranscoder * trans, const gchar * value )
  43.239 +gmyth_transcoder_set_profile(GMythTranscoder * trans, const gchar * value)
  43.240  {
  43.241 -    g_return_val_if_fail ( value != NULL, -1 );
  43.242 +  g_return_val_if_fail(value != NULL, -1);
  43.243  
  43.244 -    trans->profile = g_strndup ( value, strlen ( value ) );
  43.245 +  trans->profile = g_strndup(value, strlen(value));
  43.246  
  43.247 -    return 0;
  43.248 +  return 0;
  43.249  }
  43.250  
  43.251  gboolean
  43.252 -gmyth_transcoder_start ( GMythTranscoder * trans )
  43.253 +gmyth_transcoder_start(GMythTranscoder * trans)
  43.254  {
  43.255 -    g_return_val_if_fail ( trans != NULL, FALSE );
  43.256 -    g_return_val_if_fail ( trans->backend_info != NULL, FALSE );
  43.257 -    g_return_val_if_fail ( trans->filename != NULL, FALSE );
  43.258 +  g_return_val_if_fail(trans != NULL, FALSE);
  43.259 +  g_return_val_if_fail(trans->backend_info != NULL, FALSE);
  43.260 +  g_return_val_if_fail(trans->filename != NULL, FALSE);
  43.261  
  43.262 -    if ( trans->started == FALSE )
  43.263 -    {                           // not started yet
  43.264 -        if ( !gmyth_util_file_exists ( trans->backend_info, trans->filename ) )
  43.265 -        {
  43.266 -            gmyth_debug ( "File %s does not exist", trans->filename );
  43.267 -        }
  43.268 -        trans->started = gmyth_jobqueue_add_job ( trans, "JOB_TRANSCODE" );
  43.269 -        if ( trans->started == FALSE )
  43.270 -            gmyth_debug ( "Error while starting GMythTranscoder to file: %s",
  43.271 -                          trans->output_filename );
  43.272 -    }
  43.273 -    else
  43.274 -    {
  43.275 -        gmyth_debug ( "GMythTransfer already started!" );
  43.276 -    }
  43.277 +  if (trans->started == FALSE)
  43.278 +	{							// not started yet
  43.279 +	  if (!gmyth_util_file_exists(trans->backend_info, trans->filename))
  43.280 +		{
  43.281 +		  gmyth_debug("File %s does not exist", trans->filename);
  43.282 +		}
  43.283 +	  trans->started = gmyth_jobqueue_add_job(trans, "JOB_TRANSCODE");
  43.284 +	  if (trans->started == FALSE)
  43.285 +		gmyth_debug("Error while starting GMythTranscoder to file: %s",
  43.286 +					trans->output_filename);
  43.287 +	}
  43.288 +  else
  43.289 +	{
  43.290 +	  gmyth_debug("GMythTransfer already started!");
  43.291 +	}
  43.292  
  43.293 -    return trans->started;
  43.294 +  return trans->started;
  43.295  }
  43.296  
  43.297  gboolean
  43.298 -gmyth_transcoder_pause ( GMythTranscoder * trans )
  43.299 +gmyth_transcoder_pause(GMythTranscoder * trans)
  43.300  {
  43.301 -    g_return_val_if_fail ( trans != NULL, FALSE );
  43.302 -    g_return_val_if_fail ( trans->started == TRUE, FALSE );
  43.303 +  g_return_val_if_fail(trans != NULL, FALSE);
  43.304 +  g_return_val_if_fail(trans->started == TRUE, FALSE);
  43.305  
  43.306 -    return gmyth_jobqueue_change_cmd ( trans, "PAUSE", "JOB_TRANSCODE" );
  43.307 +  return gmyth_jobqueue_change_cmd(trans, "PAUSE", "JOB_TRANSCODE");
  43.308  }
  43.309  
  43.310  gboolean
  43.311 -gmyth_transcoder_resume ( GMythTranscoder * trans )
  43.312 +gmyth_transcoder_resume(GMythTranscoder * trans)
  43.313  {
  43.314 -    g_return_val_if_fail ( trans != NULL, FALSE );
  43.315 +  g_return_val_if_fail(trans != NULL, FALSE);
  43.316  
  43.317 -    return gmyth_jobqueue_change_cmd ( trans, "RESUME", "JOB_TRANSCODE" );
  43.318 +  return gmyth_jobqueue_change_cmd(trans, "RESUME", "JOB_TRANSCODE");
  43.319  }
  43.320  
  43.321  gboolean
  43.322 -gmyth_transcoder_cancel ( GMythTranscoder * trans )
  43.323 +gmyth_transcoder_cancel(GMythTranscoder * trans)
  43.324  {
  43.325 -    g_return_val_if_fail ( trans != NULL, FALSE );
  43.326 -    g_return_val_if_fail ( trans->started == TRUE, FALSE );
  43.327 +  g_return_val_if_fail(trans != NULL, FALSE);
  43.328 +  g_return_val_if_fail(trans->started == TRUE, FALSE);
  43.329  
  43.330 -    trans->started = FALSE;
  43.331 +  trans->started = FALSE;
  43.332  
  43.333 -    return gmyth_jobqueue_change_cmd ( trans, "STOP", "JOB_TRANSCODE" );
  43.334 +  return gmyth_jobqueue_change_cmd(trans, "STOP", "JOB_TRANSCODE");
  43.335  }
  43.336  
  43.337  //fixme: implement this method
  43.338  gint
  43.339 -gmyth_transcoder_get_progress ( GMythTranscoder * trans )
  43.340 +gmyth_transcoder_get_progress(GMythTranscoder * trans)
  43.341  {
  43.342 -    static int fixme = 0;
  43.343 +  static int fixme = 0;
  43.344  
  43.345 -    return ( fixme++ ) % 101;
  43.346 +  return (fixme++) % 101;
  43.347  }
    44.1 --- a/gmyth/src/gmyth_transcoder.h	Wed Jun 13 18:18:42 2007 +0100
    44.2 +++ b/gmyth/src/gmyth_transcoder.h	Thu Jun 14 18:19:52 2007 +0100
    44.3 @@ -48,51 +48,51 @@
    44.4  typedef struct _GMythTranscoderClass GMythTranscoderClass;
    44.5  
    44.6  struct _GMythTranscoderClass
    44.7 -    {
    44.8 -        GObjectClass parent_class;
    44.9 +{
   44.10 +  GObjectClass parent_class;
   44.11  
   44.12 -        /* callbacks */
   44.13 -    };
   44.14 + /* callbacks */
   44.15 +};
   44.16  
   44.17  /**
   44.18   * The GMythTranscoder structure is a class to implement functions
   44.19   * related to transcoding.
   44.20   */
   44.21  struct _GMythTranscoder
   44.22 -    {
   44.23 -        GObject parent;
   44.24 +{
   44.25 +  GObject parent;
   44.26  
   44.27 -        gboolean cutlist;
   44.28 -        gboolean output;
   44.29 -        gboolean started;
   44.30 +  gboolean cutlist;
   44.31 +  gboolean output;
   44.32 +  gboolean started;
   44.33  
   44.34 -        /* private begin */
   44.35 -        gchar *output_filename;
   44.36 -        gchar *filename;
   44.37 -        gchar *profile;
   44.38 -        /* private end */
   44.39 + /* private begin */
   44.40 +  gchar *output_filename;
   44.41 +  gchar *filename;
   44.42 +  gchar *profile;
   44.43 + /* private end */
   44.44  
   44.45 -        gchar *starttime;
   44.46 +  gchar *starttime;
   44.47  
   44.48 -        gint chanid;
   44.49 +  gint chanid;
   44.50  
   44.51 -        GMythBackendInfo *backend_info;
   44.52 -    };
   44.53 +  GMythBackendInfo *backend_info;
   44.54 +};
   44.55  
   44.56 -GType gmyth_transcoder_type ( void );
   44.57 +GType gmyth_transcoder_type(void);
   44.58  
   44.59 -GMythTranscoder *gmyth_transcoder_new ( GMythBackendInfo * backend_info );
   44.60 -void gmyth_transcoder_set_output ( GMythTranscoder * transcode,
   44.61 -                                   gboolean value, const gchar * outputfile );
   44.62 -void gmyth_transcoder_set_filename ( GMythTranscoder * transcode,
   44.63 -                                     const gchar * file );
   44.64 -gint gmyth_transcoder_set_profile ( GMythTranscoder * trans,
   44.65 -                                    const gchar * value );
   44.66 -gboolean gmyth_transcoder_start ( GMythTranscoder * trans );
   44.67 -gboolean gmyth_transcoder_pause ( GMythTranscoder * trans );
   44.68 -gboolean gmyth_transcoder_resume ( GMythTranscoder * trans );
   44.69 -gboolean gmyth_transcoder_cancel ( GMythTranscoder * trans );
   44.70 -gint gmyth_transcoder_get_progress ( GMythTranscoder * trans );
   44.71 +GMythTranscoder *gmyth_transcoder_new(GMythBackendInfo * backend_info);
   44.72 +void gmyth_transcoder_set_output(GMythTranscoder * transcode,
   44.73 +								 gboolean value, const gchar * outputfile);
   44.74 +void gmyth_transcoder_set_filename(GMythTranscoder * transcode,
   44.75 +								   const gchar * file);
   44.76 +gint gmyth_transcoder_set_profile(GMythTranscoder * trans,
   44.77 +								  const gchar * value);
   44.78 +gboolean gmyth_transcoder_start(GMythTranscoder * trans);
   44.79 +gboolean gmyth_transcoder_pause(GMythTranscoder * trans);
   44.80 +gboolean gmyth_transcoder_resume(GMythTranscoder * trans);
   44.81 +gboolean gmyth_transcoder_cancel(GMythTranscoder * trans);
   44.82 +gint gmyth_transcoder_get_progress(GMythTranscoder * trans);
   44.83  
   44.84  
   44.85  G_END_DECLS
    45.1 --- a/gmyth/src/gmyth_tvchain.c	Wed Jun 13 18:18:42 2007 +0100
    45.2 +++ b/gmyth/src/gmyth_tvchain.c	Thu Jun 14 18:19:52 2007 +0100
    45.3 @@ -43,90 +43,90 @@
    45.4  #include "gmyth_scheduler.h"
    45.5  #include "gmyth_debug.h"
    45.6  
    45.7 -static void gmyth_tvchain_class_init ( GMythTVChainClass * klass );
    45.8 -static void gmyth_tvchain_init ( GMythTVChain * object );
    45.9 +static void gmyth_tvchain_class_init(GMythTVChainClass * klass);
   45.10 +static void gmyth_tvchain_init(GMythTVChain * object);
   45.11  
   45.12 -static void gmyth_tvchain_dispose ( GObject * object );
   45.13 -static void gmyth_tvchain_finalize ( GObject * object );
   45.14 +static void gmyth_tvchain_dispose(GObject * object);
   45.15 +static void gmyth_tvchain_finalize(GObject * object);
   45.16  
   45.17 -static void free_tvchain_entry ( gpointer data, gpointer user_data );
   45.18 +static void free_tvchain_entry(gpointer data, gpointer user_data);
   45.19  
   45.20 -G_DEFINE_TYPE ( GMythTVChain, gmyth_tvchain, G_TYPE_OBJECT )
   45.21 -     static void gmyth_tvchain_class_init ( GMythTVChainClass * klass )
   45.22 +G_DEFINE_TYPE(GMythTVChain, gmyth_tvchain, G_TYPE_OBJECT)
   45.23 +	 static void gmyth_tvchain_class_init(GMythTVChainClass * klass)
   45.24  {
   45.25 -    GObjectClass *gobject_class;
   45.26 +  GObjectClass *gobject_class;
   45.27  
   45.28 -    gobject_class = ( GObjectClass * ) klass;
   45.29 +  gobject_class = (GObjectClass *) klass;
   45.30  
   45.31 -    gobject_class->dispose = gmyth_tvchain_dispose;
   45.32 -    gobject_class->finalize = gmyth_tvchain_finalize;
   45.33 +  gobject_class->dispose = gmyth_tvchain_dispose;
   45.34 +  gobject_class->finalize = gmyth_tvchain_finalize;
   45.35  }
   45.36  
   45.37  static void
   45.38 -gmyth_tvchain_init ( GMythTVChain * tvchain )
   45.39 +gmyth_tvchain_init(GMythTVChain * tvchain)
   45.40  {
   45.41 -    tvchain->tvchain_id = NULL;
   45.42 +  tvchain->tvchain_id = NULL;
   45.43  
   45.44 -    tvchain->cur_chanid = g_string_new ( "" );
   45.45 -    tvchain->cur_startts = NULL;
   45.46 +  tvchain->cur_chanid = g_string_new("");
   45.47 +  tvchain->cur_startts = NULL;
   45.48  
   45.49 -    tvchain->mutex = g_mutex_new (  );
   45.50 +  tvchain->mutex = g_mutex_new();
   45.51  }
   45.52  
   45.53  GMythTVChain *
   45.54 -gmyth_tvchain_new (  )
   45.55 +gmyth_tvchain_new()
   45.56  {
   45.57 -    GMythTVChain *tvchain =
   45.58 -        GMYTH_TVCHAIN ( g_object_new ( GMYTH_TVCHAIN_TYPE, NULL ) );
   45.59 +  GMythTVChain *tvchain =
   45.60 +	GMYTH_TVCHAIN(g_object_new(GMYTH_TVCHAIN_TYPE, NULL));
   45.61  
   45.62 -    return tvchain;
   45.63 +  return tvchain;
   45.64  }
   45.65  
   45.66  static void
   45.67 -gmyth_tvchain_dispose ( GObject * object )
   45.68 +gmyth_tvchain_dispose(GObject * object)
   45.69  {
   45.70 -    GMythTVChain *tvchain = GMYTH_TVCHAIN ( object );
   45.71 +  GMythTVChain *tvchain = GMYTH_TVCHAIN(object);
   45.72  
   45.73 -    if ( tvchain->tvchain_id != NULL )
   45.74 -    {
   45.75 -        g_string_free ( tvchain->tvchain_id, TRUE );
   45.76 -        tvchain->tvchain_id = NULL;
   45.77 -    }
   45.78 +  if (tvchain->tvchain_id != NULL)
   45.79 +	{
   45.80 +	  g_string_free(tvchain->tvchain_id, TRUE);
   45.81 +	  tvchain->tvchain_id = NULL;
   45.82 +	}
   45.83  
   45.84 -    if ( tvchain->mutex != NULL )
   45.85 -    {
   45.86 -        g_mutex_free ( tvchain->mutex );
   45.87 -        tvchain->mutex = NULL;
   45.88 -    }
   45.89 +  if (tvchain->mutex != NULL)
   45.90 +	{
   45.91 +	  g_mutex_free(tvchain->mutex);
   45.92 +	  tvchain->mutex = NULL;
   45.93 +	}
   45.94  
   45.95 -    if ( tvchain->tvchain_list != NULL )
   45.96 -    {
   45.97 -        g_list_foreach ( tvchain->tvchain_list, free_tvchain_entry, NULL );
   45.98 -        g_list_free ( tvchain->tvchain_list );
   45.99 -    }
  45.100 +  if (tvchain->tvchain_list != NULL)
  45.101 +	{
  45.102 +	  g_list_foreach(tvchain->tvchain_list, free_tvchain_entry, NULL);
  45.103 +	  g_list_free(tvchain->tvchain_list);
  45.104 +	}
  45.105  
  45.106 -    if ( tvchain->cur_chanid != NULL )
  45.107 -    {
  45.108 -        g_string_free ( tvchain->cur_chanid, TRUE );
  45.109 -        tvchain->cur_chanid = NULL;
  45.110 -    }
  45.111 +  if (tvchain->cur_chanid != NULL)
  45.112 +	{
  45.113 +	  g_string_free(tvchain->cur_chanid, TRUE);
  45.114 +	  tvchain->cur_chanid = NULL;
  45.115 +	}
  45.116  
  45.117 -    if ( tvchain->backend_info )
  45.118 -    {
  45.119 -        g_object_unref ( tvchain->backend_info );
  45.120 -        tvchain->backend_info = NULL;
  45.121 -    }
  45.122 +  if (tvchain->backend_info)
  45.123 +	{
  45.124 +	  g_object_unref(tvchain->backend_info);
  45.125 +	  tvchain->backend_info = NULL;
  45.126 +	}
  45.127  
  45.128  
  45.129 -    G_OBJECT_CLASS ( gmyth_tvchain_parent_class )->dispose ( object );
  45.130 +  G_OBJECT_CLASS(gmyth_tvchain_parent_class)->dispose(object);
  45.131  }
  45.132  
  45.133  static void
  45.134 -gmyth_tvchain_finalize ( GObject * object )
  45.135 +gmyth_tvchain_finalize(GObject * object)
  45.136  {
  45.137 -    g_signal_handlers_destroy ( object );
  45.138 +  g_signal_handlers_destroy(object);
  45.139  
  45.140 -    G_OBJECT_CLASS ( gmyth_tvchain_parent_class )->finalize ( object );
  45.141 +  G_OBJECT_CLASS(gmyth_tvchain_parent_class)->finalize(object);
  45.142  }
  45.143  
  45.144  /** Initializes the tvchain and generates the tvchain id.
  45.145 @@ -135,48 +135,47 @@
  45.146   * @param hostname The local hostname used to generate the tvchain id.
  45.147   */
  45.148  gboolean
  45.149 -gmyth_tvchain_initialize ( GMythTVChain * tvchain,
  45.150 -                           GMythBackendInfo * backend_info )
  45.151 +gmyth_tvchain_initialize(GMythTVChain * tvchain,
  45.152 +						 GMythBackendInfo * backend_info)
  45.153  {
  45.154 -    const char *hostname;
  45.155 +  const char *hostname;
  45.156  
  45.157 -    assert ( tvchain );
  45.158 -    g_return_val_if_fail ( backend_info != NULL, FALSE );
  45.159 +  assert(tvchain);
  45.160 +  g_return_val_if_fail(backend_info != NULL, FALSE);
  45.161  
  45.162 -    g_object_ref ( backend_info );
  45.163 -    tvchain->backend_info = backend_info;
  45.164 +  g_object_ref(backend_info);
  45.165 +  tvchain->backend_info = backend_info;
  45.166  
  45.167 -    hostname = gmyth_backend_info_get_hostname ( backend_info );
  45.168 +  hostname = gmyth_backend_info_get_hostname(backend_info);
  45.169  
  45.170 -    if ( tvchain->tvchain_id == NULL )
  45.171 -    {
  45.172 -        gchar *isodate = NULL;
  45.173 -        GTimeVal *cur_time = g_new0 ( GTimeVal, 1 );
  45.174 +  if (tvchain->tvchain_id == NULL)
  45.175 +	{
  45.176 +	  gchar *isodate = NULL;
  45.177 +	  GTimeVal *cur_time = g_new0(GTimeVal, 1);
  45.178  
  45.179 -        //struct tm* gmyth_util_time_val_to_date ( const GTimeVal* time )
  45.180 +	 //struct tm* gmyth_util_time_val_to_date ( const GTimeVal* time )
  45.181  
  45.182 -        g_get_current_time ( cur_time );
  45.183 -        isodate =
  45.184 -            gmyth_util_time_to_isoformat_from_time_val_fmt
  45.185 -            ( "%Y-%m-%dT%H:%M:%S", cur_time );
  45.186 +	  g_get_current_time(cur_time);
  45.187 +	  isodate =
  45.188 +		gmyth_util_time_to_isoformat_from_time_val_fmt
  45.189 +		("%Y-%m-%dT%H:%M:%S", cur_time);
  45.190  
  45.191 -        tvchain->tvchain_id =
  45.192 -            g_string_sized_new ( 7 + strlen ( hostname ) + strlen ( isodate ) );
  45.193 -        g_string_printf ( tvchain->tvchain_id, "live-%s-%s", hostname,
  45.194 -                          isodate );
  45.195 +	  tvchain->tvchain_id =
  45.196 +		g_string_sized_new(7 + strlen(hostname) + strlen(isodate));
  45.197 +	  g_string_printf(tvchain->tvchain_id, "live-%s-%s", hostname, isodate);
  45.198  
  45.199 -        gmyth_debug ( "[%s] tv_chain_id: %s", __FUNCTION__,
  45.200 -                      tvchain->tvchain_id->str );
  45.201 +	  gmyth_debug("[%s] tv_chain_id: %s", __FUNCTION__,
  45.202 +				  tvchain->tvchain_id->str);
  45.203  
  45.204 -        g_free ( isodate );
  45.205 -        g_free ( cur_time );
  45.206 -    }
  45.207 -    else
  45.208 -    {
  45.209 -        gmyth_debug ( "[%s] TVchain already initialized", __FUNCTION__ );
  45.210 -    }
  45.211 +	  g_free(isodate);
  45.212 +	  g_free(cur_time);
  45.213 +	}
  45.214 +  else
  45.215 +	{
  45.216 +	  gmyth_debug("[%s] TVchain already initialized", __FUNCTION__);
  45.217 +	}
  45.218  
  45.219 -    return TRUE;
  45.220 +  return TRUE;
  45.221  }
  45.222  
  45.223  /** Gets the tvchain id.
  45.224 @@ -185,12 +184,11 @@
  45.225   * @return The tvchain id.
  45.226   */
  45.227  GString *
  45.228 -gmyth_tvchain_get_id ( GMythTVChain * tvchain )
  45.229 +gmyth_tvchain_get_id(GMythTVChain * tvchain)
  45.230  {
  45.231 -    g_return_val_if_fail ( tvchain != NULL
  45.232 -                           && tvchain->tvchain_id != NULL, NULL );
  45.233 +  g_return_val_if_fail(tvchain != NULL && tvchain->tvchain_id != NULL, NULL);
  45.234  
  45.235 -    return tvchain->tvchain_id;
  45.236 +  return tvchain->tvchain_id;
  45.237  }
  45.238  
  45.239  /** Reloads all tvchain entries in the database.
  45.240 @@ -199,118 +197,115 @@
  45.241   * @return  TRUE if success, or FALSE if error.
  45.242   */
  45.243  gboolean
  45.244 -gmyth_tvchain_reload_all ( GMythTVChain * tvchain )
  45.245 +gmyth_tvchain_reload_all(GMythTVChain * tvchain)
  45.246  {
  45.247 -    MYSQL_ROW msql_row;
  45.248 -    MYSQL_RES *msql_res = NULL;
  45.249 -    GMythQuery *gmyth_query = NULL;
  45.250 -    gboolean ret = TRUE;
  45.251 -    GString *stmt_str = NULL;
  45.252 +  MYSQL_ROW msql_row;
  45.253 +  MYSQL_RES *msql_res = NULL;
  45.254 +  GMythQuery *gmyth_query = NULL;
  45.255 +  gboolean ret = TRUE;
  45.256 +  GString *stmt_str = NULL;
  45.257  
  45.258 -    g_mutex_lock ( tvchain->mutex );
  45.259 +  g_mutex_lock(tvchain->mutex);
  45.260  
  45.261 -    /* gets the initial size of the TVChain entries list */
  45.262 -    guint prev_size = g_list_length ( tvchain->tvchain_list );
  45.263 + /* gets the initial size of the TVChain entries list */
  45.264 +  guint prev_size = g_list_length(tvchain->tvchain_list);
  45.265  
  45.266 -    gmyth_debug ( "[%s] chainid: %s", __FUNCTION__, tvchain->tvchain_id->str );
  45.267 +  gmyth_debug("[%s] chainid: %s", __FUNCTION__, tvchain->tvchain_id->str);
  45.268  
  45.269 -    if ( tvchain != NULL && tvchain->tvchain_list != NULL )
  45.270 -    {
  45.271 -        g_list_free ( tvchain->tvchain_list );
  45.272 -        tvchain->tvchain_list = NULL;
  45.273 -    }
  45.274 +  if (tvchain != NULL && tvchain->tvchain_list != NULL)
  45.275 +	{
  45.276 +	  g_list_free(tvchain->tvchain_list);
  45.277 +	  tvchain->tvchain_list = NULL;
  45.278 +	}
  45.279  
  45.280 -    /* TODO: Reuse gmyth_query already connected from context */
  45.281 -    gmyth_query = gmyth_query_new (  );
  45.282 -    if ( !gmyth_query_connect ( gmyth_query, tvchain->backend_info ) )
  45.283 -    {
  45.284 -        gmyth_debug ( "[%s] Could not connect to db", __FUNCTION__ );
  45.285 -        g_mutex_unlock ( tvchain->mutex );
  45.286 -        ret = FALSE;
  45.287 -        goto done;
  45.288 -    }
  45.289 + /* TODO: Reuse gmyth_query already connected from context */
  45.290 +  gmyth_query = gmyth_query_new();
  45.291 +  if (!gmyth_query_connect(gmyth_query, tvchain->backend_info))
  45.292 +	{
  45.293 +	  gmyth_debug("[%s] Could not connect to db", __FUNCTION__);
  45.294 +	  g_mutex_unlock(tvchain->mutex);
  45.295 +	  ret = FALSE;
  45.296 +	  goto done;
  45.297 +	}
  45.298  
  45.299 -    stmt_str = g_string_new ( "" );
  45.300 -    g_string_printf ( stmt_str,
  45.301 -                      "SELECT chanid, starttime, endtime, discontinuity, "
  45.302 -                      "chainpos, hostprefix, cardtype, channame, input "
  45.303 -                      "FROM tvchain "
  45.304 -                      "WHERE chainid = \"%s\" ORDER BY chainpos;",
  45.305 -                      tvchain->tvchain_id->str );
  45.306 +  stmt_str = g_string_new("");
  45.307 +  g_string_printf(stmt_str,
  45.308 +				  "SELECT chanid, starttime, endtime, discontinuity, "
  45.309 +				  "chainpos, hostprefix, cardtype, channame, input "
  45.310 +				  "FROM tvchain "
  45.311 +				  "WHERE chainid = \"%s\" ORDER BY chainpos;",
  45.312 +				  tvchain->tvchain_id->str);
  45.313  
  45.314 -    msql_res = gmyth_query_process_statement ( gmyth_query, stmt_str->str );
  45.315 -    if ( msql_res != NULL )
  45.316 -    {
  45.317 +  msql_res = gmyth_query_process_statement(gmyth_query, stmt_str->str);
  45.318 +  if (msql_res != NULL)
  45.319 +	{
  45.320  
  45.321 -        while ( ( msql_row = mysql_fetch_row ( msql_res ) ) != NULL )
  45.322 -        {
  45.323 -            struct LiveTVChainEntry *entry =
  45.324 -                g_new0 ( struct LiveTVChainEntry, 1 );
  45.325 -            entry->chanid = g_string_new ( msql_row[0] );
  45.326 -            entry->starttime =
  45.327 -                gmyth_util_string_to_time_val ( ( const gchar * ) msql_row[1] );
  45.328 -            entry->endtime =
  45.329 -                gmyth_util_string_to_time_val ( ( const gchar * ) msql_row[2] );
  45.330 -            entry->discontinuity =
  45.331 -                g_ascii_strtoull ( msql_row[3], NULL, 10 ) != 0;
  45.332 -            entry->hostprefix = g_string_new ( msql_row[5] );
  45.333 -            entry->cardtype = g_string_new ( msql_row[6] );
  45.334 -            entry->channum = g_string_new ( msql_row[7] );
  45.335 -            entry->inputname = g_string_new ( msql_row[8] );
  45.336 +	  while ((msql_row = mysql_fetch_row(msql_res)) != NULL)
  45.337 +		{
  45.338 +		  struct LiveTVChainEntry *entry = g_new0(struct LiveTVChainEntry, 1);
  45.339 +		  entry->chanid = g_string_new(msql_row[0]);
  45.340 +		  entry->starttime =
  45.341 +			gmyth_util_string_to_time_val((const gchar *) msql_row[1]);
  45.342 +		  entry->endtime =
  45.343 +			gmyth_util_string_to_time_val((const gchar *) msql_row[2]);
  45.344 +		  entry->discontinuity = g_ascii_strtoull(msql_row[3], NULL, 10) != 0;
  45.345 +		  entry->hostprefix = g_string_new(msql_row[5]);
  45.346 +		  entry->cardtype = g_string_new(msql_row[6]);
  45.347 +		  entry->channum = g_string_new(msql_row[7]);
  45.348 +		  entry->inputname = g_string_new(msql_row[8]);
  45.349  
  45.350 -            //m_maxpos = query.value(4).toInt() + 1;
  45.351 -            gmyth_debug
  45.352 -                ( "[%s] Reading TV chain entry (channel %s): [%s, %s, %s]\n",
  45.353 -                  __FUNCTION__, entry->channum->str, entry->chanid->str,
  45.354 -                  ( gchar * ) msql_row[1], ( gchar * ) msql_row[2] );
  45.355 +		 //m_maxpos = query.value(4).toInt() + 1;
  45.356 +		  gmyth_debug
  45.357 +			("[%s] Reading TV chain entry (channel %s): [%s, %s, %s]\n",
  45.358 +			 __FUNCTION__, entry->channum->str, entry->chanid->str,
  45.359 +			 (gchar *) msql_row[1], (gchar *) msql_row[2]);
  45.360  
  45.361 -            /* add this to get the actual start timestamp of the last recording */
  45.362 -            if ( tvchain->cur_startts < entry->starttime )
  45.363 -                tvchain->cur_startts = entry->starttime;
  45.364 +		 /* add this to get the actual start timestamp of the last recording */
  45.365 +		  if (tvchain->cur_startts < entry->starttime)
  45.366 +			tvchain->cur_startts = entry->starttime;
  45.367  
  45.368 -            tvchain->tvchain_list =
  45.369 -                g_list_append ( tvchain->tvchain_list, entry );
  45.370 -        }
  45.371 -    }
  45.372 -    else
  45.373 -    {
  45.374 -        gmyth_debug ( "gmyth_tvchain_reload_all query error!\n" );
  45.375 -        g_mutex_unlock ( tvchain->mutex );
  45.376 +		  tvchain->tvchain_list = g_list_append(tvchain->tvchain_list, entry);
  45.377 +		}
  45.378 +	}
  45.379 +  else
  45.380 +	{
  45.381 +	  gmyth_debug("gmyth_tvchain_reload_all query error!\n");
  45.382 +	  g_mutex_unlock(tvchain->mutex);
  45.383  
  45.384 -        ret = FALSE;
  45.385 -        goto done;
  45.386 -    }
  45.387 +	  ret = FALSE;
  45.388 +	  goto done;
  45.389 +	}
  45.390  
  45.391 -    g_mutex_unlock ( tvchain->mutex );
  45.392 +  g_mutex_unlock(tvchain->mutex);
  45.393  
  45.394 -    tvchain->cur_pos =
  45.395 -        gmyth_tvchain_program_is_at ( tvchain, tvchain->cur_chanid,
  45.396 -                                      tvchain->cur_startts );
  45.397 -    gmyth_debug ( "[%s] TVChain current position = %d.\n", __FUNCTION__,
  45.398 -                  tvchain->cur_pos );
  45.399 +  tvchain->cur_pos =
  45.400 +	gmyth_tvchain_program_is_at(tvchain, tvchain->cur_chanid,
  45.401 +								tvchain->cur_startts);
  45.402 +  gmyth_debug("[%s] TVChain current position = %d.\n", __FUNCTION__,
  45.403 +			  tvchain->cur_pos);
  45.404  
  45.405 -    if ( tvchain->cur_pos < 0 )
  45.406 -        tvchain->cur_pos = 0;
  45.407 +  if (tvchain->cur_pos < 0)
  45.408 +	tvchain->cur_pos = 0;
  45.409  
  45.410 -    //    if (m_switchid >= 0)
  45.411 -    //        m_switchid = ProgramIsAt(m_switchentry.chanid,m_switchentry.starttime);
  45.412 + //    if (m_switchid >= 0)
  45.413 + //        m_switchid = ProgramIsAt(m_switchentry.chanid,m_switchentry.starttime);
  45.414  
  45.415 -    if ( prev_size != g_list_length ( tvchain->tvchain_list ) )
  45.416 -    {
  45.417 -        gmyth_debug ( "[%s] Added new recording", __FUNCTION__ );
  45.418 -    }
  45.419 +  if (prev_size != g_list_length(tvchain->tvchain_list))
  45.420 +	{
  45.421 +	  gmyth_debug("[%s] Added new recording", __FUNCTION__);
  45.422 +	}
  45.423  
  45.424 -  done:
  45.425 -    if ( stmt_str != NULL )
  45.426 -        g_string_free ( stmt_str, TRUE );
  45.427 +done:
  45.428 +  if (stmt_str != NULL)
  45.429 +	g_string_free(stmt_str, TRUE);
  45.430  
  45.431 -    if ( msql_res != NULL )
  45.432 -        mysql_free_result ( msql_res );
  45.433 +  if (msql_res != NULL)
  45.434 +	mysql_free_result(msql_res);
  45.435  
  45.436 -    if ( gmyth_query != NULL )
  45.437 -        g_object_unref ( gmyth_query );
  45.438 +  if (gmyth_query != NULL)
  45.439 +	g_object_unref(gmyth_query);
  45.440  
  45.441 -    return ret;
  45.442 +  return ret;
  45.443  }
  45.444  
  45.445  /** 
  45.446 @@ -321,67 +316,67 @@
  45.447   * @return  A program info listage.
  45.448   */
  45.449  GList *
  45.450 -gmyth_tvchain_get_program_info_list ( GMythTVChain * tvchain )
  45.451 +gmyth_tvchain_get_program_info_list(GMythTVChain * tvchain)
  45.452  {
  45.453 -    GList *prog_list = NULL;
  45.454 -    MYSQL_ROW msql_row;
  45.455 -    MYSQL_RES *msql_res = NULL;
  45.456 -    GMythQuery *gmyth_query = NULL;
  45.457 -    GString *stmt_str = NULL;
  45.458 +  GList *prog_list = NULL;
  45.459 +  MYSQL_ROW msql_row;
  45.460 +  MYSQL_RES *msql_res = NULL;
  45.461 +  GMythQuery *gmyth_query = NULL;
  45.462 +  GString *stmt_str = NULL;
  45.463  
  45.464 -    g_mutex_lock ( tvchain->mutex );
  45.465 +  g_mutex_lock(tvchain->mutex);
  45.466  
  45.467 -    gmyth_query = gmyth_query_new (  );
  45.468 -    if ( !gmyth_query_connect ( gmyth_query, tvchain->backend_info ) )
  45.469 -    {
  45.470 -        gmyth_debug ( "Could not connect to db." );
  45.471 -        goto done;
  45.472 -    }
  45.473 +  gmyth_query = gmyth_query_new();
  45.474 +  if (!gmyth_query_connect(gmyth_query, tvchain->backend_info))
  45.475 +	{
  45.476 +	  gmyth_debug("Could not connect to db.");
  45.477 +	  goto done;
  45.478 +	}
  45.479  
  45.480 -    stmt_str = g_string_new ( "" );
  45.481 -    g_string_printf ( stmt_str,
  45.482 -                      "SELECT channum, icon " "FROM channel "
  45.483 -                      "ORDER BY channum;" );
  45.484 +  stmt_str = g_string_new("");
  45.485 +  g_string_printf(stmt_str,
  45.486 +				  "SELECT channum, icon " "FROM channel "
  45.487 +				  "ORDER BY channum;");
  45.488  
  45.489 -    msql_res = gmyth_query_process_statement ( gmyth_query, stmt_str->str );
  45.490 -    if ( msql_res != NULL )
  45.491 -    {
  45.492 +  msql_res = gmyth_query_process_statement(gmyth_query, stmt_str->str);
  45.493 +  if (msql_res != NULL)
  45.494 +	{
  45.495  
  45.496 -        while ( ( msql_row = mysql_fetch_row ( msql_res ) ) != NULL )
  45.497 -        {
  45.498 -            GMythProgramInfo *entry = gmyth_program_info_new (  );
  45.499 +	  while ((msql_row = mysql_fetch_row(msql_res)) != NULL)
  45.500 +		{
  45.501 +		  GMythProgramInfo *entry = gmyth_program_info_new();
  45.502  
  45.503 -            entry->channame = g_string_new ( msql_row[0] );
  45.504 -            entry->chansign = g_string_new ( msql_row[1] );
  45.505 +		  entry->channame = g_string_new(msql_row[0]);
  45.506 +		  entry->chansign = g_string_new(msql_row[1]);
  45.507  
  45.508 -            gmyth_debug
  45.509 -                ( "Reading TV program info entry (channel %s): [%s - {%s, %s}]\n",
  45.510 -                  entry->channame->str, entry->chansign->str,
  45.511 -                  ( gchar * ) msql_row[0], ( gchar * ) msql_row[1] );
  45.512 +		  gmyth_debug
  45.513 +			("Reading TV program info entry (channel %s): [%s - {%s, %s}]\n",
  45.514 +			 entry->channame->str, entry->chansign->str,
  45.515 +			 (gchar *) msql_row[0], (gchar *) msql_row[1]);
  45.516  
  45.517 -            prog_list = g_list_append ( prog_list, entry );
  45.518 -        }
  45.519 -    }
  45.520 -    else
  45.521 -    {
  45.522 -        gmyth_debug
  45.523 -            ( "Query error when trying to get the channel list from database!\n" );
  45.524 -        goto done;
  45.525 -    }
  45.526 +		  prog_list = g_list_append(prog_list, entry);
  45.527 +		}
  45.528 +	}
  45.529 +  else
  45.530 +	{
  45.531 +	  gmyth_debug
  45.532 +		("Query error when trying to get the channel list from database!\n");
  45.533 +	  goto done;
  45.534 +	}
  45.535  
  45.536 -  done:
  45.537 -    g_mutex_unlock ( tvchain->mutex );
  45.538 +done:
  45.539 +  g_mutex_unlock(tvchain->mutex);
  45.540  
  45.541 -    if ( stmt_str != NULL )
  45.542 -        g_string_free ( stmt_str, TRUE );
  45.543 +  if (stmt_str != NULL)
  45.544 +	g_string_free(stmt_str, TRUE);
  45.545  
  45.546 -    if ( msql_res != NULL )
  45.547 -        mysql_free_result ( msql_res );
  45.548 +  if (msql_res != NULL)
  45.549 +	mysql_free_result(msql_res);
  45.550  
  45.551 -    if ( gmyth_query != NULL )
  45.552 -        g_object_unref ( gmyth_query );
  45.553 +  if (gmyth_query != NULL)
  45.554 +	g_object_unref(gmyth_query);
  45.555  
  45.556 -    return prog_list;
  45.557 +  return prog_list;
  45.558  }
  45.559  
  45.560  /** 
  45.561 @@ -393,69 +388,69 @@
  45.562   * @return  A program info listage, based on a given channel name.
  45.563   */
  45.564  GList *
  45.565 -gmyth_tvchain_get_program_info_from_channel ( GMythTVChain * tvchain,
  45.566 -                                              const gchar * channel )
  45.567 +gmyth_tvchain_get_program_info_from_channel(GMythTVChain * tvchain,
  45.568 +											const gchar * channel)
  45.569  {
  45.570 -    GList *prog_list = NULL;
  45.571 -    MYSQL_ROW msql_row;
  45.572 -    MYSQL_RES *msql_res = NULL;
  45.573 -    GMythQuery *gmyth_query = NULL;
  45.574 -    GString *stmt_str = NULL;
  45.575 +  GList *prog_list = NULL;
  45.576 +  MYSQL_ROW msql_row;
  45.577 +  MYSQL_RES *msql_res = NULL;
  45.578 +  GMythQuery *gmyth_query = NULL;
  45.579 +  GString *stmt_str = NULL;
  45.580  
  45.581 -    g_mutex_lock ( tvchain->mutex );
  45.582 +  g_mutex_lock(tvchain->mutex);
  45.583  
  45.584 -    gmyth_query = gmyth_query_new (  );
  45.585 -    if ( !gmyth_query_connect ( gmyth_query, tvchain->backend_info ) )
  45.586 -    {
  45.587 -        gmyth_debug ( "Could not connect to db." );
  45.588 -        goto done;
  45.589 -    }
  45.590 +  gmyth_query = gmyth_query_new();
  45.591 +  if (!gmyth_query_connect(gmyth_query, tvchain->backend_info))
  45.592 +	{
  45.593 +	  gmyth_debug("Could not connect to db.");
  45.594 +	  goto done;
  45.595 +	}
  45.596  
  45.597 -    stmt_str = g_string_new ( "" );
  45.598 -    g_string_printf ( stmt_str,
  45.599 -                      "SELECT channum, icon "
  45.600 -                      "FROM channel "
  45.601 -                      "WHERE channum = \"%s\" ORDER BY channum;", channel );
  45.602 +  stmt_str = g_string_new("");
  45.603 +  g_string_printf(stmt_str,
  45.604 +				  "SELECT channum, icon "
  45.605 +				  "FROM channel "
  45.606 +				  "WHERE channum = \"%s\" ORDER BY channum;", channel);
  45.607  
  45.608 -    msql_res = gmyth_query_process_statement ( gmyth_query, stmt_str->str );
  45.609 -    if ( msql_res != NULL )
  45.610 -    {
  45.611 +  msql_res = gmyth_query_process_statement(gmyth_query, stmt_str->str);
  45.612 +  if (msql_res != NULL)
  45.613 +	{
  45.614  
  45.615 -        while ( ( msql_row = mysql_fetch_row ( msql_res ) ) != NULL )
  45.616 -        {
  45.617 -            GMythProgramInfo *entry = gmyth_program_info_new (  );
  45.618 +	  while ((msql_row = mysql_fetch_row(msql_res)) != NULL)
  45.619 +		{
  45.620 +		  GMythProgramInfo *entry = gmyth_program_info_new();
  45.621  
  45.622 -            entry->channame = g_string_new ( msql_row[0] );
  45.623 -            entry->chansign = g_string_new ( msql_row[1] );
  45.624 +		  entry->channame = g_string_new(msql_row[0]);
  45.625 +		  entry->chansign = g_string_new(msql_row[1]);
  45.626  
  45.627 -            gmyth_debug
  45.628 -                ( "Reading TV program info entry (channel %s): [%s - {%s, %s}]\n",
  45.629 -                  entry->channame->str, entry->chansign->str,
  45.630 -                  ( gchar * ) msql_row[0], ( gchar * ) msql_row[1] );
  45.631 +		  gmyth_debug
  45.632 +			("Reading TV program info entry (channel %s): [%s - {%s, %s}]\n",
  45.633 +			 entry->channame->str, entry->chansign->str,
  45.634 +			 (gchar *) msql_row[0], (gchar *) msql_row[1]);
  45.635  
  45.636 -            prog_list = g_list_append ( prog_list, entry );
  45.637 -        }
  45.638 -    }
  45.639 -    else
  45.640 -    {
  45.641 -        gmyth_debug
  45.642 -            ( "Query error when trying to get the channel list from database!\n" );
  45.643 -        goto done;
  45.644 -    }
  45.645 +		  prog_list = g_list_append(prog_list, entry);
  45.646 +		}
  45.647 +	}
  45.648 +  else
  45.649 +	{
  45.650 +	  gmyth_debug
  45.651 +		("Query error when trying to get the channel list from database!\n");
  45.652 +	  goto done;
  45.653 +	}
  45.654  
  45.655 -  done:
  45.656 -    g_mutex_unlock ( tvchain->mutex );
  45.657 +done:
  45.658 +  g_mutex_unlock(tvchain->mutex);
  45.659  
  45.660 -    if ( stmt_str != NULL )
  45.661 -        g_string_free ( stmt_str, TRUE );
  45.662 +  if (stmt_str != NULL)
  45.663 +	g_string_free(stmt_str, TRUE);
  45.664  
  45.665 -    if ( msql_res != NULL )
  45.666 -        mysql_free_result ( msql_res );
  45.667 +  if (msql_res != NULL)
  45.668 +	mysql_free_result(msql_res);
  45.669  
  45.670 -    if ( gmyth_query != NULL )
  45.671 -        g_object_unref ( gmyth_query );
  45.672 +  if (gmyth_query != NULL)
  45.673 +	g_object_unref(gmyth_query);
  45.674  
  45.675 -    return prog_list;
  45.676 +  return prog_list;
  45.677  }
  45.678  
  45.679  /** 
  45.680 @@ -469,30 +464,30 @@
  45.681   * @return The position of the related program info in the TV chain.
  45.682   */
  45.683  gint
  45.684 -gmyth_tvchain_program_is_at ( GMythTVChain * tvchain, GString * chanid,
  45.685 -                              GTimeVal * startts )
  45.686 +gmyth_tvchain_program_is_at(GMythTVChain * tvchain, GString * chanid,
  45.687 +							GTimeVal * startts)
  45.688  {
  45.689 -    gint count = 0;
  45.690 -    struct LiveTVChainEntry *entry;
  45.691 -    GList *tmp_list = tvchain->tvchain_list;
  45.692 -    guint list_size = g_list_length ( tvchain->tvchain_list );
  45.693 +  gint count = 0;
  45.694 +  struct LiveTVChainEntry *entry;
  45.695 +  GList *tmp_list = tvchain->tvchain_list;
  45.696 +  guint list_size = g_list_length(tvchain->tvchain_list);
  45.697  
  45.698 -    g_mutex_lock ( tvchain->mutex );
  45.699 +  g_mutex_lock(tvchain->mutex);
  45.700  
  45.701 -    for ( ; tmp_list && ( count < list_size );
  45.702 -          tmp_list = tvchain->tvchain_list->next, count++ )
  45.703 -    {
  45.704 -        entry = ( struct LiveTVChainEntry * ) tmp_list->data;
  45.705 -        if ( !g_strncasecmp ( entry->chanid->str, chanid->str, chanid->len )
  45.706 -             && entry->starttime == startts )
  45.707 -        {
  45.708 -            g_mutex_unlock ( tvchain->mutex );
  45.709 -            return count;
  45.710 -        }
  45.711 -    }
  45.712 -    g_mutex_unlock ( tvchain->mutex );
  45.713 +  for (; tmp_list && (count < list_size);
  45.714 +	   tmp_list = tvchain->tvchain_list->next, count++)
  45.715 +	{
  45.716 +	  entry = (struct LiveTVChainEntry *) tmp_list->data;
  45.717 +	  if (!g_strncasecmp(entry->chanid->str, chanid->str, chanid->len)
  45.718 +		  && entry->starttime == startts)
  45.719 +		{
  45.720 +		  g_mutex_unlock(tvchain->mutex);
  45.721 +		  return count;
  45.722 +		}
  45.723 +	}
  45.724 +  g_mutex_unlock(tvchain->mutex);
  45.725  
  45.726 -    return -1;
  45.727 +  return -1;
  45.728  }
  45.729  
  45.730  /** Get the program info associated to the tvchain.
  45.731 @@ -503,16 +498,16 @@
  45.732   * @return The program info structure.
  45.733   */
  45.734  GMythProgramInfo *
  45.735 -gmyth_tvchain_get_program_at ( GMythTVChain * tvchain, gint index )
  45.736 +gmyth_tvchain_get_program_at(GMythTVChain * tvchain, gint index)
  45.737  {
  45.738 -    struct LiveTVChainEntry *entry;
  45.739 +  struct LiveTVChainEntry *entry;
  45.740  
  45.741 -    entry = gmyth_tvchain_get_entry_at ( tvchain, index );
  45.742 +  entry = gmyth_tvchain_get_entry_at(tvchain, index);
  45.743  
  45.744 -    if ( entry )
  45.745 -        return gmyth_tvchain_entry_to_program ( tvchain, entry );
  45.746 +  if (entry)
  45.747 +	return gmyth_tvchain_entry_to_program(tvchain, entry);
  45.748  
  45.749 -    return NULL;
  45.750 +  return NULL;
  45.751  }
  45.752  
  45.753  /** Gets a LiveTVChainEntry associated to the tvchain by its index.
  45.754 @@ -522,39 +517,38 @@
  45.755   * @return The LiveTVchainEntry structure.
  45.756   */
  45.757  struct LiveTVChainEntry *
  45.758 -gmyth_tvchain_get_entry_at ( GMythTVChain * tvchain, gint index )
  45.759 +gmyth_tvchain_get_entry_at(GMythTVChain * tvchain, gint index)
  45.760  {
  45.761 -    struct LiveTVChainEntry *chain_entry = NULL;
  45.762 +  struct LiveTVChainEntry *chain_entry = NULL;
  45.763  
  45.764 -    g_return_val_if_fail ( tvchain != NULL
  45.765 -                           && tvchain->tvchain_list != NULL, NULL );
  45.766 +  g_return_val_if_fail(tvchain != NULL
  45.767 +					   && tvchain->tvchain_list != NULL, NULL);
  45.768  
  45.769 -    g_mutex_lock ( tvchain->mutex );
  45.770 +  g_mutex_lock(tvchain->mutex);
  45.771  
  45.772 -    gint size = g_list_length ( tvchain->tvchain_list );
  45.773 -    gint new_index = ( index < 0 || index >= size ) ? size - 1 : index;
  45.774 +  gint size = g_list_length(tvchain->tvchain_list);
  45.775 +  gint new_index = (index < 0 || index >= size) ? size - 1 : index;
  45.776  
  45.777 -    if ( new_index >= 0 )
  45.778 -        chain_entry =
  45.779 -            ( struct LiveTVChainEntry * ) g_list_nth_data ( tvchain->
  45.780 -                                                            tvchain_list,
  45.781 -                                                            new_index );
  45.782 +  if (new_index >= 0)
  45.783 +	chain_entry =
  45.784 +	  (struct LiveTVChainEntry *) g_list_nth_data(tvchain->
  45.785 +												  tvchain_list, new_index);
  45.786  
  45.787 -    g_mutex_unlock ( tvchain->mutex );
  45.788 +  g_mutex_unlock(tvchain->mutex);
  45.789  
  45.790 -    if ( chain_entry != NULL )
  45.791 -    {
  45.792 -        gmyth_debug ( "[%s] Got TV Chain entry at %d.\n", __FUNCTION__,
  45.793 -                      new_index );
  45.794 +  if (chain_entry != NULL)
  45.795 +	{
  45.796 +	  gmyth_debug("[%s] Got TV Chain entry at %d.\n", __FUNCTION__,
  45.797 +				  new_index);
  45.798  
  45.799 -    }
  45.800 -    else
  45.801 -    {
  45.802 -        gmyth_debug ( "[%s] failed to get entry at index %d", __FUNCTION__,
  45.803 -                      index );
  45.804 -    }
  45.805 +	}
  45.806 +  else
  45.807 +	{
  45.808 +	  gmyth_debug("[%s] failed to get entry at index %d", __FUNCTION__,
  45.809 +				  index);
  45.810 +	}
  45.811  
  45.812 -    return chain_entry;
  45.813 +  return chain_entry;
  45.814  }
  45.815  
  45.816  /** 
  45.817 @@ -566,85 +560,84 @@
  45.818   * @return The program info.
  45.819   */
  45.820  GMythProgramInfo *
  45.821 -gmyth_tvchain_entry_to_program ( GMythTVChain * tvchain,
  45.822 -                                 struct LiveTVChainEntry * entry )
  45.823 +gmyth_tvchain_entry_to_program(GMythTVChain * tvchain,
  45.824 +							   struct LiveTVChainEntry * entry)
  45.825  {
  45.826 -    GMythProgramInfo *proginfo = NULL;
  45.827 +  GMythProgramInfo *proginfo = NULL;
  45.828  
  45.829 -    g_return_val_if_fail ( tvchain != NULL, NULL );
  45.830 +  g_return_val_if_fail(tvchain != NULL, NULL);
  45.831  
  45.832 -    if ( !entry || !tvchain )
  45.833 -    {
  45.834 -        gmyth_debug
  45.835 -            ( "gmyth_tvchain_entry_to_program() received NULL argument" );
  45.836 -        return NULL;
  45.837 -    }
  45.838 +  if (!entry || !tvchain)
  45.839 +	{
  45.840 +	  gmyth_debug("gmyth_tvchain_entry_to_program() received NULL argument");
  45.841 +	  return NULL;
  45.842 +	}
  45.843  
  45.844 -    GMythScheduler *scheduler = gmyth_scheduler_new (  );
  45.845 +  GMythScheduler *scheduler = gmyth_scheduler_new();
  45.846  
  45.847 -    gmyth_scheduler_connect ( scheduler, tvchain->backend_info );
  45.848 -    proginfo = gmyth_scheduler_get_recorded ( scheduler,
  45.849 -                                              entry->chanid, entry->starttime );
  45.850 -    gmyth_scheduler_disconnect ( scheduler );
  45.851 +  gmyth_scheduler_connect(scheduler, tvchain->backend_info);
  45.852 +  proginfo = gmyth_scheduler_get_recorded(scheduler,
  45.853 +										  entry->chanid, entry->starttime);
  45.854 +  gmyth_scheduler_disconnect(scheduler);
  45.855  
  45.856 -    if ( proginfo )
  45.857 -    {
  45.858 -        proginfo->pathname =
  45.859 -            g_string_prepend ( proginfo->pathname, entry->hostprefix->str );
  45.860 -    }
  45.861 -    else
  45.862 -    {
  45.863 -        gmyth_debug
  45.864 -            ( "tvchain_entry_to_program( chan id = %s, starttime = %ld) failed!",
  45.865 -              entry->chanid->str, entry->starttime->tv_sec );
  45.866 -    }
  45.867 +  if (proginfo)
  45.868 +	{
  45.869 +	  proginfo->pathname =
  45.870 +		g_string_prepend(proginfo->pathname, entry->hostprefix->str);
  45.871 +	}
  45.872 +  else
  45.873 +	{
  45.874 +	  gmyth_debug
  45.875 +		("tvchain_entry_to_program( chan id = %s, starttime = %ld) failed!",
  45.876 +		 entry->chanid->str, entry->starttime->tv_sec);
  45.877 +	}
  45.878  
  45.879 -    return proginfo;
  45.880 +  return proginfo;
  45.881  }
  45.882  
  45.883  static void
  45.884 -free_tvchain_entry ( gpointer data, gpointer user_data )
  45.885 +free_tvchain_entry(gpointer data, gpointer user_data)
  45.886  {
  45.887 -    struct LiveTVChainEntry *entry;
  45.888 +  struct LiveTVChainEntry *entry;
  45.889  
  45.890 -    g_return_if_fail ( data != NULL );
  45.891 +  g_return_if_fail(data != NULL);
  45.892  
  45.893 -    entry = ( struct LiveTVChainEntry * ) data;
  45.894 +  entry = (struct LiveTVChainEntry *) data;
  45.895  
  45.896 -    if ( entry->chanid != NULL )
  45.897 -    {
  45.898 -        g_string_free ( entry->chanid, TRUE );
  45.899 -    }
  45.900 +  if (entry->chanid != NULL)
  45.901 +	{
  45.902 +	  g_string_free(entry->chanid, TRUE);
  45.903 +	}
  45.904  
  45.905 -    if ( entry->starttime != NULL )
  45.906 -    {
  45.907 -        g_free ( entry->starttime );
  45.908 -    }
  45.909 +  if (entry->starttime != NULL)
  45.910 +	{
  45.911 +	  g_free(entry->starttime);
  45.912 +	}
  45.913  
  45.914 -    if ( entry->endtime != NULL )
  45.915 -    {
  45.916 -        g_free ( entry->endtime );
  45.917 -    }
  45.918 +  if (entry->endtime != NULL)
  45.919 +	{
  45.920 +	  g_free(entry->endtime);
  45.921 +	}
  45.922  
  45.923 -    if ( entry->hostprefix )
  45.924 -    {
  45.925 -        g_string_free ( entry->hostprefix, TRUE );
  45.926 -    }
  45.927 +  if (entry->hostprefix)
  45.928 +	{
  45.929 +	  g_string_free(entry->hostprefix, TRUE);
  45.930 +	}
  45.931  
  45.932 -    if ( entry->cardtype )
  45.933 -    {
  45.934 -        g_string_free ( entry->cardtype, TRUE );
  45.935 -    }
  45.936 +  if (entry->cardtype)
  45.937 +	{
  45.938 +	  g_string_free(entry->cardtype, TRUE);
  45.939 +	}
  45.940  
  45.941 -    if ( entry->channum )
  45.942 -    {
  45.943 -        g_string_free ( entry->channum, TRUE );
  45.944 -    }
  45.945 +  if (entry->channum)
  45.946 +	{
  45.947 +	  g_string_free(entry->channum, TRUE);
  45.948 +	}
  45.949  
  45.950 -    if ( entry->inputname )
  45.951 -    {
  45.952 -        g_string_free ( entry->inputname, TRUE );
  45.953 -    }
  45.954 +  if (entry->inputname)
  45.955 +	{
  45.956 +	  g_string_free(entry->inputname, TRUE);
  45.957 +	}
  45.958  
  45.959 -    g_free ( entry );
  45.960 +  g_free(entry);
  45.961  }
    46.1 --- a/gmyth/src/gmyth_tvchain.h	Wed Jun 13 18:18:42 2007 +0100
    46.2 +++ b/gmyth/src/gmyth_tvchain.h	Thu Jun 14 18:19:52 2007 +0100
    46.3 @@ -46,68 +46,68 @@
    46.4  
    46.5  
    46.6  struct LiveTVChainEntry
    46.7 -    {
    46.8 -        GString *chanid;
    46.9 +{
   46.10 +  GString *chanid;
   46.11  
   46.12 -        GTimeVal *starttime;
   46.13 -        GTimeVal *endtime;
   46.14 +  GTimeVal *starttime;
   46.15 +  GTimeVal *endtime;
   46.16  
   46.17 -        gboolean discontinuity; // if true, can't play smooth from last entry
   46.18 -        GString *hostprefix;
   46.19 -        GString *cardtype;
   46.20 -        GString *channum;
   46.21 -        GString *inputname;
   46.22 -    };
   46.23 +  gboolean discontinuity;		// if true, can't play smooth from last entry
   46.24 +  GString *hostprefix;
   46.25 +  GString *cardtype;
   46.26 +  GString *channum;
   46.27 +  GString *inputname;
   46.28 +};
   46.29  
   46.30  
   46.31  struct _GMythTVChainClass
   46.32 -    {
   46.33 -        GObjectClass parent_class;
   46.34 +{
   46.35 +  GObjectClass parent_class;
   46.36  
   46.37 -        /* callbacks */
   46.38 -        /* no one for now */
   46.39 -    };
   46.40 + /* callbacks */
   46.41 + /* no one for now */
   46.42 +};
   46.43  
   46.44  struct _GMythTVChain
   46.45 -    {
   46.46 -        GObject parent;
   46.47 +{
   46.48 +  GObject parent;
   46.49  
   46.50 -        GString *tvchain_id;
   46.51 -        GList *tvchain_list;
   46.52 +  GString *tvchain_id;
   46.53 +  GList *tvchain_list;
   46.54  
   46.55 -        GTimeVal *cur_startts;
   46.56 -        GString *cur_chanid;
   46.57 -        gint cur_pos;
   46.58 +  GTimeVal *cur_startts;
   46.59 +  GString *cur_chanid;
   46.60 +  gint cur_pos;
   46.61  
   46.62 -        GMythBackendInfo *backend_info;
   46.63 +  GMythBackendInfo *backend_info;
   46.64  
   46.65 -        GMutex *mutex;
   46.66 -    };
   46.67 +  GMutex *mutex;
   46.68 +};
   46.69  
   46.70 -GType gmyth_tvchain_get_type ( void );
   46.71 +GType gmyth_tvchain_get_type(void);
   46.72  
   46.73 -GMythTVChain *gmyth_tvchain_new (  );
   46.74 +GMythTVChain *gmyth_tvchain_new();
   46.75  
   46.76 -gboolean gmyth_tvchain_initialize ( GMythTVChain * tvchain,
   46.77 -                                    GMythBackendInfo * backend_info );
   46.78 -gboolean gmyth_tvchain_reload_all ( GMythTVChain * tvchain );
   46.79 -GString *gmyth_tvchain_get_id ( GMythTVChain * tvchain );
   46.80 -gint gmyth_tvchain_program_is_at ( GMythTVChain * tvchain,
   46.81 -                                   GString * chanid, GTimeVal * startts );
   46.82 +gboolean gmyth_tvchain_initialize(GMythTVChain * tvchain,
   46.83 +								  GMythBackendInfo * backend_info);
   46.84 +gboolean gmyth_tvchain_reload_all(GMythTVChain * tvchain);
   46.85 +GString *gmyth_tvchain_get_id(GMythTVChain * tvchain);
   46.86 +gint gmyth_tvchain_program_is_at(GMythTVChain * tvchain,
   46.87 +								 GString * chanid, GTimeVal * startts);
   46.88  
   46.89 -struct LiveTVChainEntry *gmyth_tvchain_get_entry_at ( GMythTVChain * tvchain,
   46.90 -                                                      gint index );
   46.91 +struct LiveTVChainEntry *gmyth_tvchain_get_entry_at(GMythTVChain * tvchain,
   46.92 +													gint index);
   46.93  
   46.94 -GMythProgramInfo *gmyth_tvchain_entry_to_program ( GMythTVChain * tvchain,
   46.95 -                                                   struct LiveTVChainEntry
   46.96 -                                                   *entry );
   46.97 -GMythProgramInfo *gmyth_tvchain_get_program_at ( GMythTVChain * tvchain,
   46.98 -                                                 gint index );
   46.99 +GMythProgramInfo *gmyth_tvchain_entry_to_program(GMythTVChain * tvchain,
  46.100 +												 struct LiveTVChainEntry
  46.101 +												 *entry);
  46.102 +GMythProgramInfo *gmyth_tvchain_get_program_at(GMythTVChain * tvchain,
  46.103 +											   gint index);
  46.104  
  46.105 -GList *gmyth_tvchain_get_program_info_from_channel ( GMythTVChain * tvchain,
  46.106 -                                                     const gchar * channel );
  46.107 +GList *gmyth_tvchain_get_program_info_from_channel(GMythTVChain * tvchain,
  46.108 +												   const gchar * channel);
  46.109  
  46.110 -GList *gmyth_tvchain_get_program_info_list ( GMythTVChain * tvchain );
  46.111 +GList *gmyth_tvchain_get_program_info_list(GMythTVChain * tvchain);
  46.112  
  46.113  G_END_DECLS
  46.114  #endif /*LIVETVCHAIN_H_ */
    47.1 --- a/gmyth/src/gmyth_uri.c	Wed Jun 13 18:18:42 2007 +0100
    47.2 +++ b/gmyth/src/gmyth_uri.c	Thu Jun 14 18:19:52 2007 +0100
    47.3 @@ -39,97 +39,97 @@
    47.4  
    47.5  #include "gmyth_debug.h"
    47.6  
    47.7 -static void gmyth_uri_class_init ( GMythURIClass * klass );
    47.8 -static void gmyth_uri_init ( GMythURI * object );
    47.9 +static void gmyth_uri_class_init(GMythURIClass * klass);
   47.10 +static void gmyth_uri_init(GMythURI * object);
   47.11  
   47.12 -static void gmyth_uri_dispose ( GObject * object );
   47.13 -static void gmyth_uri_finalize ( GObject * object );
   47.14 +static void gmyth_uri_dispose(GObject * object);
   47.15 +static void gmyth_uri_finalize(GObject * object);
   47.16  
   47.17 -static void gmyth_uri_parser_setup_and_new ( GMythURI * uri,
   47.18 -                                             const gchar * value );
   47.19 -static gchar *gmyth_uri_print_field ( const GString * field );
   47.20 +static void gmyth_uri_parser_setup_and_new(GMythURI * uri,
   47.21 +										   const gchar * value);
   47.22 +static gchar *gmyth_uri_print_field(const GString * field);
   47.23  
   47.24 -G_DEFINE_TYPE ( GMythURI, gmyth_uri, G_TYPE_OBJECT )
   47.25 -     static void gmyth_uri_class_init ( GMythURIClass * klass )
   47.26 +G_DEFINE_TYPE(GMythURI, gmyth_uri, G_TYPE_OBJECT)
   47.27 +	 static void gmyth_uri_class_init(GMythURIClass * klass)
   47.28  {
   47.29 -    GObjectClass *gobject_class;
   47.30 +  GObjectClass *gobject_class;
   47.31  
   47.32 -    gobject_class = ( GObjectClass * ) klass;
   47.33 +  gobject_class = (GObjectClass *) klass;
   47.34  
   47.35 -    gobject_class->dispose = gmyth_uri_dispose;
   47.36 -    gobject_class->finalize = gmyth_uri_finalize;
   47.37 +  gobject_class->dispose = gmyth_uri_dispose;
   47.38 +  gobject_class->finalize = gmyth_uri_finalize;
   47.39  }
   47.40  
   47.41  static void
   47.42 -gmyth_uri_init ( GMythURI * gmyth_uri )
   47.43 +gmyth_uri_init(GMythURI * gmyth_uri)
   47.44  {
   47.45  }
   47.46  
   47.47  static void
   47.48 -gmyth_uri_dispose ( GObject * object )
   47.49 +gmyth_uri_dispose(GObject * object)
   47.50  {
   47.51 -    GMythURI *gmyth_uri = GMYTH_URI ( object );
   47.52 +  GMythURI *gmyth_uri = GMYTH_URI(object);
   47.53  
   47.54 -    if ( gmyth_uri->host != NULL )
   47.55 -    {
   47.56 -        g_string_free ( gmyth_uri->host, TRUE );
   47.57 -        gmyth_uri->host = NULL;
   47.58 -    }
   47.59 +  if (gmyth_uri->host != NULL)
   47.60 +	{
   47.61 +	  g_string_free(gmyth_uri->host, TRUE);
   47.62 +	  gmyth_uri->host = NULL;
   47.63 +	}
   47.64  
   47.65 -    if ( gmyth_uri->protocol != NULL )
   47.66 -    {
   47.67 -        g_string_free ( gmyth_uri->protocol, TRUE );
   47.68 -        gmyth_uri->protocol = NULL;
   47.69 -    }
   47.70 +  if (gmyth_uri->protocol != NULL)
   47.71 +	{
   47.72 +	  g_string_free(gmyth_uri->protocol, TRUE);
   47.73 +	  gmyth_uri->protocol = NULL;
   47.74 +	}
   47.75  
   47.76 -    if ( gmyth_uri->path != NULL )
   47.77 -    {
   47.78 -        g_string_free ( gmyth_uri->path, TRUE );
   47.79 -        gmyth_uri->path = NULL;
   47.80 -    }
   47.81 +  if (gmyth_uri->path != NULL)
   47.82 +	{
   47.83 +	  g_string_free(gmyth_uri->path, TRUE);
   47.84 +	  gmyth_uri->path = NULL;
   47.85 +	}
   47.86  
   47.87 -    if ( gmyth_uri->fragment != NULL )
   47.88 -    {
   47.89 -        g_string_free ( gmyth_uri->fragment, TRUE );
   47.90 -        gmyth_uri->fragment = NULL;
   47.91 -    }
   47.92 +  if (gmyth_uri->fragment != NULL)
   47.93 +	{
   47.94 +	  g_string_free(gmyth_uri->fragment, TRUE);
   47.95 +	  gmyth_uri->fragment = NULL;
   47.96 +	}
   47.97  
   47.98 -    if ( gmyth_uri->user != NULL )
   47.99 -    {
  47.100 -        g_string_free ( gmyth_uri->user, TRUE );
  47.101 -        gmyth_uri->user = NULL;
  47.102 -    }
  47.103 +  if (gmyth_uri->user != NULL)
  47.104 +	{
  47.105 +	  g_string_free(gmyth_uri->user, TRUE);
  47.106 +	  gmyth_uri->user = NULL;
  47.107 +	}
  47.108  
  47.109 -    if ( gmyth_uri->password != NULL )
  47.110 -    {
  47.111 -        g_string_free ( gmyth_uri->password, TRUE );
  47.112 -        gmyth_uri->password = NULL;
  47.113 -    }
  47.114 +  if (gmyth_uri->password != NULL)
  47.115 +	{
  47.116 +	  g_string_free(gmyth_uri->password, TRUE);
  47.117 +	  gmyth_uri->password = NULL;
  47.118 +	}
  47.119  
  47.120 -    if ( gmyth_uri->query != NULL )
  47.121 -    {
  47.122 -        g_string_free ( gmyth_uri->query, TRUE );
  47.123 -        gmyth_uri->query = NULL;
  47.124 -    }
  47.125 +  if (gmyth_uri->query != NULL)
  47.126 +	{
  47.127 +	  g_string_free(gmyth_uri->query, TRUE);
  47.128 +	  gmyth_uri->query = NULL;
  47.129 +	}
  47.130  
  47.131 -    if ( gmyth_uri->uri != NULL )
  47.132 -    {
  47.133 -        g_string_free ( gmyth_uri->uri, TRUE );
  47.134 -        gmyth_uri->uri = NULL;
  47.135 -    }
  47.136 +  if (gmyth_uri->uri != NULL)
  47.137 +	{
  47.138 +	  g_string_free(gmyth_uri->uri, TRUE);
  47.139 +	  gmyth_uri->uri = NULL;
  47.140 +	}
  47.141  
  47.142  
  47.143 -    G_OBJECT_CLASS ( gmyth_uri_parent_class )->dispose ( object );
  47.144 +  G_OBJECT_CLASS(gmyth_uri_parent_class)->dispose(object);
  47.145  }
  47.146  
  47.147  static void
  47.148 -gmyth_uri_finalize ( GObject * object )
  47.149 +gmyth_uri_finalize(GObject * object)
  47.150  {
  47.151 -    //GMythURI *gmyth_uri = GMYTH_URI(object);
  47.152 + //GMythURI *gmyth_uri = GMYTH_URI(object);
  47.153  
  47.154 -    g_signal_handlers_destroy ( object );
  47.155 +  g_signal_handlers_destroy(object);
  47.156  
  47.157 -    G_OBJECT_CLASS ( gmyth_uri_parent_class )->finalize ( object );
  47.158 +  G_OBJECT_CLASS(gmyth_uri_parent_class)->finalize(object);
  47.159  }
  47.160  
  47.161  /** 
  47.162 @@ -138,11 +138,11 @@
  47.163   * @return a new instance of GMythURI.
  47.164   */
  47.165  GMythURI *
  47.166 -gmyth_uri_new ( void )
  47.167 +gmyth_uri_new(void)
  47.168  {
  47.169 -    GMythURI *gmyth_uri = GMYTH_URI ( g_object_new ( GMYTH_URI_TYPE, NULL ) );
  47.170 +  GMythURI *gmyth_uri = GMYTH_URI(g_object_new(GMYTH_URI_TYPE, NULL));
  47.171  
  47.172 -    return gmyth_uri;
  47.173 +  return gmyth_uri;
  47.174  }
  47.175  
  47.176  /** 
  47.177 @@ -153,13 +153,13 @@
  47.178   * @return a new instance of GMythURI.
  47.179   */
  47.180  GMythURI *
  47.181 -gmyth_uri_new_with_value ( const gchar * uri_str )
  47.182 +gmyth_uri_new_with_value(const gchar * uri_str)
  47.183  {
  47.184 -    GMythURI *gmyth_uri = GMYTH_URI ( g_object_new ( GMYTH_URI_TYPE, NULL ) );
  47.185 +  GMythURI *gmyth_uri = GMYTH_URI(g_object_new(GMYTH_URI_TYPE, NULL));
  47.186  
  47.187 -    gmyth_uri_parser_setup_and_new ( gmyth_uri, uri_str );
  47.188 +  gmyth_uri_parser_setup_and_new(gmyth_uri, uri_str);
  47.189  
  47.190 -    return gmyth_uri;
  47.191 +  return gmyth_uri;
  47.192  }
  47.193  
  47.194  /** 
  47.195 @@ -172,18 +172,18 @@
  47.196   * 				 haystack function parameter doesn't contains the needle string argument.
  47.197   */
  47.198  static gint
  47.199 -gmyth_strstr ( const gchar * haystack, const gchar * needle )
  47.200 +gmyth_strstr(const gchar * haystack, const gchar * needle)
  47.201  {
  47.202  
  47.203 -    gchar *strPos;
  47.204 +  gchar *strPos;
  47.205  
  47.206 -    if ( haystack == NULL || needle == NULL )
  47.207 -        return -1;
  47.208 -    strPos = strstr ( haystack, needle );
  47.209 -    if ( strPos == NULL )
  47.210 -        return -1;
  47.211 +  if (haystack == NULL || needle == NULL)
  47.212 +	return -1;
  47.213 +  strPos = strstr(haystack, needle);
  47.214 +  if (strPos == NULL)
  47.215 +	return -1;
  47.216  
  47.217 -    return ( strPos - haystack );
  47.218 +  return (strPos - haystack);
  47.219  
  47.220  }
  47.221  
  47.222 @@ -195,18 +195,18 @@
  47.223   * @return <code>true</code>, if the URI is absolute.
  47.224   */
  47.225  static gboolean
  47.226 -gmyth_uri_isabsolute ( const GMythURI * uri )
  47.227 +gmyth_uri_isabsolute(const GMythURI * uri)
  47.228  {
  47.229 -    gboolean ret = FALSE;
  47.230 +  gboolean ret = FALSE;
  47.231  
  47.232 -    g_return_val_if_fail ( uri != NULL && uri->uri != NULL
  47.233 -                           && uri->protocol != NULL, FALSE );
  47.234 +  g_return_val_if_fail(uri != NULL && uri->uri != NULL
  47.235 +					   && uri->protocol != NULL, FALSE);
  47.236  
  47.237 -    if ( gmyth_strstr ( uri->uri->str, GMYTH_URI_PROTOCOL_DELIM ) == 0
  47.238 -         || strlen ( uri->protocol->str ) > 0 )
  47.239 -        ret = TRUE;
  47.240 +  if (gmyth_strstr(uri->uri->str, GMYTH_URI_PROTOCOL_DELIM) == 0
  47.241 +	  || strlen(uri->protocol->str) > 0)
  47.242 +	ret = TRUE;
  47.243  
  47.244 -    return ret;
  47.245 +  return ret;
  47.246  }
  47.247  
  47.248  /** 
  47.249 @@ -223,36 +223,36 @@
  47.250   *         or <code>-1</code> if the no character of the list could be found.
  47.251   */
  47.252  static gint
  47.253 -gmyth_strrchr ( const gchar * str, const gchar * chars, const gint nchars )
  47.254 +gmyth_strrchr(const gchar * str, const gchar * chars, const gint nchars)
  47.255  {
  47.256  
  47.257 -    gint strLen;
  47.258 -    gint i, j;
  47.259 +  gint strLen;
  47.260 +  gint i, j;
  47.261  
  47.262 -    if ( str == NULL || chars == NULL )
  47.263 -        return -1;
  47.264 +  if (str == NULL || chars == NULL)
  47.265 +	return -1;
  47.266  
  47.267 -    strLen = strlen ( str );
  47.268 -    for ( i = ( strLen - 1 ); 0 <= i; i-- )
  47.269 -    {
  47.270 -        for ( j = 0; j < nchars; j++ )
  47.271 -        {
  47.272 -            if ( str[i] == chars[j] )
  47.273 -                return i;
  47.274 -        }
  47.275 -    }
  47.276 +  strLen = strlen(str);
  47.277 +  for (i = (strLen - 1); 0 <= i; i--)
  47.278 +	{
  47.279 +	  for (j = 0; j < nchars; j++)
  47.280 +		{
  47.281 +		  if (str[i] == chars[j])
  47.282 +			return i;
  47.283 +		}
  47.284 +	}
  47.285  
  47.286 -    return -1;
  47.287 +  return -1;
  47.288  
  47.289  }
  47.290  
  47.291  static gchar *
  47.292 -gmyth_uri_print_field ( const GString * field )
  47.293 +gmyth_uri_print_field(const GString * field)
  47.294  {
  47.295 -    if ( field != NULL && field->str != NULL && strlen ( field->str ) > 0 )
  47.296 -        return field->str;
  47.297 -    else
  47.298 -        return "";
  47.299 +  if (field != NULL && field->str != NULL && strlen(field->str) > 0)
  47.300 +	return field->str;
  47.301 +  else
  47.302 +	return "";
  47.303  }
  47.304  
  47.305  /** 
  47.306 @@ -263,163 +263,157 @@
  47.307   *
  47.308   */
  47.309  static void
  47.310 -gmyth_uri_parser_setup_and_new ( GMythURI * uri, const gchar * value )
  47.311 +gmyth_uri_parser_setup_and_new(GMythURI * uri, const gchar * value)
  47.312  {
  47.313  
  47.314 -    gint uriLen;
  47.315 -    gint currIdx;
  47.316 -    gint protoIdx;
  47.317 -    gint atIdx;
  47.318 -    gint colonIdx;
  47.319 -    gint shashIdx;
  47.320 -    gint eIdx;
  47.321 -    gchar *host;
  47.322 -    gint eblacketIdx;
  47.323 -    gint hostLen;
  47.324 -    gint sharpIdx;
  47.325 +  gint uriLen;
  47.326 +  gint currIdx;
  47.327 +  gint protoIdx;
  47.328 +  gint atIdx;
  47.329 +  gint colonIdx;
  47.330 +  gint shashIdx;
  47.331 +  gint eIdx;
  47.332 +  gchar *host;
  47.333 +  gint eblacketIdx;
  47.334 +  gint hostLen;
  47.335 +  gint sharpIdx;
  47.336  
  47.337 -    /*
  47.338 -       gint                 questionIdx;
  47.339 -       gint                 queryLen;
  47.340 -     */
  47.341 + /*
  47.342 +    gint                 questionIdx;
  47.343 +    gint                 queryLen;
  47.344 +  */
  47.345  
  47.346 -    uriLen = strlen ( value );
  47.347 -    uri->uri = g_string_new ( value );
  47.348 +  uriLen = strlen(value);
  47.349 +  uri->uri = g_string_new(value);
  47.350  
  47.351 -    currIdx = 0;
  47.352 +  currIdx = 0;
  47.353  
  47.354 -    /*** Protocol ****/
  47.355 -    protoIdx = gmyth_strstr ( value, GMYTH_URI_PROTOCOL_DELIM );
  47.356 -    if ( 0 < protoIdx )
  47.357 -    {
  47.358 -        uri->protocol = g_string_new_len ( value, protoIdx );
  47.359 -        currIdx += protoIdx + strlen ( GMYTH_URI_PROTOCOL_DELIM );
  47.360 -    }
  47.361 +	/*** Protocol ****/
  47.362 +  protoIdx = gmyth_strstr(value, GMYTH_URI_PROTOCOL_DELIM);
  47.363 +  if (0 < protoIdx)
  47.364 +	{
  47.365 +	  uri->protocol = g_string_new_len(value, protoIdx);
  47.366 +	  currIdx += protoIdx + strlen(GMYTH_URI_PROTOCOL_DELIM);
  47.367 +	}
  47.368  
  47.369 -    /*** User (Password) ****/
  47.370 -    atIdx = gmyth_strstr ( value + currIdx, GMYTH_URI_USER_DELIM );
  47.371 -    if ( 0 < atIdx )
  47.372 -    {
  47.373 -        colonIdx = gmyth_strstr ( value + currIdx, GMYTH_URI_COLON_DELIM );
  47.374 +	/*** User (Password) ****/
  47.375 +  atIdx = gmyth_strstr(value + currIdx, GMYTH_URI_USER_DELIM);
  47.376 +  if (0 < atIdx)
  47.377 +	{
  47.378 +	  colonIdx = gmyth_strstr(value + currIdx, GMYTH_URI_COLON_DELIM);
  47.379  
  47.380 -        if ( 0 < colonIdx && colonIdx < atIdx )
  47.381 -        {
  47.382 -            uri->user = g_string_new_len ( value + currIdx, colonIdx );
  47.383 -            uri->password =
  47.384 -                g_string_new_len ( value + currIdx + colonIdx + 1,
  47.385 -                                   atIdx - ( colonIdx + 1 ) );
  47.386 -        }
  47.387 -        else
  47.388 -            uri->user = g_string_new_len ( value + currIdx, atIdx - currIdx );
  47.389 -        currIdx += atIdx + 1;
  47.390 -    }
  47.391 +	  if (0 < colonIdx && colonIdx < atIdx)
  47.392 +		{
  47.393 +		  uri->user = g_string_new_len(value + currIdx, colonIdx);
  47.394 +		  uri->password =
  47.395 +			g_string_new_len(value + currIdx + colonIdx + 1,
  47.396 +							 atIdx - (colonIdx + 1));
  47.397 +		}
  47.398 +	  else
  47.399 +		uri->user = g_string_new_len(value + currIdx, atIdx - currIdx);
  47.400 +	  currIdx += atIdx + 1;
  47.401 +	}
  47.402  
  47.403 -    /*** Host (Port) ****/
  47.404 -    shashIdx = gmyth_strstr ( value + currIdx, GMYTH_URI_SLASH_DELIM );
  47.405 -    if ( 0 < shashIdx )
  47.406 -        uri->host = g_string_new_len ( value + currIdx, shashIdx );
  47.407 -    else if ( gmyth_uri_isabsolute ( uri ) == TRUE )
  47.408 -        uri->host =
  47.409 -            g_string_new_len ( value + currIdx, strlen ( value ) - currIdx );
  47.410 +	/*** Host (Port) ****/
  47.411 +  shashIdx = gmyth_strstr(value + currIdx, GMYTH_URI_SLASH_DELIM);
  47.412 +  if (0 < shashIdx)
  47.413 +	uri->host = g_string_new_len(value + currIdx, shashIdx);
  47.414 +  else if (gmyth_uri_isabsolute(uri) == TRUE)
  47.415 +	uri->host = g_string_new_len(value + currIdx, strlen(value) - currIdx);
  47.416  
  47.417 -    host = gmyth_uri_get_host ( uri );
  47.418 -    colonIdx = gmyth_strrchr ( host, GMYTH_URI_COLON_DELIM, 1 );
  47.419 -    eblacketIdx = gmyth_strrchr ( host, GMYTH_URI_EBLACET_DELIM, 1 );
  47.420 -    if ( ( 0 < colonIdx ) && ( eblacketIdx < colonIdx ) )
  47.421 -    {
  47.422 -        GString *portStr = NULL;
  47.423 -        GString *hostStr = g_string_new ( host != NULL ? host : "" );
  47.424 +  host = gmyth_uri_get_host(uri);
  47.425 +  colonIdx = gmyth_strrchr(host, GMYTH_URI_COLON_DELIM, 1);
  47.426 +  eblacketIdx = gmyth_strrchr(host, GMYTH_URI_EBLACET_DELIM, 1);
  47.427 +  if ((0 < colonIdx) && (eblacketIdx < colonIdx))
  47.428 +	{
  47.429 +	  GString *portStr = NULL;
  47.430 +	  GString *hostStr = g_string_new(host != NULL ? host : "");
  47.431  
  47.432 -        hostLen = hostStr->len;
  47.433 -        /**** host ****/
  47.434 -        uri->host = g_string_erase ( uri->host, 0, hostLen );
  47.435 -        uri->host =
  47.436 -            g_string_insert_len ( uri->host, 0, hostStr->str, colonIdx );
  47.437 -        if ( 0 < hostLen )
  47.438 -        {
  47.439 -            if ( host[0] == '[' && host[hostLen - 1] == ']' )
  47.440 -                uri->host = g_string_new_len ( hostStr->str + 1, colonIdx - 2 );
  47.441 -        }
  47.442 -        /**** port ****/
  47.443 -        portStr =
  47.444 -            g_string_new_len ( hostStr->str + colonIdx + 1,
  47.445 -                               hostLen - colonIdx - 1 );
  47.446 -        uri->port = ( gint ) g_ascii_strtoull ( portStr->str, NULL, 10 );
  47.447 -        g_string_free ( portStr, TRUE );
  47.448 -        g_string_free ( hostStr, TRUE );
  47.449 -    }
  47.450 -    else
  47.451 -    {
  47.452 -        const gchar *protocol = gmyth_uri_get_protocol ( uri );
  47.453 +	  hostLen = hostStr->len;
  47.454 +		/**** host ****/
  47.455 +	  uri->host = g_string_erase(uri->host, 0, hostLen);
  47.456 +	  uri->host = g_string_insert_len(uri->host, 0, hostStr->str, colonIdx);
  47.457 +	  if (0 < hostLen)
  47.458 +		{
  47.459 +		  if (host[0] == '[' && host[hostLen - 1] == ']')
  47.460 +			uri->host = g_string_new_len(hostStr->str + 1, colonIdx - 2);
  47.461 +		}
  47.462 +		/**** port ****/
  47.463 +	  portStr =
  47.464 +		g_string_new_len(hostStr->str + colonIdx + 1, hostLen - colonIdx - 1);
  47.465 +	  uri->port = (gint) g_ascii_strtoull(portStr->str, NULL, 10);
  47.466 +	  g_string_free(portStr, TRUE);
  47.467 +	  g_string_free(hostStr, TRUE);
  47.468 +	}
  47.469 +  else
  47.470 +	{
  47.471 +	  const gchar *protocol = gmyth_uri_get_protocol(uri);
  47.472  
  47.473 -        uri->port = GMYTH_URI_KNKOWN_PORT;
  47.474 -        if ( strcmp ( protocol, GMYTH_URI_PROTOCOL_HTTP ) == 0 )
  47.475 -            uri->port = GMYTH_URI_DEFAULT_HTTP_PORT;
  47.476 -        if ( strcmp ( protocol, GMYTH_URI_PROTOCOL_FTP ) == 0 )
  47.477 -            uri->port = GMYTH_URI_DEFAULT_FTP_PORT;
  47.478 -    }
  47.479 +	  uri->port = GMYTH_URI_KNKOWN_PORT;
  47.480 +	  if (strcmp(protocol, GMYTH_URI_PROTOCOL_HTTP) == 0)
  47.481 +		uri->port = GMYTH_URI_DEFAULT_HTTP_PORT;
  47.482 +	  if (strcmp(protocol, GMYTH_URI_PROTOCOL_FTP) == 0)
  47.483 +		uri->port = GMYTH_URI_DEFAULT_FTP_PORT;
  47.484 +	}
  47.485  
  47.486 -    if ( shashIdx > 0 )
  47.487 -        currIdx += shashIdx;
  47.488 +  if (shashIdx > 0)
  47.489 +	currIdx += shashIdx;
  47.490  
  47.491 -    /*
  47.492 -       Handle relative URL
  47.493 -     */
  47.494 -    if ( gmyth_uri_isabsolute ( uri ) == FALSE )
  47.495 -    {
  47.496 + /*
  47.497 +    Handle relative URL
  47.498 +  */
  47.499 +  if (gmyth_uri_isabsolute(uri) == FALSE)
  47.500 +	{
  47.501  
  47.502 -        if ( shashIdx != 0 )
  47.503 -        {
  47.504 -            /* Add slash delimiter at the beginning of the URL,
  47.505 -               if it doesn't exist 
  47.506 -             */
  47.507 -            uri->path = g_string_new ( GMYTH_URI_SLASH_DELIM );
  47.508 -        }
  47.509 -        uri->path = g_string_append ( uri->path, value );
  47.510 +	  if (shashIdx != 0)
  47.511 +		{
  47.512 +		 /* Add slash delimiter at the beginning of the URL,
  47.513 +		    if it doesn't exist 
  47.514 +		  */
  47.515 +		  uri->path = g_string_new(GMYTH_URI_SLASH_DELIM);
  47.516 +		}
  47.517 +	  uri->path = g_string_append(uri->path, value);
  47.518  
  47.519 -    }
  47.520 -    else
  47.521 -    {
  47.522 -        /* First set path simply to the rest of URI */
  47.523 -        uri->path = g_string_new_len ( value + currIdx, uriLen - currIdx );
  47.524 -    }
  47.525 +	}
  47.526 +  else
  47.527 +	{
  47.528 +	 /* First set path simply to the rest of URI */
  47.529 +	  uri->path = g_string_new_len(value + currIdx, uriLen - currIdx);
  47.530 +	}
  47.531  
  47.532 -    //gmyth_debug( "uri value:  %s", value );
  47.533 -    uri->query =
  47.534 -        g_string_new ( g_strstr_len
  47.535 -                       ( value, strlen ( value ), GMYTH_URI_QUESTION_DELIM ) );
  47.536 + //gmyth_debug( "uri value:  %s", value );
  47.537 +  uri->query =
  47.538 +	g_string_new(g_strstr_len
  47.539 +				 (value, strlen(value), GMYTH_URI_QUESTION_DELIM));
  47.540  
  47.541 -    eIdx = gmyth_strstr ( value + currIdx, GMYTH_URI_QUESTION_DELIM );
  47.542 +  eIdx = gmyth_strstr(value + currIdx, GMYTH_URI_QUESTION_DELIM);
  47.543  
  47.544 -    if ( 0 < eIdx )
  47.545 -    {
  47.546 -        uri->query =
  47.547 -            g_string_new ( g_strstr_len
  47.548 -                           ( value, strlen ( value ),
  47.549 -                             GMYTH_URI_QUESTION_DELIM ) );
  47.550 -        gmyth_debug ( "query = %s", uri->query->str );
  47.551 -    }
  47.552 +  if (0 < eIdx)
  47.553 +	{
  47.554 +	  uri->query =
  47.555 +		g_string_new(g_strstr_len
  47.556 +					 (value, strlen(value), GMYTH_URI_QUESTION_DELIM));
  47.557 +	  gmyth_debug("query = %s", uri->query->str);
  47.558 +	}
  47.559  
  47.560 -    /**** Path (Query/Fragment) ****/
  47.561 -    sharpIdx = gmyth_strstr ( value + currIdx, GMYTH_URI_E_DELIM );
  47.562 -    if ( 0 < sharpIdx )
  47.563 -    {
  47.564 -        uri->path =
  47.565 -            g_string_append_len ( uri->path, value + currIdx, sharpIdx );
  47.566 -        uri->fragment =
  47.567 -            g_string_new_len ( value + currIdx + sharpIdx + 1,
  47.568 -                               uriLen - ( currIdx + sharpIdx + 1 ) );
  47.569 -    }
  47.570 +	/**** Path (Query/Fragment) ****/
  47.571 +  sharpIdx = gmyth_strstr(value + currIdx, GMYTH_URI_E_DELIM);
  47.572 +  if (0 < sharpIdx)
  47.573 +	{
  47.574 +	  uri->path = g_string_append_len(uri->path, value + currIdx, sharpIdx);
  47.575 +	  uri->fragment =
  47.576 +		g_string_new_len(value + currIdx + sharpIdx + 1,
  47.577 +						 uriLen - (currIdx + sharpIdx + 1));
  47.578 +	}
  47.579  
  47.580 -    gmyth_debug
  47.581 -        ( "[%s] GMythURI: host = %s, port = %d, path = %s, query = %s, fragment = %s, "
  47.582 -          "user = %s, password = %s.\n", __FUNCTION__,
  47.583 -          gmyth_uri_print_field ( uri->host ), uri->port,
  47.584 -          gmyth_uri_print_field ( uri->path ),
  47.585 -          gmyth_uri_print_field ( uri->query ),
  47.586 -          gmyth_uri_print_field ( uri->fragment ),
  47.587 -          gmyth_uri_print_field ( uri->user ),
  47.588 -          gmyth_uri_print_field ( uri->password ) );
  47.589 +  gmyth_debug
  47.590 +	("[%s] GMythURI: host = %s, port = %d, path = %s, query = %s, fragment = %s, "
  47.591 +	 "user = %s, password = %s.\n", __FUNCTION__,
  47.592 +	 gmyth_uri_print_field(uri->host), uri->port,
  47.593 +	 gmyth_uri_print_field(uri->path),
  47.594 +	 gmyth_uri_print_field(uri->query),
  47.595 +	 gmyth_uri_print_field(uri->fragment),
  47.596 +	 gmyth_uri_print_field(uri->user), gmyth_uri_print_field(uri->password));
  47.597  
  47.598  }
  47.599  
  47.600 @@ -432,11 +426,11 @@
  47.601   * @return <code>true</code>, if these two URI instances are equals.
  47.602   */
  47.603  gboolean
  47.604 -gmyth_uri_is_equals ( GMythURI * uri1, GMythURI * uri2 )
  47.605 +gmyth_uri_is_equals(GMythURI * uri1, GMythURI * uri2)
  47.606  {
  47.607 -    return ( g_ascii_strcasecmp
  47.608 -             ( gmyth_uri_get_host ( uri1 ), gmyth_uri_get_host ( uri2 ) ) == 0
  47.609 -             && gmyth_uri_get_port ( uri1 ) == gmyth_uri_get_port ( uri2 ) );
  47.610 +  return (g_ascii_strcasecmp
  47.611 +		  (gmyth_uri_get_host(uri1), gmyth_uri_get_host(uri2)) == 0
  47.612 +		  && gmyth_uri_get_port(uri1) == gmyth_uri_get_port(uri2));
  47.613  }
  47.614  
  47.615  /** 
  47.616 @@ -447,24 +441,24 @@
  47.617   * @return <code>true</code>, if the URI points to LiveTV content.
  47.618   */
  47.619  gboolean
  47.620 -gmyth_uri_is_livetv ( GMythURI * uri )
  47.621 +gmyth_uri_is_livetv(GMythURI * uri)
  47.622  {
  47.623 -    gboolean ret = TRUE;
  47.624 +  gboolean ret = TRUE;
  47.625  
  47.626 -    g_return_val_if_fail ( uri != NULL, FALSE );
  47.627 -    g_return_val_if_fail ( uri->uri != NULL, FALSE );
  47.628 -    g_return_val_if_fail ( uri->uri->str != NULL, FALSE );
  47.629 +  g_return_val_if_fail(uri != NULL, FALSE);
  47.630 +  g_return_val_if_fail(uri->uri != NULL, FALSE);
  47.631 +  g_return_val_if_fail(uri->uri->str != NULL, FALSE);
  47.632  
  47.633 -    if ( ( strstr ( uri->uri->str, "channel" ) == NULL ) ||
  47.634 -         ( strstr ( uri->uri->str, "livetv" ) == NULL ) )
  47.635 -        ret = FALSE;
  47.636 +  if ((strstr(uri->uri->str, "channel") == NULL) ||
  47.637 +	  (strstr(uri->uri->str, "livetv") == NULL))
  47.638 +	ret = FALSE;
  47.639  
  47.640 -    if ( ret )
  47.641 -        gmyth_debug ( "This URI is a LiveTV recording..." );
  47.642 -    else
  47.643 -        gmyth_debug ( "This URI is a stored remote recording." );
  47.644 +  if (ret)
  47.645 +	gmyth_debug("This URI is a LiveTV recording...");
  47.646 +  else
  47.647 +	gmyth_debug("This URI is a stored remote recording.");
  47.648  
  47.649 -    return ret;
  47.650 +  return ret;
  47.651  
  47.652  }
  47.653  
  47.654 @@ -477,37 +471,35 @@
  47.655   * 				 of the URI string.
  47.656   */
  47.657  gchar *
  47.658 -gmyth_uri_get_channel_name ( GMythURI * uri )
  47.659 +gmyth_uri_get_channel_name(GMythURI * uri)
  47.660  {
  47.661 -    gchar *channel = NULL;
  47.662 +  gchar *channel = NULL;
  47.663  
  47.664 -    g_return_val_if_fail ( uri != NULL && uri->uri != NULL
  47.665 -                           && uri->uri->str != NULL, FALSE );
  47.666 +  g_return_val_if_fail(uri != NULL && uri->uri != NULL
  47.667 +					   && uri->uri->str != NULL, FALSE);
  47.668  
  47.669 -    gchar *channel_query = g_strstr_len ( gmyth_uri_get_query ( uri ),
  47.670 -                                          strlen ( gmyth_uri_get_query
  47.671 -                                                   ( uri ) ),
  47.672 -                                          "channel" );
  47.673 +  gchar *channel_query = g_strstr_len(gmyth_uri_get_query(uri),
  47.674 +									  strlen(gmyth_uri_get_query(uri)),
  47.675 +									  "channel");
  47.676  
  47.677 -    if ( channel_query != NULL )
  47.678 -    {
  47.679 -        gchar **chan_key_value =
  47.680 -            g_strsplit ( gmyth_uri_get_query ( uri ), "=", 2 );
  47.681 +  if (channel_query != NULL)
  47.682 +	{
  47.683 +	  gchar **chan_key_value = g_strsplit(gmyth_uri_get_query(uri), "=", 2);
  47.684  
  47.685 -        /* gmyth_debug( "Channel tuple is [ %s, %s ]", chan_key_value[0], chan_key_value[1] ); */
  47.686 +	 /* gmyth_debug( "Channel tuple is [ %s, %s ]", chan_key_value[0], chan_key_value[1] ); */
  47.687  
  47.688 -        if ( chan_key_value[1] != NULL && strlen ( chan_key_value[1] ) > 0 )
  47.689 -        {
  47.690 -            channel = g_strdup ( chan_key_value[1] );
  47.691 -        }
  47.692 +	  if (chan_key_value[1] != NULL && strlen(chan_key_value[1]) > 0)
  47.693 +		{
  47.694 +		  channel = g_strdup(chan_key_value[1]);
  47.695 +		}
  47.696  
  47.697 -        if ( chan_key_value != NULL )
  47.698 -            g_strfreev ( chan_key_value );
  47.699 -    }
  47.700 +	  if (chan_key_value != NULL)
  47.701 +		g_strfreev(chan_key_value);
  47.702 +	}
  47.703  
  47.704 -    gmyth_debug ( "Got channel decimal value from the URI: %s", channel );
  47.705 +  gmyth_debug("Got channel decimal value from the URI: %s", channel);
  47.706  
  47.707 -    return channel;
  47.708 +  return channel;
  47.709  
  47.710  }
  47.711  
  47.712 @@ -520,16 +512,16 @@
  47.713   * 				 of the URI string, or <code>-1</code> it if couldn't be converted.
  47.714   */
  47.715  gint
  47.716 -gmyth_uri_get_channel_num ( GMythURI * uri )
  47.717 +gmyth_uri_get_channel_num(GMythURI * uri)
  47.718  {
  47.719 -    gchar *channel_name = gmyth_uri_get_channel_name ( uri );
  47.720 +  gchar *channel_name = gmyth_uri_get_channel_name(uri);
  47.721  
  47.722 -    if ( channel_name != NULL )
  47.723 -    {
  47.724 -        return g_ascii_strtoull ( channel_name, NULL, 10 );
  47.725 -    }
  47.726 +  if (channel_name != NULL)
  47.727 +	{
  47.728 +	  return g_ascii_strtoull(channel_name, NULL, 10);
  47.729 +	}
  47.730  
  47.731 -    return -1;
  47.732 +  return -1;
  47.733  
  47.734  }
  47.735  
  47.736 @@ -541,37 +533,37 @@
  47.737   * @return <code>true</code>, if the URI points to a local file.
  47.738   */
  47.739  gboolean
  47.740 -gmyth_uri_is_local_file ( const GMythURI * uri )
  47.741 +gmyth_uri_is_local_file(const GMythURI * uri)
  47.742  {
  47.743 -    gboolean ret = FALSE;
  47.744 -    gint len = -1;
  47.745 +  gboolean ret = FALSE;
  47.746 +  gint len = -1;
  47.747  
  47.748 -    GString *hostname = gmyth_socket_get_local_hostname (  );
  47.749 +  GString *hostname = gmyth_socket_get_local_hostname();
  47.750  
  47.751 -    g_return_val_if_fail ( uri != NULL, FALSE );
  47.752 +  g_return_val_if_fail(uri != NULL, FALSE);
  47.753  
  47.754 -    len = strlen ( gmyth_uri_get_host ( uri ) );
  47.755 +  len = strlen(gmyth_uri_get_host(uri));
  47.756  
  47.757 -    // gmyth_debug("URI: host = %s, hostname = %s.", uri->host->str, hostname != NULL ? hostname->str : "[no hostname]");
  47.758 + // gmyth_debug("URI: host = %s, hostname = %s.", uri->host->str, hostname != NULL ? hostname->str : "[no hostname]");
  47.759  
  47.760 -    ret = ( NULL != hostname && ( g_ascii_strncasecmp ( uri->host->str, ( hostname )->str, len ) == 0 ) /*|| 
  47.761 -                                                                                                           ( g_ascii_strncasecmp( gmyth_uri_get_host(uri), gmyth_socket_get_primary_addr(), len ) == 0 ) */
  47.762 -         );
  47.763 +  ret = (NULL != hostname && (g_ascii_strncasecmp(uri->host->str, (hostname)->str, len) == 0)	/*|| 
  47.764 +																								   ( g_ascii_strncasecmp( gmyth_uri_get_host(uri), gmyth_socket_get_primary_addr(), len ) == 0 ) */
  47.765 +	);
  47.766  
  47.767 -    if ( ret )
  47.768 -        gmyth_debug ( "This URI is a local file..." );
  47.769 -    else
  47.770 -        gmyth_debug ( "This URI is NOT a local file..." );
  47.771 +  if (ret)
  47.772 +	gmyth_debug("This URI is a local file...");
  47.773 +  else
  47.774 +	gmyth_debug("This URI is NOT a local file...");
  47.775  
  47.776 -    return ret;
  47.777 +  return ret;
  47.778  
  47.779  }
  47.780  
  47.781  char *
  47.782 -gmyth_uri_to_string ( const GMythURI * uri )
  47.783 +gmyth_uri_to_string(const GMythURI * uri)
  47.784  {
  47.785 -    g_return_val_if_fail ( uri != NULL, NULL );
  47.786 -    g_return_val_if_fail ( uri->uri != NULL, NULL );
  47.787 +  g_return_val_if_fail(uri != NULL, NULL);
  47.788 +  g_return_val_if_fail(uri->uri != NULL, NULL);
  47.789  
  47.790 -    return g_strdup ( uri->uri->str );
  47.791 +  return g_strdup(uri->uri->str);
  47.792  }
    48.1 --- a/gmyth/src/gmyth_uri.h	Wed Jun 13 18:18:42 2007 +0100
    48.2 +++ b/gmyth/src/gmyth_uri.h	Thu Jun 14 18:19:52 2007 +0100
    48.3 @@ -46,7 +46,7 @@
    48.4  typedef struct _GMythURI GMythURI;
    48.5  typedef struct _GMythURIClass GMythURIClass;
    48.6  
    48.7 -    /****************************************
    48.8 +	/****************************************
    48.9  	 * Define
   48.10  	 ****************************************/
   48.11  
   48.12 @@ -71,44 +71,44 @@
   48.13  #define GMYTH_URI_PROTOCOL_HTTP 			"http"
   48.14  #define GMYTH_URI_PROTOCOL_FTP 				"ftp"
   48.15  
   48.16 -    /****************************************
   48.17 +	/****************************************
   48.18  	 * Data Type
   48.19  	 ****************************************/
   48.20  
   48.21  struct _GMythURIClass
   48.22 -    {
   48.23 -        GObjectClass parent_class;
   48.24 +{
   48.25 +  GObjectClass parent_class;
   48.26  
   48.27 -        /* callbacks */
   48.28 -        /* no one for now */
   48.29 -    };
   48.30 + /* callbacks */
   48.31 + /* no one for now */
   48.32 +};
   48.33  
   48.34  struct _GMythURI
   48.35 -    {
   48.36 +{
   48.37  
   48.38 -        GObject parent;
   48.39 +  GObject parent;
   48.40  
   48.41 -        GString *uri;
   48.42 -        GString *host;
   48.43 -        gint port;
   48.44 -        GString *protocol;
   48.45 -        GString *path;
   48.46 -        GString *fragment;
   48.47 -        GString *user;
   48.48 -        GString *password;
   48.49 -        GString *query;
   48.50 +  GString *uri;
   48.51 +  GString *host;
   48.52 +  gint port;
   48.53 +  GString *protocol;
   48.54 +  GString *path;
   48.55 +  GString *fragment;
   48.56 +  GString *user;
   48.57 +  GString *password;
   48.58 +  GString *query;
   48.59  
   48.60 -    };
   48.61 +};
   48.62  
   48.63 -GType gmyth_uri_get_type ( void );
   48.64 -GMythURI *gmyth_uri_new ( void );
   48.65 -GMythURI *gmyth_uri_new_with_value ( const gchar * value );
   48.66 -gboolean gmyth_uri_is_equals ( GMythURI * uri1, GMythURI * uri2 );
   48.67 -gboolean gmyth_uri_is_livetv ( GMythURI * uri );
   48.68 -gint gmyth_uri_get_channel_num ( GMythURI * uri );
   48.69 -gchar *gmyth_uri_get_channel_name ( GMythURI * uri );
   48.70 -char *gmyth_uri_to_string ( const GMythURI * uri );
   48.71 -gboolean gmyth_uri_is_local_file ( const GMythURI * uri );
   48.72 +GType gmyth_uri_get_type(void);
   48.73 +GMythURI *gmyth_uri_new(void);
   48.74 +GMythURI *gmyth_uri_new_with_value(const gchar * value);
   48.75 +gboolean gmyth_uri_is_equals(GMythURI * uri1, GMythURI * uri2);
   48.76 +gboolean gmyth_uri_is_livetv(GMythURI * uri);
   48.77 +gint gmyth_uri_get_channel_num(GMythURI * uri);
   48.78 +gchar *gmyth_uri_get_channel_name(GMythURI * uri);
   48.79 +char *gmyth_uri_to_string(const GMythURI * uri);
   48.80 +gboolean gmyth_uri_is_local_file(const GMythURI * uri);
   48.81  
   48.82  #define 	gmyth_uri_get_host(urip) 			( urip->host != NULL ? urip->host->str : "" )
   48.83  #define 	gmyth_uri_get_port(urip) 			( urip->port )
    49.1 --- a/gmyth/src/gmyth_util.c	Wed Jun 13 18:18:42 2007 +0100
    49.2 +++ b/gmyth/src/gmyth_util.c	Thu Jun 14 18:19:52 2007 +0100
    49.3 @@ -47,9 +47,9 @@
    49.4  #include "gmyth_debug.h"
    49.5  
    49.6  #if !GLIB_CHECK_VERSION (2, 10, 0)
    49.7 -gchar *g_time_val_to_iso8601 ( GTimeVal * time_ );
    49.8 -gboolean g_time_val_from_iso8601 ( const gchar * iso_date, GTimeVal * time_ );
    49.9 -void g_date_set_time_val ( GDate * date, GTimeVal * timeval );
   49.10 +gchar *g_time_val_to_iso8601(GTimeVal * time_);
   49.11 +gboolean g_time_val_from_iso8601(const gchar * iso_date, GTimeVal * time_);
   49.12 +void g_date_set_time_val(GDate * date, GTimeVal * timeval);
   49.13  
   49.14  #endif
   49.15  
   49.16 @@ -63,26 +63,26 @@
   49.17   * @return GString* the converted isoformat string 
   49.18   */
   49.19  GString *
   49.20 -gmyth_util_time_to_isoformat ( time_t time_value )
   49.21 +gmyth_util_time_to_isoformat(time_t time_value)
   49.22  {
   49.23 -    struct tm tm_time;
   49.24 -    GString *result;
   49.25 +  struct tm tm_time;
   49.26 +  GString *result;
   49.27  
   49.28 -    if ( localtime_r ( &time_value, &tm_time ) == NULL )
   49.29 -    {
   49.30 -        gmyth_debug ( "gmyth_util_time_to_isoformat convertion error!\n" );
   49.31 -        return NULL;
   49.32 -    }
   49.33 +  if (localtime_r(&time_value, &tm_time) == NULL)
   49.34 +	{
   49.35 +	  gmyth_debug("gmyth_util_time_to_isoformat convertion error!\n");
   49.36 +	  return NULL;
   49.37 +	}
   49.38  
   49.39 -    result = g_string_sized_new ( 20 );
   49.40 -    g_string_printf ( result, "%04d-%02d-%02dT%02d:%02d:%02d",
   49.41 -                      tm_time.tm_year + 1900, tm_time.tm_mon + 1,
   49.42 -                      tm_time.tm_mday, tm_time.tm_hour, tm_time.tm_min,
   49.43 -                      tm_time.tm_sec );
   49.44 +  result = g_string_sized_new(20);
   49.45 +  g_string_printf(result, "%04d-%02d-%02dT%02d:%02d:%02d",
   49.46 +				  tm_time.tm_year + 1900, tm_time.tm_mon + 1,
   49.47 +				  tm_time.tm_mday, tm_time.tm_hour, tm_time.tm_min,
   49.48 +				  tm_time.tm_sec);
   49.49  
   49.50 -    gmyth_debug ( "Result (ISO 8601) = %s", result->str );
   49.51 +  gmyth_debug("Result (ISO 8601) = %s", result->str);
   49.52  
   49.53 -    return result;
   49.54 +  return result;
   49.55  }
   49.56  
   49.57  /** Converts a time_t struct in a GString at ISO standard format 
   49.58 @@ -95,56 +95,55 @@
   49.59   * @return GString* the converted isoformat string 
   49.60   */
   49.61  gchar *
   49.62 -gmyth_util_time_to_isoformat_from_time_val_fmt ( const gchar * fmt_string,
   49.63 -                                                 const GTimeVal * time_val )
   49.64 +gmyth_util_time_to_isoformat_from_time_val_fmt(const gchar * fmt_string,
   49.65 +											   const GTimeVal * time_val)
   49.66  {
   49.67 -    gchar *result = NULL;
   49.68 -    struct tm *tm_time = NULL;
   49.69 -    time_t time;
   49.70 +  gchar *result = NULL;
   49.71 +  struct tm *tm_time = NULL;
   49.72 +  time_t time;
   49.73  
   49.74 -    gint buffer_len = 0;
   49.75 +  gint buffer_len = 0;
   49.76  
   49.77 -    g_return_val_if_fail ( fmt_string != NULL, NULL );
   49.78 +  g_return_val_if_fail(fmt_string != NULL, NULL);
   49.79  
   49.80 -    g_return_val_if_fail ( time_val != NULL, NULL );
   49.81 +  g_return_val_if_fail(time_val != NULL, NULL);
   49.82  
   49.83 -    time = time_val->tv_sec;    // + (gint)( time_val->tv_usec / G_USEC_PER_SEC );
   49.84 +  time = time_val->tv_sec;		// + (gint)( time_val->tv_usec / G_USEC_PER_SEC );
   49.85  
   49.86 -    tm_time = g_malloc0 ( sizeof ( struct tm ) );
   49.87 +  tm_time = g_malloc0(sizeof(struct tm));
   49.88  
   49.89 -    if ( NULL == localtime_r ( &time, tm_time ) )
   49.90 -    {
   49.91 -        gmyth_debug ( "gmyth_util_time_to_isoformat convertion error!\n" );
   49.92 -    }
   49.93 -    else
   49.94 -    {
   49.95 -        /* we first check the return of strftime to allocate a buffer of the correct size */
   49.96 -        buffer_len = strftime ( NULL, SSIZE_MAX, fmt_string, tm_time );
   49.97 -        if ( buffer_len > 0 )
   49.98 -        {
   49.99 -            result = g_malloc0 ( buffer_len + 1 );
  49.100 -            if ( result == NULL )
  49.101 -            {
  49.102 -                gmyth_debug
  49.103 -                    ( "gmyth_util_time_to_isoformat convertion error!\n" );
  49.104 -                return NULL;
  49.105 -            }
  49.106 -            strftime ( result, buffer_len + 1, fmt_string, tm_time );
  49.107 -            gmyth_debug ( "Dateline (ISO result): %s", result );
  49.108 -        }
  49.109 -    }                           /* if */
  49.110 +  if (NULL == localtime_r(&time, tm_time))
  49.111 +	{
  49.112 +	  gmyth_debug("gmyth_util_time_to_isoformat convertion error!\n");
  49.113 +	}
  49.114 +  else
  49.115 +	{
  49.116 +	 /* we first check the return of strftime to allocate a buffer of the correct size */
  49.117 +	  buffer_len = strftime(NULL, SSIZE_MAX, fmt_string, tm_time);
  49.118 +	  if (buffer_len > 0)
  49.119 +		{
  49.120 +		  result = g_malloc0(buffer_len + 1);
  49.121 +		  if (result == NULL)
  49.122 +			{
  49.123 +			  gmyth_debug("gmyth_util_time_to_isoformat convertion error!\n");
  49.124 +			  return NULL;
  49.125 +			}
  49.126 +		  strftime(result, buffer_len + 1, fmt_string, tm_time);
  49.127 +		  gmyth_debug("Dateline (ISO result): %s", result);
  49.128 +		}
  49.129 +	}							/* if */
  49.130  
  49.131 -    gmyth_debug ( "Result (strftime) = %s", result );
  49.132 +  gmyth_debug("Result (strftime) = %s", result);
  49.133  
  49.134 -    //strptime( result, "%Y-%m-%dT%H:%M:%SZ", tm_time ); 
  49.135 + //strptime( result, "%Y-%m-%dT%H:%M:%SZ", tm_time ); 
  49.136  
  49.137 -    //strftime( result, strlen(result), fmt_string, tm_time );
  49.138 + //strftime( result, strlen(result), fmt_string, tm_time );
  49.139  
  49.140 -    g_free ( tm_time );
  49.141 +  g_free(tm_time);
  49.142  
  49.143 -    gmyth_debug ( "Result (ISO 8601) = %s", result );
  49.144 +  gmyth_debug("Result (ISO 8601) = %s", result);
  49.145  
  49.146 -    return result;
  49.147 +  return result;
  49.148  }
  49.149  
  49.150  /** Converts a time_t struct in a GString at ISO standard format 
  49.151 @@ -157,16 +156,16 @@
  49.152   * @return GString* the converted isoformat string 
  49.153   */
  49.154  gchar *
  49.155 -gmyth_util_time_to_isoformat_from_time_val ( const GTimeVal * time )
  49.156 +gmyth_util_time_to_isoformat_from_time_val(const GTimeVal * time)
  49.157  {
  49.158 -    gchar *result =
  49.159 -        gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y-%m-%d %H:%M:%S",
  49.160 -                                                         time );
  49.161 +  gchar *result =
  49.162 +	gmyth_util_time_to_isoformat_from_time_val_fmt("%Y-%m-%d %H:%M:%S",
  49.163 +												   time);
  49.164  
  49.165 -    //result[10] = ' ';
  49.166 -    //result[ strlen(result) - 1] = '\0';
  49.167 + //result[10] = ' ';
  49.168 + //result[ strlen(result) - 1] = '\0';
  49.169  
  49.170 -    return result;
  49.171 +  return result;
  49.172  }
  49.173  
  49.174  /** Converts a time_t struct in a GString at ISO standard format 2 
  49.175 @@ -179,13 +178,13 @@
  49.176   * @return GString* the converted isoformat string 
  49.177   */
  49.178  gchar *
  49.179 -gmyth_util_time_to_mythformat_from_time_val ( const GTimeVal * time )
  49.180 +gmyth_util_time_to_mythformat_from_time_val(const GTimeVal * time)
  49.181  {
  49.182 -    gchar *result =
  49.183 -        gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y-%m-%dT%H:%M:%S",
  49.184 -                                                         time );
  49.185 +  gchar *result =
  49.186 +	gmyth_util_time_to_isoformat_from_time_val_fmt("%Y-%m-%dT%H:%M:%S",
  49.187 +												   time);
  49.188  
  49.189 -    return result;
  49.190 +  return result;
  49.191  }
  49.192  
  49.193  /** Converts a time_t struct in a GString at ISO standard format 
  49.194 @@ -198,13 +197,13 @@
  49.195   * @return GString* the converted isoformat string 
  49.196   */
  49.197  gchar *
  49.198 -gmyth_util_time_to_string_only_date ( const GTimeVal * time )
  49.199 +gmyth_util_time_to_string_only_date(const GTimeVal * time)
  49.200  {
  49.201 -    gchar *result =
  49.202 -        gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y-%m-%d", time );
  49.203 -    //result[10] = ' ';
  49.204 -    //result[ strlen(result) - 1] = '\0';
  49.205 -    return result;
  49.206 +  gchar *result =
  49.207 +	gmyth_util_time_to_isoformat_from_time_val_fmt("%Y-%m-%d", time);
  49.208 + //result[10] = ' ';
  49.209 + //result[ strlen(result) - 1] = '\0';
  49.210 +  return result;
  49.211  }
  49.212  
  49.213  /** Converts a time_t struct in a GString at ISO standard format 
  49.214 @@ -217,13 +216,13 @@
  49.215   * @return GString* the converted isoformat string 
  49.216   */
  49.217  gchar *
  49.218 -gmyth_util_time_to_string_only_time ( const GTimeVal * time )
  49.219 +gmyth_util_time_to_string_only_time(const GTimeVal * time)
  49.220  {
  49.221 -    gchar *result =
  49.222 -        gmyth_util_time_to_isoformat_from_time_val_fmt ( "%H:%M:%S", time );
  49.223 -    //result[10] = ' ';
  49.224 -    //result[ strlen(result) - 1] = '\0';
  49.225 -    return result;
  49.226 +  gchar *result =
  49.227 +	gmyth_util_time_to_isoformat_from_time_val_fmt("%H:%M:%S", time);
  49.228 + //result[10] = ' ';
  49.229 + //result[ strlen(result) - 1] = '\0';
  49.230 +  return result;
  49.231  }
  49.232  
  49.233  /** Converts a time_t struct in a GString to the following 
  49.234 @@ -236,14 +235,14 @@
  49.235   * @return GString* the converted string 
  49.236   */
  49.237  GString *
  49.238 -gmyth_util_time_to_string ( time_t time_value )
  49.239 +gmyth_util_time_to_string(time_t time_value)
  49.240  {
  49.241 -    GString *result = gmyth_util_time_to_isoformat ( time_value );
  49.242 +  GString *result = gmyth_util_time_to_isoformat(time_value);
  49.243  
  49.244 -    result->str[10] = ' ';
  49.245 -    result->str[strlen ( result->str ) - 1] = '\0';
  49.246 +  result->str[10] = ' ';
  49.247 +  result->str[strlen(result->str) - 1] = '\0';
  49.248  
  49.249 -    return result;
  49.250 +  return result;
  49.251  }
  49.252  
  49.253  /** Converts a time_t struct in a GString to the following 
  49.254 @@ -256,15 +255,15 @@
  49.255   * @return GString* the converted string 
  49.256   */
  49.257  gchar *
  49.258 -gmyth_util_time_to_string_from_time_val ( const GTimeVal * time_val )
  49.259 +gmyth_util_time_to_string_from_time_val(const GTimeVal * time_val)
  49.260  {
  49.261 -    gchar *result =
  49.262 -        gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y-%m-%d %H:%M:%S",
  49.263 -                                                         time_val );
  49.264 +  gchar *result =
  49.265 +	gmyth_util_time_to_isoformat_from_time_val_fmt("%Y-%m-%d %H:%M:%S",
  49.266 +												   time_val);
  49.267  
  49.268 -    //result[10] = ' ';
  49.269 + //result[10] = ' ';
  49.270  
  49.271 -    return result;
  49.272 +  return result;
  49.273  }
  49.274  
  49.275  /** Converts a GString in the following format 
  49.276 @@ -274,30 +273,30 @@
  49.277   * @return time_t the time converted value
  49.278   */
  49.279  time_t
  49.280 -gmyth_util_string_to_time ( GString * time_str )
  49.281 +gmyth_util_string_to_time(GString * time_str)
  49.282  {
  49.283 -    gint year, month, day, hour, min, sec;
  49.284 +  gint year, month, day, hour, min, sec;
  49.285  
  49.286 -    gmyth_debug ( "[%s] time_str = %s. [%s]", __FUNCTION__, time_str != NULL ?
  49.287 -                  time_str->str : "[time string is NULL!]", time_str->str );
  49.288 +  gmyth_debug("[%s] time_str = %s. [%s]", __FUNCTION__, time_str != NULL ?
  49.289 +			  time_str->str : "[time string is NULL!]", time_str->str);
  49.290  
  49.291 -    if ( sscanf ( time_str->str, "%04d-%02d-%02d %02d:%02d:%02d",
  49.292 -                  &year, &month, &day, &hour, &min, &sec ) < 3 )
  49.293 -    {
  49.294 -        gmyth_debug ( "GMythUtil: isoformat_to_time converter error!\n" );
  49.295 -        return 0;
  49.296 -    }
  49.297 +  if (sscanf(time_str->str, "%04d-%02d-%02d %02d:%02d:%02d",
  49.298 +			 &year, &month, &day, &hour, &min, &sec) < 3)
  49.299 +	{
  49.300 +	  gmyth_debug("GMythUtil: isoformat_to_time converter error!\n");
  49.301 +	  return 0;
  49.302 +	}
  49.303  
  49.304 -    struct tm *tm_time = g_malloc0 ( sizeof ( struct tm ) );
  49.305 +  struct tm *tm_time = g_malloc0(sizeof(struct tm));
  49.306  
  49.307 -    tm_time->tm_year = year - 1900;
  49.308 -    tm_time->tm_mon = month - 1;
  49.309 -    tm_time->tm_mday = day;
  49.310 -    tm_time->tm_hour = hour;
  49.311 -    tm_time->tm_min = min;
  49.312 -    tm_time->tm_sec = sec;
  49.313 +  tm_time->tm_year = year - 1900;
  49.314 +  tm_time->tm_mon = month - 1;
  49.315 +  tm_time->tm_mday = day;
  49.316 +  tm_time->tm_hour = hour;
  49.317 +  tm_time->tm_min = min;
  49.318 +  tm_time->tm_sec = sec;
  49.319  
  49.320 -    return mktime ( tm_time );
  49.321 +  return mktime(tm_time);
  49.322  }
  49.323  
  49.324  /** Converts a GString in the following format 
  49.325 @@ -307,27 +306,27 @@
  49.326   * @return time_t the time converted value
  49.327   */
  49.328  struct tm *
  49.329 -gmyth_util_time_val_to_date ( const GTimeVal * time )
  49.330 +gmyth_util_time_val_to_date(const GTimeVal * time)
  49.331  {
  49.332 -    struct tm *date = g_malloc0 ( sizeof ( struct tm ) );
  49.333 -    time_t time_micros = time->tv_sec;  // + (gint)( time->tv_usec / G_USEC_PER_SEC );
  49.334 +  struct tm *date = g_malloc0(sizeof(struct tm));
  49.335 +  time_t time_micros = time->tv_sec;	// + (gint)( time->tv_usec / G_USEC_PER_SEC );
  49.336  
  49.337 -    if ( NULL == date )
  49.338 -    {
  49.339 -        gmyth_debug
  49.340 -            ( "GMythUtil: GDate *gmyth_util_time_val_to_date (GTimeVal* time) - converter error!\n" );
  49.341 -        return NULL;
  49.342 -    }
  49.343 +  if (NULL == date)
  49.344 +	{
  49.345 +	  gmyth_debug
  49.346 +		("GMythUtil: GDate *gmyth_util_time_val_to_date (GTimeVal* time) - converter error!\n");
  49.347 +	  return NULL;
  49.348 +	}
  49.349  
  49.350 -    if ( NULL == localtime_r ( &time_micros, date ) )
  49.351 -    {
  49.352 -        gmyth_debug ( "gmyth_util_time_to_isoformat convertion error!\n" );
  49.353 -        return NULL;
  49.354 -    }
  49.355 +  if (NULL == localtime_r(&time_micros, date))
  49.356 +	{
  49.357 +	  gmyth_debug("gmyth_util_time_to_isoformat convertion error!\n");
  49.358 +	  return NULL;
  49.359 +	}
  49.360  
  49.361 -    gmyth_debug ( "Converted from GTimeVal == %s to GDate", asctime ( date ) );
  49.362 +  gmyth_debug("Converted from GTimeVal == %s to GDate", asctime(date));
  49.363  
  49.364 -    return date;
  49.365 +  return date;
  49.366  }
  49.367  
  49.368  /** Converts a GString in the following format 
  49.369 @@ -337,58 +336,58 @@
  49.370   * @return time_t the time converted value
  49.371   */
  49.372  GTimeVal *
  49.373 -gmyth_util_string_to_time_val_fmt ( const gchar * fmt_string,
  49.374 -                                    const gchar * time_str )
  49.375 +gmyth_util_string_to_time_val_fmt(const gchar * fmt_string,
  49.376 +								  const gchar * time_str)
  49.377  {
  49.378 -    GTimeVal *time = g_new0 ( GTimeVal, 1 );
  49.379 -    struct tm *tm_time = NULL;
  49.380 -    time_t time_micros;
  49.381 -    gchar *result;
  49.382 +  GTimeVal *time = g_new0(GTimeVal, 1);
  49.383 +  struct tm *tm_time = NULL;
  49.384 +  time_t time_micros;
  49.385 +  gchar *result;
  49.386  
  49.387 -    gmyth_debug ( "[%s] time_str = %s. [%s]", time_str, time_str != NULL ?
  49.388 -                  time_str : "[time string is NULL!]", time_str );
  49.389 +  gmyth_debug("[%s] time_str = %s. [%s]", time_str, time_str != NULL ?
  49.390 +			  time_str : "[time string is NULL!]", time_str);
  49.391  
  49.392 -    if ( NULL == time_str )
  49.393 -    {
  49.394 -        gmyth_debug ( "GMythUtil: isoformat_to_time converter error!\n" );
  49.395 -        return NULL;
  49.396 -    }
  49.397 +  if (NULL == time_str)
  49.398 +	{
  49.399 +	  gmyth_debug("GMythUtil: isoformat_to_time converter error!\n");
  49.400 +	  return NULL;
  49.401 +	}
  49.402  
  49.403 -    tm_time = g_malloc0 ( sizeof ( struct tm ) );
  49.404 +  tm_time = g_malloc0(sizeof(struct tm));
  49.405  
  49.406 -    /* we first check the return of strftime to allocate a buffer of the correct size */
  49.407 -    result = strptime ( time_str, "%Y-%m-%dT%H:%M:%S", tm_time );
  49.408 -    if ( NULL == result )
  49.409 -    {
  49.410 -        /* we first check the return of strftime to allocate a buffer of the correct size */
  49.411 -        result = strptime ( time_str, "%Y-%m-%dT%H:%M:%SZ", tm_time );
  49.412 -        if ( NULL == result )
  49.413 -        {
  49.414 -            /* we first check the return of strftime to allocate a buffer of the correct size */
  49.415 -            result = strptime ( time_str, "%Y-%m-%d %H:%M:%S", tm_time );
  49.416 -            if ( NULL == result )
  49.417 -            {
  49.418 -                result = strptime ( time_str, "%Y-%m-%dT%H:%M", tm_time );
  49.419 -                if ( NULL == result )
  49.420 -                {
  49.421 -                    gmyth_debug ( "Dateline (ISO result): %s", result );
  49.422 -                    g_free ( tm_time );
  49.423 -                    return NULL;
  49.424 -                    //goto done;            
  49.425 -                }
  49.426 -            }
  49.427 -        }
  49.428 -    }
  49.429 + /* we first check the return of strftime to allocate a buffer of the correct size */
  49.430 +  result = strptime(time_str, "%Y-%m-%dT%H:%M:%S", tm_time);
  49.431 +  if (NULL == result)
  49.432 +	{
  49.433 +	 /* we first check the return of strftime to allocate a buffer of the correct size */
  49.434 +	  result = strptime(time_str, "%Y-%m-%dT%H:%M:%SZ", tm_time);
  49.435 +	  if (NULL == result)
  49.436 +		{
  49.437 +		 /* we first check the return of strftime to allocate a buffer of the correct size */
  49.438 +		  result = strptime(time_str, "%Y-%m-%d %H:%M:%S", tm_time);
  49.439 +		  if (NULL == result)
  49.440 +			{
  49.441 +			  result = strptime(time_str, "%Y-%m-%dT%H:%M", tm_time);
  49.442 +			  if (NULL == result)
  49.443 +				{
  49.444 +				  gmyth_debug("Dateline (ISO result): %s", result);
  49.445 +				  g_free(tm_time);
  49.446 +				  return NULL;
  49.447 +				 //goto done;            
  49.448 +				}
  49.449 +			}
  49.450 +		}
  49.451 +	}
  49.452  
  49.453 -    time_micros = mktime ( tm_time );
  49.454 +  time_micros = mktime(tm_time);
  49.455  
  49.456 -    time->tv_sec = time_micros; // + (gint)( time_val->tv_usec / G_USEC_PER_SEC );
  49.457 +  time->tv_sec = time_micros;	// + (gint)( time_val->tv_usec / G_USEC_PER_SEC );
  49.458  
  49.459 -    gmyth_debug ( "After mktime call... = %s", asctime ( tm_time ) );
  49.460 +  gmyth_debug("After mktime call... = %s", asctime(tm_time));
  49.461  
  49.462 -    g_free ( tm_time );
  49.463 +  g_free(tm_time);
  49.464  
  49.465 -    return time;
  49.466 +  return time;
  49.467  }
  49.468  
  49.469  /** Converts a GString in the following format 
  49.470 @@ -398,12 +397,12 @@
  49.471   * @return time_t the time converted value
  49.472   */
  49.473  GTimeVal *
  49.474 -gmyth_util_string_to_time_val ( const gchar * time_str )
  49.475 +gmyth_util_string_to_time_val(const gchar * time_str)
  49.476  {
  49.477 -    GTimeVal *time =
  49.478 -        gmyth_util_string_to_time_val_fmt ( "%Y-%m-%d %H:%M:%S", time_str );
  49.479 +  GTimeVal *time =
  49.480 +	gmyth_util_string_to_time_val_fmt("%Y-%m-%d %H:%M:%S", time_str);
  49.481  
  49.482 -    return time;
  49.483 +  return time;
  49.484  }
  49.485  
  49.486  /** 
  49.487 @@ -415,45 +414,45 @@
  49.488   * @return <code>true</code>, if the remote file exists.
  49.489   */
  49.490  gboolean
  49.491 -gmyth_util_file_exists ( GMythBackendInfo * backend_info,
  49.492 -                         const gchar * filename )
  49.493 +gmyth_util_file_exists(GMythBackendInfo * backend_info,
  49.494 +					   const gchar * filename)
  49.495  {
  49.496 -    GMythSocket *socket;
  49.497 -    gboolean res;
  49.498 +  GMythSocket *socket;
  49.499 +  gboolean res;
  49.500  
  49.501 -    gmyth_debug ( "Check if file %s exists", filename );
  49.502 +  gmyth_debug("Check if file %s exists", filename);
  49.503  
  49.504 -    g_return_val_if_fail ( backend_info != NULL, FALSE );
  49.505 -    g_return_val_if_fail ( filename != NULL, FALSE );
  49.506 +  g_return_val_if_fail(backend_info != NULL, FALSE);
  49.507 +  g_return_val_if_fail(filename != NULL, FALSE);
  49.508  
  49.509 -    socket = gmyth_socket_new (  );
  49.510 -    res = gmyth_socket_connect_to_backend ( socket, backend_info->hostname,
  49.511 -                                            backend_info->port, TRUE );
  49.512 +  socket = gmyth_socket_new();
  49.513 +  res = gmyth_socket_connect_to_backend(socket, backend_info->hostname,
  49.514 +										backend_info->port, TRUE);
  49.515  
  49.516 -    if ( res == TRUE )
  49.517 -    {
  49.518 -        GMythStringList *slist;
  49.519 -        GMythProgramInfo *program = NULL;
  49.520 +  if (res == TRUE)
  49.521 +	{
  49.522 +	  GMythStringList *slist;
  49.523 +	  GMythProgramInfo *program = NULL;
  49.524  
  49.525 -        program = gmyth_program_info_new (  );
  49.526 -        program->pathname = g_string_new ( filename );
  49.527 +	  program = gmyth_program_info_new();
  49.528 +	  program->pathname = g_string_new(filename);
  49.529  
  49.530 -        slist = gmyth_string_list_new (  );
  49.531 -        gmyth_string_list_append_char_array ( slist, "QUERY_CHECKFILE" );
  49.532 +	  slist = gmyth_string_list_new();
  49.533 +	  gmyth_string_list_append_char_array(slist, "QUERY_CHECKFILE");
  49.534  
  49.535 -        gmyth_program_info_to_string_list ( program, slist );
  49.536 +	  gmyth_program_info_to_string_list(program, slist);
  49.537  
  49.538 -        gmyth_socket_sendreceive_stringlist ( socket, slist );
  49.539 +	  gmyth_socket_sendreceive_stringlist(socket, slist);
  49.540  
  49.541 -        res = ( gmyth_string_list_get_int ( slist, 0 ) == 1 );
  49.542 +	  res = (gmyth_string_list_get_int(slist, 0) == 1);
  49.543  
  49.544 -        g_object_unref ( program );
  49.545 -        g_object_unref ( slist );
  49.546 +	  g_object_unref(program);
  49.547 +	  g_object_unref(slist);
  49.548  
  49.549 -        gmyth_socket_close_connection ( socket );
  49.550 -    }
  49.551 -    g_object_unref ( socket );
  49.552 -    return res;
  49.553 +	  gmyth_socket_close_connection(socket);
  49.554 +	}
  49.555 +  g_object_unref(socket);
  49.556 +  return res;
  49.557  }
  49.558  
  49.559  /** 
  49.560 @@ -466,53 +465,52 @@
  49.561   * @return <code>true</code>, if the remote file exists.
  49.562   */
  49.563  gboolean
  49.564 -gmyth_util_file_exists_and_get_remote_dir ( GMythBackendInfo * backend_info,
  49.565 -                                            const gchar * filename,
  49.566 -                                            gchar ** current_dir )
  49.567 +gmyth_util_file_exists_and_get_remote_dir(GMythBackendInfo * backend_info,
  49.568 +										  const gchar * filename,
  49.569 +										  gchar ** current_dir)
  49.570  {
  49.571 -    GMythSocket *socket;
  49.572 -    gboolean res;
  49.573 +  GMythSocket *socket;
  49.574 +  gboolean res;
  49.575  
  49.576 -    *current_dir = NULL;
  49.577 +  *current_dir = NULL;
  49.578  
  49.579 -    socket = gmyth_socket_new (  );
  49.580 -    res = gmyth_socket_connect_to_backend ( socket, backend_info->hostname,
  49.581 -                                            backend_info->port, TRUE );
  49.582 +  socket = gmyth_socket_new();
  49.583 +  res = gmyth_socket_connect_to_backend(socket, backend_info->hostname,
  49.584 +										backend_info->port, TRUE);
  49.585  
  49.586 -    if ( res == TRUE )
  49.587 -    {
  49.588 -        GMythStringList *slist;
  49.589 -        GMythProgramInfo *program = NULL;
  49.590 +  if (res == TRUE)
  49.591 +	{
  49.592 +	  GMythStringList *slist;
  49.593 +	  GMythProgramInfo *program = NULL;
  49.594  
  49.595 -        program = gmyth_program_info_new (  );
  49.596 -        program->pathname = g_string_new ( filename );
  49.597 +	  program = gmyth_program_info_new();
  49.598 +	  program->pathname = g_string_new(filename);
  49.599  
  49.600 -        slist = gmyth_string_list_new (  );
  49.601 -        gmyth_string_list_append_char_array ( slist, "QUERY_CHECKFILE" );
  49.602 +	  slist = gmyth_string_list_new();
  49.603 +	  gmyth_string_list_append_char_array(slist, "QUERY_CHECKFILE");
  49.604  
  49.605 -        gmyth_program_info_to_string_list ( program, slist );
  49.606 +	  gmyth_program_info_to_string_list(program, slist);
  49.607  
  49.608 -        gmyth_socket_sendreceive_stringlist ( socket, slist );
  49.609 +	  gmyth_socket_sendreceive_stringlist(socket, slist);
  49.610  
  49.611 -        res = ( gmyth_string_list_get_int ( slist, 0 ) == 1 );
  49.612 +	  res = (gmyth_string_list_get_int(slist, 0) == 1);
  49.613  
  49.614 -        if ( ( gmyth_string_list_length ( slist ) > 1 ) &&
  49.615 -             gmyth_string_list_get_char_array ( slist, 1 ) != NULL )
  49.616 -            *current_dir =
  49.617 -                g_strdup ( gmyth_string_list_get_char_array ( slist, 1 ) );
  49.618 +	  if ((gmyth_string_list_length(slist) > 1) &&
  49.619 +		  gmyth_string_list_get_char_array(slist, 1) != NULL)
  49.620 +		*current_dir = g_strdup(gmyth_string_list_get_char_array(slist, 1));
  49.621  
  49.622 -        if ( *current_dir != NULL )
  49.623 -            gmyth_debug ( "Current directory = %s.", ( *current_dir != NULL )
  49.624 -                          ? *current_dir : "[directory not found]" );
  49.625 +	  if (*current_dir != NULL)
  49.626 +		gmyth_debug("Current directory = %s.", (*current_dir != NULL)
  49.627 +					? *current_dir : "[directory not found]");
  49.628  
  49.629 -        g_object_unref ( program );
  49.630 +	  g_object_unref(program);
  49.631  
  49.632 -        g_object_unref ( slist );
  49.633 +	  g_object_unref(slist);
  49.634  
  49.635 -        gmyth_socket_close_connection ( socket );
  49.636 -    }
  49.637 -    g_object_unref ( socket );
  49.638 -    return res;
  49.639 +	  gmyth_socket_close_connection(socket);
  49.640 +	}
  49.641 +  g_object_unref(socket);
  49.642 +  return res;
  49.643  }
  49.644  
  49.645  /** 
  49.646 @@ -525,24 +523,24 @@
  49.647   * @return The string representing the file name.
  49.648   */
  49.649  gchar *
  49.650 -gmyth_util_create_filename ( const gint chan_id, const GTimeVal * start_time )
  49.651 +gmyth_util_create_filename(const gint chan_id, const GTimeVal * start_time)
  49.652  {
  49.653 -    gchar *basename = NULL;
  49.654 +  gchar *basename = NULL;
  49.655  
  49.656 -    g_return_val_if_fail ( start_time != NULL, NULL );
  49.657 +  g_return_val_if_fail(start_time != NULL, NULL);
  49.658  
  49.659 -    gchar *isodate =
  49.660 -        gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y%m%d%H%M%S",
  49.661 -                                                         start_time );
  49.662 +  gchar *isodate =
  49.663 +	gmyth_util_time_to_isoformat_from_time_val_fmt("%Y%m%d%H%M%S",
  49.664 +												   start_time);
  49.665  
  49.666 -    basename = g_strdup_printf ( "%d_%s", chan_id, isodate );
  49.667 +  basename = g_strdup_printf("%d_%s", chan_id, isodate);
  49.668  
  49.669 -    gmyth_debug ( "Basename (from chan_id and start_time): %s", basename );
  49.670 +  gmyth_debug("Basename (from chan_id and start_time): %s", basename);
  49.671  
  49.672 -    if ( isodate )
  49.673 -        g_free ( isodate );
  49.674 +  if (isodate)
  49.675 +	g_free(isodate);
  49.676  
  49.677 -    return basename;
  49.678 +  return basename;
  49.679  }
  49.680  
  49.681  /** 
  49.682 @@ -553,62 +551,61 @@
  49.683   * @return a pointer to a GList with all the channels.
  49.684   */
  49.685  GList *
  49.686 -gmyth_util_get_channel_list ( GMythBackendInfo * backend_info )
  49.687 +gmyth_util_get_channel_list(GMythBackendInfo * backend_info)
  49.688  {
  49.689 -    GMythRecorder *recorder;
  49.690 -    GList *channel_list = NULL;
  49.691 -    gboolean res = FALSE;
  49.692 +  GMythRecorder *recorder;
  49.693 +  GList *channel_list = NULL;
  49.694 +  gboolean res = FALSE;
  49.695  
  49.696 -    gmyth_debug ( "Gets channel list." );
  49.697 +  gmyth_debug("Gets channel list.");
  49.698  
  49.699 -    g_return_val_if_fail ( backend_info != NULL, FALSE );
  49.700 +  g_return_val_if_fail(backend_info != NULL, FALSE);
  49.701  
  49.702 -    recorder =
  49.703 -        gmyth_recorder_new ( 1,
  49.704 -                             g_string_new ( gmyth_backend_info_get_hostname
  49.705 -                                            ( backend_info ) ),
  49.706 -                             gmyth_backend_info_get_port ( backend_info ) );
  49.707 -    res = gmyth_recorder_setup ( recorder );
  49.708 +  recorder =
  49.709 +	gmyth_recorder_new(1,
  49.710 +					   g_string_new(gmyth_backend_info_get_hostname
  49.711 +									(backend_info)),
  49.712 +					   gmyth_backend_info_get_port(backend_info));
  49.713 +  res = gmyth_recorder_setup(recorder);
  49.714  
  49.715 -    if ( res == TRUE )
  49.716 -    {
  49.717 -        //GList* channel_list = gmyth_recorder_get_channel_list( recorder );        
  49.718 -        gmyth_debug ( "Yeah, got channel list!!!" );
  49.719 -        GList *ch = NULL;
  49.720 -        GMythChannelInfo *channel_info = NULL;
  49.721 +  if (res == TRUE)
  49.722 +	{
  49.723 +	 //GList* channel_list = gmyth_recorder_get_channel_list( recorder );        
  49.724 +	  gmyth_debug("Yeah, got channel list!!!");
  49.725 +	  GList *ch = NULL;
  49.726 +	  GMythChannelInfo *channel_info = NULL;
  49.727  
  49.728 -        for ( ch = gmyth_recorder_get_channel_list ( recorder ); ch != NULL; )
  49.729 -        {
  49.730 -            channel_info = g_malloc0 ( sizeof ( GMythChannelInfo ) );
  49.731 -            channel_info->channel_ID = 0;
  49.732 -            channel_info->channel_num =
  49.733 -                g_string_new ( g_strdup ( ( gchar * ) ch->data ) );
  49.734 -            channel_info->channel_name = g_string_new ( "" );
  49.735 -            gmyth_debug ( "Printing channel info... (%s)",
  49.736 -                          channel_info->channel_num->str );
  49.737 -            channel_list =
  49.738 -                g_list_append ( channel_list,
  49.739 -                                g_memdup ( channel_info,
  49.740 -                                           sizeof ( GMythChannelInfo ) ) );
  49.741 +	  for (ch = gmyth_recorder_get_channel_list(recorder); ch != NULL;)
  49.742 +		{
  49.743 +		  channel_info = g_malloc0(sizeof(GMythChannelInfo));
  49.744 +		  channel_info->channel_ID = 0;
  49.745 +		  channel_info->channel_num =
  49.746 +			g_string_new(g_strdup((gchar *) ch->data));
  49.747 +		  channel_info->channel_name = g_string_new("");
  49.748 +		  gmyth_debug("Printing channel info... (%s)",
  49.749 +					  channel_info->channel_num->str);
  49.750 +		  channel_list =
  49.751 +			g_list_append(channel_list,
  49.752 +						  g_memdup(channel_info, sizeof(GMythChannelInfo)));
  49.753  
  49.754 -            ch = g_list_next ( ch );
  49.755 +		  ch = g_list_next(ch);
  49.756  
  49.757 -            if ( channel_info != NULL )
  49.758 -                g_free ( channel_info );
  49.759 -        }
  49.760 +		  if (channel_info != NULL)
  49.761 +			g_free(channel_info);
  49.762 +		}
  49.763  
  49.764 -    }                           /* if */
  49.765 -    else
  49.766 -    {
  49.767 -        gmyth_debug ( "No, couldn't get the channel list!!!" );
  49.768 -    }
  49.769 +	}							/* if */
  49.770 +  else
  49.771 +	{
  49.772 +	  gmyth_debug("No, couldn't get the channel list!!!");
  49.773 +	}
  49.774  
  49.775 -    gmyth_debug ( "Got %d channels!!!", g_list_length ( channel_list ) );
  49.776 +  gmyth_debug("Got %d channels!!!", g_list_length(channel_list));
  49.777  
  49.778  
  49.779 -    g_object_unref ( recorder );
  49.780 +  g_object_unref(recorder);
  49.781  
  49.782 -    return channel_list;
  49.783 +  return channel_list;
  49.784  }
  49.785  
  49.786  /** 
  49.787 @@ -619,58 +616,58 @@
  49.788   * @return The program info's listage.
  49.789   */
  49.790  GSList *
  49.791 -gmyth_util_get_all_recordings ( GMythBackendInfo * backend_info )
  49.792 +gmyth_util_get_all_recordings(GMythBackendInfo * backend_info)
  49.793  {
  49.794 -    GSList *program_list = NULL;
  49.795 -    GMythSocket *socket;
  49.796 -    gboolean res;
  49.797 +  GSList *program_list = NULL;
  49.798 +  GMythSocket *socket;
  49.799 +  gboolean res;
  49.800  
  49.801 -    socket = gmyth_socket_new (  );
  49.802 -    res = gmyth_socket_connect_to_backend ( socket, backend_info->hostname,
  49.803 -                                            backend_info->port, TRUE );
  49.804 +  socket = gmyth_socket_new();
  49.805 +  res = gmyth_socket_connect_to_backend(socket, backend_info->hostname,
  49.806 +										backend_info->port, TRUE);
  49.807  
  49.808 -    if ( res == TRUE )
  49.809 -    {
  49.810 -        GMythStringList *slist = gmyth_string_list_new (  );
  49.811 -        guint pos = 0;
  49.812 +  if (res == TRUE)
  49.813 +	{
  49.814 +	  GMythStringList *slist = gmyth_string_list_new();
  49.815 +	  guint pos = 0;
  49.816  
  49.817 -        gmyth_string_list_append_char_array ( slist, "QUERY_RECORDINGS Play" );
  49.818 +	  gmyth_string_list_append_char_array(slist, "QUERY_RECORDINGS Play");
  49.819  
  49.820 -        gmyth_socket_sendreceive_stringlist ( socket, slist );
  49.821 +	  gmyth_socket_sendreceive_stringlist(socket, slist);
  49.822  
  49.823 -        if ( slist != NULL && ( gmyth_string_list_length ( slist ) > 0 ) )
  49.824 -        {
  49.825 -            GMythProgramInfo *program = NULL;
  49.826 +	  if (slist != NULL && (gmyth_string_list_length(slist) > 0))
  49.827 +		{
  49.828 +		  GMythProgramInfo *program = NULL;
  49.829  
  49.830 -            gmyth_debug ( "OK! Got the program list [size=%d].",
  49.831 -                          gmyth_string_list_length ( slist ) );
  49.832 +		  gmyth_debug("OK! Got the program list [size=%d].",
  49.833 +					  gmyth_string_list_length(slist));
  49.834  
  49.835 -            do
  49.836 -            {
  49.837 -                program =
  49.838 -                    gmyth_program_info_from_string_list_from_pos ( slist, pos );
  49.839 +		  do
  49.840 +			{
  49.841 +			  program =
  49.842 +				gmyth_program_info_from_string_list_from_pos(slist, pos);
  49.843  
  49.844 -                if ( program != NULL )
  49.845 -                {
  49.846 -                    pos += 41;
  49.847 +			  if (program != NULL)
  49.848 +				{
  49.849 +				  pos += 41;
  49.850  
  49.851 -                    program_list = g_slist_append ( program_list, program );
  49.852 -                }
  49.853 -                else
  49.854 -                    break;
  49.855 +				  program_list = g_slist_append(program_list, program);
  49.856 +				}
  49.857 +			  else
  49.858 +				break;
  49.859  
  49.860 -            }
  49.861 -            while ( gmyth_string_list_length ( slist ) > pos );
  49.862 +			}
  49.863 +		  while (gmyth_string_list_length(slist) > pos);
  49.864  
  49.865 -        }
  49.866 -        /* if */
  49.867 -        g_object_unref ( slist );
  49.868 +		}
  49.869 +	 /* if */
  49.870 +	  g_object_unref(slist);
  49.871  
  49.872 -        gmyth_socket_close_connection ( socket );
  49.873 -    }
  49.874 -    g_object_unref ( socket );
  49.875 +	  gmyth_socket_close_connection(socket);
  49.876 +	}
  49.877 +  g_object_unref(socket);
  49.878  
  49.879 -    return program_list;
  49.880 +  return program_list;
  49.881  }
  49.882  
  49.883  /** 
  49.884 @@ -682,41 +679,40 @@
  49.885   * @return The requested program info.
  49.886   */
  49.887  GMythProgramInfo *
  49.888 -gmyth_util_get_recording_from_channel ( GMythBackendInfo * backend_info,
  49.889 -                                        const gchar * channel )
  49.890 +gmyth_util_get_recording_from_channel(GMythBackendInfo * backend_info,
  49.891 +									  const gchar * channel)
  49.892  {
  49.893 -    GSList *program_list = NULL;
  49.894 -    GMythProgramInfo *program = NULL;
  49.895 +  GSList *program_list = NULL;
  49.896 +  GMythProgramInfo *program = NULL;
  49.897  
  49.898 -    program_list = gmyth_util_get_all_recordings ( backend_info );
  49.899 +  program_list = gmyth_util_get_all_recordings(backend_info);
  49.900  
  49.901 -    if ( program_list != NULL && g_slist_length ( program_list ) > 0 )
  49.902 -    {
  49.903 -        GMythProgramInfo *program = NULL;
  49.904 -        guint pos = 0;
  49.905 +  if (program_list != NULL && g_slist_length(program_list) > 0)
  49.906 +	{
  49.907 +	  GMythProgramInfo *program = NULL;
  49.908 +	  guint pos = 0;
  49.909  
  49.910 -        gmyth_debug ( "OK! Got the program list [size=%d].",
  49.911 -                      g_slist_length ( program_list ) );
  49.912 +	  gmyth_debug("OK! Got the program list [size=%d].",
  49.913 +				  g_slist_length(program_list));
  49.914  
  49.915 -        while ( pos < g_slist_length ( program_list ) )
  49.916 -        {
  49.917 -            program =
  49.918 -                ( GMythProgramInfo * ) g_slist_nth_data ( program_list, pos );
  49.919 +	  while (pos < g_slist_length(program_list))
  49.920 +		{
  49.921 +		  program = (GMythProgramInfo *) g_slist_nth_data(program_list, pos);
  49.922  
  49.923 -            if ( program != NULL && program->channame != NULL &&
  49.924 -                 g_ascii_strncasecmp ( program->channame->str, channel,
  49.925 -                                       strlen ( channel ) ) == 0 )
  49.926 -            {
  49.927 -                break;
  49.928 -            }
  49.929 +		  if (program != NULL && program->channame != NULL &&
  49.930 +			  g_ascii_strncasecmp(program->channame->str, channel,
  49.931 +								  strlen(channel)) == 0)
  49.932 +			{
  49.933 +			  break;
  49.934 +			}
  49.935  
  49.936 -            ++pos;
  49.937 +		  ++pos;
  49.938  
  49.939 -        }                       /* while */
  49.940 +		}						/* while */
  49.941  
  49.942 -    }
  49.943 -    /* if */
  49.944 -    return program;
  49.945 +	}
  49.946 + /* if */
  49.947 +  return program;
  49.948  }
  49.949  
  49.950  #if !GLIB_CHECK_VERSION (2, 10, 0)
  49.951 @@ -724,185 +720,182 @@
  49.952  /* Hacked from glib 2.10 <gtime.c> */
  49.953  
  49.954  static time_t
  49.955 -mktime_utc ( struct tm *tm )
  49.956 +mktime_utc(struct tm *tm)
  49.957  {
  49.958 -    time_t retval;
  49.959 +  time_t retval;
  49.960  
  49.961  #ifndef HAVE_TIMEGM
  49.962 -    static const gint days_before[] = {
  49.963 -        0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
  49.964 -    };
  49.965 +  static const gint days_before[] = {
  49.966 +	0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
  49.967 +  };
  49.968  #endif
  49.969  
  49.970  #ifndef HAVE_TIMEGM
  49.971 -    if ( tm->tm_mon < 0 || tm->tm_mon > 11 )
  49.972 -        return ( time_t ) - 1;
  49.973 +  if (tm->tm_mon < 0 || tm->tm_mon > 11)
  49.974 +	return (time_t) - 1;
  49.975  
  49.976 -    retval = ( tm->tm_year - 70 ) * 365;
  49.977 -    retval += ( tm->tm_year - 68 ) / 4;
  49.978 -    retval += days_before[tm->tm_mon] + tm->tm_mday - 1;
  49.979 +  retval = (tm->tm_year - 70) * 365;
  49.980 +  retval += (tm->tm_year - 68) / 4;
  49.981 +  retval += days_before[tm->tm_mon] + tm->tm_mday - 1;
  49.982  
  49.983 -    if ( tm->tm_year % 4 == 0 && tm->tm_mon < 2 )
  49.984 -        retval -= 1;
  49.985 +  if (tm->tm_year % 4 == 0 && tm->tm_mon < 2)
  49.986 +	retval -= 1;
  49.987  
  49.988 -    retval =
  49.989 -        ( ( ( ( retval * 24 ) + tm->tm_hour ) * 60 ) + tm->tm_min ) * 60 +
  49.990 -        tm->tm_sec;
  49.991 +  retval =
  49.992 +	((((retval * 24) + tm->tm_hour) * 60) + tm->tm_min) * 60 + tm->tm_sec;
  49.993  #else
  49.994 -    retval = timegm ( tm );
  49.995 +  retval = timegm(tm);
  49.996  #endif /* !HAVE_TIMEGM */
  49.997  
  49.998 -    return retval;
  49.999 +  return retval;
 49.1000  }
 49.1001  
 49.1002  gboolean
 49.1003 -g_time_val_from_iso8601 ( const gchar * iso_date, GTimeVal * time_ )
 49.1004 +g_time_val_from_iso8601(const gchar * iso_date, GTimeVal * time_)
 49.1005  {
 49.1006 -    struct tm tm;
 49.1007 -    long val;
 49.1008 +  struct tm tm;
 49.1009 +  long val;
 49.1010  
 49.1011 -    g_return_val_if_fail ( iso_date != NULL, FALSE );
 49.1012 -    g_return_val_if_fail ( time_ != NULL, FALSE );
 49.1013 +  g_return_val_if_fail(iso_date != NULL, FALSE);
 49.1014 +  g_return_val_if_fail(time_ != NULL, FALSE);
 49.1015  
 49.1016 -    val = strtoul ( iso_date, ( char ** ) &iso_date, 10 );
 49.1017 -    if ( *iso_date == '-' )
 49.1018 -    {
 49.1019 -        /* YYYY-MM-DD */
 49.1020 -        tm.tm_year = val - 1900;
 49.1021 -        iso_date++;
 49.1022 -        tm.tm_mon = strtoul ( iso_date, ( char ** ) &iso_date, 10 ) - 1;
 49.1023 +  val = strtoul(iso_date, (char **) &iso_date, 10);
 49.1024 +  if (*iso_date == '-')
 49.1025 +	{
 49.1026 +	 /* YYYY-MM-DD */
 49.1027 +	  tm.tm_year = val - 1900;
 49.1028 +	  iso_date++;
 49.1029 +	  tm.tm_mon = strtoul(iso_date, (char **) &iso_date, 10) - 1;
 49.1030  
 49.1031 -        if ( *iso_date++ != '-' )
 49.1032 -            return FALSE;
 49.1033 +	  if (*iso_date++ != '-')
 49.1034 +		return FALSE;
 49.1035  
 49.1036 -        tm.tm_mday = strtoul ( iso_date, ( char ** ) &iso_date, 10 );
 49.1037 -    }
 49.1038 -    else
 49.1039 -    {
 49.1040 -        /* YYYYMMDD */
 49.1041 -        tm.tm_mday = val % 100;
 49.1042 -        tm.tm_mon = ( val % 10000 ) / 100 - 1;
 49.1043 -        tm.tm_year = val / 10000 - 1900;
 49.1044 -    }
 49.1045 +	  tm.tm_mday = strtoul(iso_date, (char **) &iso_date, 10);
 49.1046 +	}
 49.1047 +  else
 49.1048 +	{
 49.1049 +	 /* YYYYMMDD */
 49.1050 +	  tm.tm_mday = val % 100;
 49.1051 +	  tm.tm_mon = (val % 10000) / 100 - 1;
 49.1052 +	  tm.tm_year = val / 10000 - 1900;
 49.1053 +	}
 49.1054  
 49.1055 -    if ( *iso_date++ != 'T' )
 49.1056 -        return FALSE;
 49.1057 +  if (*iso_date++ != 'T')
 49.1058 +	return FALSE;
 49.1059  
 49.1060 -    val = strtoul ( iso_date, ( char ** ) &iso_date, 10 );
 49.1061 -    if ( *iso_date == ':' )
 49.1062 -    {
 49.1063 -        /* hh:mm:ss */
 49.1064 -        tm.tm_hour = val;
 49.1065 -        iso_date++;
 49.1066 -        tm.tm_min = strtoul ( iso_date, ( char ** ) &iso_date, 10 );
 49.1067 +  val = strtoul(iso_date, (char **) &iso_date, 10);
 49.1068 +  if (*iso_date == ':')
 49.1069 +	{
 49.1070 +	 /* hh:mm:ss */
 49.1071 +	  tm.tm_hour = val;
 49.1072 +	  iso_date++;
 49.1073 +	  tm.tm_min = strtoul(iso_date, (char **) &iso_date, 10);
 49.1074  
 49.1075 -        if ( *iso_date++ != ':' )
 49.1076 -            return FALSE;
 49.1077 +	  if (*iso_date++ != ':')
 49.1078 +		return FALSE;
 49.1079  
 49.1080 -        tm.tm_sec = strtoul ( iso_date, ( char ** ) &iso_date, 10 );
 49.1081 -    }
 49.1082 -    else
 49.1083 -    {
 49.1084 -        /* hhmmss */
 49.1085 -        tm.tm_sec = val % 100;
 49.1086 -        tm.tm_min = ( val % 10000 ) / 100;
 49.1087 -        tm.tm_hour = val / 10000;
 49.1088 -    }
 49.1089 +	  tm.tm_sec = strtoul(iso_date, (char **) &iso_date, 10);
 49.1090 +	}
 49.1091 +  else
 49.1092 +	{
 49.1093 +	 /* hhmmss */
 49.1094 +	  tm.tm_sec = val % 100;
 49.1095 +	  tm.tm_min = (val % 10000) / 100;
 49.1096 +	  tm.tm_hour = val / 10000;
 49.1097 +	}
 49.1098  
 49.1099 -    time_->tv_sec = mktime_utc ( &tm );
 49.1100 -    time_->tv_usec = 1;
 49.1101 +  time_->tv_sec = mktime_utc(&tm);
 49.1102 +  time_->tv_usec = 1;
 49.1103  
 49.1104 -    if ( *iso_date == '.' )
 49.1105 -        time_->tv_usec = strtoul ( iso_date + 1, ( char ** ) &iso_date, 10 );
 49.1106 +  if (*iso_date == '.')
 49.1107 +	time_->tv_usec = strtoul(iso_date + 1, (char **) &iso_date, 10);
 49.1108  
 49.1109 -    if ( *iso_date == '+' || *iso_date == '-' )
 49.1110 -    {
 49.1111 -        gint sign = ( *iso_date == '+' ) ? -1 : 1;
 49.1112 +  if (*iso_date == '+' || *iso_date == '-')
 49.1113 +	{
 49.1114 +	  gint sign = (*iso_date == '+') ? -1 : 1;
 49.1115  
 49.1116 -        val = 60 * strtoul ( iso_date + 1, ( char ** ) &iso_date, 10 );
 49.1117 +	  val = 60 * strtoul(iso_date + 1, (char **) &iso_date, 10);
 49.1118  
 49.1119 -        if ( *iso_date == ':' )
 49.1120 -            val = 60 * val + strtoul ( iso_date + 1, NULL, 10 );
 49.1121 -        else
 49.1122 -            val = 60 * ( val / 100 ) + ( val % 100 );
 49.1123 +	  if (*iso_date == ':')
 49.1124 +		val = 60 * val + strtoul(iso_date + 1, NULL, 10);
 49.1125 +	  else
 49.1126 +		val = 60 * (val / 100) + (val % 100);
 49.1127  
 49.1128 -        time_->tv_sec += ( time_t ) ( val * sign );
 49.1129 -    }
 49.1130 +	  time_->tv_sec += (time_t) (val * sign);
 49.1131 +	}
 49.1132  
 49.1133 -    return TRUE;
 49.1134 +  return TRUE;
 49.1135  }
 49.1136  
 49.1137  
 49.1138  gchar *
 49.1139 -g_time_val_to_iso8601 ( GTimeVal * time_ )
 49.1140 +g_time_val_to_iso8601(GTimeVal * time_)
 49.1141  {
 49.1142 -    gchar *retval;
 49.1143 +  gchar *retval;
 49.1144  
 49.1145 -    g_return_val_if_fail ( time_->tv_usec >= 0
 49.1146 -                           && time_->tv_usec < G_USEC_PER_SEC, NULL );
 49.1147 +  g_return_val_if_fail(time_->tv_usec >= 0
 49.1148 +					   && time_->tv_usec < G_USEC_PER_SEC, NULL);
 49.1149  
 49.1150  #define ISO_8601_LEN    21
 49.1151  #define ISO_8601_FORMAT "%Y-%m-%dT%H:%M:%SZ"
 49.1152 -    retval = g_new0 ( gchar, ISO_8601_LEN + 1 );
 49.1153 +  retval = g_new0(gchar, ISO_8601_LEN + 1);
 49.1154  
 49.1155 -    strftime ( retval, ISO_8601_LEN, ISO_8601_FORMAT,
 49.1156 -               gmtime ( &( time_->tv_sec ) ) );
 49.1157 +  strftime(retval, ISO_8601_LEN, ISO_8601_FORMAT, gmtime(&(time_->tv_sec)));
 49.1158  
 49.1159 -    return retval;
 49.1160 +  return retval;
 49.1161  }
 49.1162  
 49.1163  
 49.1164  /* Hacked from glib 2.10 <gdate.c> */
 49.1165  
 49.1166  void
 49.1167 -g_date_set_time_t ( GDate * date, time_t timet )
 49.1168 +g_date_set_time_t(GDate * date, time_t timet)
 49.1169  {
 49.1170 -    struct tm tm;
 49.1171 +  struct tm tm;
 49.1172  
 49.1173 -    g_return_if_fail ( date != NULL );
 49.1174 +  g_return_if_fail(date != NULL);
 49.1175  
 49.1176  #ifdef HAVE_LOCALTIME_R
 49.1177 -    localtime_r ( &timet, &tm );
 49.1178 +  localtime_r(&timet, &tm);
 49.1179  #else
 49.1180 -    {
 49.1181 -        struct tm *ptm = localtime ( &timet );
 49.1182 +  {
 49.1183 +	struct tm *ptm = localtime(&timet);
 49.1184  
 49.1185 -        if ( ptm == NULL )
 49.1186 -        {
 49.1187 -            /* Happens at least in Microsoft's C library if you pass a
 49.1188 -             * negative time_t. Use 2000-01-01 as default date.
 49.1189 -             */
 49.1190 +	if (ptm == NULL)
 49.1191 +	  {
 49.1192 +	   /* Happens at least in Microsoft's C library if you pass a
 49.1193 +	    * negative time_t. Use 2000-01-01 as default date.
 49.1194 +	    */
 49.1195  #ifndef G_DISABLE_CHECKS
 49.1196 -            g_return_if_fail_warning ( G_LOG_DOMAIN, "g_date_set_time",
 49.1197 -                                       "ptm != NULL" );
 49.1198 +		g_return_if_fail_warning(G_LOG_DOMAIN, "g_date_set_time",
 49.1199 +								 "ptm != NULL");
 49.1200  #endif
 49.1201  
 49.1202 -            tm.tm_mon = 0;
 49.1203 -            tm.tm_mday = 1;
 49.1204 -            tm.tm_year = 100;
 49.1205 -        }
 49.1206 -        else
 49.1207 -            memcpy ( ( void * ) &tm, ( void * ) ptm, sizeof ( struct tm ) );
 49.1208 -    }
 49.1209 +		tm.tm_mon = 0;
 49.1210 +		tm.tm_mday = 1;
 49.1211 +		tm.tm_year = 100;
 49.1212 +	  }
 49.1213 +	else
 49.1214 +	  memcpy((void *) &tm, (void *) ptm, sizeof(struct tm));
 49.1215 +  }
 49.1216  #endif
 49.1217  
 49.1218 -    date->julian = FALSE;
 49.1219 +  date->julian = FALSE;
 49.1220  
 49.1221 -    date->month = tm.tm_mon + 1;
 49.1222 -    date->day = tm.tm_mday;
 49.1223 -    date->year = tm.tm_year + 1900;
 49.1224 +  date->month = tm.tm_mon + 1;
 49.1225 +  date->day = tm.tm_mday;
 49.1226 +  date->year = tm.tm_year + 1900;
 49.1227  
 49.1228 -    g_return_if_fail ( g_date_valid_dmy
 49.1229 -                       ( date->day, date->month, date->year ) );
 49.1230 +  g_return_if_fail(g_date_valid_dmy(date->day, date->month, date->year));
 49.1231  
 49.1232 -    date->dmy = TRUE;
 49.1233 +  date->dmy = TRUE;
 49.1234  }
 49.1235  
 49.1236  
 49.1237  void
 49.1238 -g_date_set_time_val ( GDate * date, GTimeVal * timeval )
 49.1239 +g_date_set_time_val(GDate * date, GTimeVal * timeval)
 49.1240  {
 49.1241 -    g_date_set_time_t ( date, ( time_t ) timeval->tv_sec );
 49.1242 +  g_date_set_time_t(date, (time_t) timeval->tv_sec);
 49.1243  }
 49.1244  
 49.1245  
    50.1 --- a/gmyth/src/gmyth_util.h	Wed Jun 13 18:18:42 2007 +0100
    50.2 +++ b/gmyth/src/gmyth_util.h	Thu Jun 14 18:19:52 2007 +0100
    50.3 @@ -36,50 +36,50 @@
    50.4  #include "gmyth_backendinfo.h"
    50.5  #include "gmyth_programinfo.h"
    50.6  
    50.7 -G_BEGIN_DECLS GString *gmyth_util_time_to_isoformat ( time_t time_value );
    50.8 -GString *gmyth_util_time_to_string ( time_t time_value );
    50.9 -time_t gmyth_util_string_to_time ( GString * time_str );
   50.10 +G_BEGIN_DECLS GString *gmyth_util_time_to_isoformat(time_t time_value);
   50.11 +GString *gmyth_util_time_to_string(time_t time_value);
   50.12 +time_t gmyth_util_string_to_time(GString * time_str);
   50.13  
   50.14 -gchar *gmyth_util_time_to_isoformat_from_time_val_fmt ( const gchar *
   50.15 -                                                        fmt_string,
   50.16 -                                                        const GTimeVal *
   50.17 -                                                        time_val );
   50.18 +gchar *gmyth_util_time_to_isoformat_from_time_val_fmt(const gchar *
   50.19 +													  fmt_string,
   50.20 +													  const GTimeVal *
   50.21 +													  time_val);
   50.22  
   50.23 -GTimeVal *gmyth_util_string_to_time_val_fmt ( const gchar * fmt_string,
   50.24 -                                              const gchar * time_str );
   50.25 +GTimeVal *gmyth_util_string_to_time_val_fmt(const gchar * fmt_string,
   50.26 +											const gchar * time_str);
   50.27  
   50.28 -GTimeVal *gmyth_util_string_to_time_val ( const gchar * time_str );
   50.29 +GTimeVal *gmyth_util_string_to_time_val(const gchar * time_str);
   50.30  
   50.31 -gchar *gmyth_util_time_to_isoformat_from_time_val ( const GTimeVal * time );
   50.32 -gchar *gmyth_util_time_to_mythformat_from_time_val ( const GTimeVal * time );
   50.33 +gchar *gmyth_util_time_to_isoformat_from_time_val(const GTimeVal * time);
   50.34 +gchar *gmyth_util_time_to_mythformat_from_time_val(const GTimeVal * time);
   50.35  
   50.36 -gchar *gmyth_util_time_to_string_only_date ( const GTimeVal * time );
   50.37 +gchar *gmyth_util_time_to_string_only_date(const GTimeVal * time);
   50.38  
   50.39 -gchar *gmyth_util_time_to_string_only_time ( const GTimeVal * time );
   50.40 +gchar *gmyth_util_time_to_string_only_time(const GTimeVal * time);
   50.41  
   50.42 -gchar *gmyth_util_time_to_string_from_time_val ( const GTimeVal * time_val );
   50.43 +gchar *gmyth_util_time_to_string_from_time_val(const GTimeVal * time_val);
   50.44  
   50.45 -struct tm *gmyth_util_time_val_to_date ( const GTimeVal * time );
   50.46 +struct tm *gmyth_util_time_val_to_date(const GTimeVal * time);
   50.47  
   50.48 -gboolean gmyth_util_file_exists ( GMythBackendInfo * backend_info,
   50.49 -                                  const gchar * filename );
   50.50 +gboolean gmyth_util_file_exists(GMythBackendInfo * backend_info,
   50.51 +								const gchar * filename);
   50.52  
   50.53 -gboolean gmyth_util_file_exists_and_get_remote_dir ( GMythBackendInfo *
   50.54 -                                                     backend_info,
   50.55 -                                                     const gchar * filename,
   50.56 -                                                     gchar ** current_dir );
   50.57 +gboolean gmyth_util_file_exists_and_get_remote_dir(GMythBackendInfo *
   50.58 +												   backend_info,
   50.59 +												   const gchar * filename,
   50.60 +												   gchar ** current_dir);
   50.61  
   50.62 -gchar *gmyth_util_create_filename ( const gint chan_id,
   50.63 -                                    const GTimeVal * start_time );
   50.64 +gchar *gmyth_util_create_filename(const gint chan_id,
   50.65 +								  const GTimeVal * start_time);
   50.66  
   50.67 -GList *gmyth_util_get_channel_list ( GMythBackendInfo * backend_info );
   50.68 +GList *gmyth_util_get_channel_list(GMythBackendInfo * backend_info);
   50.69  
   50.70 -GSList *gmyth_util_get_all_recordings ( GMythBackendInfo * backend_info );
   50.71 +GSList *gmyth_util_get_all_recordings(GMythBackendInfo * backend_info);
   50.72  
   50.73 -GMythProgramInfo *gmyth_util_get_recording_from_channel ( GMythBackendInfo *
   50.74 -                                                          backend_info,
   50.75 -                                                          const gchar *
   50.76 -                                                          channel );
   50.77 +GMythProgramInfo *gmyth_util_get_recording_from_channel(GMythBackendInfo *
   50.78 +														backend_info,
   50.79 +														const gchar *
   50.80 +														channel);
   50.81  
   50.82  G_END_DECLS
   50.83  #endif /*GMYTH_UTIL_H_ */
    51.1 --- a/gmyth/src/gmyth_vlc.c	Wed Jun 13 18:18:42 2007 +0100
    51.2 +++ b/gmyth/src/gmyth_vlc.c	Thu Jun 14 18:19:52 2007 +0100
    51.3 @@ -36,8 +36,8 @@
    51.4  #include "gmyth_socket.h"
    51.5  
    51.6  /* static functions */
    51.7 -static int _socket_send ( int socket, gchar * msg );
    51.8 -static int _socket_recv ( int socket, gchar * buf );
    51.9 +static int _socket_send(int socket, gchar * msg);
   51.10 +static int _socket_recv(int socket, gchar * buf);
   51.11  
   51.12  /** Primitive function to send a message through the socket
   51.13   *
   51.14 @@ -46,18 +46,18 @@
   51.15   * @return 0 if success
   51.16   */
   51.17  static int
   51.18 -_socket_send ( int socket, gchar * msg )
   51.19 +_socket_send(int socket, gchar * msg)
   51.20  {
   51.21 -    size_t size = strlen ( msg ) + 2;   // (\n + \0)
   51.22 -    gchar *final = ( gchar * ) g_malloc0 ( sizeof ( gchar ) * size );
   51.23 +  size_t size = strlen(msg) + 2;	// (\n + \0)
   51.24 +  gchar *final = (gchar *) g_malloc0(sizeof(gchar) * size);
   51.25  
   51.26 -    g_snprintf ( final, size, "%s\n", msg );
   51.27 +  g_snprintf(final, size, "%s\n", msg);
   51.28  
   51.29 -    if ( send ( socket, final, strlen ( final ), 0 ) == -1 )
   51.30 -        perror ( "GMyth_VLC: send error" );
   51.31 +  if (send(socket, final, strlen(final), 0) == -1)
   51.32 +	perror("GMyth_VLC: send error");
   51.33  
   51.34 -    g_free ( final );
   51.35 -    return 0;
   51.36 +  g_free(final);
   51.37 +  return 0;
   51.38  }
   51.39  
   51.40  
   51.41 @@ -68,18 +68,18 @@
   51.42   * @return 0 if success
   51.43   */
   51.44  static int
   51.45 -_socket_recv ( int socket, gchar * buf )
   51.46 +_socket_recv(int socket, gchar * buf)
   51.47  {
   51.48 -    int numbytes = 0;
   51.49 +  int numbytes = 0;
   51.50  
   51.51 -    if ( ( numbytes = recv ( socket, buf, BUFFER - 1, 0 ) ) == -1 )
   51.52 -    {
   51.53 -        perror ( "GMyth_VLC: recv error" );
   51.54 -        return -1;
   51.55 -    }
   51.56 +  if ((numbytes = recv(socket, buf, BUFFER - 1, 0)) == -1)
   51.57 +	{
   51.58 +	  perror("GMyth_VLC: recv error");
   51.59 +	  return -1;
   51.60 +	}
   51.61  
   51.62 -    buf[numbytes - 1] = '\0';
   51.63 -    return numbytes;
   51.64 +  buf[numbytes - 1] = '\0';
   51.65 +  return numbytes;
   51.66  }
   51.67  
   51.68  
   51.69 @@ -92,20 +92,19 @@
   51.70   * @return 0 if success
   51.71   */
   51.72  int
   51.73 -gmyth_vlc_setup_output ( GMythVlc * vlc, int output, gchar * kind,
   51.74 -                         gchar * opts )
   51.75 +gmyth_vlc_setup_output(GMythVlc * vlc, int output, gchar * kind, gchar * opts)
   51.76  {
   51.77 -    int ret;
   51.78 +  int ret;
   51.79  
   51.80 -    size_t size = strlen ( opts ) + 25;
   51.81 -    gchar *msg = g_malloc0 ( sizeof ( gchar ) * size );
   51.82 +  size_t size = strlen(opts) + 25;
   51.83 +  gchar *msg = g_malloc0(sizeof(gchar) * size);
   51.84  
   51.85 -    g_snprintf ( msg, size, "setup output%d %s %s", output, kind, opts );
   51.86 +  g_snprintf(msg, size, "setup output%d %s %s", output, kind, opts);
   51.87  
   51.88 -    ret = _socket_send ( vlc->sockfd, msg );
   51.89 +  ret = _socket_send(vlc->sockfd, msg);
   51.90  
   51.91 -    g_free ( msg );
   51.92 -    return ret;
   51.93 +  g_free(msg);
   51.94 +  return ret;
   51.95  }
   51.96  
   51.97  
   51.98 @@ -117,9 +116,9 @@
   51.99   * @return 0 if success
  51.100   */
  51.101  int
  51.102 -gmyth_vlc_clean_playlist ( GMythVlc * vlc )
  51.103 +gmyth_vlc_clean_playlist(GMythVlc * vlc)
  51.104  {
  51.105 -    return _socket_send ( vlc->sockfd, "del all" );
  51.106 +  return _socket_send(vlc->sockfd, "del all");
  51.107  }
  51.108  
  51.109  
  51.110 @@ -131,17 +130,17 @@
  51.111   * @return 0 if success
  51.112   */
  51.113  int
  51.114 -gmyth_vlc_control_input ( GMythVlc * vlc, int output, gchar * command )
  51.115 +gmyth_vlc_control_input(GMythVlc * vlc, int output, gchar * command)
  51.116  {
  51.117 -    size_t size = 25;
  51.118 -    gchar *msg = g_malloc0 ( sizeof ( gchar ) * size );
  51.119 +  size_t size = 25;
  51.120 +  gchar *msg = g_malloc0(sizeof(gchar) * size);
  51.121  
  51.122 -    g_snprintf ( msg, size, "control output%d %s", output, command );
  51.123 +  g_snprintf(msg, size, "control output%d %s", output, command);
  51.124  
  51.125 -    int ret = _socket_send ( vlc->sockfd, msg );
  51.126 +  int ret = _socket_send(vlc->sockfd, msg);
  51.127  
  51.128 -    g_free ( msg );
  51.129 -    return ret;
  51.130 +  g_free(msg);
  51.131 +  return ret;
  51.132  }
  51.133  
  51.134  
  51.135 @@ -154,9 +153,9 @@
  51.136   * @return 0 if success
  51.137   */
  51.138  int
  51.139 -gmyth_vlc_create_input ( GMythVlc * vlc, int output, gchar * file )
  51.140 +gmyth_vlc_create_input(GMythVlc * vlc, int output, gchar * file)
  51.141  {
  51.142 -    return gmyth_vlc_setup_output ( vlc, output, "input", file );
  51.143 +  return gmyth_vlc_setup_output(vlc, output, "input", file);
  51.144  }
  51.145  
  51.146  
  51.147 @@ -168,46 +167,45 @@
  51.148   * @return 0 if success
  51.149   */
  51.150  int
  51.151 -gmyth_vlc_create_channel ( GMythVlc * vlc, gchar * type, int port, int vcodec )
  51.152 +gmyth_vlc_create_channel(GMythVlc * vlc, gchar * type, int port, int vcodec)
  51.153  {
  51.154 -    int ret;
  51.155 -    size_t size = 40;
  51.156 -    gchar *msg = ( gchar * ) g_malloc0 ( sizeof ( gchar ) * size );
  51.157 +  int ret;
  51.158 +  size_t size = 40;
  51.159 +  gchar *msg = (gchar *) g_malloc0(sizeof(gchar) * size);
  51.160  
  51.161 -    g_snprintf ( msg, size, "new output%d %s enabled loop",
  51.162 -                 vlc->n_outputs, type );
  51.163 +  g_snprintf(msg, size, "new output%d %s enabled loop", vlc->n_outputs, type);
  51.164  
  51.165 -    ret = _socket_send ( vlc->sockfd, msg );
  51.166 +  ret = _socket_send(vlc->sockfd, msg);
  51.167  
  51.168 -    if ( ret > -1 )
  51.169 -    {
  51.170 -        gmyth_vlc_setup_output ( vlc, vlc->n_outputs, "option", "sout-keep=1" );
  51.171 +  if (ret > -1)
  51.172 +	{
  51.173 +	  gmyth_vlc_setup_output(vlc, vlc->n_outputs, "option", "sout-keep=1");
  51.174  
  51.175 -        g_free ( msg );
  51.176 -        size = 256;
  51.177 -        msg = ( gchar * ) g_malloc0 ( sizeof ( gchar ) * size );
  51.178 +	  g_free(msg);
  51.179 +	  size = 256;
  51.180 +	  msg = (gchar *) g_malloc0(sizeof(gchar) * size);
  51.181  
  51.182 -        if ( vcodec == MPEG1 )
  51.183 -            // Best transcode option for N800 (MP1V)
  51.184 -            g_snprintf ( msg, size, "#transcode{vcodec=mp1v,vb=384,"
  51.185 -                         "fps=25.0,scale=1,acodec=mpga,"
  51.186 -                         "ab=64,channels=1}:duplicate{dst="
  51.187 -                         "std{access=http,mux=mpeg1,dst=" ":%d}}", port );
  51.188 -        else
  51.189 -            // Best transcode option for N800 (THEORA)
  51.190 -            g_snprintf ( msg, size, "#transcode{vcodec=theo,vb=384,"
  51.191 -                         "fps=25.0,scale=1,acodec=vorb,"
  51.192 -                         "ab=64,channels=1}:duplicate{dst="
  51.193 -                         "std{access=http,mux=ogg,dst=" ":%d}}", port );
  51.194 +	  if (vcodec == MPEG1)
  51.195 +	   // Best transcode option for N800 (MP1V)
  51.196 +		g_snprintf(msg, size, "#transcode{vcodec=mp1v,vb=384,"
  51.197 +				   "fps=25.0,scale=1,acodec=mpga,"
  51.198 +				   "ab=64,channels=1}:duplicate{dst="
  51.199 +				   "std{access=http,mux=mpeg1,dst=" ":%d}}", port);
  51.200 +	  else
  51.201 +	   // Best transcode option for N800 (THEORA)
  51.202 +		g_snprintf(msg, size, "#transcode{vcodec=theo,vb=384,"
  51.203 +				   "fps=25.0,scale=1,acodec=vorb,"
  51.204 +				   "ab=64,channels=1}:duplicate{dst="
  51.205 +				   "std{access=http,mux=ogg,dst=" ":%d}}", port);
  51.206  
  51.207 -        ret = gmyth_vlc_setup_output ( vlc, vlc->n_outputs, "output", msg );
  51.208 +	  ret = gmyth_vlc_setup_output(vlc, vlc->n_outputs, "output", msg);
  51.209  
  51.210 -        vlc->n_outputs++;
  51.211 -    }
  51.212 +	  vlc->n_outputs++;
  51.213 +	}
  51.214  
  51.215 -    g_free ( msg );
  51.216 +  g_free(msg);
  51.217  
  51.218 -    return ret;
  51.219 +  return ret;
  51.220  }
  51.221  
  51.222  
  51.223 @@ -219,53 +217,53 @@
  51.224   * @return 0 if success
  51.225   */
  51.226  int
  51.227 -gmyth_vlc_connect ( GMythVlc * vlc, GMythBackendInfo * backend_info,
  51.228 -                    gchar * passwd, int port )
  51.229 +gmyth_vlc_connect(GMythVlc * vlc, GMythBackendInfo * backend_info,
  51.230 +				  gchar * passwd, int port)
  51.231  {
  51.232 -    int numbytes;
  51.233 +  int numbytes;
  51.234  
  51.235 -    if ( ( vlc->he = gethostbyname ( backend_info->hostname ) ) == NULL )
  51.236 -    {
  51.237 -        herror ( "GMyth_VLC: gethostbyname error" );
  51.238 -        return -1;
  51.239 -    }
  51.240 +  if ((vlc->he = gethostbyname(backend_info->hostname)) == NULL)
  51.241 +	{
  51.242 +	  herror("GMyth_VLC: gethostbyname error");
  51.243 +	  return -1;
  51.244 +	}
  51.245  
  51.246 -    if ( ( vlc->sockfd = socket ( PF_INET, SOCK_STREAM, 0 ) ) == -1 )
  51.247 -    {
  51.248 -        perror ( "GMyth_VLC: socket error" );
  51.249 -        return -1;
  51.250 -    }
  51.251 -    // Socket properties
  51.252 -    vlc->their_addr.sin_family = AF_INET;
  51.253 -    vlc->their_addr.sin_port = htons ( port );
  51.254 -    vlc->their_addr.sin_addr = *( ( struct in_addr * ) vlc->he->h_addr );
  51.255 -    memset ( &( vlc->their_addr.sin_zero ), '\0', 8 );
  51.256 +  if ((vlc->sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1)
  51.257 +	{
  51.258 +	  perror("GMyth_VLC: socket error");
  51.259 +	  return -1;
  51.260 +	}
  51.261 + // Socket properties
  51.262 +  vlc->their_addr.sin_family = AF_INET;
  51.263 +  vlc->their_addr.sin_port = htons(port);
  51.264 +  vlc->their_addr.sin_addr = *((struct in_addr *) vlc->he->h_addr);
  51.265 +  memset(&(vlc->their_addr.sin_zero), '\0', 8);
  51.266  
  51.267 -    if ( connect ( vlc->sockfd, ( struct sockaddr * ) &( vlc->their_addr ),
  51.268 -                   sizeof ( struct sockaddr ) ) == -1 )
  51.269 -    {
  51.270 -        perror ( "GMyth_VLC: connect error. Check VLC's telnet interface" );
  51.271 -        return -1;
  51.272 -    }
  51.273 -    // Receive the Password's Prompt
  51.274 -    numbytes = _socket_recv ( vlc->sockfd, vlc->buf );
  51.275 +  if (connect(vlc->sockfd, (struct sockaddr *) &(vlc->their_addr),
  51.276 +			  sizeof(struct sockaddr)) == -1)
  51.277 +	{
  51.278 +	  perror("GMyth_VLC: connect error. Check VLC's telnet interface");
  51.279 +	  return -1;
  51.280 +	}
  51.281 + // Receive the Password's Prompt
  51.282 +  numbytes = _socket_recv(vlc->sockfd, vlc->buf);
  51.283  
  51.284 -    // Send the Password. We don't have to
  51.285 -    // care about passwords being sent in plain text
  51.286 -    // because telnet protocol does it.
  51.287 -    _socket_send ( vlc->sockfd, passwd );
  51.288 + // Send the Password. We don't have to
  51.289 + // care about passwords being sent in plain text
  51.290 + // because telnet protocol does it.
  51.291 +  _socket_send(vlc->sockfd, passwd);
  51.292  
  51.293 -    // Receive the Welcome msg
  51.294 -    numbytes = _socket_recv ( vlc->sockfd, vlc->buf );
  51.295 -    if ( numbytes > -1 )
  51.296 -        if ( strncmp ( vlc->buf, "\r\nWrong password.", 17 ) == 0 )
  51.297 -        {
  51.298 -            perror ( "Gmyth_VLC: passwd error. Check your passwd" );
  51.299 -            return -2;
  51.300 -        }
  51.301 + // Receive the Welcome msg
  51.302 +  numbytes = _socket_recv(vlc->sockfd, vlc->buf);
  51.303 +  if (numbytes > -1)
  51.304 +	if (strncmp(vlc->buf, "\r\nWrong password.", 17) == 0)
  51.305 +	  {
  51.306 +		perror("Gmyth_VLC: passwd error. Check your passwd");
  51.307 +		return -2;
  51.308 +	  }
  51.309  
  51.310  
  51.311 -    return 0;
  51.312 +  return 0;
  51.313  }
  51.314  
  51.315  
  51.316 @@ -276,18 +274,18 @@
  51.317   * @return 0 if success
  51.318   */
  51.319  int
  51.320 -gmyth_vlc_disconnect ( GMythVlc * vlc )
  51.321 +gmyth_vlc_disconnect(GMythVlc * vlc)
  51.322  {
  51.323  
  51.324 -    int ret;
  51.325 +  int ret;
  51.326  
  51.327 -    ret = gmyth_vlc_clean_playlist ( vlc );
  51.328 +  ret = gmyth_vlc_clean_playlist(vlc);
  51.329  
  51.330 -    if ( ret > -1 )
  51.331 -    {
  51.332 -        vlc->n_outputs = 0;
  51.333 -        vlc->n_inputs = 0;
  51.334 -    }
  51.335 +  if (ret > -1)
  51.336 +	{
  51.337 +	  vlc->n_outputs = 0;
  51.338 +	  vlc->n_inputs = 0;
  51.339 +	}
  51.340  
  51.341 -    return close ( vlc->sockfd );
  51.342 +  return close(vlc->sockfd);
  51.343  }
    52.1 --- a/gmyth/src/gmyth_vlc.h	Wed Jun 13 18:18:42 2007 +0100
    52.2 +++ b/gmyth/src/gmyth_vlc.h	Thu Jun 14 18:19:52 2007 +0100
    52.3 @@ -53,42 +53,42 @@
    52.4  typedef struct _GMythVlc GMythVlc;
    52.5  
    52.6  struct _GMythVlc
    52.7 -    {
    52.8 -        int sockfd;
    52.9 +{
   52.10 +  int sockfd;
   52.11  
   52.12 -        // Number of outputs used
   52.13 -        int n_outputs;
   52.14 + // Number of outputs used
   52.15 +  int n_outputs;
   52.16  
   52.17 -        // Number of inputs
   52.18 -        int n_inputs;
   52.19 + // Number of inputs
   52.20 +  int n_inputs;
   52.21  
   52.22 -        // Socket vars
   52.23 -        struct hostent *he;
   52.24 -        struct sockaddr_in their_addr;
   52.25 + // Socket vars
   52.26 +  struct hostent *he;
   52.27 +  struct sockaddr_in their_addr;
   52.28  
   52.29 -        char buf[BUFFER];
   52.30 -    };
   52.31 +  char buf[BUFFER];
   52.32 +};
   52.33  
   52.34  
   52.35  
   52.36 -int gmyth_vlc_setup_output ( GMythVlc * vlc, int output,
   52.37 -                             gchar * kind, gchar * opts );
   52.38 +int gmyth_vlc_setup_output(GMythVlc * vlc, int output,
   52.39 +						   gchar * kind, gchar * opts);
   52.40  
   52.41  
   52.42 -int gmyth_vlc_clean_playlist ( GMythVlc * vlc );
   52.43 +int gmyth_vlc_clean_playlist(GMythVlc * vlc);
   52.44  
   52.45  
   52.46 -int gmyth_vlc_control_input ( GMythVlc * vlc, int output, gchar * command );
   52.47 +int gmyth_vlc_control_input(GMythVlc * vlc, int output, gchar * command);
   52.48  
   52.49 -int gmyth_vlc_create_input ( GMythVlc * vlc, int output, gchar * file );
   52.50 +int gmyth_vlc_create_input(GMythVlc * vlc, int output, gchar * file);
   52.51  
   52.52 -int gmyth_vlc_create_channel ( GMythVlc * vlc, gchar * type,
   52.53 -                               int port, int vcodec );
   52.54 +int gmyth_vlc_create_channel(GMythVlc * vlc, gchar * type,
   52.55 +							 int port, int vcodec);
   52.56  
   52.57 -int gmyth_vlc_connect ( GMythVlc * vlc, GMythBackendInfo * backend_info,
   52.58 -                        gchar * passwd, int port );
   52.59 +int gmyth_vlc_connect(GMythVlc * vlc, GMythBackendInfo * backend_info,
   52.60 +					  gchar * passwd, int port);
   52.61  
   52.62 -int gmyth_vlc_disconnect ( GMythVlc * vlc );
   52.63 +int gmyth_vlc_disconnect(GMythVlc * vlc);
   52.64  
   52.65  G_END_DECLS
   52.66  #endif /* __GMYTH_VLC_H__ */
    53.1 --- a/gmyth/tests/gmyth_test_connection.c	Wed Jun 13 18:18:42 2007 +0100
    53.2 +++ b/gmyth/tests/gmyth_test_connection.c	Thu Jun 14 18:19:52 2007 +0100
    53.3 @@ -11,81 +11,90 @@
    53.4  #include "common.h"
    53.5  
    53.6  static gboolean
    53.7 -test_backend_connection1 (GMythBackendInfo *backend_info)
    53.8 +test_backend_connection1(GMythBackendInfo * backend_info)
    53.9  {
   53.10 -    GMythSocket *socket = gmyth_socket_new ();
   53.11 -    if (gmyth_socket_connect_with_timeout (socket, 
   53.12 -	    gmyth_backend_info_get_hostname (backend_info),
   53.13 -	    gmyth_backend_info_get_port (backend_info), 4) == TRUE) {
   53.14 -        g_object_unref( socket );
   53.15 -        g_debug ("Socket connection success");
   53.16 -	return TRUE;
   53.17 -    } else {
   53.18 -	g_debug ("Connection failed");
   53.19 -	return FALSE;
   53.20 -    }
   53.21 +  GMythSocket *socket = gmyth_socket_new();
   53.22 +  if (gmyth_socket_connect_with_timeout(socket,
   53.23 +										gmyth_backend_info_get_hostname
   53.24 +										(backend_info),
   53.25 +										gmyth_backend_info_get_port
   53.26 +										(backend_info), 4) == TRUE)
   53.27 +	{
   53.28 +	  g_object_unref(socket);
   53.29 +	  g_debug("Socket connection success");
   53.30 +	  return TRUE;
   53.31 +	}
   53.32 +  else
   53.33 +	{
   53.34 +	  g_debug("Connection failed");
   53.35 +	  return FALSE;
   53.36 +	}
   53.37  }
   53.38  
   53.39  static gboolean
   53.40 -test_backend_connection2 (GMythBackendInfo *backend_info)
   53.41 +test_backend_connection2(GMythBackendInfo * backend_info)
   53.42  {
   53.43 -    GMythSocket *socket = gmyth_socket_new ();
   53.44 -    if (gmyth_socket_connect_to_backend (socket,
   53.45 -	    gmyth_backend_info_get_hostname (backend_info),
   53.46 -	    gmyth_backend_info_get_port (backend_info), TRUE) == TRUE) {
   53.47 -        
   53.48 -    
   53.49 -    g_object_unref( socket );
   53.50 -		    
   53.51 -	g_debug ("Backend socket connection success");
   53.52 -	return TRUE;
   53.53 -    } else {
   53.54 -	g_debug ("Connection failed");
   53.55 -	return FALSE;
   53.56 -    }
   53.57 +  GMythSocket *socket = gmyth_socket_new();
   53.58 +  if (gmyth_socket_connect_to_backend(socket,
   53.59 +									  gmyth_backend_info_get_hostname
   53.60 +									  (backend_info),
   53.61 +									  gmyth_backend_info_get_port
   53.62 +									  (backend_info), TRUE) == TRUE)
   53.63 +	{
   53.64 +
   53.65 +
   53.66 +	  g_object_unref(socket);
   53.67 +
   53.68 +	  g_debug("Backend socket connection success");
   53.69 +	  return TRUE;
   53.70 +	}
   53.71 +  else
   53.72 +	{
   53.73 +	  g_debug("Connection failed");
   53.74 +	  return FALSE;
   53.75 +	}
   53.76  }
   53.77  
   53.78  static gboolean
   53.79 -test_mysql_connection1 (GMythBackendInfo *backend_info)
   53.80 +test_mysql_connection1(GMythBackendInfo * backend_info)
   53.81  {
   53.82 -    GMythQuery *query = gmyth_query_new ();
   53.83 +  GMythQuery *query = gmyth_query_new();
   53.84  
   53.85 -    if (gmyth_query_connect_with_timeout (query, backend_info, 3) == TRUE) {
   53.86 -        g_object_unref( query );
   53.87 -	g_debug ("Mysql connection success");
   53.88 -	return TRUE;
   53.89 -    } else {
   53.90 -	g_debug ("Mysql connection failed");
   53.91 -	return FALSE;
   53.92 -    }
   53.93 -       
   53.94 -}
   53.95 -
   53.96 -
   53.97 -int
   53.98 -main (int args, const char **argv)
   53.99 -{
  53.100 -    GMythBackendInfo *backend_info;
  53.101 -    g_type_init ();
  53.102 -    g_thread_init (NULL);
  53.103 -
  53.104 -    backend_info = gmyth_backend_info_new_with_uri (argv[1]);
  53.105 -
  53.106 -    test_backend_connection1 (backend_info);
  53.107 -    test_backend_connection2 (backend_info);
  53.108 -    test_mysql_connection1 (backend_info);
  53.109 -
  53.110 -    fprintf(stdout, SYNC_STRING);
  53.111 -    fflush(NULL);
  53.112 -    getchar();
  53.113 -    
  53.114 -    if ( backend_info != NULL )
  53.115 -        g_object_unref( backend_info );
  53.116 -
  53.117 -    return (0);
  53.118 +  if (gmyth_query_connect_with_timeout(query, backend_info, 3) == TRUE)
  53.119 +	{
  53.120 +	  g_object_unref(query);
  53.121 +	  g_debug("Mysql connection success");
  53.122 +	  return TRUE;
  53.123 +	}
  53.124 +  else
  53.125 +	{
  53.126 +	  g_debug("Mysql connection failed");
  53.127 +	  return FALSE;
  53.128 +	}
  53.129  
  53.130  }
  53.131  
  53.132  
  53.133 +int
  53.134 +main(int args, const char **argv)
  53.135 +{
  53.136 +  GMythBackendInfo *backend_info;
  53.137 +  g_type_init();
  53.138 +  g_thread_init(NULL);
  53.139  
  53.140 +  backend_info = gmyth_backend_info_new_with_uri(argv[1]);
  53.141  
  53.142 +  test_backend_connection1(backend_info);
  53.143 +  test_backend_connection2(backend_info);
  53.144 +  test_mysql_connection1(backend_info);
  53.145 +
  53.146 +  fprintf(stdout, SYNC_STRING);
  53.147 +  fflush(NULL);
  53.148 +  getchar();
  53.149 +
  53.150 +  if (backend_info != NULL)
  53.151 +	g_object_unref(backend_info);
  53.152 +
  53.153 +  return (0);
  53.154 +
  53.155 +}
    54.1 --- a/gmyth/tests/gmyth_test_epg.c	Wed Jun 13 18:18:42 2007 +0100
    54.2 +++ b/gmyth/tests/gmyth_test_epg.c	Thu Jun 14 18:19:52 2007 +0100
    54.3 @@ -5,119 +5,133 @@
    54.4  #include "common.h"
    54.5  
    54.6  static gboolean
    54.7 -test_epg_connection (GMythBackendInfo *backend_info)
    54.8 +test_epg_connection(GMythBackendInfo * backend_info)
    54.9  {
   54.10 -    GMythEPG *epg = gmyth_epg_new ();
   54.11 -    gboolean res = FALSE;
   54.12 +  GMythEPG *epg = gmyth_epg_new();
   54.13 +  gboolean res = FALSE;
   54.14  
   54.15 -    res = gmyth_epg_connect (epg, backend_info);
   54.16 +  res = gmyth_epg_connect(epg, backend_info);
   54.17  
   54.18 -    gmyth_epg_disconnect (epg);
   54.19 -    if ( epg != NULL )
   54.20 -    	g_object_unref (epg);
   54.21 +  gmyth_epg_disconnect(epg);
   54.22 +  if (epg != NULL)
   54.23 +	g_object_unref(epg);
   54.24  
   54.25 -    return res; 
   54.26 +  return res;
   54.27  }
   54.28  
   54.29  
   54.30  static gboolean
   54.31 -test_epg_get_channels (GMythBackendInfo *backend_info)
   54.32 +test_epg_get_channels(GMythBackendInfo * backend_info)
   54.33  {
   54.34 -    GMythEPG *epg = gmyth_epg_new ();
   54.35 -    GList *clist;
   54.36 -    gint i, length;
   54.37 +  GMythEPG *epg = gmyth_epg_new();
   54.38 +  GList *clist;
   54.39 +  gint i, length;
   54.40  
   54.41 -    if (!gmyth_epg_connect (epg, backend_info)) {
   54.42 -        return FALSE;
   54.43 -    }
   54.44 +  if (!gmyth_epg_connect(epg, backend_info))
   54.45 +	{
   54.46 +	  return FALSE;
   54.47 +	}
   54.48  
   54.49 -    length = gmyth_epg_get_channel_list (epg, &clist);
   54.50 -    g_debug ("==== %d channels found in the EPG ====\n", length);
   54.51 -    for (i=0; i<length; i++) {
   54.52 -        GMythChannelInfo *channel_info = (GMythChannelInfo*) g_list_nth_data (clist, i);
   54.53 +  length = gmyth_epg_get_channel_list(epg, &clist);
   54.54 +  g_debug("==== %d channels found in the EPG ====\n", length);
   54.55 +  for (i = 0; i < length; i++)
   54.56 +	{
   54.57 +	  GMythChannelInfo *channel_info =
   54.58 +		(GMythChannelInfo *) g_list_nth_data(clist, i);
   54.59  
   54.60 -        gmyth_channel_info_print(channel_info);
   54.61 -    }
   54.62 +	  gmyth_channel_info_print(channel_info);
   54.63 +	}
   54.64  
   54.65 -    g_list_free (clist);
   54.66 -    gmyth_epg_disconnect (epg);
   54.67 -    if ( epg != NULL )
   54.68 -    	g_object_unref (epg);
   54.69 +  g_list_free(clist);
   54.70 +  gmyth_epg_disconnect(epg);
   54.71 +  if (epg != NULL)
   54.72 +	g_object_unref(epg);
   54.73  }
   54.74  
   54.75  static gboolean
   54.76 -test_epg_get_channel_icon (GMythBackendInfo *backend_info)
   54.77 +test_epg_get_channel_icon(GMythBackendInfo * backend_info)
   54.78  {
   54.79 -    GMythEPG *epg = gmyth_epg_new ();
   54.80 -    GList *clist;
   54.81 -    gint i, length;
   54.82 +  GMythEPG *epg = gmyth_epg_new();
   54.83 +  GList *clist;
   54.84 +  gint i, length;
   54.85  
   54.86 -    if (!gmyth_epg_connect (epg, backend_info)) {
   54.87 -        return FALSE;
   54.88 -    }
   54.89 +  if (!gmyth_epg_connect(epg, backend_info))
   54.90 +	{
   54.91 +	  return FALSE;
   54.92 +	}
   54.93  
   54.94 -    length = gmyth_epg_get_channel_list (epg, &clist);
   54.95 -    g_debug ("==== %d channels found in the EPG ====\n", length);
   54.96 -    for (i=0; i<length; i++) {
   54.97 -        GMythChannelInfo *channel_info = (GMythChannelInfo*) g_list_nth_data (clist, i);
   54.98 -        
   54.99 -        if (gmyth_epg_channel_has_icon (epg, channel_info)) {
  54.100 -            gchar *icon_name = g_strdup_printf ("%s.jpg", channel_info->channel_name->str);
  54.101 -            guint8 *icon_data = NULL;
  54.102 -            guint icon_length;
  54.103 +  length = gmyth_epg_get_channel_list(epg, &clist);
  54.104 +  g_debug("==== %d channels found in the EPG ====\n", length);
  54.105 +  for (i = 0; i < length; i++)
  54.106 +	{
  54.107 +	  GMythChannelInfo *channel_info =
  54.108 +		(GMythChannelInfo *) g_list_nth_data(clist, i);
  54.109  
  54.110 -            g_debug ("Channel %s has icon %s\n", channel_info->channel_name->str, channel_info->channel_icon->str);
  54.111 +	  if (gmyth_epg_channel_has_icon(epg, channel_info))
  54.112 +		{
  54.113 +		  gchar *icon_name =
  54.114 +			g_strdup_printf("%s.jpg", channel_info->channel_name->str);
  54.115 +		  guint8 *icon_data = NULL;
  54.116 +		  guint icon_length;
  54.117  
  54.118 -            if (gmyth_epg_channel_get_icon (epg, channel_info, &icon_data, &icon_length)) {
  54.119 -                FILE *outfile = fopen (icon_name, "w+");
  54.120 -                if (fwrite (icon_data, icon_length, 1, outfile) == icon_length)
  54.121 -                    g_debug ("\tIcon saved as %s", icon_name);
  54.122 -                else
  54.123 -                    g_debug ("\tError while downloading the file or writing it");
  54.124 +		  g_debug("Channel %s has icon %s\n", channel_info->channel_name->str,
  54.125 +				  channel_info->channel_icon->str);
  54.126  
  54.127 -                g_free (icon_data);
  54.128 -            }
  54.129 -            g_free (icon_name);
  54.130 -            
  54.131 -        } else {
  54.132 -            g_debug ("Channel %s does not have icon\n", channel_info->channel_name->str);
  54.133 -        }
  54.134 -        gmyth_channel_info_print(channel_info);
  54.135 -    }
  54.136 +		  if (gmyth_epg_channel_get_icon
  54.137 +			  (epg, channel_info, &icon_data, &icon_length))
  54.138 +			{
  54.139 +			  FILE *outfile = fopen(icon_name, "w+");
  54.140 +			  if (fwrite(icon_data, icon_length, 1, outfile) == icon_length)
  54.141 +				g_debug("\tIcon saved as %s", icon_name);
  54.142 +			  else
  54.143 +				g_debug("\tError while downloading the file or writing it");
  54.144  
  54.145 -    g_list_free (clist);
  54.146 -    gmyth_epg_disconnect (epg);
  54.147 -    g_object_unref (epg);
  54.148 +			  g_free(icon_data);
  54.149 +			}
  54.150 +		  g_free(icon_name);
  54.151  
  54.152 -    return TRUE;
  54.153 +		}
  54.154 +	  else
  54.155 +		{
  54.156 +		  g_debug("Channel %s does not have icon\n",
  54.157 +				  channel_info->channel_name->str);
  54.158 +		}
  54.159 +	  gmyth_channel_info_print(channel_info);
  54.160 +	}
  54.161 +
  54.162 +  g_list_free(clist);
  54.163 +  gmyth_epg_disconnect(epg);
  54.164 +  g_object_unref(epg);
  54.165 +
  54.166 +  return TRUE;
  54.167  }
  54.168  
  54.169  int
  54.170 -main (int args, const char **argv)
  54.171 +main(int args, const char **argv)
  54.172  {
  54.173  
  54.174 -    GMythBackendInfo *backend_info;
  54.175 -    g_type_init ();
  54.176 -    g_thread_init (NULL);
  54.177 +  GMythBackendInfo *backend_info;
  54.178 +  g_type_init();
  54.179 +  g_thread_init(NULL);
  54.180  
  54.181 -    if (args < 2) {
  54.182 -        g_debug ("Type %s myth://hostname:port/?mythconverg\n", argv[0]);
  54.183 -        return -1;
  54.184 -    }
  54.185 +  if (args < 2)
  54.186 +	{
  54.187 +	  g_debug("Type %s myth://hostname:port/?mythconverg\n", argv[0]);
  54.188 +	  return -1;
  54.189 +	}
  54.190  
  54.191 -    backend_info = gmyth_backend_info_new_with_uri (argv[1]);
  54.192 +  backend_info = gmyth_backend_info_new_with_uri(argv[1]);
  54.193  
  54.194 -    fprintf(stdout, SYNC_STRING);
  54.195 -    fflush(NULL);
  54.196 -    getchar();
  54.197 +  fprintf(stdout, SYNC_STRING);
  54.198 +  fflush(NULL);
  54.199 +  getchar();
  54.200  
  54.201 -    test_epg_connection (backend_info);
  54.202 -    test_epg_get_channels (backend_info);
  54.203 -    test_epg_get_channel_icon (backend_info);
  54.204 +  test_epg_connection(backend_info);
  54.205 +  test_epg_get_channels(backend_info);
  54.206 +  test_epg_get_channel_icon(backend_info);
  54.207  
  54.208 -    if ( backend_info != NULL )
  54.209 -    	g_object_unref( backend_info );
  54.210 +  if (backend_info != NULL)
  54.211 +	g_object_unref(backend_info);
  54.212  
  54.213 -    return(0);
  54.214 +  return (0);
  54.215  }
  54.216 -
    55.1 --- a/gmyth/tests/gmyth_test_file_download.c	Wed Jun 13 18:18:42 2007 +0100
    55.2 +++ b/gmyth/tests/gmyth_test_file_download.c	Thu Jun 14 18:19:52 2007 +0100
    55.3 @@ -12,101 +12,107 @@
    55.4  #define URI_FILE_TRANSFER_DEFAULT	"myth://192.168.3.165:6543/"
    55.5  
    55.6  static gboolean
    55.7 -test_file_download_setup( gchar *uri ) {
    55.8 -    GMythFile *file = NULL;
    55.9 -    GMythFileReadResult result;
   55.10 -    gint64 num_bytes;
   55.11 -    GByteArray *file_buffer = g_byte_array_new ();
   55.12 -    gboolean ret = TRUE;    
   55.13 -    gboolean is_local = FALSE;
   55.14 +test_file_download_setup(gchar * uri)
   55.15 +{
   55.16 +  GMythFile *file = NULL;
   55.17 +  GMythFileReadResult result;
   55.18 +  gint64 num_bytes;
   55.19 +  GByteArray *file_buffer = g_byte_array_new();
   55.20 +  gboolean ret = TRUE;
   55.21 +  gboolean is_local = FALSE;
   55.22  
   55.23 -    if ( NULL == uri)
   55.24 -        uri = g_strdup( URI_FILE_TRANSFER_DEFAULT );
   55.25 +  if (NULL == uri)
   55.26 +	uri = g_strdup(URI_FILE_TRANSFER_DEFAULT);
   55.27  
   55.28 -    GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri);
   55.29 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
   55.30  
   55.31 -    GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri(uri);
   55.32 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
   55.33  
   55.34 -    /* Check if the file is local to this specific client renderer, and tries to open
   55.35 -     * a local connection
   55.36 -     */
   55.37 -    if ( gmyth_uri_is_local_file(gmyth_uri)) {
   55.38 -        g_debug( "Opening local file connection to download...");
   55.39 -        file = GMYTH_FILE(gmyth_file_local_new(backend_info));
   55.40 -        ret = gmyth_file_local_open( GMYTH_FILE_LOCAL( file ) );
   55.41 -    } else {
   55.42 -        g_debug( "Opening remote file connection to download...");
   55.43 -        file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
   55.44 -        ret = gmyth_file_transfer_open( GMYTH_FILE_TRANSFER(file), uri);
   55.45 -    }
   55.46 +  /* Check if the file is local to this specific client renderer, and tries to open
   55.47 +   * a local connection
   55.48 +   */
   55.49 +  if (gmyth_uri_is_local_file(gmyth_uri))
   55.50 +	{
   55.51 +	  g_debug("Opening local file connection to download...");
   55.52 +	  file = GMYTH_FILE(gmyth_file_local_new(backend_info));
   55.53 +	  ret = gmyth_file_local_open(GMYTH_FILE_LOCAL(file));
   55.54 +	}
   55.55 +  else
   55.56 +	{
   55.57 +	  g_debug("Opening remote file connection to download...");
   55.58 +	  file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
   55.59 +	  ret = gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(file), uri);
   55.60 +	}
   55.61  
   55.62 -    if (NULL == file) {
   55.63 -        g_debug("FileTransfer is NULL");
   55.64 -        ret = FALSE;
   55.65 -        goto init_failed;
   55.66 -    }
   55.67 -    
   55.68 -    g_debug( "uri = %s", uri);
   55.69 +  if (NULL == file)
   55.70 +	{
   55.71 +	  g_debug("FileTransfer is NULL");
   55.72 +	  ret = FALSE;
   55.73 +	  goto init_failed;
   55.74 +	}
   55.75  
   55.76 -    if (ret == FALSE) {
   55.77 -        g_debug("MythTV FileTransfer request failed when setting up socket connection!");
   55.78 -        goto init_failed;
   55.79 -    }
   55.80 +  g_debug("uri = %s", uri);
   55.81  
   55.82 -    g_debug( "MythTV FileTransfer filesize = %lld",
   55.83 -            num_bytes = gmyth_file_get_filesize( file ) );
   55.84 -    
   55.85 -    is_local = gmyth_uri_is_local_file(gmyth_uri);
   55.86 -    
   55.87 -    do
   55.88 -    {
   55.89 +  if (ret == FALSE)
   55.90 +	{
   55.91 +	  g_debug
   55.92 +		("MythTV FileTransfer request failed when setting up socket connection!");
   55.93 +	  goto init_failed;
   55.94 +	}
   55.95  
   55.96 -        if ( is_local )
   55.97 -            result = gmyth_file_local_read ( GMYTH_FILE_LOCAL(file),
   55.98 -                                           file_buffer,
   55.99 -                                           num_bytes, FALSE );
  55.100 -        else
  55.101 -            result = gmyth_file_transfer_read ( GMYTH_FILE_TRANSFER(file),
  55.102 -                                           file_buffer,
  55.103 -                                           num_bytes, FALSE );
  55.104 +  g_debug("MythTV FileTransfer filesize = %lld",
  55.105 +		  num_bytes = gmyth_file_get_filesize(file));
  55.106  
  55.107 -    } while ( result == GMYTH_FILE_READ_OK );
  55.108 +  is_local = gmyth_uri_is_local_file(gmyth_uri);
  55.109  
  55.110 -init_failed: 
  55.111 +  do
  55.112 +	{
  55.113  
  55.114 -    if ( file != NULL)
  55.115 -        g_object_unref(file);
  55.116 +	  if (is_local)
  55.117 +		result = gmyth_file_local_read(GMYTH_FILE_LOCAL(file),
  55.118 +									   file_buffer, num_bytes, FALSE);
  55.119 +	  else
  55.120 +		result = gmyth_file_transfer_read(GMYTH_FILE_TRANSFER(file),
  55.121 +										  file_buffer, num_bytes, FALSE);
  55.122  
  55.123 -    if ( gmyth_uri != NULL)
  55.124 -        g_object_unref( gmyth_uri);
  55.125 +	}
  55.126 +  while (result == GMYTH_FILE_READ_OK);
  55.127  
  55.128 -    if ( backend_info != NULL)
  55.129 -        g_object_unref( backend_info);
  55.130 +init_failed:
  55.131  
  55.132 -    return ret;
  55.133 +  if (file != NULL)
  55.134 +	g_object_unref(file);
  55.135 +
  55.136 +  if (gmyth_uri != NULL)
  55.137 +	g_object_unref(gmyth_uri);
  55.138 +
  55.139 +  if (backend_info != NULL)
  55.140 +	g_object_unref(backend_info);
  55.141 +
  55.142 +  return ret;
  55.143  
  55.144  }
  55.145  
  55.146  gint
  55.147 -main(gint args, const gchar **argv) {
  55.148 -    gboolean ret = FALSE;
  55.149 +main(gint args, const gchar ** argv)
  55.150 +{
  55.151 +  gboolean ret = FALSE;
  55.152  
  55.153 -    g_type_init();
  55.154 +  g_type_init();
  55.155  
  55.156 -    g_thread_init(NULL);
  55.157 +  g_thread_init(NULL);
  55.158  
  55.159 -    fprintf(stdout, SYNC_STRING);
  55.160 -    fflush(NULL);
  55.161 -    getchar();
  55.162 +  fprintf(stdout, SYNC_STRING);
  55.163 +  fflush(NULL);
  55.164 +  getchar();
  55.165  
  55.166 -    if ( args > 1)
  55.167 -        ret = test_file_download_setup( argv[1]);
  55.168 +  if (args > 1)
  55.169 +	ret = test_file_download_setup(argv[1]);
  55.170  
  55.171 -    if ( !ret)
  55.172 -        g_debug("Error when running LiveTV setup test script!");
  55.173 -    else
  55.174 -        g_debug("LiveTV setup test script finished with success.");
  55.175 +  if (!ret)
  55.176 +	g_debug("Error when running LiveTV setup test script!");
  55.177 +  else
  55.178 +	g_debug("LiveTV setup test script finished with success.");
  55.179  
  55.180 -    return (0);
  55.181 +  return (0);
  55.182  }
  55.183 -
    56.1 --- a/gmyth/tests/gmyth_test_filelocal.c	Wed Jun 13 18:18:42 2007 +0100
    56.2 +++ b/gmyth/tests/gmyth_test_filelocal.c	Thu Jun 14 18:19:52 2007 +0100
    56.3 @@ -11,81 +11,89 @@
    56.4  #define URI_FILE_LOCAL_DEFAULT	"myth://192.168.3.165:6543/"
    56.5  
    56.6  static gboolean
    56.7 -test_file_local_setup( gchar *uri ) {
    56.8 -    GMythFileLocal *file = NULL;
    56.9 -    gboolean ret = TRUE;
   56.10 +test_file_local_setup(gchar * uri)
   56.11 +{
   56.12 +  GMythFileLocal *file = NULL;
   56.13 +  gboolean ret = TRUE;
   56.14  
   56.15 -    if ( NULL == uri)
   56.16 -        uri = g_strdup( URI_FILE_LOCAL_DEFAULT );
   56.17 +  if (NULL == uri)
   56.18 +	uri = g_strdup(URI_FILE_LOCAL_DEFAULT);
   56.19  
   56.20 -    GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri);
   56.21 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
   56.22  
   56.23 -    GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri(uri);
   56.24 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
   56.25  
   56.26 -    /* Check if the file is local to this specific client renderer, and tries to open
   56.27 -     * a local connection
   56.28 -     */
   56.29 -    if ( gmyth_uri_is_local_file(gmyth_uri)) {
   56.30 -        g_debug( "Opening local file connection to download...");
   56.31 -        file = gmyth_file_local_new(backend_info);
   56.32 -        ret = gmyth_file_local_open( file );
   56.33 -    } else {
   56.34 -        g_debug("FileLocal object specified is not local to the current machine!");
   56.35 -        ret = FALSE;
   56.36 -        goto init_failed;
   56.37 -    }
   56.38 +  /* Check if the file is local to this specific client renderer, and tries to open
   56.39 +   * a local connection
   56.40 +   */
   56.41 +  if (gmyth_uri_is_local_file(gmyth_uri))
   56.42 +	{
   56.43 +	  g_debug("Opening local file connection to download...");
   56.44 +	  file = gmyth_file_local_new(backend_info);
   56.45 +	  ret = gmyth_file_local_open(file);
   56.46 +	}
   56.47 +  else
   56.48 +	{
   56.49 +	  g_debug
   56.50 +		("FileLocal object specified is not local to the current machine!");
   56.51 +	  ret = FALSE;
   56.52 +	  goto init_failed;
   56.53 +	}
   56.54  
   56.55 -    if (NULL == file) {
   56.56 -        g_debug("File is NULL");
   56.57 -        ret = FALSE;
   56.58 -        goto init_failed;
   56.59 -    }
   56.60 -    
   56.61 -    g_debug( "uri = %s", uri);
   56.62 +  if (NULL == file)
   56.63 +	{
   56.64 +	  g_debug("File is NULL");
   56.65 +	  ret = FALSE;
   56.66 +	  goto init_failed;
   56.67 +	}
   56.68  
   56.69 -    if (ret == FALSE) {
   56.70 -        g_debug("MythTV FileLocal request failed when setting up socket connection!");
   56.71 -        goto init_failed;
   56.72 -    }
   56.73 +  g_debug("uri = %s", uri);
   56.74  
   56.75 -    g_debug( "MythTV FileLocal filesize = %lld",
   56.76 -            gmyth_file_get_filesize( GMYTH_FILE(file) ) );
   56.77 +  if (ret == FALSE)
   56.78 +	{
   56.79 +	  g_debug
   56.80 +		("MythTV FileLocal request failed when setting up socket connection!");
   56.81 +	  goto init_failed;
   56.82 +	}
   56.83  
   56.84 -    init_failed:
   56.85 +  g_debug("MythTV FileLocal filesize = %lld",
   56.86 +		  gmyth_file_get_filesize(GMYTH_FILE(file)));
   56.87  
   56.88 -    if ( file != NULL)
   56.89 -        g_object_unref(file);
   56.90 +init_failed:
   56.91  
   56.92 -    if ( gmyth_uri != NULL)
   56.93 -        g_object_unref( gmyth_uri);
   56.94 +  if (file != NULL)
   56.95 +	g_object_unref(file);
   56.96  
   56.97 -    if ( backend_info != NULL)
   56.98 -        g_object_unref( backend_info);
   56.99 +  if (gmyth_uri != NULL)
  56.100 +	g_object_unref(gmyth_uri);
  56.101  
  56.102 -    return ret;
  56.103 +  if (backend_info != NULL)
  56.104 +	g_object_unref(backend_info);
  56.105 +
  56.106 +  return ret;
  56.107  
  56.108  }
  56.109  
  56.110  gint
  56.111 -main(gint args, const gchar **argv) {
  56.112 -    gboolean ret = FALSE;
  56.113 +main(gint args, const gchar ** argv)
  56.114 +{
  56.115 +  gboolean ret = FALSE;
  56.116  
  56.117 -    g_type_init();
  56.118 +  g_type_init();
  56.119  
  56.120 -    g_thread_init(NULL);
  56.121 +  g_thread_init(NULL);
  56.122  
  56.123 -    fprintf(stdout, SYNC_STRING);
  56.124 -    fflush(NULL);
  56.125 -    getchar();
  56.126 +  fprintf(stdout, SYNC_STRING);
  56.127 +  fflush(NULL);
  56.128 +  getchar();
  56.129  
  56.130 -    if ( args > 1)
  56.131 -        ret = test_file_local_setup( argv[1]);
  56.132 +  if (args > 1)
  56.133 +	ret = test_file_local_setup(argv[1]);
  56.134  
  56.135 -    if ( !ret)
  56.136 -        g_debug("Error when running FileLocal setup test script!");
  56.137 -    else
  56.138 -        g_debug("FileLocal setup test script finished with success.");
  56.139 +  if (!ret)
  56.140 +	g_debug("Error when running FileLocal setup test script!");
  56.141 +  else
  56.142 +	g_debug("FileLocal setup test script finished with success.");
  56.143  
  56.144 -    return (0);
  56.145 +  return (0);
  56.146  }
  56.147 -
    57.1 --- a/gmyth/tests/gmyth_test_filetransfer.c	Wed Jun 13 18:18:42 2007 +0100
    57.2 +++ b/gmyth/tests/gmyth_test_filetransfer.c	Thu Jun 14 18:19:52 2007 +0100
    57.3 @@ -13,81 +13,88 @@
    57.4  #define URI_FILE_TRANSFER_DEFAULT	"myth://192.168.3.165:6543/"
    57.5  
    57.6  static gboolean
    57.7 -test_file_transfer_setup( gchar *uri ) {
    57.8 -    GMythFile *file = NULL;
    57.9 -    gboolean ret = TRUE;
   57.10 +test_file_transfer_setup(gchar * uri)
   57.11 +{
   57.12 +  GMythFile *file = NULL;
   57.13 +  gboolean ret = TRUE;
   57.14  
   57.15 -    if ( NULL == uri)
   57.16 -        uri = g_strdup( URI_FILE_TRANSFER_DEFAULT );
   57.17 +  if (NULL == uri)
   57.18 +	uri = g_strdup(URI_FILE_TRANSFER_DEFAULT);
   57.19  
   57.20 -    GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri);
   57.21 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
   57.22  
   57.23 -    GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri(uri);
   57.24 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
   57.25  
   57.26 -    /* Check if the file is local to this specific client renderer, and tries to open
   57.27 -     * a local connection
   57.28 -     */
   57.29 -    if ( gmyth_uri_is_local_file(gmyth_uri)) {
   57.30 -        g_debug( "Opening local file connection to download...");
   57.31 -        file = GMYTH_FILE(gmyth_file_local_new(backend_info));
   57.32 -        ret = gmyth_file_local_open( GMYTH_FILE_LOCAL( file ) );
   57.33 -    } else {
   57.34 -        g_debug( "Opening remote file connection to download...");
   57.35 -        file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
   57.36 -        ret = gmyth_file_transfer_open( GMYTH_FILE_TRANSFER(file), uri);
   57.37 -    }
   57.38 +  /* Check if the file is local to this specific client renderer, and tries to open
   57.39 +   * a local connection
   57.40 +   */
   57.41 +  if (gmyth_uri_is_local_file(gmyth_uri))
   57.42 +	{
   57.43 +	  g_debug("Opening local file connection to download...");
   57.44 +	  file = GMYTH_FILE(gmyth_file_local_new(backend_info));
   57.45 +	  ret = gmyth_file_local_open(GMYTH_FILE_LOCAL(file));
   57.46 +	}
   57.47 +  else
   57.48 +	{
   57.49 +	  g_debug("Opening remote file connection to download...");
   57.50 +	  file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
   57.51 +	  ret = gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(file), uri);
   57.52 +	}
   57.53  
   57.54 -    if (NULL == file) {
   57.55 -        g_debug("FileTransfer is NULL");
   57.56 -        ret = FALSE;
   57.57 -        goto init_failed;
   57.58 -    }
   57.59 -    
   57.60 -    g_debug( "uri = %s", uri);
   57.61 +  if (NULL == file)
   57.62 +	{
   57.63 +	  g_debug("FileTransfer is NULL");
   57.64 +	  ret = FALSE;
   57.65 +	  goto init_failed;
   57.66 +	}
   57.67  
   57.68 -    if (ret == FALSE) {
   57.69 -        g_debug("MythTV FileTransfer request failed when setting up socket connection!");
   57.70 -        goto init_failed;
   57.71 -    }
   57.72 +  g_debug("uri = %s", uri);
   57.73  
   57.74 -    g_debug( "MythTV FileTransfer filesize = %lld",
   57.75 -            gmyth_file_get_filesize( file));
   57.76 +  if (ret == FALSE)
   57.77 +	{
   57.78 +	  g_debug
   57.79 +		("MythTV FileTransfer request failed when setting up socket connection!");
   57.80 +	  goto init_failed;
   57.81 +	}
   57.82  
   57.83 -    init_failed: 
   57.84 +  g_debug("MythTV FileTransfer filesize = %lld",
   57.85 +		  gmyth_file_get_filesize(file));
   57.86  
   57.87 -    if ( file != NULL)
   57.88 -        g_object_unref(file);
   57.89 +init_failed:
   57.90  
   57.91 -    if ( gmyth_uri != NULL)
   57.92 -        g_object_unref( gmyth_uri);
   57.93 +  if (file != NULL)
   57.94 +	g_object_unref(file);
   57.95  
   57.96 -    if ( backend_info != NULL)
   57.97 -        g_object_unref( backend_info);
   57.98 +  if (gmyth_uri != NULL)
   57.99 +	g_object_unref(gmyth_uri);
  57.100  
  57.101 -    return ret;
  57.102 +  if (backend_info != NULL)
  57.103 +	g_object_unref(backend_info);
  57.104 +
  57.105 +  return ret;
  57.106  
  57.107  }
  57.108  
  57.109  gint
  57.110 -main(gint args, const gchar **argv) {
  57.111 -    gboolean ret = FALSE;
  57.112 +main(gint args, const gchar ** argv)
  57.113 +{
  57.114 +  gboolean ret = FALSE;
  57.115  
  57.116 -    g_type_init();
  57.117 +  g_type_init();
  57.118  
  57.119 -    g_thread_init(NULL);
  57.120 +  g_thread_init(NULL);
  57.121  
  57.122 -    fprintf(stdout, SYNC_STRING);
  57.123 -    fflush(NULL);
  57.124 -    getchar();
  57.125 +  fprintf(stdout, SYNC_STRING);
  57.126 +  fflush(NULL);
  57.127 +  getchar();
  57.128  
  57.129 -    if ( args > 1)
  57.130 -        ret = test_file_transfer_setup( argv[1]);
  57.131 +  if (args > 1)
  57.132 +	ret = test_file_transfer_setup(argv[1]);
  57.133  
  57.134 -    if ( !ret)
  57.135 -        g_debug("Error when running LiveTV setup test script!");
  57.136 -    else
  57.137 -        g_debug("LiveTV setup test script finished with success.");
  57.138 +  if (!ret)
  57.139 +	g_debug("Error when running LiveTV setup test script!");
  57.140 +  else
  57.141 +	g_debug("LiveTV setup test script finished with success.");
  57.142  
  57.143 -    return (0);
  57.144 +  return (0);
  57.145  }
  57.146 -
    58.1 --- a/gmyth/tests/gmyth_test_http.c	Wed Jun 13 18:18:42 2007 +0100
    58.2 +++ b/gmyth/tests/gmyth_test_http.c	Thu Jun 14 18:19:52 2007 +0100
    58.3 @@ -5,65 +5,68 @@
    58.4  #include "common.h"
    58.5  
    58.6  int
    58.7 -main (int args, const char **argv)
    58.8 +main(int args, const char **argv)
    58.9  {
   58.10 -    GMythBackendInfo *backend_info;
   58.11 -    g_type_init();
   58.12 -    g_thread_init(NULL);
   58.13 +  GMythBackendInfo *backend_info;
   58.14 +  g_type_init();
   58.15 +  g_thread_init(NULL);
   58.16  
   58.17 -    backend_info = gmyth_backend_info_new ();
   58.18 +  backend_info = gmyth_backend_info_new();
   58.19  
   58.20 -    gmyth_backend_info_set_hostname (backend_info, "192.168.3.165");
   58.21 -    gmyth_backend_info_set_port (backend_info, 6543);
   58.22 -    gmyth_backend_info_set_status_port (backend_info, 6544);
   58.23 -    
   58.24 -    GTimeVal* start = gmyth_util_string_to_time_val("2007-03-19T17:00:00");
   58.25 -    //GTimeVal* end = gmyth_util_string_to_time_val("2007-03-10T00:00:00");
   58.26 -    fprintf(stdout, SYNC_STRING);
   58.27 -    fflush(NULL);
   58.28 -    getchar();
   58.29 +  gmyth_backend_info_set_hostname(backend_info, "192.168.3.165");
   58.30 +  gmyth_backend_info_set_port(backend_info, 6543);
   58.31 +  gmyth_backend_info_set_status_port(backend_info, 6544);
   58.32  
   58.33 -    //GMythEpg epg;
   58.34 -    /*
   58.35 -    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 1000, 10000, "1");
   58.36 +  GTimeVal *start = gmyth_util_string_to_time_val("2007-03-19T17:00:00");
   58.37 +  //GTimeVal* end = gmyth_util_string_to_time_val("2007-03-10T00:00:00");
   58.38 +  fprintf(stdout, SYNC_STRING);
   58.39 +  fflush(NULL);
   58.40 +  getchar();
   58.41  
   58.42 -    if ( NULL == epg.channelList || g_slist_length( epg.channelList ) <= 0 )
   58.43 -    	printf( "Channel list is empty!!!" );
   58.44 - 
   58.45 -    GMythRecorded recorded;
   58.46 -    recorded = gmyth_http_retrieve_recorded(backend_info);
   58.47 +  //GMythEpg epg;
   58.48 +  /*
   58.49 +     epg  = gmyth_http_retrieve_epg(backend_info, start, end, 1000, 10000, "1");
   58.50  
   58.51 -    GMythRecorded_Program* program = recorded.programList->data;
   58.52 -    */
   58.53 -    GMythRecProfile* profile;
   58.54 +     if ( NULL == epg.channelList || g_slist_length( epg.channelList ) <= 0 )
   58.55 +     printf( "Channel list is empty!!!" );
   58.56  
   58.57 -    GSList* profiles = gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
   58.58 +     GMythRecorded recorded;
   58.59 +     recorded = gmyth_http_retrieve_recorded(backend_info);
   58.60  
   58.61 -    profile = profiles->data;
   58.62 +     GMythRecorded_Program* program = recorded.programList->data;
   58.63 +   */
   58.64 +  GMythRecProfile *profile;
   58.65  
   58.66 -    gchar* sett = gmyth_http_retrieve_setting(backend_info, "JobQueueTranscodeCommand", "wakko");	
   58.67 +  GSList *profiles =
   58.68 +	gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
   58.69  
   58.70 -    profile = gmyth_recprofile_new();
   58.71 +  profile = profiles->data;
   58.72  
   58.73 -    gmyth_recprofile_set_name(profile, "Teste");
   58.74 -    gmyth_recprofile_set_group(profile, "Transcoders");
   58.75 -    gmyth_recprofile_set_vcodec(profile, "MPEG-4");
   58.76 -    gmyth_recprofile_set_acodec(profile, "MP3"); 
   58.77 +  gchar *sett =
   58.78 +	gmyth_http_retrieve_setting(backend_info, "JobQueueTranscodeCommand",
   58.79 +								"wakko");
   58.80  
   58.81 -    int teste = gmyth_http_create_rec_profile(backend_info, profile);
   58.82 -	
   58.83 -    printf("Hello: %d\n", teste);
   58.84 +  profile = gmyth_recprofile_new();
   58.85  
   58.86 -    int teste2 = gmyth_http_del_rec_profile(backend_info, 56);
   58.87 +  gmyth_recprofile_set_name(profile, "Teste");
   58.88 +  gmyth_recprofile_set_group(profile, "Transcoders");
   58.89 +  gmyth_recprofile_set_vcodec(profile, "MPEG-4");
   58.90 +  gmyth_recprofile_set_acodec(profile, "MP3");
   58.91  
   58.92 -    gint ret =  gmyth_http_retrieve_job_status(backend_info, 1000, start);
   58.93 -    printf("Status: %d\n\n", ret);
   58.94 +  int teste = gmyth_http_create_rec_profile(backend_info, profile);
   58.95  
   58.96 -    //if ( profile != NULL )
   58.97 -    //	g_object_unref( profile );
   58.98 +  printf("Hello: %d\n", teste);
   58.99  
  58.100 -    if ( backend_info != NULL )
  58.101 -    	g_object_unref( backend_info );
  58.102 +  int teste2 = gmyth_http_del_rec_profile(backend_info, 56);
  58.103  
  58.104 -    return(0);
  58.105 +  gint ret = gmyth_http_retrieve_job_status(backend_info, 1000, start);
  58.106 +  printf("Status: %d\n\n", ret);
  58.107 +
  58.108 +  //if ( profile != NULL )
  58.109 +  //  g_object_unref( profile );
  58.110 +
  58.111 +  if (backend_info != NULL)
  58.112 +	g_object_unref(backend_info);
  58.113 +
  58.114 +  return (0);
  58.115  }
    59.1 --- a/gmyth/tests/gmyth_test_livetv.c	Wed Jun 13 18:18:42 2007 +0100
    59.2 +++ b/gmyth/tests/gmyth_test_livetv.c	Thu Jun 14 18:19:52 2007 +0100
    59.3 @@ -13,142 +13,156 @@
    59.4  #define URI_DEFAULT	"myth://192.168.3.165:6543/livetv?channel=9"
    59.5  
    59.6  static gboolean
    59.7 -test_livetv_setup ( gchar *uri )
    59.8 +test_livetv_setup(gchar * uri)
    59.9  {
   59.10    GMythLiveTV *livetv = NULL;
   59.11    GMythFile *file = NULL;
   59.12    gchar *channel_name = NULL;
   59.13    gboolean ret = TRUE;
   59.14    gboolean live_tv = FALSE;
   59.15 -  
   59.16 -  if ( NULL == uri )
   59.17 -    uri = g_strdup( URI_DEFAULT );
   59.18  
   59.19 -  GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri );
   59.20 +  if (NULL == uri)
   59.21 +	uri = g_strdup(URI_DEFAULT);
   59.22  
   59.23 -  GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri (uri);
   59.24 -  live_tv = gmyth_uri_is_livetv( gmyth_uri );
   59.25 -  if ( live_tv ) {
   59.26 -    livetv = gmyth_livetv_new (backend_info);
   59.27 -    
   59.28 -    gchar* ch = gmyth_uri_get_channel_name( gmyth_uri );
   59.29 -    if ( ch != NULL )
   59.30 -        channel_name = ch;
   59.31 -        
   59.32 -    if (channel_name != NULL) {
   59.33 -      if (gmyth_livetv_channel_name_setup (livetv, channel_name) == FALSE) {
   59.34 -        g_debug("LiveTV setup felt down on error.");
   59.35 -        ret = FALSE;
   59.36 -        goto init_failed;
   59.37 -      }
   59.38 -    } else {
   59.39 -      if (gmyth_livetv_setup (livetv) == FALSE) {
   59.40 -        g_debug("LiveTV setup felt down on error");
   59.41 -        ret = FALSE;
   59.42 -        goto init_failed;
   59.43 -      }
   59.44 -    }
   59.45 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
   59.46  
   59.47 -    file = GMYTH_FILE( gmyth_livetv_create_file_transfer (livetv) );
   59.48 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
   59.49 +  live_tv = gmyth_uri_is_livetv(gmyth_uri);
   59.50 +  if (live_tv)
   59.51 +	{
   59.52 +	  livetv = gmyth_livetv_new(backend_info);
   59.53  
   59.54 -    if (NULL == file) {
   59.55 -      g_debug("[LiveTV] FileTransfer equals to NULL");
   59.56 -      ret = FALSE;
   59.57 -      goto init_failed;
   59.58 -    }
   59.59 -    
   59.60 -    /* Check if the file is local to this specific client renderer */
   59.61 -    if ( gmyth_uri_is_local_file(gmyth_uri) )
   59.62 -        ret = gmyth_file_local_open( GMYTH_FILE_LOCAL(file) );
   59.63 -    else
   59.64 -        ret = gmyth_file_transfer_open( GMYTH_FILE_TRANSFER(file), livetv->uri != NULL ? 
   59.65 -            gmyth_uri_get_path(livetv->uri) : 
   59.66 -            livetv->proginfo->pathname->str );
   59.67 +	  gchar *ch = gmyth_uri_get_channel_name(gmyth_uri);
   59.68 +	  if (ch != NULL)
   59.69 +		channel_name = ch;
   59.70  
   59.71 -    if ( !ret )
   59.72 -    {
   59.73 -        g_debug("Error: couldn't open the FileTransfer from LiveTV source!" );
   59.74 -        goto init_failed;
   59.75 -    }
   59.76 -  } else {
   59.77 -    
   59.78 -    /* Check if the file is local to this specific client renderer, and tries to open
   59.79 -     * a local connection
   59.80 -     */
   59.81 -    if ( gmyth_uri_is_local_file(gmyth_uri) )
   59.82 -    {
   59.83 -        g_debug ( "Opening local file connection to download..." );
   59.84 -        file = GMYTH_FILE(gmyth_file_local_new(backend_info));
   59.85 -        ret = gmyth_file_local_open ( GMYTH_FILE_LOCAL( file ) );      
   59.86 -    } else {
   59.87 -        g_debug ( "Opening remote file connection to download..." );
   59.88 -        file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
   59.89 -        ret = gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(file), uri );
   59.90 -    }
   59.91 +	  if (channel_name != NULL)
   59.92 +		{
   59.93 +		  if (gmyth_livetv_channel_name_setup(livetv, channel_name) == FALSE)
   59.94 +			{
   59.95 +			  g_debug("LiveTV setup felt down on error.");
   59.96 +			  ret = FALSE;
   59.97 +			  goto init_failed;
   59.98 +			}
   59.99 +		}
  59.100 +	  else
  59.101 +		{
  59.102 +		  if (gmyth_livetv_setup(livetv) == FALSE)
  59.103 +			{
  59.104 +			  g_debug("LiveTV setup felt down on error");
  59.105 +			  ret = FALSE;
  59.106 +			  goto init_failed;
  59.107 +			}
  59.108 +		}
  59.109  
  59.110 -  } /* if (else) - recorded FileTransfer */
  59.111 +	  file = GMYTH_FILE(gmyth_livetv_create_file_transfer(livetv));
  59.112  
  59.113 -  if (NULL == file) {
  59.114 -    g_debug("FileTransfer is NULL");
  59.115 -    ret = FALSE;
  59.116 -    goto init_failed;
  59.117 -  }
  59.118 -  g_debug( "uri = %s", uri);
  59.119 +	  if (NULL == file)
  59.120 +		{
  59.121 +		  g_debug("[LiveTV] FileTransfer equals to NULL");
  59.122 +		  ret = FALSE;
  59.123 +		  goto init_failed;
  59.124 +		}
  59.125  
  59.126 -  if (ret == FALSE) {
  59.127 -      g_debug("MythTV FileTransfer request failed when setting up socket connection!");
  59.128 -      goto init_failed;
  59.129 -  }
  59.130 +	  /* Check if the file is local to this specific client renderer */
  59.131 +	  if (gmyth_uri_is_local_file(gmyth_uri))
  59.132 +		ret = gmyth_file_local_open(GMYTH_FILE_LOCAL(file));
  59.133 +	  else
  59.134 +		ret =
  59.135 +		  gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(file),
  59.136 +								   livetv->uri !=
  59.137 +								   NULL ? gmyth_uri_get_path(livetv->
  59.138 +															 uri) : livetv->
  59.139 +								   proginfo->pathname->str);
  59.140  
  59.141 -  g_debug( "MythTV FileTransfer filesize = %lld",
  59.142 -      gmyth_file_get_filesize( file ));
  59.143 +	  if (!ret)
  59.144 +		{
  59.145 +		  g_debug
  59.146 +			("Error: couldn't open the FileTransfer from LiveTV source!");
  59.147 +		  goto init_failed;
  59.148 +		}
  59.149 +	}
  59.150 +  else
  59.151 +	{
  59.152 +
  59.153 +	  /* Check if the file is local to this specific client renderer, and tries to open
  59.154 +	   * a local connection
  59.155 +	   */
  59.156 +	  if (gmyth_uri_is_local_file(gmyth_uri))
  59.157 +		{
  59.158 +		  g_debug("Opening local file connection to download...");
  59.159 +		  file = GMYTH_FILE(gmyth_file_local_new(backend_info));
  59.160 +		  ret = gmyth_file_local_open(GMYTH_FILE_LOCAL(file));
  59.161 +		}
  59.162 +	  else
  59.163 +		{
  59.164 +		  g_debug("Opening remote file connection to download...");
  59.165 +		  file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
  59.166 +		  ret = gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(file), uri);
  59.167 +		}
  59.168 +
  59.169 +	}							/* if (else) - recorded FileTransfer */
  59.170 +
  59.171 +  if (NULL == file)
  59.172 +	{
  59.173 +	  g_debug("FileTransfer is NULL");
  59.174 +	  ret = FALSE;
  59.175 +	  goto init_failed;
  59.176 +	}
  59.177 +  g_debug("uri = %s", uri);
  59.178 +
  59.179 +  if (ret == FALSE)
  59.180 +	{
  59.181 +	  g_debug
  59.182 +		("MythTV FileTransfer request failed when setting up socket connection!");
  59.183 +	  goto init_failed;
  59.184 +	}
  59.185 +
  59.186 +  g_debug("MythTV FileTransfer filesize = %lld",
  59.187 +		  gmyth_file_get_filesize(file));
  59.188  
  59.189  init_failed:
  59.190 -    if ( livetv != NULL )
  59.191 -        g_object_unref(livetv);
  59.192 -  
  59.193 -    if ( file != NULL )
  59.194 -        g_object_unref(file);
  59.195 -    
  59.196 +  if (livetv != NULL)
  59.197 +	g_object_unref(livetv);
  59.198 +
  59.199 +  if (file != NULL)
  59.200 +	g_object_unref(file);
  59.201 +
  59.202  //    if ( uri != NULL )
  59.203  //        g_free( uri );
  59.204 -  
  59.205 -    if ( gmyth_uri != NULL )
  59.206 -        g_object_unref( gmyth_uri );
  59.207 +
  59.208 +  if (gmyth_uri != NULL)
  59.209 +	g_object_unref(gmyth_uri);
  59.210  
  59.211  //    if ( backend_info != NULL )
  59.212  //       g_object_unref( backend_info );
  59.213  
  59.214 -    return ret;
  59.215 -    
  59.216 +  return ret;
  59.217 +
  59.218  }
  59.219  
  59.220  gint
  59.221 -main (gint args, const gchar **argv)
  59.222 +main(gint args, const gchar ** argv)
  59.223  {
  59.224 -    gboolean ret;
  59.225 +  gboolean ret;
  59.226  
  59.227 -    g_type_init ();
  59.228 -    
  59.229 -    g_thread_init (NULL);
  59.230 +  g_type_init();
  59.231  
  59.232 -    fprintf(stdout, SYNC_STRING);
  59.233 -    fflush(NULL);
  59.234 -    getchar();
  59.235 -    
  59.236 -    if ( args > 1 )
  59.237 -	ret = test_livetv_setup ( argv[1] );
  59.238 -    else
  59.239 -    	ret = test_livetv_setup ( NULL );
  59.240 -    
  59.241 -    if ( !ret )
  59.242 -        g_debug ("Error when running LiveTV setup test script!");
  59.243 -    else
  59.244 -        g_debug ("LiveTV setup test script finished with success.");
  59.245 +  g_thread_init(NULL);
  59.246  
  59.247 -    return(0);
  59.248 +  fprintf(stdout, SYNC_STRING);
  59.249 +  fflush(NULL);
  59.250 +  getchar();
  59.251 +
  59.252 +  if (args > 1)
  59.253 +	ret = test_livetv_setup(argv[1]);
  59.254 +  else
  59.255 +	ret = test_livetv_setup(NULL);
  59.256 +
  59.257 +  if (!ret)
  59.258 +	g_debug("Error when running LiveTV setup test script!");
  59.259 +  else
  59.260 +	g_debug("LiveTV setup test script finished with success.");
  59.261 +
  59.262 +  return (0);
  59.263  }
  59.264 -
  59.265 -
  59.266 -
  59.267 -
    60.1 --- a/gmyth/tests/gmyth_test_monitor_handler.c	Wed Jun 13 18:18:42 2007 +0100
    60.2 +++ b/gmyth/tests/gmyth_test_monitor_handler.c	Thu Jun 14 18:19:52 2007 +0100
    60.3 @@ -21,14 +21,13 @@
    60.4   * @param user_data pointer to the GMythLiveTV instance (NULL in the tests)
    60.5   */
    60.6  static void
    60.7 -gmyth_livetv_monitor_signal_handler (GMythMonitorHandler * monitor,
    60.8 -                                     gint msg_code, gchar * message,
    60.9 -                                     gpointer user_data)
   60.10 +gmyth_livetv_monitor_signal_handler(GMythMonitorHandler * monitor,
   60.11 +									gint msg_code, gchar * message,
   60.12 +									gpointer user_data)
   60.13  {
   60.14 -    g_debug
   60.15 -        ("LIVETV Signal handler ( msg = %s, code = %d, live_tv param = %s, user_data = %s )\n",
   60.16 -         message, msg_code, "NULL",
   60.17 -         user_data != NULL ? "" : "NULL");
   60.18 +  g_debug
   60.19 +	("LIVETV Signal handler ( msg = %s, code = %d, live_tv param = %s, user_data = %s )\n",
   60.20 +	 message, msg_code, "NULL", user_data != NULL ? "" : "NULL");
   60.21  
   60.22  }
   60.23  
   60.24 @@ -42,115 +41,110 @@
   60.25   * 	   had been concluded succcesfully 
   60.26   */
   60.27  static gboolean
   60.28 -gmyth_test_monitor_handler_start (GMythBackendInfo * backend_info, GMythMonitorHandler * * monitor)
   60.29 +gmyth_test_monitor_handler_start(GMythBackendInfo * backend_info,
   60.30 +								 GMythMonitorHandler * *monitor)
   60.31  {
   60.32  
   60.33 -    gboolean res = TRUE;
   60.34 +  gboolean res = TRUE;
   60.35  
   60.36 -    if (*monitor != NULL)
   60.37 -    {
   60.38 -        g_object_unref (*monitor);
   60.39 -        *monitor = NULL;
   60.40 -    }
   60.41 +  if (*monitor != NULL)
   60.42 +	{
   60.43 +	  g_object_unref(*monitor);
   60.44 +	  *monitor = NULL;
   60.45 +	}
   60.46  
   60.47 -    *monitor = gmyth_monitor_handler_new ();
   60.48 +  *monitor = gmyth_monitor_handler_new();
   60.49  
   60.50 -    res =
   60.51 -        gmyth_monitor_handler_open (*monitor,
   60.52 -                                    backend_info->hostname,
   60.53 -                                    backend_info->port);
   60.54 +  res =
   60.55 +	gmyth_monitor_handler_open(*monitor,
   60.56 +							   backend_info->hostname, backend_info->port);
   60.57  
   60.58 -    if (res == TRUE)
   60.59 -    {
   60.60 -        g_debug
   60.61 -            ("Connect MythTV Monitor event socket! Trying to start the message handler...");
   60.62 +  if (res == TRUE)
   60.63 +	{
   60.64 +	  g_debug
   60.65 +		("Connect MythTV Monitor event socket! Trying to start the message handler...");
   60.66  
   60.67 -        res = gmyth_monitor_handler_start (*monitor);
   60.68 +	  res = gmyth_monitor_handler_start(*monitor);
   60.69  
   60.70 -        if (res)
   60.71 -        {
   60.72 -            g_debug
   60.73 -                ("MythTV Monitor event socket connected and listening!");
   60.74 -            g_signal_connect (G_OBJECT (*monitor),
   60.75 -                              "backend-events-handler",
   60.76 -                              (GCallback) gmyth_livetv_monitor_signal_handler,
   60.77 -                              NULL);
   60.78 -        }
   60.79 -        else
   60.80 -        {
   60.81 -            g_debug
   60.82 -                ("Problems when trying to start MythTV Monitor event socket!");
   60.83 -            goto error;
   60.84 -        }
   60.85 -    }
   60.86 +	  if (res)
   60.87 +		{
   60.88 +		  g_debug("MythTV Monitor event socket connected and listening!");
   60.89 +		  g_signal_connect(G_OBJECT(*monitor),
   60.90 +						   "backend-events-handler",
   60.91 +						   (GCallback) gmyth_livetv_monitor_signal_handler,
   60.92 +						   NULL);
   60.93 +		}
   60.94 +	  else
   60.95 +		{
   60.96 +		  g_debug
   60.97 +			("Problems when trying to start MythTV Monitor event socket!");
   60.98 +		  goto error;
   60.99 +		}
  60.100 +	}
  60.101  
  60.102 -  error:
  60.103 -    return res;
  60.104 +error:
  60.105 +  return res;
  60.106  
  60.107  }
  60.108  
  60.109  static gboolean
  60.110 -test_monitor_handler_setup ( gchar *uri )
  60.111 +test_monitor_handler_setup(gchar * uri)
  60.112  {
  60.113    gboolean ret = TRUE;
  60.114    GMythMonitorHandler *monitor;
  60.115 -  
  60.116 -  if ( NULL == uri )
  60.117 -    uri = g_strdup( URI_DEFAULT );
  60.118  
  60.119 -  GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri );
  60.120 +  if (NULL == uri)
  60.121 +	uri = g_strdup(URI_DEFAULT);
  60.122  
  60.123 -  GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri (uri);
  60.124 -  g_debug( "uri = %s", uri);
  60.125 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
  60.126  
  60.127 -  ret = gmyth_test_monitor_handler_start( backend_info, &monitor );
  60.128 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
  60.129 +  g_debug("uri = %s", uri);
  60.130  
  60.131 -  if ( ret == FALSE )
  60.132 -  {
  60.133 -	g_debug( "MonitorHandler couldn't start!\n" );
  60.134 -	goto init_failed;
  60.135 -  }
  60.136 - 
  60.137 +  ret = gmyth_test_monitor_handler_start(backend_info, &monitor);
  60.138 +
  60.139 +  if (ret == FALSE)
  60.140 +	{
  60.141 +	  g_debug("MonitorHandler couldn't start!\n");
  60.142 +	  goto init_failed;
  60.143 +	}
  60.144 +
  60.145  init_failed:
  60.146 -    if ( monitor != NULL )
  60.147 -        g_object_unref(monitor);
  60.148 -  
  60.149 -     if ( gmyth_uri != NULL )
  60.150 -        g_object_unref( gmyth_uri );
  60.151 +  if (monitor != NULL)
  60.152 +	g_object_unref(monitor);
  60.153  
  60.154 -    if ( backend_info != NULL )
  60.155 -       g_object_unref( backend_info );
  60.156 +  if (gmyth_uri != NULL)
  60.157 +	g_object_unref(gmyth_uri);
  60.158  
  60.159 -    return ret;
  60.160 -    
  60.161 +  if (backend_info != NULL)
  60.162 +	g_object_unref(backend_info);
  60.163 +
  60.164 +  return ret;
  60.165 +
  60.166  }
  60.167  
  60.168  gint
  60.169 -main (gint args, const gchar **argv)
  60.170 +main(gint args, const gchar ** argv)
  60.171  {
  60.172 -    gboolean ret;
  60.173 +  gboolean ret;
  60.174  
  60.175 -    g_type_init ();
  60.176 -    
  60.177 -    g_thread_init (NULL);
  60.178 +  g_type_init();
  60.179  
  60.180 -    fprintf(stdout, SYNC_STRING);
  60.181 -    fflush(NULL);
  60.182 -    getchar();
  60.183 -    
  60.184 -    if ( args > 1 )
  60.185 -	ret = test_monitor_handler_setup ( argv[1] );
  60.186 -    else
  60.187 -    	ret = test_monitor_handler_setup ( NULL );
  60.188 -    
  60.189 -    if ( !ret )
  60.190 -        g_debug ("Error when running Monitor Handler setup test script!");
  60.191 -    else
  60.192 -        g_debug ("MonitorHandler setup test script setup with success.");
  60.193 +  g_thread_init(NULL);
  60.194  
  60.195 -    return(0);
  60.196 +  fprintf(stdout, SYNC_STRING);
  60.197 +  fflush(NULL);
  60.198 +  getchar();
  60.199 +
  60.200 +  if (args > 1)
  60.201 +	ret = test_monitor_handler_setup(argv[1]);
  60.202 +  else
  60.203 +	ret = test_monitor_handler_setup(NULL);
  60.204 +
  60.205 +  if (!ret)
  60.206 +	g_debug("Error when running Monitor Handler setup test script!");
  60.207 +  else
  60.208 +	g_debug("MonitorHandler setup test script setup with success.");
  60.209 +
  60.210 +  return (0);
  60.211  }
  60.212 -
  60.213 -
  60.214 -
  60.215 -
    61.1 --- a/gmyth/tests/gmyth_test_program_info.c	Wed Jun 13 18:18:42 2007 +0100
    61.2 +++ b/gmyth/tests/gmyth_test_program_info.c	Thu Jun 14 18:19:52 2007 +0100
    61.3 @@ -11,7 +11,7 @@
    61.4  #define URI_DEFAULT	"myth://192.168.3.165:6543/livetv?channel=9"
    61.5  
    61.6  static gboolean
    61.7 -test_program_info_setup ( gchar *uri )
    61.8 +test_program_info_setup(gchar * uri)
    61.9  {
   61.10    GMythLiveTV *livetv = NULL;
   61.11    GMythStringList *str_list = NULL;
   61.12 @@ -20,104 +20,113 @@
   61.13    gchar *channel_name = NULL;
   61.14    gboolean ret = TRUE;
   61.15    gboolean live_tv = FALSE;
   61.16 -  
   61.17 -  if ( NULL == uri )
   61.18 -    uri = g_strdup( URI_DEFAULT );
   61.19  
   61.20 -  GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri );
   61.21 +  if (NULL == uri)
   61.22 +	uri = g_strdup(URI_DEFAULT);
   61.23  
   61.24 -  GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri (uri);
   61.25 -  live_tv = gmyth_uri_is_livetv( gmyth_uri );
   61.26 -  if ( live_tv ) {
   61.27 -    livetv = gmyth_livetv_new (backend_info);
   61.28 -    
   61.29 -    gchar* ch = gmyth_uri_get_channel_name( gmyth_uri );
   61.30 -    if ( ch != NULL )
   61.31 -        channel_name = ch;
   61.32 -        
   61.33 -    if (channel_name != NULL) {
   61.34 -      if (gmyth_livetv_channel_name_setup (livetv, channel_name) == FALSE) {
   61.35 -        g_debug("LiveTV setup felt down on error.");
   61.36 -        ret = FALSE;
   61.37 -        goto init_failed;
   61.38 -      }
   61.39 -    } else {
   61.40 -      if (gmyth_livetv_setup (livetv) == FALSE) {
   61.41 -        g_debug("LiveTV setup felt down on error");
   61.42 -        ret = FALSE;
   61.43 -        goto init_failed;
   61.44 -      }
   61.45 -    }
   61.46 -  }
   61.47 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
   61.48  
   61.49 -  g_debug( "uri = %s", uri);
   61.50 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
   61.51 +  live_tv = gmyth_uri_is_livetv(gmyth_uri);
   61.52 +  if (live_tv)
   61.53 +	{
   61.54 +	  livetv = gmyth_livetv_new(backend_info);
   61.55  
   61.56 -  if ( ret == FALSE ) {
   61.57 -      g_debug("MythTV ProgramInfo request failed when setting up socket connection!");
   61.58 -      goto init_failed;
   61.59 -  }
   61.60 +	  gchar *ch = gmyth_uri_get_channel_name(gmyth_uri);
   61.61 +	  if (ch != NULL)
   61.62 +		channel_name = ch;
   61.63  
   61.64 -  g_return_val_if_fail( livetv->proginfo != NULL, FALSE );
   61.65 +	  if (channel_name != NULL)
   61.66 +		{
   61.67 +		  if (gmyth_livetv_channel_name_setup(livetv, channel_name) == FALSE)
   61.68 +			{
   61.69 +			  g_debug("LiveTV setup felt down on error.");
   61.70 +			  ret = FALSE;
   61.71 +			  goto init_failed;
   61.72 +			}
   61.73 +		}
   61.74 +	  else
   61.75 +		{
   61.76 +		  if (gmyth_livetv_setup(livetv) == FALSE)
   61.77 +			{
   61.78 +			  g_debug("LiveTV setup felt down on error");
   61.79 +			  ret = FALSE;
   61.80 +			  goto init_failed;
   61.81 +			}
   61.82 +		}
   61.83 +	}
   61.84  
   61.85 -  g_debug( "Printing  ProgramInfo... [%s]", gmyth_program_info_to_string( livetv->proginfo ) );
   61.86 +  g_debug("uri = %s", uri);
   61.87  
   61.88 -  str_list = gmyth_program_info_to_string_list( livetv->proginfo, str_list );
   61.89 +  if (ret == FALSE)
   61.90 +	{
   61.91 +	  g_debug
   61.92 +		("MythTV ProgramInfo request failed when setting up socket connection!");
   61.93 +	  goto init_failed;
   61.94 +	}
   61.95  
   61.96 -  g_return_val_if_fail( str_list != NULL && gmyth_string_list_length( str_list ) > 0, FALSE );
   61.97 +  g_return_val_if_fail(livetv->proginfo != NULL, FALSE);
   61.98  
   61.99 -  program_info = gmyth_program_info_from_string_list( str_list );
  61.100 +  g_debug("Printing  ProgramInfo... [%s]",
  61.101 +		  gmyth_program_info_to_string(livetv->proginfo));
  61.102  
  61.103 - /* assert it IS the same program info */
  61.104 -  g_return_val_if_fail( gmyth_program_info_is_equals( program_info, livetv->proginfo ), FALSE );
  61.105 +  str_list = gmyth_program_info_to_string_list(livetv->proginfo, str_list);
  61.106  
  61.107 -  program_info->title = g_string_assign( program_info->title, "Another RaNdOm Title..." );
  61.108 +  g_return_val_if_fail(str_list != NULL
  61.109 +					   && gmyth_string_list_length(str_list) > 0, FALSE);
  61.110 +
  61.111 +  program_info = gmyth_program_info_from_string_list(str_list);
  61.112 +
  61.113 +  /* assert it IS the same program info */
  61.114 +  g_return_val_if_fail(gmyth_program_info_is_equals
  61.115 +					   (program_info, livetv->proginfo), FALSE);
  61.116 +
  61.117 +  program_info->title =
  61.118 +	g_string_assign(program_info->title, "Another RaNdOm Title...");
  61.119  
  61.120    /* assert it is not the same program info anymore */
  61.121 -  g_return_val_if_fail( !gmyth_program_info_is_equals( program_info, livetv->proginfo ), FALSE );
  61.122 +  g_return_val_if_fail(!gmyth_program_info_is_equals
  61.123 +					   (program_info, livetv->proginfo), FALSE);
  61.124  
  61.125  init_failed:
  61.126 -    if ( str_list != NULL )
  61.127 -    	g_object_unref( str_list );
  61.128 +  if (str_list != NULL)
  61.129 +	g_object_unref(str_list);
  61.130  
  61.131 -    if ( program_info != NULL )
  61.132 -    	g_object_unref( program_info );
  61.133 +  if (program_info != NULL)
  61.134 +	g_object_unref(program_info);
  61.135  
  61.136 -    if ( livetv != NULL )
  61.137 -        g_object_unref(livetv);
  61.138 - 
  61.139 -    if ( gmyth_uri != NULL )
  61.140 -        g_object_unref( gmyth_uri );
  61.141 +  if (livetv != NULL)
  61.142 +	g_object_unref(livetv);
  61.143  
  61.144 -    return ret;
  61.145 -    
  61.146 +  if (gmyth_uri != NULL)
  61.147 +	g_object_unref(gmyth_uri);
  61.148 +
  61.149 +  return ret;
  61.150 +
  61.151  }
  61.152  
  61.153  gint
  61.154 -main (gint args, const gchar **argv)
  61.155 +main(gint args, const gchar ** argv)
  61.156  {
  61.157 -    gboolean ret;
  61.158 +  gboolean ret;
  61.159  
  61.160 -    g_type_init ();
  61.161 -    
  61.162 -    g_thread_init (NULL);
  61.163 +  g_type_init();
  61.164  
  61.165 -    fprintf(stdout, SYNC_STRING);
  61.166 -    fflush(NULL);
  61.167 -    getchar();
  61.168 -    
  61.169 -    if ( args > 1 )
  61.170 -	ret = test_program_info_setup ( argv[1] );
  61.171 -    else
  61.172 -    	ret = test_program_info_setup( NULL );
  61.173 -    
  61.174 -    if ( !ret )
  61.175 -        g_debug ("Error when getting program info from the LiveTV instance!");
  61.176 -    else
  61.177 -        g_debug ("LiveTV setup test script finished with success.");
  61.178 +  g_thread_init(NULL);
  61.179  
  61.180 -    return(0);
  61.181 +  fprintf(stdout, SYNC_STRING);
  61.182 +  fflush(NULL);
  61.183 +  getchar();
  61.184 +
  61.185 +  if (args > 1)
  61.186 +	ret = test_program_info_setup(argv[1]);
  61.187 +  else
  61.188 +	ret = test_program_info_setup(NULL);
  61.189 +
  61.190 +  if (!ret)
  61.191 +	g_debug("Error when getting program info from the LiveTV instance!");
  61.192 +  else
  61.193 +	g_debug("LiveTV setup test script finished with success.");
  61.194 +
  61.195 +  return (0);
  61.196  }
  61.197 -
  61.198 -
  61.199 -
  61.200 -
    62.1 --- a/gmyth/tests/gmyth_test_recorder.c	Wed Jun 13 18:18:42 2007 +0100
    62.2 +++ b/gmyth/tests/gmyth_test_recorder.c	Thu Jun 14 18:19:52 2007 +0100
    62.3 @@ -9,139 +9,149 @@
    62.4  #include "common.h"
    62.5  
    62.6  static gboolean
    62.7 -test_recorder_availability (GMythBackendInfo *backend_info)
    62.8 +test_recorder_availability(GMythBackendInfo * backend_info)
    62.9  {
   62.10 -    GMythRecorder* recorder;
   62.11 -    GMythSocket *socket = gmyth_socket_new ();
   62.12 +  GMythRecorder *recorder;
   62.13 +  GMythSocket *socket = gmyth_socket_new();
   62.14  
   62.15 -    if (gmyth_socket_connect_to_backend (socket, 
   62.16 -	    gmyth_backend_info_get_hostname (backend_info),
   62.17 -	    gmyth_backend_info_get_port (backend_info), TRUE) == FALSE) {
   62.18 -	g_debug ("Test recorder failed: Connection failed");
   62.19 -	return FALSE;
   62.20 -    }
   62.21 +  if (gmyth_socket_connect_to_backend(socket,
   62.22 +									  gmyth_backend_info_get_hostname
   62.23 +									  (backend_info),
   62.24 +									  gmyth_backend_info_get_port
   62.25 +									  (backend_info), TRUE) == FALSE)
   62.26 +	{
   62.27 +	  g_debug("Test recorder failed: Connection failed");
   62.28 +	  return FALSE;
   62.29 +	}
   62.30  
   62.31 -    recorder = remote_request_next_free_recorder (socket, -1);
   62.32 -    gmyth_socket_close_connection (socket);
   62.33 +  recorder = remote_request_next_free_recorder(socket, -1);
   62.34 +  gmyth_socket_close_connection(socket);
   62.35  
   62.36 -    if ( socket != NULL )
   62.37 -    	g_object_unref( socket );
   62.38 +  if (socket != NULL)
   62.39 +	g_object_unref(socket);
   62.40  
   62.41 -    if (recorder == NULL) {
   62.42 -	g_debug ("Recorder not available\n");
   62.43 -	return FALSE;
   62.44 -    }
   62.45 -    
   62.46 -    g_debug ("Recorder found (num): %d", recorder->recorder_num);
   62.47 +  if (recorder == NULL)
   62.48 +	{
   62.49 +	  g_debug("Recorder not available\n");
   62.50 +	  return FALSE;
   62.51 +	}
   62.52  
   62.53 -    if ( recorder != NULL )
   62.54 -    	g_object_unref( recorder );
   62.55 -   
   62.56 -    return TRUE;
   62.57 +  g_debug("Recorder found (num): %d", recorder->recorder_num);
   62.58 +
   62.59 +  if (recorder != NULL)
   62.60 +	g_object_unref(recorder);
   62.61 +
   62.62 +  return TRUE;
   62.63  }
   62.64  
   62.65  static gboolean
   62.66 -test_recorder_setup (GMythBackendInfo *backend_info)
   62.67 +test_recorder_setup(GMythBackendInfo * backend_info)
   62.68  {
   62.69 -    GMythQuery *query = gmyth_query_new ();
   62.70 +  GMythQuery *query = gmyth_query_new();
   62.71  
   62.72 -    if (gmyth_query_connect_with_timeout (query, backend_info, 3) == TRUE) {
   62.73 -	g_debug ("Mysql connection success");
   62.74 -	return TRUE;
   62.75 -    } else {
   62.76 -	g_debug ("Mysql connection failed");
   62.77 -	return FALSE;
   62.78 -    }
   62.79 +  if (gmyth_query_connect_with_timeout(query, backend_info, 3) == TRUE)
   62.80 +	{
   62.81 +	  g_debug("Mysql connection success");
   62.82 +	  return TRUE;
   62.83 +	}
   62.84 +  else
   62.85 +	{
   62.86 +	  g_debug("Mysql connection failed");
   62.87 +	  return FALSE;
   62.88 +	}
   62.89  
   62.90 -    if ( query != NULL )
   62.91 -    	g_object_unref( query );
   62.92 +  if (query != NULL)
   62.93 +	g_object_unref(query);
   62.94  
   62.95  }
   62.96  
   62.97  static gboolean
   62.98 -test_recorder_check_channels (GMythBackendInfo *backend_info)
   62.99 +test_recorder_check_channels(GMythBackendInfo * backend_info)
  62.100  {
  62.101 -    GMythRecorder* recorder;
  62.102 -    GMythSocket *socket = gmyth_socket_new ();
  62.103 -    GMythEPG *epg = gmyth_epg_new ();
  62.104 -    GList *clist;
  62.105 -    gint i, length;
  62.106 +  GMythRecorder *recorder;
  62.107 +  GMythSocket *socket = gmyth_socket_new();
  62.108 +  GMythEPG *epg = gmyth_epg_new();
  62.109 +  GList *clist;
  62.110 +  gint i, length;
  62.111  
  62.112 -    // Gets the free recorder
  62.113 -    if (gmyth_socket_connect_to_backend (socket, 
  62.114 -	    gmyth_backend_info_get_hostname (backend_info),
  62.115 -	    gmyth_backend_info_get_port (backend_info), TRUE) == FALSE) {
  62.116 -	g_debug ("Test recorder failed: Connection failed");
  62.117 -	return FALSE;
  62.118 -    }
  62.119 +  // Gets the free recorder
  62.120 +  if (gmyth_socket_connect_to_backend(socket,
  62.121 +									  gmyth_backend_info_get_hostname
  62.122 +									  (backend_info),
  62.123 +									  gmyth_backend_info_get_port
  62.124 +									  (backend_info), TRUE) == FALSE)
  62.125 +	{
  62.126 +	  g_debug("Test recorder failed: Connection failed");
  62.127 +	  return FALSE;
  62.128 +	}
  62.129  
  62.130 -    recorder = remote_request_next_free_recorder (socket, -1);
  62.131 -    gmyth_socket_close_connection (socket);
  62.132 -    g_object_unref( socket );
  62.133 +  recorder = remote_request_next_free_recorder(socket, -1);
  62.134 +  gmyth_socket_close_connection(socket);
  62.135 +  g_object_unref(socket);
  62.136  
  62.137 -    if (recorder == NULL) {
  62.138 -	g_debug ("[%s] Recorder not available", __FUNCTION__);
  62.139 -	return FALSE;
  62.140 -    }
  62.141 +  if (recorder == NULL)
  62.142 +	{
  62.143 +	  g_debug("[%s] Recorder not available", __FUNCTION__);
  62.144 +	  return FALSE;
  62.145 +	}
  62.146  
  62.147 -    // Connects the recorder socket
  62.148 -    gmyth_recorder_setup (recorder);
  62.149 +  // Connects the recorder socket
  62.150 +  gmyth_recorder_setup(recorder);
  62.151  
  62.152 -    // Gets the list of channels
  62.153 -    if (!gmyth_epg_connect (epg, backend_info)) {
  62.154 -        g_debug ("%s: Not connected\n", __FUNCTION__);
  62.155 -        return FALSE;
  62.156 -    }
  62.157 +  // Gets the list of channels
  62.158 +  if (!gmyth_epg_connect(epg, backend_info))
  62.159 +	{
  62.160 +	  g_debug("%s: Not connected\n", __FUNCTION__);
  62.161 +	  return FALSE;
  62.162 +	}
  62.163  
  62.164 -    length = gmyth_epg_get_channel_list (epg, &clist);
  62.165 -    gmyth_epg_disconnect (epg);
  62.166 -    g_object_unref (epg);
  62.167 +  length = gmyth_epg_get_channel_list(epg, &clist);
  62.168 +  gmyth_epg_disconnect(epg);
  62.169 +  g_object_unref(epg);
  62.170  
  62.171 -    g_print ("==== Verifying the %d channels found in the EPG ====\n", length);
  62.172 -    for (i=0; i<length; i++) {
  62.173 -        GMythChannelInfo *channel_info = (GMythChannelInfo*) g_list_nth_data (clist, i);
  62.174 -	gboolean res;
  62.175 +  g_print("==== Verifying the %d channels found in the EPG ====\n", length);
  62.176 +  for (i = 0; i < length; i++)
  62.177 +	{
  62.178 +	  GMythChannelInfo *channel_info =
  62.179 +		(GMythChannelInfo *) g_list_nth_data(clist, i);
  62.180 +	  gboolean res;
  62.181  
  62.182 -	// Checks the channels
  62.183 -        res = gmyth_recorder_check_channel (recorder, channel_info->channel_ID);
  62.184 -	g_debug ("Channel %d %s", channel_info->channel_ID, res ? "Found" : "Not found");
  62.185 -    }
  62.186 +	  // Checks the channels
  62.187 +	  res = gmyth_recorder_check_channel(recorder, channel_info->channel_ID);
  62.188 +	  g_debug("Channel %d %s", channel_info->channel_ID,
  62.189 +			  res ? "Found" : "Not found");
  62.190 +	}
  62.191  
  62.192 -    g_list_free (clist);
  62.193 +  g_list_free(clist);
  62.194  
  62.195 -    if ( recorder != NULL )
  62.196 -    	g_object_unref( recorder );
  62.197 +  if (recorder != NULL)
  62.198 +	g_object_unref(recorder);
  62.199  
  62.200  }
  62.201  
  62.202  int
  62.203 -main (int args, const char **argv)
  62.204 +main(int args, const char **argv)
  62.205  {
  62.206  
  62.207 -    GMythBackendInfo *backend_info;
  62.208 -    g_type_init ();
  62.209 -    g_thread_init (NULL);
  62.210 +  GMythBackendInfo *backend_info;
  62.211 +  g_type_init();
  62.212 +  g_thread_init(NULL);
  62.213  
  62.214 -    backend_info = gmyth_backend_info_new_with_uri (argv[1]);
  62.215 +  backend_info = gmyth_backend_info_new_with_uri(argv[1]);
  62.216  
  62.217 -    printf ("******** Testing recorder availability ***********\n");
  62.218 -    test_recorder_availability (backend_info);
  62.219 +  printf("******** Testing recorder availability ***********\n");
  62.220 +  test_recorder_availability(backend_info);
  62.221  
  62.222 -    printf ("******** Testing recorder check channels function ***********\n");
  62.223 -    test_recorder_check_channels (backend_info);
  62.224 +  printf("******** Testing recorder check channels function ***********\n");
  62.225 +  test_recorder_check_channels(backend_info);
  62.226  
  62.227 -    fprintf(stdout, SYNC_STRING);
  62.228 -    fflush(NULL);
  62.229 -    getchar();
  62.230 -    
  62.231 -    if ( backend_info != NULL )
  62.232 -      g_object_unref( backend_info );
  62.233 +  fprintf(stdout, SYNC_STRING);
  62.234 +  fflush(NULL);
  62.235 +  getchar();
  62.236  
  62.237 -    return(0);
  62.238 +  if (backend_info != NULL)
  62.239 +	g_object_unref(backend_info);
  62.240 +
  62.241 +  return (0);
  62.242  
  62.243  }
  62.244 -
  62.245 -
  62.246 -
  62.247 -
  62.248 -
    63.1 --- a/gmyth/tests/gmyth_test_recordings.c	Wed Jun 13 18:18:42 2007 +0100
    63.2 +++ b/gmyth/tests/gmyth_test_recordings.c	Thu Jun 14 18:19:52 2007 +0100
    63.3 @@ -9,63 +9,68 @@
    63.4  #include "common.h"
    63.5  
    63.6  static gboolean
    63.7 -test_recording_list (GMythBackendInfo *backend_info)
    63.8 +test_recording_list(GMythBackendInfo * backend_info)
    63.9  {
   63.10 -    GList *list = NULL;
   63.11 -    gint length = 0;
   63.12 -    GMythScheduler *scheduler = gmyth_scheduler_new ();
   63.13 -    
   63.14 -    if (gmyth_scheduler_connect_with_timeout (scheduler, 
   63.15 -	    backend_info, 10) == TRUE) {
   63.16 -	g_debug ("===== Scheduler connection success =====");
   63.17 -    } else {
   63.18 -	g_debug ("===== Scheduler connection failed =====");
   63.19 -	return FALSE;
   63.20 -    }
   63.21 +  GList *list = NULL;
   63.22 +  gint length = 0;
   63.23 +  GMythScheduler *scheduler = gmyth_scheduler_new();
   63.24  
   63.25 -    length = gmyth_scheduler_get_recorded_list (scheduler, &list);
   63.26 +  if (gmyth_scheduler_connect_with_timeout(scheduler,
   63.27 +										   backend_info, 10) == TRUE)
   63.28 +	{
   63.29 +	  g_debug("===== Scheduler connection success =====");
   63.30 +	}
   63.31 +  else
   63.32 +	{
   63.33 +	  g_debug("===== Scheduler connection failed =====");
   63.34 +	  return FALSE;
   63.35 +	}
   63.36  
   63.37 -    g_debug ("===== %d Recordings found =====\n", length);
   63.38 -    length--;
   63.39 -    while (length >= 0) {
   63.40 -        RecordedInfo *record = (RecordedInfo*) g_list_nth_data (list, length);
   63.41 -	if (record == 0) {
   63.42 -	    g_debug ("===== Recorded list returned NULL pointer =====\n");
   63.43 -	    length--;
   63.44 -	    continue;
   63.45 +  length = gmyth_scheduler_get_recorded_list(scheduler, &list);
   63.46 +
   63.47 +  g_debug("===== %d Recordings found =====\n", length);
   63.48 +  length--;
   63.49 +  while (length >= 0)
   63.50 +	{
   63.51 +	  RecordedInfo *record = (RecordedInfo *) g_list_nth_data(list, length);
   63.52 +	  if (record == 0)
   63.53 +		{
   63.54 +		  g_debug("===== Recorded list returned NULL pointer =====\n");
   63.55 +		  length--;
   63.56 +		  continue;
   63.57 +		}
   63.58 +	  g_debug("===== Record id = %d =====\n", record->record_id);
   63.59 +	  g_debug("===== Record name = %s =====\n",
   63.60 +			  (record ? record->basename->str : "NULL"));
   63.61 +	  length--;
   63.62  	}
   63.63 -	g_debug ("===== Record id = %d =====\n", record->record_id);
   63.64 -	g_debug ("===== Record name = %s =====\n", (record ? record->basename->str : "NULL")); 
   63.65 -	length--;
   63.66 -    }
   63.67  
   63.68 -    gmyth_scheduler_disconnect (scheduler);
   63.69 +  gmyth_scheduler_disconnect(scheduler);
   63.70  
   63.71 -    if ( scheduler != NULL )
   63.72 -    	g_object_unref( scheduler );
   63.73 +  if (scheduler != NULL)
   63.74 +	g_object_unref(scheduler);
   63.75  
   63.76 -    if ( list != NULL )
   63.77 -    	g_list_free( list );
   63.78 -    
   63.79 +  if (list != NULL)
   63.80 +	g_list_free(list);
   63.81 +
   63.82  }
   63.83  
   63.84  int
   63.85 -main (int args, const char **argv)
   63.86 +main(int args, const char **argv)
   63.87  {
   63.88 -    GMythBackendInfo *backend_info;
   63.89 -    g_type_init ();
   63.90 +  GMythBackendInfo *backend_info;
   63.91 +  g_type_init();
   63.92  
   63.93 -    backend_info = gmyth_backend_info_new_with_uri (argv[1]);
   63.94 +  backend_info = gmyth_backend_info_new_with_uri(argv[1]);
   63.95  
   63.96 -    test_recording_list (backend_info);
   63.97 +  test_recording_list(backend_info);
   63.98  
   63.99 -    fprintf(stdout, SYNC_STRING);
  63.100 -    fflush(NULL);
  63.101 -    getchar();
  63.102 +  fprintf(stdout, SYNC_STRING);
  63.103 +  fflush(NULL);
  63.104 +  getchar();
  63.105  
  63.106 -    if ( backend_info != NULL )
  63.107 -    	g_object_unref( backend_info );
  63.108 +  if (backend_info != NULL)
  63.109 +	g_object_unref(backend_info);
  63.110  
  63.111 -    return(0);
  63.112 +  return (0);
  63.113  }
  63.114 -
    64.1 --- a/gmyth/tests/gmyth_test_stringlist.c	Wed Jun 13 18:18:42 2007 +0100
    64.2 +++ b/gmyth/tests/gmyth_test_stringlist.c	Thu Jun 14 18:19:52 2007 +0100
    64.3 @@ -9,100 +9,95 @@
    64.4  static gboolean
    64.5  test_string_list()
    64.6  {
    64.7 -    gboolean ret = TRUE;
    64.8 -    gchar *str_list_param = NULL;
    64.9 -    GString *str = NULL;
   64.10 +  gboolean ret = TRUE;
   64.11 +  gchar *str_list_param = NULL;
   64.12 +  GString *str = NULL;
   64.13  
   64.14 -    GMythStringList *str_list = gmyth_string_list_new();
   64.15 -    
   64.16 -    gmyth_string_list_append_int( str_list, 54 );
   64.17 +  GMythStringList *str_list = gmyth_string_list_new();
   64.18  
   64.19 -    gmyth_string_list_append_uint64( str_list, 39282L );
   64.20 +  gmyth_string_list_append_int(str_list, 54);
   64.21  
   64.22 -    gmyth_string_list_append_int64( str_list, -123445L );
   64.23 +  gmyth_string_list_append_uint64(str_list, 39282L);
   64.24  
   64.25 -    gmyth_string_list_append_char_array( str_list, "lloollabbee" );
   64.26 +  gmyth_string_list_append_int64(str_list, -123445L);
   64.27  
   64.28 -    gmyth_string_list_append_string( str_list, g_string_new( "minarrai" ) );
   64.29 +  gmyth_string_list_append_char_array(str_list, "lloollabbee");
   64.30  
   64.31 -    if ( gmyth_string_list_length( str_list ) != 5 )
   64.32 -    {
   64.33 -    	ret = FALSE;
   64.34 -	goto done;
   64.35 -    }
   64.36 +  gmyth_string_list_append_string(str_list, g_string_new("minarrai"));
   64.37  
   64.38 -    if ( gmyth_string_list_get_int( str_list, 0 ) != 54 )
   64.39 -    {
   64.40 -    	ret = FALSE;
   64.41 -	goto done;
   64.42 -    }
   64.43 +  if (gmyth_string_list_length(str_list) != 5)
   64.44 +	{
   64.45 +	  ret = FALSE;
   64.46 +	  goto done;
   64.47 +	}
   64.48  
   64.49 -    if ( gmyth_string_list_get_uint64( str_list, 1 ) != 39282L )
   64.50 -    {
   64.51 -    	ret = FALSE;
   64.52 -	goto done;
   64.53 -    }
   64.54 +  if (gmyth_string_list_get_int(str_list, 0) != 54)
   64.55 +	{
   64.56 +	  ret = FALSE;
   64.57 +	  goto done;
   64.58 +	}
   64.59  
   64.60 -    
   64.61 -    if ( gmyth_string_list_get_int64( str_list, 2 ) != -123445L )
   64.62 -    {
   64.63 -    	ret = FALSE;
   64.64 -	goto done;
   64.65 -    }
   64.66 -    
   64.67 +  if (gmyth_string_list_get_uint64(str_list, 1) != 39282L)
   64.68 +	{
   64.69 +	  ret = FALSE;
   64.70 +	  goto done;
   64.71 +	}
   64.72  
   64.73 -    str_list_param = gmyth_string_list_get_char_array( str_list, 3 );
   64.74  
   64.75 -    if ( strcmp( str_list_param, "lloollabbee" ) != 0 )
   64.76 -    {
   64.77 -    	ret = FALSE;
   64.78 -	goto done;
   64.79 -    }
   64.80 +  if (gmyth_string_list_get_int64(str_list, 2) != -123445L)
   64.81 +	{
   64.82 +	  ret = FALSE;
   64.83 +	  goto done;
   64.84 +	}
   64.85  
   64.86  
   64.87 -    str = gmyth_string_list_get_string( str_list, 4 );
   64.88 +  str_list_param = gmyth_string_list_get_char_array(str_list, 3);
   64.89  
   64.90 -    if ( g_string_equal( str, g_string_new( "minarrai" ) ) )
   64.91 -    {
   64.92 -    	ret = FALSE;
   64.93 -	goto done;
   64.94 -    }
   64.95 +  if (strcmp(str_list_param, "lloollabbee") != 0)
   64.96 +	{
   64.97 +	  ret = FALSE;
   64.98 +	  goto done;
   64.99 +	}
  64.100 +
  64.101 +
  64.102 +  str = gmyth_string_list_get_string(str_list, 4);
  64.103 +
  64.104 +  if (g_string_equal(str, g_string_new("minarrai")))
  64.105 +	{
  64.106 +	  ret = FALSE;
  64.107 +	  goto done;
  64.108 +	}
  64.109  
  64.110  done:
  64.111 -    if ( str_list != NULL )
  64.112 -    	g_object_unref( str_list );
  64.113 +  if (str_list != NULL)
  64.114 +	g_object_unref(str_list);
  64.115  
  64.116 -    if ( str_list_param != NULL )
  64.117 -    	g_free( str_list_param );
  64.118 +  if (str_list_param != NULL)
  64.119 +	g_free(str_list_param);
  64.120  
  64.121 -    if ( str != NULL )
  64.122 -    	g_string_free( str, TRUE );
  64.123 +  if (str != NULL)
  64.124 +	g_string_free(str, TRUE);
  64.125  
  64.126 -    return ret;
  64.127 +  return ret;
  64.128  }
  64.129  
  64.130  int
  64.131 -main (int args, const char **argv)
  64.132 +main(int args, const char **argv)
  64.133  {
  64.134  
  64.135 -    g_type_init ();
  64.136 -    g_thread_init (NULL);
  64.137 +  g_type_init();
  64.138 +  g_thread_init(NULL);
  64.139  
  64.140 -    fprintf(stdout, SYNC_STRING);
  64.141 -    fflush(NULL);
  64.142 -    getchar();
  64.143 - 
  64.144 -    g_debug ("******** Testing main string list function ***********\n");
  64.145 -    if ( !test_string_list () )
  64.146 -    {
  64.147 -    	return -1;
  64.148 -    }
  64.149 -   
  64.150 -    return(0);
  64.151 +  fprintf(stdout, SYNC_STRING);
  64.152 +  fflush(NULL);
  64.153 +  getchar();
  64.154 +
  64.155 +  g_debug("******** Testing main string list function ***********\n");
  64.156 +  if (!test_string_list())
  64.157 +	{
  64.158 +	  return -1;
  64.159 +	}
  64.160 +
  64.161 +  return (0);
  64.162  
  64.163  }
  64.164 -
  64.165 -
  64.166 -
  64.167 -
  64.168 -
    65.1 --- a/gmyth/tests/gmyth_test_transcode.c	Wed Jun 13 18:18:42 2007 +0100
    65.2 +++ b/gmyth/tests/gmyth_test_transcode.c	Thu Jun 14 18:19:52 2007 +0100
    65.3 @@ -10,41 +10,40 @@
    65.4  #include "common.h"
    65.5  
    65.6  int
    65.7 -main (int args, const char **argv)
    65.8 +main(int args, const char **argv)
    65.9  {
   65.10 -    GMythBackendInfo *backend_info;
   65.11 -    GMythTranscoder *transcode;
   65.12 -    g_type_init ();
   65.13 -    g_thread_init (NULL);
   65.14 +  GMythBackendInfo *backend_info;
   65.15 +  GMythTranscoder *transcode;
   65.16 +  g_type_init();
   65.17 +  g_thread_init(NULL);
   65.18  
   65.19 -    backend_info = gmyth_backend_info_new ();
   65.20 -    gmyth_backend_info_set_hostname (backend_info, "192.168.3.165");
   65.21 -    gmyth_backend_info_set_port (backend_info, 6543);
   65.22 -    gmyth_backend_info_set_status_port (backend_info, 6544);
   65.23 +  backend_info = gmyth_backend_info_new();
   65.24 +  gmyth_backend_info_set_hostname(backend_info, "192.168.3.165");
   65.25 +  gmyth_backend_info_set_port(backend_info, 6543);
   65.26 +  gmyth_backend_info_set_status_port(backend_info, 6544);
   65.27  
   65.28 -    transcode = gmyth_transcoder_new(backend_info);
   65.29 +  transcode = gmyth_transcoder_new(backend_info);
   65.30  
   65.31 -    transcode->backend_info = backend_info;
   65.32 -    transcode->cutlist = TRUE;
   65.33 +  transcode->backend_info = backend_info;
   65.34 +  transcode->cutlist = TRUE;
   65.35  
   65.36 -    //gmyth_transcoder_set_output (transcode, TRUE, "/tmp/teste.mp4");
   65.37 -    //gmyth_transcoder_set_filename (transcode, "1000_20070309160500.nuv");
   65.38 -    gmyth_transcoder_set_filename (transcode, "1000_20070319170000.nuv");
   65.39 -    int teste = gmyth_jobqueue_add_job(transcode, "JOB_TRANSCODE");
   65.40 +  //gmyth_transcoder_set_output (transcode, TRUE, "/tmp/teste.mp4");
   65.41 +  //gmyth_transcoder_set_filename (transcode, "1000_20070309160500.nuv");
   65.42 +  gmyth_transcoder_set_filename(transcode, "1000_20070319170000.nuv");
   65.43 +  int teste = gmyth_jobqueue_add_job(transcode, "JOB_TRANSCODE");
   65.44  
   65.45 -    teste = gmyth_jobqueue_change_cmd(transcode, "STOP", "JOB_TRANSCODE");
   65.46 +  teste = gmyth_jobqueue_change_cmd(transcode, "STOP", "JOB_TRANSCODE");
   65.47  
   65.48 -    fprintf(stdout, SYNC_STRING);
   65.49 -    fflush(NULL);
   65.50 -    getchar();
   65.51 +  fprintf(stdout, SYNC_STRING);
   65.52 +  fflush(NULL);
   65.53 +  getchar();
   65.54  
   65.55 -    if ( transcode != NULL )
   65.56 -    	g_object_unref( transcode );
   65.57 -    
   65.58 -    if ( backend_info != NULL )
   65.59 -    	g_object_unref( backend_info );
   65.60 +  if (transcode != NULL)
   65.61 +	g_object_unref(transcode);
   65.62  
   65.63 -    return(0);
   65.64 +  if (backend_info != NULL)
   65.65 +	g_object_unref(backend_info);
   65.66 +
   65.67 +  return (0);
   65.68  
   65.69  }
   65.70 -
    66.1 --- a/gmyth/tests/gmyth_test_tvchain.c	Wed Jun 13 18:18:42 2007 +0100
    66.2 +++ b/gmyth/tests/gmyth_test_tvchain.c	Thu Jun 14 18:19:52 2007 +0100
    66.3 @@ -13,130 +13,121 @@
    66.4  #define URI_DEFAULT	"myth://192.168.3.165:6543/livetv?channel=9"
    66.5  
    66.6  static gboolean
    66.7 -test_tvchain_setup ( gchar *uri )
    66.8 +test_tvchain_setup(gchar * uri)
    66.9  {
   66.10    GMythTVChain *tvchain = NULL;
   66.11    gchar *channel = NULL;
   66.12    gboolean ret = TRUE;
   66.13 -  
   66.14 -  if ( NULL == uri )
   66.15 -    uri = g_strdup( URI_DEFAULT );
   66.16  
   66.17 -  GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri );
   66.18 +  if (NULL == uri)
   66.19 +	uri = g_strdup(URI_DEFAULT);
   66.20  
   66.21 -  GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri (uri);
   66.22 -  
   66.23 -  channel = gmyth_uri_get_channel_name( gmyth_uri );
   66.24 +  GMythURI *gmyth_uri = gmyth_uri_new_with_value(uri);
   66.25 +
   66.26 +  GMythBackendInfo *backend_info = gmyth_backend_info_new_with_uri(uri);
   66.27 +
   66.28 +  channel = gmyth_uri_get_channel_name(gmyth_uri);
   66.29  
   66.30    /* Creates livetv chain handler */
   66.31 -  tvchain = gmyth_tvchain_new ();
   66.32 -  gmyth_tvchain_initialize (tvchain, backend_info);
   66.33 +  tvchain = gmyth_tvchain_new();
   66.34 +  gmyth_tvchain_initialize(tvchain, backend_info);
   66.35  
   66.36    if (tvchain == NULL || tvchain->tvchain_id == NULL)
   66.37 -  {
   66.38 -    ret = FALSE;
   66.39 -    goto init_failed;
   66.40 -  }
   66.41 +	{
   66.42 +	  ret = FALSE;
   66.43 +	  goto init_failed;
   66.44 +	}
   66.45  
   66.46 -  ret = ( gmyth_tvchain_get_id (tvchain) != NULL );
   66.47 +  ret = (gmyth_tvchain_get_id(tvchain) != NULL);
   66.48    if (!ret)
   66.49 -  {
   66.50 -    g_debug ("[%s] TV Chain ID is NULL.\n", __FUNCTION__);
   66.51 -    goto init_failed;
   66.52 -  }
   66.53 +	{
   66.54 +	  g_debug("[%s] TV Chain ID is NULL.\n", __FUNCTION__);
   66.55 +	  goto init_failed;
   66.56 +	}
   66.57  
   66.58 -  gmyth_backend_info_set_username (tvchain->backend_info,
   66.59 -		  "mythtv");
   66.60 -  gmyth_backend_info_set_password (tvchain->backend_info,
   66.61 -		  "mythtv");
   66.62 -  gmyth_backend_info_set_db_name (tvchain->backend_info,
   66.63 -		  "mythconverg");
   66.64 -  GList *prog_list =
   66.65 -	  gmyth_tvchain_get_program_info_from_channel (tvchain,
   66.66 -			  channel);
   66.67 +  gmyth_backend_info_set_username(tvchain->backend_info, "mythtv");
   66.68 +  gmyth_backend_info_set_password(tvchain->backend_info, "mythtv");
   66.69 +  gmyth_backend_info_set_db_name(tvchain->backend_info, "mythconverg");
   66.70 +  GList *prog_list = gmyth_tvchain_get_program_info_from_channel(tvchain,
   66.71 +																 channel);
   66.72    GMythProgramInfo *ch_prog = NULL;
   66.73 -  if (prog_list != NULL && g_list_length (prog_list) > 0)
   66.74 -  {
   66.75 -	  ch_prog = (GMythProgramInfo *) g_list_nth_data (prog_list, 0);
   66.76 -	  g_debug ("Channel program info (from a list with size = %d)!",
   66.77 -			  g_list_length (prog_list));
   66.78 -	  gmyth_program_info_print (ch_prog);
   66.79 -  }
   66.80 +  if (prog_list != NULL && g_list_length(prog_list) > 0)
   66.81 +	{
   66.82 +	  ch_prog = (GMythProgramInfo *) g_list_nth_data(prog_list, 0);
   66.83 +	  g_debug("Channel program info (from a list with size = %d)!",
   66.84 +			  g_list_length(prog_list));
   66.85 +	  gmyth_program_info_print(ch_prog);
   66.86 +	}
   66.87  
   66.88 -  g_debug ("Program Info: %s\n",
   66.89 -		  gmyth_program_info_to_string (ch_prog));
   66.90 -  
   66.91 +  g_debug("Program Info: %s\n", gmyth_program_info_to_string(ch_prog));
   66.92 +
   66.93    /* Reload all TV chain from Mysql database. */
   66.94 -  gmyth_tvchain_reload_all (tvchain);
   66.95 +  gmyth_tvchain_reload_all(tvchain);
   66.96  
   66.97    if (tvchain == NULL)
   66.98 -  {
   66.99 +	{
  66.100  	  ret = FALSE;
  66.101  	  goto init_failed;
  66.102 -  }
  66.103 +	}
  66.104  
  66.105    /* Get program info from database using chanid and starttime */
  66.106 -  ch_prog = gmyth_tvchain_get_program_at (tvchain, 0);
  66.107 +  ch_prog = gmyth_tvchain_get_program_at(tvchain, 0);
  66.108    if (NULL == ch_prog)
  66.109 -  {
  66.110 -	  g_debug ("TVChain not successfully started.\n");
  66.111 +	{
  66.112 +	  g_debug("TVChain not successfully started.\n");
  66.113  	  ret = FALSE;
  66.114  	  goto init_failed;
  66.115 -  }
  66.116 +	}
  66.117    else
  66.118 -  {
  66.119 +	{
  66.120  	  ret = TRUE;
  66.121  	  g_debug
  66.122 -		  ("GMythTVChain: All requests to backend to start TV were OK. [%s]\n",
  66.123 -		   ch_prog->pathname->str);
  66.124 -  }
  66.125 +		("GMythTVChain: All requests to backend to start TV were OK. [%s]\n",
  66.126 +		 ch_prog->pathname->str);
  66.127 +	}
  66.128  
  66.129  
  66.130  init_failed:
  66.131 -    if ( tvchain != NULL )
  66.132 -        g_object_unref(tvchain);
  66.133 - 
  66.134 -    if ( gmyth_uri != NULL )
  66.135 -        g_object_unref( gmyth_uri );
  66.136 +  if (tvchain != NULL)
  66.137 +	g_object_unref(tvchain);
  66.138  
  66.139 -    if ( ch_prog != NULL )
  66.140 -       g_object_unref( ch_prog );
  66.141 +  if (gmyth_uri != NULL)
  66.142 +	g_object_unref(gmyth_uri);
  66.143  
  66.144 -    if ( prog_list != NULL )
  66.145 -       g_list_free( prog_list );
  66.146 +  if (ch_prog != NULL)
  66.147 +	g_object_unref(ch_prog);
  66.148  
  66.149 -    if ( backend_info != NULL )
  66.150 -       g_object_unref( backend_info );
  66.151 +  if (prog_list != NULL)
  66.152 +	g_list_free(prog_list);
  66.153  
  66.154 -    return ret;
  66.155 -    
  66.156 +  if (backend_info != NULL)
  66.157 +	g_object_unref(backend_info);
  66.158 +
  66.159 +  return ret;
  66.160 +
  66.161  }
  66.162  
  66.163  gint
  66.164 -main (gint args, const gchar **argv)
  66.165 +main(gint args, const gchar ** argv)
  66.166  {
  66.167 -    gboolean ret;
  66.168 +  gboolean ret;
  66.169  
  66.170 -    g_type_init ();
  66.171 -    g_thread_init (NULL);
  66.172 +  g_type_init();
  66.173 +  g_thread_init(NULL);
  66.174  
  66.175 -    fprintf(stdout, SYNC_STRING);
  66.176 -    fflush(NULL);
  66.177 -    getchar();
  66.178 -    
  66.179 -    if ( args > 1 )
  66.180 -	ret = test_tvchain_setup ( argv[1] );
  66.181 -    else
  66.182 -    	ret = test_tvchain_setup ( NULL );
  66.183 -    
  66.184 -    if ( !ret )
  66.185 -        g_debug ("Error when running TV Chain setup test script!");
  66.186 -    else
  66.187 -        g_debug ("TV Chain setup test script finished with success.");
  66.188 +  fprintf(stdout, SYNC_STRING);
  66.189 +  fflush(NULL);
  66.190 +  getchar();
  66.191  
  66.192 -    return(0);
  66.193 +  if (args > 1)
  66.194 +	ret = test_tvchain_setup(argv[1]);
  66.195 +  else
  66.196 +	ret = test_tvchain_setup(NULL);
  66.197 +
  66.198 +  if (!ret)
  66.199 +	g_debug("Error when running TV Chain setup test script!");
  66.200 +  else
  66.201 +	g_debug("TV Chain setup test script finished with success.");
  66.202 +
  66.203 +  return (0);
  66.204  }
  66.205 -
  66.206 -
  66.207 -
  66.208 -
    67.1 --- a/gmyth/tests/gmyth_test_vlc.c	Wed Jun 13 18:18:42 2007 +0100
    67.2 +++ b/gmyth/tests/gmyth_test_vlc.c	Thu Jun 14 18:19:52 2007 +0100
    67.3 @@ -5,39 +5,39 @@
    67.4  #include "common.h"
    67.5  
    67.6  int
    67.7 -main (int args, const char **argv)
    67.8 +main(int args, const char **argv)
    67.9  {
   67.10 -    GMythBackendInfo *backend_info;
   67.11 -    g_type_init();
   67.12 -    g_thread_init(NULL);
   67.13 +  GMythBackendInfo *backend_info;
   67.14 +  g_type_init();
   67.15 +  g_thread_init(NULL);
   67.16  
   67.17 -    backend_info = gmyth_backend_info_new ();
   67.18 +  backend_info = gmyth_backend_info_new();
   67.19  
   67.20 -    GMythVlc vlc;
   67.21 -    vlc.n_inputs = 0;
   67.22 -    vlc.n_outputs = 0;
   67.23 +  GMythVlc vlc;
   67.24 +  vlc.n_inputs = 0;
   67.25 +  vlc.n_outputs = 0;
   67.26  
   67.27 -    gmyth_backend_info_set_hostname (backend_info, "192.168.3.137");
   67.28 -    gmyth_backend_info_set_port (backend_info, 6543);
   67.29 -    
   67.30 -    int res = gmyth_vlc_connect(&vlc, backend_info, "admin", 4212);
   67.31 -    
   67.32 -    if ( res >= 0 )
   67.33 -    {
   67.34 -    	gmyth_vlc_create_channel(&vlc, "broadcast", 8080, THEORA);
   67.35 -        gmyth_vlc_create_input(&vlc, 0, "/tmp/mpg/bad_day.mpg");
   67.36 -        gmyth_vlc_control_input(&vlc, 0, "play");
   67.37 -        gmyth_vlc_disconnect(&vlc);
   67.38 -    }
   67.39 +  gmyth_backend_info_set_hostname(backend_info, "192.168.3.137");
   67.40 +  gmyth_backend_info_set_port(backend_info, 6543);
   67.41  
   67.42 -    //gchar* teste = gmyth_http_retrieve_setting(backend_info, "RecordFilePrefix", "hmelo-desktop");
   67.43 +  int res = gmyth_vlc_connect(&vlc, backend_info, "admin", 4212);
   67.44  
   67.45 -    fprintf(stdout, SYNC_STRING);
   67.46 -    fflush(NULL);
   67.47 -    getchar();
   67.48 +  if (res >= 0)
   67.49 +	{
   67.50 +	  gmyth_vlc_create_channel(&vlc, "broadcast", 8080, THEORA);
   67.51 +	  gmyth_vlc_create_input(&vlc, 0, "/tmp/mpg/bad_day.mpg");
   67.52 +	  gmyth_vlc_control_input(&vlc, 0, "play");
   67.53 +	  gmyth_vlc_disconnect(&vlc);
   67.54 +	}
   67.55  
   67.56 -    if ( backend_info != NULL )
   67.57 -    	g_object_unref( backend_info );
   67.58 +  //gchar* teste = gmyth_http_retrieve_setting(backend_info, "RecordFilePrefix", "hmelo-desktop");
   67.59  
   67.60 -    return(0);
   67.61 +  fprintf(stdout, SYNC_STRING);
   67.62 +  fflush(NULL);
   67.63 +  getchar();
   67.64 +
   67.65 +  if (backend_info != NULL)
   67.66 +	g_object_unref(backend_info);
   67.67 +
   67.68 +  return (0);
   67.69  }
    68.1 --- a/gmyth/tests/main.c	Wed Jun 13 18:18:42 2007 +0100
    68.2 +++ b/gmyth/tests/main.c	Thu Jun 14 18:19:52 2007 +0100
    68.3 @@ -5,57 +5,60 @@
    68.4  #include "common.h"
    68.5  
    68.6  int
    68.7 -main (int args, const char **argv)
    68.8 +main(int args, const char **argv)
    68.9  {
   68.10 -    const char *uri = argv[1];
   68.11 -    GMythURI *gmyth_uri = NULL;
   68.12 -    gboolean res;
   68.13 -    GMythBackendInfo *backend_info = NULL;
   68.14 -    g_type_init ();
   68.15 -    g_thread_init (NULL);
   68.16 +  const char *uri = argv[1];
   68.17 +  GMythURI *gmyth_uri = NULL;
   68.18 +  gboolean res;
   68.19 +  GMythBackendInfo *backend_info = NULL;
   68.20 +  g_type_init();
   68.21 +  g_thread_init(NULL);
   68.22  
   68.23 -    fprintf(stdout, SYNC_STRING);
   68.24 -    fflush(NULL);
   68.25 -    getchar();
   68.26 +  fprintf(stdout, SYNC_STRING);
   68.27 +  fflush(NULL);
   68.28 +  getchar();
   68.29  
   68.30 -    backend_info = gmyth_backend_info_new ();
   68.31 -    gmyth_uri = gmyth_uri_new_with_value (uri);
   68.32 +  backend_info = gmyth_backend_info_new();
   68.33 +  gmyth_uri = gmyth_uri_new_with_value(uri);
   68.34  
   68.35 -    gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host (gmyth_uri));
   68.36 -    gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port (gmyth_uri));
   68.37 -    
   68.38 -    res = gmyth_util_file_exists (backend_info, uri);
   68.39 -    if (res == FALSE) {
   68.40 -        g_debug ("file not exists");
   68.41 -        return -1;
   68.42 -    }
   68.43 -    GMythFileTransfer *file_transfer = gmyth_file_transfer_new (backend_info);
   68.44 -    GString *hostname = g_string_new (uri);
   68.45 -    res = gmyth_file_transfer_open (file_transfer, uri);
   68.46 -    if (res == FALSE) {
   68.47 -        g_debug ("Fail to open server");
   68.48 -        return  -1;
   68.49 -    }
   68.50 +  gmyth_backend_info_set_hostname(backend_info,
   68.51 +								  gmyth_uri_get_host(gmyth_uri));
   68.52 +  gmyth_backend_info_set_port(backend_info, gmyth_uri_get_port(gmyth_uri));
   68.53  
   68.54 -    gint64 filesize = gmyth_file_transfer_get_filesize (file_transfer);
   68.55 -    if (filesize <= 0) {
   68.56 -        g_debug ("filesize is 0");
   68.57 -        return -1;
   68.58 -    }
   68.59 +  res = gmyth_util_file_exists(backend_info, uri);
   68.60 +  if (res == FALSE)
   68.61 +	{
   68.62 +	  g_debug("file not exists");
   68.63 +	  return -1;
   68.64 +	}
   68.65 +  GMythFileTransfer *file_transfer = gmyth_file_transfer_new(backend_info);
   68.66 +  GString *hostname = g_string_new(uri);
   68.67 +  res = gmyth_file_transfer_open(file_transfer, uri);
   68.68 +  if (res == FALSE)
   68.69 +	{
   68.70 +	  g_debug("Fail to open server");
   68.71 +	  return -1;
   68.72 +	}
   68.73  
   68.74 -    GByteArray *data = g_byte_array_new ();
   68.75 -    guint num = gmyth_file_transfer_read (file_transfer, data, filesize, FALSE);
   68.76 -    g_debug ("read %d bytes", num);
   68.77 +  gint64 filesize = gmyth_file_transfer_get_filesize(file_transfer);
   68.78 +  if (filesize <= 0)
   68.79 +	{
   68.80 +	  g_debug("filesize is 0");
   68.81 +	  return -1;
   68.82 +	}
   68.83  
   68.84 -    if ( data != NULL )
   68.85 -	g_byte_array_free (data, TRUE);
   68.86 -    if ( file_transfer != NULL )
   68.87 -	g_object_unref (file_transfer);
   68.88 -    if ( gmyth_uri != NULL )
   68.89 -	g_object_unref (gmyth_uri);
   68.90 -    if ( hostname != NULL )
   68.91 -	g_string_free (hostname, TRUE);
   68.92 +  GByteArray *data = g_byte_array_new();
   68.93 +  guint num = gmyth_file_transfer_read(file_transfer, data, filesize, FALSE);
   68.94 +  g_debug("read %d bytes", num);
   68.95  
   68.96 -    return (0);
   68.97 +  if (data != NULL)
   68.98 +	g_byte_array_free(data, TRUE);
   68.99 +  if (file_transfer != NULL)
  68.100 +	g_object_unref(file_transfer);
  68.101 +  if (gmyth_uri != NULL)
  68.102 +	g_object_unref(gmyth_uri);
  68.103 +  if (hostname != NULL)
  68.104 +	g_string_free(hostname, TRUE);
  68.105 +
  68.106 +  return (0);
  68.107  }
  68.108 -