[svn r344] Next program chain with different MythTV backend messages. trunk
authorrosfran
Thu Feb 08 23:07:59 2007 +0000 (2007-02-08)
branchtrunk
changeset 342b00705a84ffe
parent 341 64ded911540b
child 343 2dea9369a985
[svn r344] Next program chain with different MythTV backend messages.
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_livetv.c
     1.1 --- a/gmyth/src/gmyth_file_transfer.c	Thu Feb 08 22:03:26 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_file_transfer.c	Thu Feb 08 23:07:59 2007 +0000
     1.3 @@ -595,7 +595,7 @@
     1.4  	    bytes_sent = gmyth_string_list_get_int( strlist,  0 ); // -1 on backend error
     1.5  	    gmyth_debug ( "[%s] got SENT buffer message = %d\n", __FUNCTION__, bytes_sent );
     1.6  
     1.7 -    	if ( bytes_sent >= 0 ) 
     1.8 +    	if ( bytes_sent >= 0 )
     1.9      	{
    1.10          gchar *data_buffer = g_new0 ( gchar, bytes_sent );    
    1.11     	    while ( 0 != bytes_sent ) 
    1.12 @@ -605,7 +605,7 @@
    1.13  
    1.14  	        total_read += bytes_read;
    1.15            bytes_sent -= bytes_read;
    1.16 -      
    1.17 +
    1.18              /* append new data to the increasing byte array */
    1.19  	    		data = g_byte_array_append (data, (const guint8*)data_buffer, bytes_read);
    1.20  	        gmyth_debug ("Total transfer data read: %d\n", total_read);
    1.21 @@ -622,8 +622,8 @@
    1.22      g_object_unref (strlist);
    1.23      strlist = NULL;
    1.24    }
    1.25 -  
    1.26 -  if ( bytes_sent == 0 && max_tries == 0 ) 
    1.27 +
    1.28 +  if ( bytes_sent == 0 || max_tries == 0 )
    1.29  	{
    1.30  		gmyth_debug( "Trying to move to the next program chain..." );
    1.31  		transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);
    1.32 @@ -638,6 +638,11 @@
    1.33  	  		
    1.34  	  		ret = gmyth_livetv_next_program_chain( transfer->priv->livetv );
    1.35  	  		
    1.36 +	  		if ( transfer->priv->livetv->proginfo != NULL && 
    1.37 +	  						transfer->priv->livetv->proginfo->pathname != NULL &&
    1.38 +	  						g_ascii_strcasecmp( transfer->priv->livetv->proginfo->pathname->str, transfer->filename ) != 0 )	  						
    1.39 +	  			ret = gmyth_file_transfer_open ( transfer, transfer->priv->livetv->proginfo->pathname->str );
    1.40 +	  		
    1.41  	  		g_mutex_unlock( transfer->mutex );
    1.42    		
    1.43  			if ( !ret )
    1.44 @@ -680,7 +685,7 @@
    1.45  	
    1.46  	transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer);	
    1.47  	
    1.48 -	transfer->priv->livetv = livetv;	
    1.49 +	transfer->priv->livetv = livetv;
    1.50  	transfer->priv->do_next_program_chain = TRUE;
    1.51  	
    1.52  	//g_object_unref( transfer );
     2.1 --- a/gmyth/src/gmyth_livetv.c	Thu Feb 08 22:03:26 2007 +0000
     2.2 +++ b/gmyth/src/gmyth_livetv.c	Thu Feb 08 23:07:59 2007 +0000
     2.3 @@ -175,6 +175,9 @@
     2.4  				if ( live_tv->file_transfer != NULL )
     2.5  				{
     2.6  					gmyth_debug( "Emitting signal to the FileTransfer... [ \"program-info-changed \" ]" );
     2.7 +					GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( live_tv->recorder );
     2.8 +					if ( prog_info != NULL )
     2.9 +						live_tv->proginfo = prog_info;
    2.10  					
    2.11  					gmyth_file_transfer_emit_program_info_changed_signal( live_tv->file_transfer,
    2.12  		             msg_code, (gpointer)live_tv );
    2.13 @@ -194,7 +197,10 @@
    2.14  				/* advertises the FileTransfer about the program info changed */
    2.15  				if ( live_tv->file_transfer != NULL )
    2.16  				{
    2.17 -					gmyth_debug( "Emitting signal to the FileTransfer... [ \"program-info-changed \" ]" );
    2.18 +					gmyth_debug( "Emitting signal to the FileTransfer... [ \"backend-done-recording\" ]" );
    2.19 +					GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( live_tv->recorder );
    2.20 +					if ( prog_info != NULL )
    2.21 +						live_tv->proginfo = prog_info;
    2.22  					
    2.23  					gmyth_file_transfer_emit_program_info_changed_signal( live_tv->file_transfer,
    2.24  		             msg_code, (gpointer)live_tv );
    2.25 @@ -547,15 +553,16 @@
    2.26  		goto error;		
    2.27  	}
    2.28  	
    2.29 -	prog_info = gmyth_recorder_get_next_program_info( livetv->recorder, BROWSE_DIRECTION_RIGHT );
    2.30 +	gmyth_debug( "Current ProgramInfo...\n" );
    2.31 +	prog_info = gmyth_recorder_get_current_program_info( livetv->recorder );
    2.32  	
    2.33 -	gmyth_debug( "Next ProgramInfo...\n" );
    2.34 -	
    2.35 -	if ( NULL == prog_info )
    2.36 +	if ( prog_info != NULL )
    2.37  	{
    2.38 -		gmyth_debug( "ProgramInfo is equals to NULL!!!" );
    2.39 -		
    2.40 -		return FALSE;
    2.41 +		livetv->proginfo = prog_info;
    2.42 +	} else {
    2.43 +		gmyth_debug( "ProgramInfo is equals to NULL!!! Getting the next program info..." );
    2.44 +		prog_info = gmyth_recorder_get_next_program_info( livetv->recorder, BROWSE_DIRECTION_RIGHT );
    2.45 +		livetv->proginfo = prog_info;		
    2.46  	}
    2.47  	/* prints program info data text */ 
    2.48  	gmyth_program_info_print( prog_info );