# HG changeset patch # User rosfran # Date 1170976079 0 # Node ID b00705a84ffedb3623f661b6883cf7c93f4a2342 # Parent 64ded911540bfc5ceee603f9b390386c105b214b [svn r344] Next program chain with different MythTV backend messages. diff -r 64ded911540b -r b00705a84ffe gmyth/src/gmyth_file_transfer.c --- a/gmyth/src/gmyth_file_transfer.c Thu Feb 08 22:03:26 2007 +0000 +++ b/gmyth/src/gmyth_file_transfer.c Thu Feb 08 23:07:59 2007 +0000 @@ -595,7 +595,7 @@ bytes_sent = gmyth_string_list_get_int( strlist, 0 ); // -1 on backend error gmyth_debug ( "[%s] got SENT buffer message = %d\n", __FUNCTION__, bytes_sent ); - if ( bytes_sent >= 0 ) + if ( bytes_sent >= 0 ) { gchar *data_buffer = g_new0 ( gchar, bytes_sent ); while ( 0 != bytes_sent ) @@ -605,7 +605,7 @@ total_read += bytes_read; bytes_sent -= bytes_read; - + /* append new data to the increasing byte array */ data = g_byte_array_append (data, (const guint8*)data_buffer, bytes_read); gmyth_debug ("Total transfer data read: %d\n", total_read); @@ -622,8 +622,8 @@ g_object_unref (strlist); strlist = NULL; } - - if ( bytes_sent == 0 && max_tries == 0 ) + + if ( bytes_sent == 0 || max_tries == 0 ) { gmyth_debug( "Trying to move to the next program chain..." ); transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer); @@ -638,6 +638,11 @@ ret = gmyth_livetv_next_program_chain( transfer->priv->livetv ); + if ( transfer->priv->livetv->proginfo != NULL && + transfer->priv->livetv->proginfo->pathname != NULL && + g_ascii_strcasecmp( transfer->priv->livetv->proginfo->pathname->str, transfer->filename ) != 0 ) + ret = gmyth_file_transfer_open ( transfer, transfer->priv->livetv->proginfo->pathname->str ); + g_mutex_unlock( transfer->mutex ); if ( !ret ) @@ -680,7 +685,7 @@ transfer->priv = GMYTH_FILE_TRANSFER_GET_PRIVATE(transfer); - transfer->priv->livetv = livetv; + transfer->priv->livetv = livetv; transfer->priv->do_next_program_chain = TRUE; //g_object_unref( transfer ); diff -r 64ded911540b -r b00705a84ffe gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Thu Feb 08 22:03:26 2007 +0000 +++ b/gmyth/src/gmyth_livetv.c Thu Feb 08 23:07:59 2007 +0000 @@ -175,6 +175,9 @@ if ( live_tv->file_transfer != NULL ) { gmyth_debug( "Emitting signal to the FileTransfer... [ \"program-info-changed \" ]" ); + GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( live_tv->recorder ); + if ( prog_info != NULL ) + live_tv->proginfo = prog_info; gmyth_file_transfer_emit_program_info_changed_signal( live_tv->file_transfer, msg_code, (gpointer)live_tv ); @@ -194,7 +197,10 @@ /* advertises the FileTransfer about the program info changed */ if ( live_tv->file_transfer != NULL ) { - gmyth_debug( "Emitting signal to the FileTransfer... [ \"program-info-changed \" ]" ); + gmyth_debug( "Emitting signal to the FileTransfer... [ \"backend-done-recording\" ]" ); + GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( live_tv->recorder ); + if ( prog_info != NULL ) + live_tv->proginfo = prog_info; gmyth_file_transfer_emit_program_info_changed_signal( live_tv->file_transfer, msg_code, (gpointer)live_tv ); @@ -547,15 +553,16 @@ goto error; } - prog_info = gmyth_recorder_get_next_program_info( livetv->recorder, BROWSE_DIRECTION_RIGHT ); + gmyth_debug( "Current ProgramInfo...\n" ); + prog_info = gmyth_recorder_get_current_program_info( livetv->recorder ); - gmyth_debug( "Next ProgramInfo...\n" ); - - if ( NULL == prog_info ) + if ( prog_info != NULL ) { - gmyth_debug( "ProgramInfo is equals to NULL!!!" ); - - return FALSE; + livetv->proginfo = prog_info; + } else { + gmyth_debug( "ProgramInfo is equals to NULL!!! Getting the next program info..." ); + prog_info = gmyth_recorder_get_next_program_info( livetv->recorder, BROWSE_DIRECTION_RIGHT ); + livetv->proginfo = prog_info; } /* prints program info data text */ gmyth_program_info_print( prog_info );