[svn r335] Some fixes to the do_get_file_info. trunk
authorrosfran
Wed Feb 07 20:38:39 2007 +0000 (2007-02-07)
branchtrunk
changeset 333f9d778bb88a2
parent 332 be533d944ceb
child 334 e326033fb048
[svn r335] Some fixes to the do_get_file_info.
libgnomevfs2-mythtv/modules/mythtv-method.c
     1.1 --- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Wed Feb 07 19:15:48 2007 +0000
     1.2 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Wed Feb 07 20:38:39 2007 +0000
     1.3 @@ -130,6 +130,8 @@
     1.4  	
     1.5  	    if (NULL == myth_handle->file_transfer) {
     1.6  	      ret = FALSE;
     1.7 +		    g_warning ("MythTV FileTransfer is NULL!\n");
     1.8 +		    return GNOME_VFS_ERROR_NOT_OPEN;
     1.9  	    }
    1.10  	    
    1.11    		if ( !gmyth_file_transfer_open( myth_handle->file_transfer, myth_handle->livetv->uri != NULL ? 
    1.12 @@ -170,7 +172,7 @@
    1.13  	  g_return_val_if_fail (myth_handle->file_transfer != NULL, GNOME_VFS_ERROR_NOT_OPEN);
    1.14  	  
    1.15  	  if ( myth_handle->file_transfer->filesize < 0 && is_livetv ) {
    1.16 -	  	myth_handle->content_size = (GnomeVFSFileSize) - 1;
    1.17 +	  	myth_handle->content_size = (GnomeVFSFileSize) 0;
    1.18  			myth_handle->content_size = gmyth_recorder_get_file_position( myth_handle->livetv->recorder );
    1.19  	  } else		
    1.20      	myth_handle->content_size = myth_handle->file_transfer->filesize;
    1.21 @@ -218,7 +220,7 @@
    1.22  
    1.23  		if (len < 0) {
    1.24  	    g_byte_array_free (tmp_buffer, TRUE);
    1.25 -	    g_warning ("Fail to read bytes");
    1.26 +	    g_print ("Fail to read bytes");
    1.27  	    return GNOME_VFS_ERROR_IO;
    1.28  	  } /*else if (len == 0) {
    1.29  		    g_byte_array_free (tmp_buffer, TRUE);
    1.30 @@ -334,13 +336,13 @@
    1.31  			res = gmyth_socket_connect_to_backend (socket, backend_info->hostname,
    1.32  					backend_info->port, TRUE);
    1.33  			if (!res) {
    1.34 -				g_warning ("[%s] LiveTV can not connect to backend", __FUNCTION__);	
    1.35 +				g_print ("[%s] LiveTV can not connect to backend", __FUNCTION__);	
    1.36  				res = FALSE;
    1.37  				goto error;
    1.38  			}
    1.39  
    1.40  			if ( gmyth_remote_util_get_free_recorder_count (socket) <= 0 ) {
    1.41 -				g_warning ("No free remote encoder available.");
    1.42 +				g_print ("No free remote encoder available.");
    1.43  				res = FALSE;
    1.44  				goto error;
    1.45  			}
    1.46 @@ -350,7 +352,7 @@
    1.47  			gmyth_socket_close_connection (socket);
    1.48  		
    1.49  			if ( recorder == NULL ) {
    1.50 -				g_warning ("[%s] None remote encoder available", __FUNCTION__);
    1.51 +				g_print ("[%s] None remote encoder available", __FUNCTION__);
    1.52  				res = FALSE;
    1.53  				goto error;
    1.54  			}
    1.55 @@ -358,7 +360,7 @@
    1.56  			/* Init remote encoder. Opens its control socket. */
    1.57  			res = gmyth_recorder_setup(recorder);
    1.58  			if ( !res ) {
    1.59 -				g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__);
    1.60 +				g_print ("[%s] Fail while setting remote encoder\n", __FUNCTION__);
    1.61  				res = FALSE;
    1.62  				goto error;
    1.63  			}
    1.64 @@ -368,6 +370,7 @@
    1.65  			gmyth_tvchain_initialize ( tvchain, backend_info );
    1.66  		
    1.67  			if ( tvchain == NULL || tvchain->tvchain_id == NULL ) {
    1.68 +				g_print ("[%s] TVChain couldn't be initialized.\n", __FUNCTION__);
    1.69  				res = FALSE;
    1.70  				goto error;
    1.71  			}
    1.72 @@ -376,7 +379,7 @@
    1.73  			res = gmyth_recorder_spawntv ( recorder,
    1.74  					gmyth_tvchain_get_id(tvchain) );
    1.75  			if (!res) {
    1.76 -				g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__);
    1.77 +				g_print ("[%s] Fail while spawn tv\n", __FUNCTION__);
    1.78  				res = FALSE;
    1.79  				goto error;
    1.80  			}
    1.81 @@ -387,8 +390,8 @@
    1.82  		    /* loop finished, set the max tries variable to zero again... */
    1.83  		    gint wait_to_transfer = 0;
    1.84  		
    1.85 -		    while (wait_to_transfer++ < MYTHTV_TRANSFER_MAX_WAITS &&
    1.86 -		        (gmyth_recorder_is_recording (recorder) == FALSE))
    1.87 +		    while ( wait_to_transfer++ < MYTHTV_TRANSFER_MAX_WAITS &&
    1.88 +		        (gmyth_recorder_is_recording (recorder) == FALSE) )
    1.89  		      g_usleep (500);
    1.90  		
    1.91  		    /* IS_RECORDING again, just like the MythTV backend does... */
    1.92 @@ -399,27 +402,29 @@
    1.93  					/* Pauses remote encoder. */
    1.94  					res = gmyth_recorder_pause_recording(recorder);
    1.95  					if ( !res ) {
    1.96 -						g_warning ("[%s] Fail while pausing remote encoder\n", __FUNCTION__);
    1.97 +						g_print ("[%s] Fail while pausing remote encoder\n", __FUNCTION__);
    1.98  						res = FALSE;
    1.99  						goto error;
   1.100  					}
   1.101  			
   1.102  			  	if ( gmyth_recorder_check_channel_name( recorder, channel_name ) )
   1.103  			  	{
   1.104 -				  	if ( gmyth_recorder_set_channel_name( recorder, channel_name ) )
   1.105 +				  	if ( !gmyth_recorder_set_channel_name( recorder, channel_name ) )
   1.106  				  	{
   1.107 -				  		g_warning( "Channel changed!!! [%s].\n", channel_name );
   1.108 +				  		g_warning( "Channel will not changes to: [%s].\n", channel_name );
   1.109  				  	}
   1.110  			  	}
   1.111  			
   1.112  				} /* if - changes the channel number */
   1.113  				
   1.114 -				sleep( 5 );
   1.115 +				//sleep( 1 );
   1.116  				
   1.117  		  }
   1.118  		  
   1.119  		  /* DEBUG message */  
   1.120  			GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( recorder );
   1.121 +			//gmyth_debug( "New ProgramInfo...\n" );
   1.122 +			gmyth_program_info_print( prog_info );
   1.123  			
   1.124  			if ( prog_info != NULL )
   1.125  			{
   1.126 @@ -441,14 +446,15 @@
   1.127  			} else {
   1.128  				file_info->size = gmyth_recorder_get_file_position( recorder );
   1.129  			}
   1.130 -
   1.131 +			
   1.132  	    if ( tvchain != NULL)
   1.133  	    	g_object_unref (tvchain);
   1.134  				
   1.135  	    if ( recorder != NULL )
   1.136  	    	g_object_unref (recorder);
   1.137 -	    	
   1.138 -	    g_object_unref( prog_info );
   1.139 +	    
   1.140 +	    if ( prog_info != NULL )
   1.141 +	    	g_object_unref( prog_info );
   1.142  
   1.143  	  } else {
   1.144