[svn r161] Filetransfer interface now receives GMythBackendInfo and file name instead of URI trunk
authormelunko
Thu Nov 30 21:31:34 2006 +0000 (2006-11-30)
branchtrunk
changeset 160106adb6883dc
parent 159 2db0e1da044a
child 161 a2308f2e6ed0
[svn r161] Filetransfer interface now receives GMythBackendInfo and file name instead of URI
libgnomevfs2-mythtv/modules/mythtv-method.c
     1.1 --- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Thu Nov 30 21:29:54 2006 +0000
     1.2 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Thu Nov 30 21:31:34 2006 +0000
     1.3 @@ -28,6 +28,7 @@
     1.4  #include <libgnomevfs/gnome-vfs-utils.h>
     1.5  
     1.6  #include "gmyth_file_transfer.h"
     1.7 +#include "gmyth_backendinfo.h"
     1.8  
     1.9  #define GST_MYTHTV_ID_NUM               1
    1.10  #define MYTHTV_VERSION_DEFAULT          30
    1.11 @@ -61,11 +62,8 @@
    1.12           GnomeVFSOpenMode mode,
    1.13           GnomeVFSContext *context)
    1.14  {
    1.15 -
    1.16 -    gchar *transfer_uri;
    1.17      MythtvHandle *myth_handle;
    1.18 -
    1.19 -    GString *uri_str;
    1.20 +    GMythBackendInfo *backend_info;
    1.21      gboolean ret;
    1.22  
    1.23      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
    1.24 @@ -83,30 +81,29 @@
    1.25      	return GNOME_VFS_ERROR_INVALID_HOST_NAME;
    1.26      }
    1.27  
    1.28 -    transfer_uri = gnome_vfs_uri_to_string (uri, 
    1.29 -		    GNOME_VFS_URI_HIDE_USER_NAME | GNOME_VFS_URI_HIDE_PASSWORD);
    1.30 -   
    1.31      /* Initialize mythtv handler*/
    1.32      myth_handle->file_transfer = NULL;
    1.33      myth_handle->mythtv_version = MYTHTV_VERSION_DEFAULT;
    1.34      myth_handle->bytes_read = 0;
    1.35      myth_handle->content_size = -1;
    1.36  
    1.37 +    /* Creates and fills out the backend info structure */
    1.38 +    backend_info = gmyth_backend_info_new_full (
    1.39 +	gnome_vfs_uri_get_host_name (uri),
    1.40 +	NULL, NULL, NULL,
    1.41 +	gnome_vfs_uri_get_host_port (uri));
    1.42 +
    1.43      /* Connect to the backend */
    1.44 -    myth_handle->file_transfer = gmyth_file_transfer_new ();
    1.45 +    myth_handle->file_transfer = gmyth_file_transfer_new (backend_info);
    1.46  
    1.47      g_return_val_if_fail (myth_handle->file_transfer != NULL, GNOME_VFS_ERROR_NOT_OPEN);
    1.48  
    1.49      /* sets the Playback monitor connection */
    1.50 -    uri_str = g_string_new (transfer_uri);
    1.51 -    g_free (transfer_uri);
    1.52 -    transfer_uri = NULL;
    1.53 -    ret = gmyth_file_transfer_open (myth_handle->file_transfer, uri_str);
    1.54 +    ret = gmyth_file_transfer_open (myth_handle->file_transfer, gnome_vfs_uri_get_path (uri));
    1.55      if (ret == FALSE) {
    1.56          g_printerr ("Mythtv FileTransfer open error\n");
    1.57          return GNOME_VFS_ERROR_NOT_OPEN;
    1.58      }
    1.59 -    g_string_free (uri_str, TRUE);
    1.60  
    1.61      // TODO: Verify if file exists in the backend
    1.62  
    1.63 @@ -137,6 +134,7 @@
    1.64  
    1.65      *bytes_read = 0;
    1.66  
    1.67 +    printf ("XXXXXXXXXXXXXXXXXXXX bytes_read: %d, content_size: %d\n", (int)myth_handle->bytes_read, (int)myth_handle->content_size);
    1.68      if (myth_handle->bytes_read >= myth_handle->content_size)
    1.69          return GNOME_VFS_ERROR_EOF;
    1.70