[svn r303] More program info related functions.
1.1 --- a/gmyth/src/gmyth_common.c Wed Jan 24 23:06:53 2007 +0000
1.2 +++ b/gmyth/src/gmyth_common.c Thu Jan 25 15:15:40 2007 +0000
1.3 @@ -77,20 +77,34 @@
1.4 void
1.5 gmyth_channel_info_print(GMythChannelInfo *channel_info)
1.6 {
1.7 - g_print("ChannelInfo (Name, ID) = (%s, %d)\n",
1.8 + if ( channel_info != NULL )
1.9 + {
1.10 + gmyth_debug("ChannelInfo (Name, ID) = (%s, %d)\n",
1.11 channel_info->channel_name->str, channel_info->channel_ID);
1.12 + }
1.13 }
1.14
1.15 void
1.16 gmyth_program_info_print(GMythProgramInfo *program_info)
1.17 {
1.18 - g_print("ProgramInfo\n\tTitle = %s\n\t"
1.19 - "Description = %s\n\t"
1.20 - "Start time= %s\t"
1.21 - "End time = %s\n", program_info->title->str,
1.22 - program_info->description->str,
1.23 - gmyth_util_time_to_string_from_time_val(program_info->startts),
1.24 - gmyth_util_time_to_string_from_time_val(program_info->endts));
1.25 +
1.26 + if ( program_info != NULL ) {
1.27 +
1.28 + gmyth_debug("ProgramInfo\n\tTitle = %s\n\t"
1.29 + "Description = %s\n\t"
1.30 + "Start time= %s\t"
1.31 + "End time = %s\n"
1.32 + "Path name = %s\n"
1.33 + "File size = %lld\n"
1.34 + , program_info->title->str,
1.35 + program_info->description->str,
1.36 + gmyth_util_time_to_string_from_time_val(program_info->startts),
1.37 + gmyth_util_time_to_string_from_time_val(program_info->endts),
1.38 + program_info->pathname->str,
1.39 + program_info->filesize);
1.40 +
1.41 + }
1.42 +
1.43 }
1.44
1.45 static void
2.1 --- a/gmyth/src/gmyth_file_transfer.c Wed Jan 24 23:06:53 2007 +0000
2.2 +++ b/gmyth/src/gmyth_file_transfer.c Thu Jan 25 15:15:40 2007 +0000
2.3 @@ -597,11 +597,11 @@
2.4 }
2.5 g_free (data_buffer);
2.6 } /* if */
2.7 - } else if ( transfer->priv != NULL && transfer->priv->livetv != NULL &&
2.8 - transfer->priv->do_next_program_chain ) {
2.9 + } else if ( !(transfer->priv != NULL && transfer->priv->livetv != NULL &&
2.10 + transfer->priv->do_next_program_chain) ) {
2.11 total_read = GMYTHTV_FILE_TRANSFER_READ_ERROR;
2.12 g_object_unref (strlist);
2.13 - strlist = NULL;
2.14 + strlist = NULL;
2.15 break;
2.16 }
2.17 g_object_unref (strlist);
3.1 --- a/gmyth/src/gmyth_livetv.c Wed Jan 24 23:06:53 2007 +0000
3.2 +++ b/gmyth/src/gmyth_livetv.c Thu Jan 25 15:15:40 2007 +0000
3.3 @@ -350,6 +350,19 @@
3.4
3.5 sleep (9); /* FIXME: this is evil (tpm) */
3.6 }
3.7 +
3.8 + /* DEBUG message */
3.9 + GMythProgramInfo* prog_info = gmyth_recorder_get_current_program_info( livetv->recorder );
3.10 +
3.11 + if ( NULL == prog_info )
3.12 + {
3.13 + gmyth_debug( "ProgramInfo is equals to NULL!!!" );
3.14 +
3.15 + return FALSE;
3.16 + }
3.17 + /* prints program info data text */
3.18 + gmyth_program_info_print( prog_info );
3.19 + /* DEBUG message */
3.20
3.21 // Reload all TV chain from Mysql database.
3.22 gmyth_tvchain_reload_all (livetv->tvchain);
3.23 @@ -443,6 +456,7 @@
3.24 gmyth_livetv_next_program_chain ( GMythLiveTV *livetv )
3.25 {
3.26 gboolean res = TRUE;
3.27 + GMythProgramInfo *prog_info = NULL;
3.28
3.29 if ( !livetv->setup_done )
3.30 {
3.31 @@ -453,25 +467,25 @@
3.32
3.33 //if ( !gmyth_livetv_monitor_handler_start( livetv ) )
3.34 // goto error;
3.35 + prog_info = gmyth_recorder_get_current_program_info( livetv->recorder );
3.36
3.37 - /* Reload all TV chain from Mysql database. */
3.38 - gmyth_tvchain_reload_all (livetv->tvchain);
3.39 + if ( NULL == prog_info )
3.40 + {
3.41 + gmyth_debug( "ProgramInfo is equals to NULL!!!" );
3.42 +
3.43 + return FALSE;
3.44 + }
3.45 + /* prints program info data text */
3.46 + gmyth_program_info_print( prog_info );
3.47
3.48 - if ( livetv->tvchain == NULL ) {
3.49 + if ( prog_info != NULL ) {
3.50 + res = TRUE;
3.51 + gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK, program info changed.");
3.52 + } else {
3.53 + g_warning ("LiveTV not successfully started on the next program chain.\n", __FUNCTION__ );
3.54 res = FALSE;
3.55 goto error;
3.56 }
3.57 -
3.58 - // Get program info from database using chanid and starttime
3.59 - livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, -1 );
3.60 - if ( livetv->proginfo == NULL ) {
3.61 - g_warning ("[%s] LiveTV not successfully started on the next program chain.\n", __FUNCTION__ );
3.62 - res = FALSE;
3.63 - goto error;
3.64 - } else {
3.65 - res = TRUE;
3.66 - gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK, TV chain changed.");
3.67 - }
3.68
3.69 livetv->setup_done = TRUE;
3.70
3.71 @@ -521,6 +535,13 @@
3.72 gmyth_debug( "URI path = %s.\n", livetv->proginfo->pathname->str );
3.73
3.74 g_static_mutex_lock( &lock );
3.75 +
3.76 + if ( livetv->file_transfer != NULL )
3.77 + {
3.78 + gmyth_file_transfer_close( livetv->file_transfer );
3.79 + g_object_unref( livetv->file_transfer );
3.80 + livetv->file_transfer = NULL;
3.81 + }
3.82
3.83 livetv->file_transfer = gmyth_file_transfer_new( livetv->backend_info );
3.84
4.1 --- a/gmyth/src/gmyth_programinfo.c Wed Jan 24 23:06:53 2007 +0000
4.2 +++ b/gmyth/src/gmyth_programinfo.c Thu Jan 25 15:15:40 2007 +0000
4.3 @@ -350,7 +350,49 @@
4.4 GMythProgramInfo *prog = gmyth_program_info_new();
4.5
4.6 g_return_val_if_fail (slist != NULL, NULL);
4.7 -
4.8 + /*
4.9 + Unknown
4.10 +
4.11 +
4.12 +
4.13 + 1000
4.14 + 9
4.15 + 1000
4.16 + Band
4.17 + /mnt/store//1000_20070125110059.nuv
4.18 + 0
4.19 + 0
4.20 + 1169733659
4.21 + 1169735400
4.22 + 0
4.23 + 0
4.24 + 0
4.25 + hmelo-desktop
4.26 + 0
4.27 + 1
4.28 + 0
4.29 + 0
4.30 + -2
4.31 + 0
4.32 + 0
4.33 + 15
4.34 + 6
4.35 + 1169733659
4.36 + 1169735400
4.37 + 0
4.38 + 0
4.39 + LiveTV
4.40 + 0
4.41 +
4.42 +
4.43 +
4.44 + 1169733659
4.45 + 0.000000
4.46 + -1
4.47 + 0
4.48 + Default
4.49 + 0
4.50 + */
4.51 prog->title = gmyth_string_list_get_string (slist, 0);
4.52 prog->subtitle = gmyth_string_list_get_string (slist, 1);
4.53 prog->description = gmyth_string_list_get_string (slist, 2);
4.54 @@ -362,8 +404,8 @@
4.55 prog->pathname = gmyth_string_list_get_string (slist, 8);
4.56 prog->filesize = gmyth_string_list_get_int64 (slist, 9);
4.57
4.58 - gmyth_string_list_get_int (slist, 10); //DATETIME_TO_LIST(startts)
4.59 - gmyth_string_list_get_int (slist, 11); //DATETIME_TO_LIST(endts)
4.60 + prog->startts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 10) ); //DATETIME_TO_LIST(startts)
4.61 + prog->endts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 11) ); //DATETIME_TO_LIST(endts)
4.62 prog->duplicate = gmyth_string_list_get_int (slist, 12);
4.63 prog->shareable = gmyth_string_list_get_int (slist, 13);
4.64 prog->findid = gmyth_string_list_get_int (slist, 14);
4.65 @@ -372,13 +414,13 @@
4.66 prog->cardid = gmyth_string_list_get_int (slist, 17);
4.67 prog->inputid = gmyth_string_list_get_int (slist, 18);
4.68 prog->recpriority = gmyth_string_list_get_int (slist, 19);
4.69 - gmyth_string_list_get_int (slist, 20);
4.70 + prog->reactivate = gmyth_string_list_get_int (slist, 20);
4.71 prog->recordid = gmyth_string_list_get_int (slist, 21);
4.72 gmyth_string_list_get_int (slist, 22);
4.73 gmyth_string_list_get_int (slist, 23);
4.74 gmyth_string_list_get_int (slist, 24);
4.75 - gmyth_string_list_get_int (slist, 25); //DATETIME_TO_LIST(recstartts)
4.76 - gmyth_string_list_get_int (slist, 26); //DATETIME_TO_LIST(recendts)
4.77 + prog->recstartts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 25) ); //DATETIME_TO_LIST(recstartts)
4.78 + prog->recendts = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 26) ); //DATETIME_TO_LIST(recendts)
4.79 prog->repeat = gmyth_string_list_get_int (slist, 27);
4.80 prog->programflags = gmyth_string_list_get_int (slist, 28);
4.81 prog->recgroup = gmyth_string_list_get_string (slist, 29); //prog->(recgroup != "") ? recgroup : "Default")
4.82 @@ -386,9 +428,9 @@
4.83 prog->chanOutputFilters = gmyth_string_list_get_string (slist, 31);
4.84 prog->seriesid = gmyth_string_list_get_string (slist, 32);
4.85 prog->programid = gmyth_string_list_get_string (slist, 33);
4.86 - gmyth_string_list_get_int (slist, 34); //DATETIME_TO_LIST(lastmodified)
4.87 + prog->lastmodified = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 34) ); //DATETIME_TO_LIST(lastmodified)
4.88 gmyth_string_list_get_int (slist, 35); //FLOAT_TO_LIST(stars)
4.89 - gmyth_string_list_get_int (slist, 36); //DATETIME_TO_LIST(QDateTime(originalAirDate))
4.90 + prog->originalAirDate = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 36) ); //DATETIME_TO_LIST(QDateTime(originalAirDate))
4.91 prog->hasAirDate = gmyth_string_list_get_int (slist, 37);
4.92 prog->playgroup = gmyth_string_list_get_string (slist, 38); //prog->(playgroup != "") ? playgroup : "Default")
4.93 prog->recpriority2 = gmyth_string_list_get_int (slist, 39);