diff -r cde4aad8577a -r 5ef4452c42cc libgnomevfs2-mythtv/modules/mythtv-method.c --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Tue Mar 27 16:12:15 2007 +0100 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Tue Mar 27 21:42:35 2007 +0100 @@ -149,6 +149,7 @@ GMythBackendInfo *backend_info; _GNOME_VFS_METHOD_PARAM_CHECK (info != NULL); + if (myth_handle == NULL) { gchar *tmp_str1; @@ -190,10 +191,18 @@ /* Verifies if the file exists */ if (!gmyth_util_file_exists (backend_info, gmyth_uri_get_path (gmyth_uri))) { + g_object_unref (file_transfer); g_object_unref (backend_info); g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__); return GNOME_VFS_ERROR_NOT_FOUND; } + + if (!gmyth_file_transfer_open (file_transfer, gmyth_uri_get_path (gmyth_uri))) { + g_object_unref (file_transfer); + g_object_unref (backend_info); + g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__); + return GNOME_VFS_ERROR_NOT_FOUND; + } info->size = gmyth_file_transfer_get_filesize (file_transfer); info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE; @@ -214,11 +223,8 @@ _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL); _GNOME_VFS_METHOD_PARAM_CHECK (method_handle->backend_info != NULL); - /* Connect to the backend */ if (gmyth_uri_is_livetv (method_handle->gmyth_uri) == TRUE) { - - method_handle->livetv = gmyth_livetv_new (method_handle->backend_info); method_handle->channel_name = gmyth_uri_get_channel_name (method_handle->gmyth_uri); @@ -265,23 +271,24 @@ gmyth_uri_get_path (method_handle->gmyth_uri))) { g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__); - result = GNOME_VFS_ERROR_NOT_FOUND; goto error; } /* sets the Playback monitor connection */ - result = gmyth_file_transfer_open (method_handle->file_transfer, - gmyth_uri_get_path (method_handle->gmyth_uri)); + if (!gmyth_file_transfer_open (method_handle->file_transfer, + gmyth_uri_get_path (method_handle->gmyth_uri))) { + + g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__); + result = GNOME_VFS_ERROR_NOT_FOUND; + goto error; + } } /* if - LiveTV or not? */ method_handle->configured = TRUE; if (method_handle->file_transfer == NULL) { result = GNOME_VFS_ERROR_NOT_OPEN; - goto error; } - g_return_val_if_fail (method_handle->file_transfer != NULL, - GNOME_VFS_ERROR_NOT_OPEN); error: @@ -314,6 +321,7 @@ myth_handle = NULL; return result; } + *method_handle = (GnomeVFSMethodHandle *) myth_handle; return result; @@ -359,7 +367,6 @@ _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL); - myth_handle = (MythtvHandle *) method_handle; result = GNOME_VFS_OK; @@ -382,7 +389,7 @@ g_byte_array_free (myth_buffer, TRUE); myth_handle->offset += total_read; } - + *bytes_read = (GnomeVFSFileSize) total_read; return result;