# HG changeset patch
# User rosfran
# Date 1169500975 0
# Node ID 96b436a81e53f0333d42161d7bee32b63f47b8a8
# Parent  fdac5773d2a69989bfc8da367566933c18b5aa62
[svn r291] Some fixes to use the LiveTV inside gnomevfssrc.

diff -r fdac5773d2a6 -r 96b436a81e53 libgnomevfs2-mythtv/modules/mythtv-method.c
--- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Mon Jan 22 21:03:08 2007 +0000
+++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Mon Jan 22 21:22:55 2007 +0000
@@ -151,20 +151,6 @@
 	    g_warning ("MythTV FileTransfer open error\n");
 	    return GNOME_VFS_ERROR_NOT_OPEN;
 	  } 
-	
-	  if ( is_livetv == TRUE && ret == TRUE ) {
-	    /* loop finished, set the max tries variable to zero again... */
-	    wait_to_transfer = 0;
-	
-	    while ( wait_to_transfer++ < MYTHTV_TRANSFER_MAX_WAITS &&
-	        (gmyth_livetv_is_recording (myth_handle->livetv) == FALSE))
-	      g_usleep (500);
-	
-	    /* IS_RECORDING again, just like the MythTV backend does... */
-	    gmyth_livetv_is_recording (myth_handle->livetv);
-	
-	    sleep (4);                  /* FIXME: this is evil (tpm) */
-	  }
 
     g_object_unref (backend_info);
 
@@ -204,8 +190,8 @@
 
     /* Loop sending the Myth File Transfer request:
     * Retry whilst authentication fails and we supply it. */
-  
-    if ( bytes_to_read > myth_handle->buffer_remain ) {
+    if ((myth_handle->buffer_remain = myth_handle->buffer->len) < MYTHTV_BUFFER_SIZE) {
+    //if ( bytes_to_read > myth_handle->buffer_remain ) {
         GByteArray *tmp_buffer = g_byte_array_new();
 
         gint len = gmyth_file_transfer_read (myth_handle->file_transfer,
@@ -215,11 +201,11 @@
             g_byte_array_free (tmp_buffer, TRUE);
             g_warning ("Fail to read bytes");
 	    return GNOME_VFS_ERROR_IO;
-        } else if (len == 0) {
+        } /*else if (len == 0) {
 	    g_byte_array_free (tmp_buffer, TRUE);
 	    g_warning ("End of file probably achieved");
 	    return GNOME_VFS_ERROR_EOF;
-	}
+	}*/
 
         myth_handle->buffer = g_byte_array_append (myth_handle->buffer,
     		tmp_buffer->data, len);