# HG changeset patch
# User rosfran
# Date 1170456299 0
# Node ID 6523ab923c006174496cfb2408e65975b0816ae4
# Parent  eb6b0b1409b5e691074446c072768bedda1f9306
[svn r325] Minor changes, separated process of opening LiveTV FileTransfer from the LiveTV setup.

diff -r eb6b0b1409b5 -r 6523ab923c00 libgnomevfs2-mythtv/modules/mythtv-method.c
--- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Fri Feb 02 22:04:00 2007 +0000
+++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Fri Feb 02 22:44:59 2007 +0000
@@ -128,6 +128,15 @@
 	      ret = FALSE;
 	    }
 	    
+  		if ( !gmyth_file_transfer_open( myth_handle->file_transfer, myth_handle->livetv->uri != NULL ? 
+								gmyth_uri_get_path(myth_handle->livetv->uri) : 
+								myth_handle->livetv->proginfo->pathname->str ) )
+			{
+				g_object_unref( myth_handle->file_transfer );
+				myth_handle->file_transfer = NULL;
+				ret = FALSE;
+			}
+	    
 	  } else {
 	
 	    myth_handle->file_transfer = gmyth_file_transfer_new (backend_info);
@@ -135,7 +144,7 @@
 	    /* Verifies if the file exists */
 	    if (!gmyth_util_file_exists (backend_info, gmyth_uri_get_path (gmyth_uri))) {
 	        g_object_unref (backend_info);
-					return GNOME_VFS_ERROR_NOT_FOUND;
+					ret = FALSE;
 	    }
 	    
 	    /* sets the Playback monitor connection */
@@ -144,9 +153,9 @@
 	  } /* if - LiveTV or not? */
 	  
     if (ret == FALSE) {
-	    g_warning ("MythTV FileTransfer open error\n");
+	    g_warning ("MythTV FileTransfer open error.\n");
 	    return GNOME_VFS_ERROR_NOT_OPEN;
-	  } 
+	  }
 
     g_object_unref (backend_info);
     
@@ -154,8 +163,11 @@
 	  //	g_object_unref( gmyth_uri );
 	  
 	  g_return_val_if_fail (myth_handle->file_transfer != NULL, GNOME_VFS_ERROR_NOT_OPEN);
-
-    myth_handle->content_size = myth_handle->file_transfer->filesize;
+	  
+	  if ( myth_handle->file_transfer->filesize < 0 && is_livetv )
+			myth_handle->content_size = gmyth_recorder_get_file_position( myth_handle->livetv->recorder );
+		else		
+    	myth_handle->content_size = myth_handle->file_transfer->filesize;
     
     myth_handle->buffer = g_byte_array_sized_new (MYTHTV_BUFFER_SIZE);
     myth_handle->buffer_remain = 0;
@@ -344,8 +356,11 @@
 	    return GNOME_VFS_ERROR_NOT_OPEN;
 	  }
 	  */
-
-    file_info->size = gmyth_file_transfer_get_filesize (file_transfer);
+	  if ( file_transfer->filesize < 0 && is_livetv )
+			file_info->size = gmyth_recorder_get_file_position( livetv->recorder );
+		else		
+    	file_info->size = gmyth_file_transfer_get_filesize (file_transfer);
+    
     file_info->block_count = GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT;
     file_info->io_block_size = GNOME_VFS_FILE_INFO_FIELDS_IO_BLOCK_SIZE;