# HG changeset patch # User rosfran # Date 1170113737 0 # Node ID 0638b71f9293c7ecc15fc7fd38486b7b52273343 # Parent 311da9c88a5354bd1cb5fa4a43ed36fde9638492 [svn r311] A lot of fixes regarding program info structure creation. diff -r 311da9c88a53 -r 0638b71f9293 gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Mon Jan 29 14:14:26 2007 +0000 +++ b/gmyth/src/gmyth_livetv.c Mon Jan 29 23:35:37 2007 +0000 @@ -393,7 +393,9 @@ /* check if the program chain could be obtained from the MythTV protocol message */ if ( prog_info != NULL ) { - livetv->proginfo = prog_info; + livetv->proginfo = prog_info; + /* testing change channel */ + //gmyth_recorder_spawntv_no_tvchain( livetv->recorder ); } else { /* check for the program info in the TV program chain could be obtained @@ -420,7 +422,7 @@ } - livetv->uri = gmyth_backend_info_get_uri( backend_info ); + livetv->uri = (GMythURI*)gmyth_backend_info_get_uri( backend_info ); g_static_mutex_unlock( &lock ); diff -r 311da9c88a53 -r 0638b71f9293 gmyth/src/gmyth_programinfo.c --- a/gmyth/src/gmyth_programinfo.c Mon Jan 29 14:14:26 2007 +0000 +++ b/gmyth/src/gmyth_programinfo.c Mon Jan 29 23:35:37 2007 +0000 @@ -299,47 +299,49 @@ g_return_val_if_fail (prog != NULL, NULL); g_return_val_if_fail (slist != NULL, NULL); - gmyth_string_list_append_string (slist, prog->title); - gmyth_string_list_append_string (slist, prog->subtitle); - gmyth_string_list_append_string (slist, prog->description); - gmyth_string_list_append_string (slist, prog->category); - gmyth_string_list_append_string (slist, prog->chanid); - gmyth_string_list_append_string (slist, prog->chanstr); - gmyth_string_list_append_string (slist, prog->chansign); - gmyth_string_list_append_string (slist, prog->channame); - gmyth_string_list_append_string (slist, prog->pathname); - gmyth_string_list_append_int64 (slist, prog->filesize); + gmyth_string_list_append_string (slist, prog->title); /* 0 */ + gmyth_string_list_append_string (slist, prog->subtitle); /* 1 */ + gmyth_string_list_append_string (slist, prog->description); /* 2 */ + gmyth_string_list_append_string (slist, prog->category); /* 3 */ + gmyth_string_list_append_string (slist, prog->chanid); /* 4 */ + gmyth_string_list_append_string (slist, prog->chanstr); /* 5 */ + gmyth_string_list_append_string (slist, prog->chansign); /* 6 */ + gmyth_string_list_append_string (slist, prog->channame); /* 7 */ + gmyth_string_list_append_string (slist, prog->pathname); /* 8 */ + gmyth_string_list_append_int64 (slist, prog->filesize); /* 9 */ + gmyth_string_list_get_int64 (slist, 10); /* 11 */ - gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(startts) - gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(endts) - gmyth_string_list_append_int (slist, prog->duplicate); - gmyth_string_list_append_int (slist, prog->shareable); - gmyth_string_list_append_int (slist, prog->findid); - gmyth_string_list_append_string (slist, prog->hostname); - gmyth_string_list_append_int (slist, prog->sourceid); - gmyth_string_list_append_int (slist, prog->cardid); - gmyth_string_list_append_int (slist, prog->inputid); - gmyth_string_list_append_int (slist, prog->recpriority); - gmyth_string_list_append_int (slist, 0 /*prog->recstatus*/); - gmyth_string_list_append_int (slist, prog->recordid); - gmyth_string_list_append_int (slist, 0 /*prog->rectype*/); - gmyth_string_list_append_int (slist, 0 /*prog->dupin*/); - gmyth_string_list_append_int (slist, 0 /*prog->dupmethod*/); - gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(recstartts) - gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(recendts) - gmyth_string_list_append_int (slist, prog->repeat); - gmyth_string_list_append_int (slist, prog->programflags); - gmyth_string_list_append_char_array (slist, "Default"); //prog->(recgroup != "") ? recgroup : "Default") - gmyth_string_list_append_int (slist, prog->chancommfree); - gmyth_string_list_append_string (slist, prog->chanOutputFilters); - gmyth_string_list_append_string (slist, prog->seriesid); - gmyth_string_list_append_string (slist, prog->programid); - gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(lastmodified) - gmyth_string_list_append_int (slist, 0); //FLOAT_TO_LIST(stars) - gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(QDateTime(originalAirDate)) - gmyth_string_list_append_int (slist, prog->hasAirDate); - gmyth_string_list_append_char_array (slist, "Default"); //prog->(playgroup != "") ? playgroup : "Default") - gmyth_string_list_append_int (slist, prog->recpriority2); + gmyth_string_list_append_int (slist, prog->startts->tv_sec); /* 11 */ //DATETIME_TO_LIST(startts) + gmyth_string_list_append_int (slist, prog->endts->tv_sec); /* 12 */ //DATETIME_TO_LIST(endts) + gmyth_string_list_append_int (slist, prog->duplicate); /* 13 */ + gmyth_string_list_append_int (slist, prog->shareable); /* 14 */ + gmyth_string_list_append_int (slist, prog->findid); /* 15 */ + gmyth_string_list_append_string (slist, prog->hostname); /* 16 */ + gmyth_string_list_append_int (slist, prog->sourceid); /* 17 */ + gmyth_string_list_append_int (slist, prog->cardid); /* 18 */ + gmyth_string_list_append_int (slist, prog->inputid); /* 19 */ + gmyth_string_list_append_int (slist, prog->recpriority); /* 20 */ + gmyth_string_list_append_int (slist, 0 /*prog->recstatus*/); /* 21 */ + gmyth_string_list_append_int (slist, prog->recordid); /* 22 */ + gmyth_string_list_append_int (slist, 0 /*prog->rectype*/); /* 23 */ + gmyth_string_list_append_int (slist, 0 /*prog->dupin*/); /* 24 */ + gmyth_string_list_append_int (slist, 0 /*prog->dupmethod*/); /* 25 */ + gmyth_string_list_append_int (slist, prog->recstartts != NULL ? prog->recstartts->tv_sec : 0); /* 26 */ //DATETIME_TO_LIST(recstartts) + gmyth_string_list_append_int (slist, prog->recendts != NULL ? prog->recendts->tv_sec : 0); /* 27 */ //DATETIME_TO_LIST(recendts) + gmyth_string_list_append_int (slist, prog->repeat); /* 28 */ + gmyth_string_list_append_int (slist, prog->programflags); /* 29 */ + gmyth_string_list_append_char_array (slist, "Default"); /* 30 */ //prog->(recgroup != "") ? recgroup : "Default") + gmyth_string_list_append_int (slist, prog->chancommfree); /* 31 */ + gmyth_string_list_append_string (slist, prog->chanOutputFilters); /* 32 */ + gmyth_string_list_append_string (slist, prog->seriesid); /* 33 */ + gmyth_string_list_append_string (slist, prog->programid); /* 34 */ + gmyth_string_list_append_string (slist, ""); /* 35 */ + gmyth_string_list_append_int (slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0); /* 36 */ //DATETIME_TO_LIST(lastmodified) + gmyth_string_list_append_int (slist, 0); /* 37 */ //FLOAT_TO_LIST(stars) + gmyth_string_list_append_int (slist, prog->originalAirDate != NULL ? prog->originalAirDate->tv_sec : 0); /* 38 */ //DATETIME_TO_LIST(QDateTime(originalAirDate)) + gmyth_string_list_append_int (slist, prog->hasAirDate); /* 39 */ + gmyth_string_list_append_char_array (slist, "Default"); /* 40 */ //prog->(playgroup != "") ? playgroup : "Default") + gmyth_string_list_append_int (slist, prog->recpriority2); /* 41 */ return slist; } @@ -433,13 +435,15 @@ prog->chanOutputFilters = gmyth_string_list_get_string (slist, 32); prog->seriesid = gmyth_string_list_get_string (slist, 33); prog->programid = gmyth_string_list_get_string (slist, 34); - prog->lastmodified = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 35) ); //DATETIME_TO_LIST(lastmodified) - gmyth_string_list_get_int (slist, 36); //FLOAT_TO_LIST(stars) - prog->originalAirDate = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 37) ); //DATETIME_TO_LIST(QDateTime(originalAirDate)) - prog->hasAirDate = gmyth_string_list_get_int (slist, 38); - prog->playgroup = gmyth_string_list_get_string (slist, 39); //prog->(playgroup != "") ? playgroup : "Default") - prog->recpriority2 = gmyth_string_list_get_int (slist, 40); + gmyth_string_list_get_string (slist, 35); + prog->lastmodified = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat( + (time_t)gmyth_string_list_get_int (slist, 36) ))->str ); //DATETIME_TO_LIST(lastmodified) + gmyth_string_list_get_int (slist, 37); //FLOAT_TO_LIST(stars) + prog->originalAirDate = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat( + (time_t)gmyth_string_list_get_int (slist, 38) ))->str ); //DATETIME_TO_LIST(QDateTime(originalAirDate)) + prog->hasAirDate = gmyth_string_list_get_int (slist, 39); + prog->playgroup = gmyth_string_list_get_string (slist, 40); //prog->(playgroup != "") ? playgroup : "Default") + prog->recpriority2 = gmyth_string_list_get_int (slist, 41); return prog; } - diff -r 311da9c88a53 -r 0638b71f9293 gmyth/src/gmyth_recorder.c --- a/gmyth/src/gmyth_recorder.c Mon Jan 29 14:14:26 2007 +0000 +++ b/gmyth/src/gmyth_recorder.c Mon Jan 29 23:35:37 2007 +0000 @@ -178,6 +178,50 @@ } +/** + * Sends the SPAWN_LIVETV command through Mythtv protocol. This command + * requests the backend to start capturing TV content, but it doesn't need + * the TV chain ID. + * + * @param recorder The GMythRecorder instance. + * @return true if success, false if any error happens. + */ +gboolean +gmyth_recorder_spawntv_no_tvchain (GMythRecorder *recorder) +{ + GMythStringList *str_list; + GString *tmp_str = g_string_new( GMYTHTV_RECORDER_HEADER ); + + gmyth_debug ("[%s] Spawntv, no TV chain!", __FUNCTION__); + + str_list = gmyth_string_list_new (); + + g_string_append_printf ( tmp_str, " %d", recorder->recorder_num ); + + gmyth_string_list_append_string (str_list, tmp_str); + gmyth_string_list_append_string (str_list, g_string_new ("SPAWN_LIVETV")); + + gmyth_socket_sendreceive_stringlist (recorder->myth_socket, str_list); + + g_string_free (tmp_str, TRUE); + + tmp_str = gmyth_string_list_get_string (str_list, 0); + if (tmp_str == NULL) { + g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str); + return FALSE; + } + + if (g_ascii_strncasecmp (tmp_str->str, "ok", 2)) { + g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str); + g_object_unref (str_list); + return FALSE; + } + + g_object_unref (str_list); + return TRUE; + +} + /** Sends the command STOP_LIVETV to Mythtv backend. * * @param recorder the GMythRecorder instance. diff -r 311da9c88a53 -r 0638b71f9293 gmyth/src/gmyth_recorder.h --- a/gmyth/src/gmyth_recorder.h Mon Jan 29 14:14:26 2007 +0000 +++ b/gmyth/src/gmyth_recorder.h Mon Jan 29 23:35:37 2007 +0000 @@ -89,6 +89,9 @@ gboolean gmyth_recorder_setup (GMythRecorder *recorder); gboolean gmyth_recorder_spawntv (GMythRecorder *recorder, GString *tvchain_id); + +gboolean gmyth_recorder_spawntv_no_tvchain (GMythRecorder *recorder); + gboolean gmyth_recorder_stop_livetv (GMythRecorder *recorder); gboolean gmyth_recorder_send_frontend_ready_command (GMythRecorder *recorder);