# HG changeset patch # User rosfran # Date 1169738140 0 # Node ID 42c40657fc617758c7fd57768c09f9007476ab80 # Parent c3fdac309aec3747083893473cefbd40601a1565 [svn r303] More program info related functions. diff -r c3fdac309aec -r 42c40657fc61 gmyth/src/gmyth_common.c --- a/gmyth/src/gmyth_common.c Wed Jan 24 23:06:53 2007 +0000 +++ b/gmyth/src/gmyth_common.c Thu Jan 25 15:15:40 2007 +0000 @@ -77,20 +77,34 @@ void gmyth_channel_info_print(GMythChannelInfo *channel_info) { - g_print("ChannelInfo (Name, ID) = (%s, %d)\n", + if ( channel_info != NULL ) + { + gmyth_debug("ChannelInfo (Name, ID) = (%s, %d)\n", channel_info->channel_name->str, channel_info->channel_ID); + } } void gmyth_program_info_print(GMythProgramInfo *program_info) { - g_print("ProgramInfo\n\tTitle = %s\n\t" - "Description = %s\n\t" - "Start time= %s\t" - "End time = %s\n", program_info->title->str, - program_info->description->str, - gmyth_util_time_to_string_from_time_val(program_info->startts), - gmyth_util_time_to_string_from_time_val(program_info->endts)); + + if ( program_info != NULL ) { + + gmyth_debug("ProgramInfo\n\tTitle = %s\n\t" + "Description = %s\n\t" + "Start time= %s\t" + "End time = %s\n" + "Path name = %s\n" + "File size = %lld\n" + , program_info->title->str, + program_info->description->str, + gmyth_util_time_to_string_from_time_val(program_info->startts), + gmyth_util_time_to_string_from_time_val(program_info->endts), + program_info->pathname->str, + program_info->filesize); + + } + } static void diff -r c3fdac309aec -r 42c40657fc61 gmyth/src/gmyth_file_transfer.c --- a/gmyth/src/gmyth_file_transfer.c Wed Jan 24 23:06:53 2007 +0000 +++ b/gmyth/src/gmyth_file_transfer.c Thu Jan 25 15:15:40 2007 +0000 @@ -597,11 +597,11 @@ } g_free (data_buffer); } /* if */ - } else if ( transfer->priv != NULL && transfer->priv->livetv != NULL && - transfer->priv->do_next_program_chain ) { + } else if ( !(transfer->priv != NULL && transfer->priv->livetv != NULL && + transfer->priv->do_next_program_chain) ) { total_read = GMYTHTV_FILE_TRANSFER_READ_ERROR; g_object_unref (strlist); - strlist = NULL; + strlist = NULL; break; } g_object_unref (strlist); diff -r c3fdac309aec -r 42c40657fc61 gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Wed Jan 24 23:06:53 2007 +0000 +++ b/gmyth/src/gmyth_livetv.c Thu Jan 25 15:15:40 2007 +0000 @@ -350,6 +350,19 @@ sleep (9); /* FIXME: this is evil (tpm) */ } + + /* DEBUG message */ + GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( livetv->recorder ); + + if ( NULL == prog_info ) + { + gmyth_debug( "ProgramInfo is equals to NULL!!!" ); + + return FALSE; + } + /* prints program info data text */ + gmyth_program_info_print( prog_info ); + /* DEBUG message */ // Reload all TV chain from Mysql database. gmyth_tvchain_reload_all (livetv->tvchain); @@ -443,6 +456,7 @@ gmyth_livetv_next_program_chain ( GMythLiveTV *livetv ) { gboolean res = TRUE; + GMythProgramInfo *prog_info = NULL; if ( !livetv->setup_done ) { @@ -453,25 +467,25 @@ //if ( !gmyth_livetv_monitor_handler_start( livetv ) ) // goto error; + prog_info = gmyth_recorder_get_current_program_info( livetv->recorder ); - /* Reload all TV chain from Mysql database. */ - gmyth_tvchain_reload_all (livetv->tvchain); + if ( NULL == prog_info ) + { + gmyth_debug( "ProgramInfo is equals to NULL!!!" ); + + return FALSE; + } + /* prints program info data text */ + gmyth_program_info_print( prog_info ); - if ( livetv->tvchain == NULL ) { + if ( prog_info != NULL ) { + res = TRUE; + gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK, program info changed."); + } else { + g_warning ("LiveTV not successfully started on the next program chain.\n", __FUNCTION__ ); res = FALSE; goto error; } - - // Get program info from database using chanid and starttime - livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, -1 ); - if ( livetv->proginfo == NULL ) { - g_warning ("[%s] LiveTV not successfully started on the next program chain.\n", __FUNCTION__ ); - res = FALSE; - goto error; - } else { - res = TRUE; - gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK, TV chain changed."); - } livetv->setup_done = TRUE; @@ -521,6 +535,13 @@ gmyth_debug( "URI path = %s.\n", livetv->proginfo->pathname->str ); g_static_mutex_lock( &lock ); + + if ( livetv->file_transfer != NULL ) + { + gmyth_file_transfer_close( livetv->file_transfer ); + g_object_unref( livetv->file_transfer ); + livetv->file_transfer = NULL; + } livetv->file_transfer = gmyth_file_transfer_new( livetv->backend_info ); diff -r c3fdac309aec -r 42c40657fc61 gmyth/src/gmyth_programinfo.c --- a/gmyth/src/gmyth_programinfo.c Wed Jan 24 23:06:53 2007 +0000 +++ b/gmyth/src/gmyth_programinfo.c Thu Jan 25 15:15:40 2007 +0000 @@ -350,7 +350,49 @@ GMythProgramInfo *prog = gmyth_program_info_new(); g_return_val_if_fail (slist != NULL, NULL); - + /* + Unknown + + + + 1000 + 9 + 1000 + Band + /mnt/store//1000_20070125110059.nuv + 0 + 0 + 1169733659 + 1169735400 + 0 + 0 + 0 + hmelo-desktop + 0 + 1 + 0 + 0 + -2 + 0 + 0 + 15 + 6 + 1169733659 + 1169735400 + 0 + 0 + LiveTV + 0 + + + + 1169733659 + 0.000000 + -1 + 0 + Default + 0 + */ prog->title = gmyth_string_list_get_string (slist, 0); prog->subtitle = gmyth_string_list_get_string (slist, 1); prog->description = gmyth_string_list_get_string (slist, 2); @@ -362,8 +404,8 @@ prog->pathname = gmyth_string_list_get_string (slist, 8); prog->filesize = gmyth_string_list_get_int64 (slist, 9); - gmyth_string_list_get_int (slist, 10); //DATETIME_TO_LIST(startts) - gmyth_string_list_get_int (slist, 11); //DATETIME_TO_LIST(endts) + prog->startts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 10) ); //DATETIME_TO_LIST(startts) + prog->endts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 11) ); //DATETIME_TO_LIST(endts) prog->duplicate = gmyth_string_list_get_int (slist, 12); prog->shareable = gmyth_string_list_get_int (slist, 13); prog->findid = gmyth_string_list_get_int (slist, 14); @@ -372,13 +414,13 @@ prog->cardid = gmyth_string_list_get_int (slist, 17); prog->inputid = gmyth_string_list_get_int (slist, 18); prog->recpriority = gmyth_string_list_get_int (slist, 19); - gmyth_string_list_get_int (slist, 20); + prog->reactivate = gmyth_string_list_get_int (slist, 20); prog->recordid = gmyth_string_list_get_int (slist, 21); gmyth_string_list_get_int (slist, 22); gmyth_string_list_get_int (slist, 23); gmyth_string_list_get_int (slist, 24); - gmyth_string_list_get_int (slist, 25); //DATETIME_TO_LIST(recstartts) - gmyth_string_list_get_int (slist, 26); //DATETIME_TO_LIST(recendts) + prog->recstartts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 25) ); //DATETIME_TO_LIST(recstartts) + prog->recendts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 26) ); //DATETIME_TO_LIST(recendts) prog->repeat = gmyth_string_list_get_int (slist, 27); prog->programflags = gmyth_string_list_get_int (slist, 28); prog->recgroup = gmyth_string_list_get_string (slist, 29); //prog->(recgroup != "") ? recgroup : "Default") @@ -386,9 +428,9 @@ prog->chanOutputFilters = gmyth_string_list_get_string (slist, 31); prog->seriesid = gmyth_string_list_get_string (slist, 32); prog->programid = gmyth_string_list_get_string (slist, 33); - gmyth_string_list_get_int (slist, 34); //DATETIME_TO_LIST(lastmodified) + prog->lastmodified = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 34) ); //DATETIME_TO_LIST(lastmodified) gmyth_string_list_get_int (slist, 35); //FLOAT_TO_LIST(stars) - gmyth_string_list_get_int (slist, 36); //DATETIME_TO_LIST(QDateTime(originalAirDate)) + prog->originalAirDate = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 36) ); //DATETIME_TO_LIST(QDateTime(originalAirDate)) prog->hasAirDate = gmyth_string_list_get_int (slist, 37); prog->playgroup = gmyth_string_list_get_string (slist, 38); //prog->(playgroup != "") ? playgroup : "Default") prog->recpriority2 = gmyth_string_list_get_int (slist, 39);