# HG changeset patch # User rosfran # Date 1170880719 0 # Node ID f9d778bb88a2d74a3c1323c130f02cd0a70829d5 # Parent be533d944ceb9ac776543cb34e7a05ade1db9d6f [svn r335] Some fixes to the do_get_file_info. diff -r be533d944ceb -r f9d778bb88a2 libgnomevfs2-mythtv/modules/mythtv-method.c --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Wed Feb 07 19:15:48 2007 +0000 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Wed Feb 07 20:38:39 2007 +0000 @@ -130,6 +130,8 @@ if (NULL == myth_handle->file_transfer) { ret = FALSE; + g_warning ("MythTV FileTransfer is NULL!\n"); + return GNOME_VFS_ERROR_NOT_OPEN; } if ( !gmyth_file_transfer_open( myth_handle->file_transfer, myth_handle->livetv->uri != NULL ? @@ -170,7 +172,7 @@ g_return_val_if_fail (myth_handle->file_transfer != NULL, GNOME_VFS_ERROR_NOT_OPEN); if ( myth_handle->file_transfer->filesize < 0 && is_livetv ) { - myth_handle->content_size = (GnomeVFSFileSize) - 1; + myth_handle->content_size = (GnomeVFSFileSize) 0; myth_handle->content_size = gmyth_recorder_get_file_position( myth_handle->livetv->recorder ); } else myth_handle->content_size = myth_handle->file_transfer->filesize; @@ -218,7 +220,7 @@ if (len < 0) { g_byte_array_free (tmp_buffer, TRUE); - g_warning ("Fail to read bytes"); + g_print ("Fail to read bytes"); return GNOME_VFS_ERROR_IO; } /*else if (len == 0) { g_byte_array_free (tmp_buffer, TRUE); @@ -334,13 +336,13 @@ res = gmyth_socket_connect_to_backend (socket, backend_info->hostname, backend_info->port, TRUE); if (!res) { - g_warning ("[%s] LiveTV can not connect to backend", __FUNCTION__); + g_print ("[%s] LiveTV can not connect to backend", __FUNCTION__); res = FALSE; goto error; } if ( gmyth_remote_util_get_free_recorder_count (socket) <= 0 ) { - g_warning ("No free remote encoder available."); + g_print ("No free remote encoder available."); res = FALSE; goto error; } @@ -350,7 +352,7 @@ gmyth_socket_close_connection (socket); if ( recorder == NULL ) { - g_warning ("[%s] None remote encoder available", __FUNCTION__); + g_print ("[%s] None remote encoder available", __FUNCTION__); res = FALSE; goto error; } @@ -358,7 +360,7 @@ /* Init remote encoder. Opens its control socket. */ res = gmyth_recorder_setup(recorder); if ( !res ) { - g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__); + g_print ("[%s] Fail while setting remote encoder\n", __FUNCTION__); res = FALSE; goto error; } @@ -368,6 +370,7 @@ gmyth_tvchain_initialize ( tvchain, backend_info ); if ( tvchain == NULL || tvchain->tvchain_id == NULL ) { + g_print ("[%s] TVChain couldn't be initialized.\n", __FUNCTION__); res = FALSE; goto error; } @@ -376,7 +379,7 @@ res = gmyth_recorder_spawntv ( recorder, gmyth_tvchain_get_id(tvchain) ); if (!res) { - g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__); + g_print ("[%s] Fail while spawn tv\n", __FUNCTION__); res = FALSE; goto error; } @@ -387,8 +390,8 @@ /* loop finished, set the max tries variable to zero again... */ gint wait_to_transfer = 0; - while (wait_to_transfer++ < MYTHTV_TRANSFER_MAX_WAITS && - (gmyth_recorder_is_recording (recorder) == FALSE)) + while ( wait_to_transfer++ < MYTHTV_TRANSFER_MAX_WAITS && + (gmyth_recorder_is_recording (recorder) == FALSE) ) g_usleep (500); /* IS_RECORDING again, just like the MythTV backend does... */ @@ -399,27 +402,29 @@ /* Pauses remote encoder. */ res = gmyth_recorder_pause_recording(recorder); if ( !res ) { - g_warning ("[%s] Fail while pausing remote encoder\n", __FUNCTION__); + g_print ("[%s] Fail while pausing remote encoder\n", __FUNCTION__); res = FALSE; goto error; } if ( gmyth_recorder_check_channel_name( recorder, channel_name ) ) { - if ( gmyth_recorder_set_channel_name( recorder, channel_name ) ) + if ( !gmyth_recorder_set_channel_name( recorder, channel_name ) ) { - g_warning( "Channel changed!!! [%s].\n", channel_name ); + g_warning( "Channel will not changes to: [%s].\n", channel_name ); } } } /* if - changes the channel number */ - sleep( 5 ); + //sleep( 1 ); } /* DEBUG message */ GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( recorder ); + //gmyth_debug( "New ProgramInfo...\n" ); + gmyth_program_info_print( prog_info ); if ( prog_info != NULL ) { @@ -441,14 +446,15 @@ } else { file_info->size = gmyth_recorder_get_file_position( recorder ); } - + if ( tvchain != NULL) g_object_unref (tvchain); if ( recorder != NULL ) g_object_unref (recorder); - - g_object_unref( prog_info ); + + if ( prog_info != NULL ) + g_object_unref( prog_info ); } else {