libgnomevfs2-mythtv/modules/mythtv-method.c
branchtrunk
changeset 464 5ef4452c42cc
parent 460 cde4aad8577a
child 465 997f281ba596
     1.1 --- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Tue Mar 27 16:12:15 2007 +0100
     1.2 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Tue Mar 27 21:42:35 2007 +0100
     1.3 @@ -149,6 +149,7 @@
     1.4      GMythBackendInfo *backend_info;
     1.5      
     1.6      _GNOME_VFS_METHOD_PARAM_CHECK (info != NULL);
     1.7 +    
     1.8  
     1.9      if (myth_handle == NULL) {
    1.10          gchar *tmp_str1;
    1.11 @@ -190,10 +191,18 @@
    1.12          /* Verifies if the file exists */
    1.13          if (!gmyth_util_file_exists (backend_info, 
    1.14                      gmyth_uri_get_path (gmyth_uri))) {
    1.15 +            g_object_unref (file_transfer);
    1.16              g_object_unref (backend_info);
    1.17              g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
    1.18              return GNOME_VFS_ERROR_NOT_FOUND;
    1.19  		}
    1.20 +
    1.21 +        if (!gmyth_file_transfer_open (file_transfer, gmyth_uri_get_path (gmyth_uri))) {
    1.22 +            g_object_unref (file_transfer);
    1.23 +            g_object_unref (backend_info);
    1.24 +            g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
    1.25 +            return GNOME_VFS_ERROR_NOT_FOUND;
    1.26 +        }
    1.27  	
    1.28  		info->size = gmyth_file_transfer_get_filesize (file_transfer);
    1.29          info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
    1.30 @@ -214,11 +223,8 @@
    1.31      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
    1.32      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle->backend_info != NULL);
    1.33  
    1.34 -    
    1.35  	/* Connect to the backend */
    1.36  	if (gmyth_uri_is_livetv (method_handle->gmyth_uri) == TRUE) {
    1.37 -        
    1.38 -        
    1.39  		method_handle->livetv = gmyth_livetv_new (method_handle->backend_info);
    1.40  		method_handle->channel_name = gmyth_uri_get_channel_name (method_handle->gmyth_uri);
    1.41          
    1.42 @@ -265,23 +271,24 @@
    1.43                      gmyth_uri_get_path (method_handle->gmyth_uri))) {
    1.44  
    1.45              g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
    1.46 -		    result = GNOME_VFS_ERROR_NOT_FOUND;
    1.47              goto error;
    1.48  		}
    1.49  
    1.50  		/* sets the Playback monitor connection */
    1.51 -		result = gmyth_file_transfer_open (method_handle->file_transfer,
    1.52 -                  					    gmyth_uri_get_path (method_handle->gmyth_uri));
    1.53 +		if (!gmyth_file_transfer_open (method_handle->file_transfer,
    1.54 +                  					    gmyth_uri_get_path (method_handle->gmyth_uri))) {
    1.55 +
    1.56 +            g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
    1.57 +		    result = GNOME_VFS_ERROR_NOT_FOUND;
    1.58 +            goto error;
    1.59 +        }
    1.60  	} /* if - LiveTV or not? */
    1.61  
    1.62  	method_handle->configured = TRUE;    
    1.63  
    1.64      if (method_handle->file_transfer == NULL) {
    1.65          result = GNOME_VFS_ERROR_NOT_OPEN;
    1.66 -        goto error;
    1.67      }
    1.68 -	g_return_val_if_fail (method_handle->file_transfer != NULL, 
    1.69 -            GNOME_VFS_ERROR_NOT_OPEN);
    1.70  
    1.71  error:
    1.72      
    1.73 @@ -314,6 +321,7 @@
    1.74          myth_handle = NULL;
    1.75          return result;
    1.76      }
    1.77 +
    1.78      *method_handle = (GnomeVFSMethodHandle *) myth_handle;
    1.79      
    1.80      return result;
    1.81 @@ -359,7 +367,6 @@
    1.82  
    1.83      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
    1.84  
    1.85 -    
    1.86      myth_handle = (MythtvHandle *) method_handle;
    1.87      result = GNOME_VFS_OK;
    1.88  
    1.89 @@ -382,7 +389,7 @@
    1.90          g_byte_array_free (myth_buffer, TRUE);
    1.91          myth_handle->offset += total_read;
    1.92      } 
    1.93 -
    1.94 +    
    1.95      *bytes_read = (GnomeVFSFileSize) total_read;
    1.96  
    1.97  	return result;