[svn r311] A lot of fixes regarding program info structure creation. trunk
authorrosfran
Mon Jan 29 23:35:37 2007 +0000 (2007-01-29)
branchtrunk
changeset 3100638b71f9293
parent 309 311da9c88a53
child 311 916ac82f8d6e
[svn r311] A lot of fixes regarding program info structure creation.
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_programinfo.c
gmyth/src/gmyth_recorder.c
gmyth/src/gmyth_recorder.h
     1.1 --- a/gmyth/src/gmyth_livetv.c	Mon Jan 29 14:14:26 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_livetv.c	Mon Jan 29 23:35:37 2007 +0000
     1.3 @@ -393,7 +393,9 @@
     1.4  	/* check if the program chain could be obtained from the MythTV protocol message */
     1.5  	if ( prog_info != NULL )
     1.6  	{
     1.7 -		livetv->proginfo = prog_info;		
     1.8 +		livetv->proginfo = prog_info;
     1.9 +		/* testing change channel */
    1.10 +		//gmyth_recorder_spawntv_no_tvchain( livetv->recorder );
    1.11  	} else {
    1.12  		
    1.13  		/* check for the program info in the TV program chain could be obtained 
    1.14 @@ -420,7 +422,7 @@
    1.15  		
    1.16  	}
    1.17  	
    1.18 -	livetv->uri = gmyth_backend_info_get_uri( backend_info );
    1.19 +	livetv->uri = (GMythURI*)gmyth_backend_info_get_uri( backend_info );
    1.20  	
    1.21  	g_static_mutex_unlock( &lock );
    1.22  
     2.1 --- a/gmyth/src/gmyth_programinfo.c	Mon Jan 29 14:14:26 2007 +0000
     2.2 +++ b/gmyth/src/gmyth_programinfo.c	Mon Jan 29 23:35:37 2007 +0000
     2.3 @@ -299,47 +299,49 @@
     2.4      g_return_val_if_fail (prog != NULL, NULL);
     2.5      g_return_val_if_fail (slist != NULL, NULL);
     2.6  
     2.7 -    gmyth_string_list_append_string (slist, prog->title);
     2.8 -    gmyth_string_list_append_string (slist, prog->subtitle);
     2.9 -    gmyth_string_list_append_string (slist, prog->description);
    2.10 -    gmyth_string_list_append_string (slist, prog->category);
    2.11 -    gmyth_string_list_append_string (slist, prog->chanid);
    2.12 -    gmyth_string_list_append_string (slist, prog->chanstr);
    2.13 -    gmyth_string_list_append_string (slist, prog->chansign);
    2.14 -    gmyth_string_list_append_string (slist, prog->channame);
    2.15 -    gmyth_string_list_append_string (slist, prog->pathname);
    2.16 -    gmyth_string_list_append_int64 (slist, prog->filesize);
    2.17 +    gmyth_string_list_append_string (slist, prog->title); /* 0 */
    2.18 +    gmyth_string_list_append_string (slist, prog->subtitle); /* 1 */
    2.19 +    gmyth_string_list_append_string (slist, prog->description); /* 2 */
    2.20 +    gmyth_string_list_append_string (slist, prog->category); /* 3 */
    2.21 +    gmyth_string_list_append_string (slist, prog->chanid); /* 4 */
    2.22 +    gmyth_string_list_append_string (slist, prog->chanstr); /* 5 */
    2.23 +    gmyth_string_list_append_string (slist, prog->chansign); /* 6 */
    2.24 +    gmyth_string_list_append_string (slist, prog->channame); /* 7 */
    2.25 +    gmyth_string_list_append_string (slist, prog->pathname); /* 8 */
    2.26 +    gmyth_string_list_append_int64 (slist, prog->filesize); /* 9 */
    2.27 +    gmyth_string_list_get_int64 (slist, 10); /* 11 */
    2.28  
    2.29 -    gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(startts)
    2.30 -    gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(endts)
    2.31 -    gmyth_string_list_append_int (slist, prog->duplicate);
    2.32 -    gmyth_string_list_append_int (slist, prog->shareable);
    2.33 -    gmyth_string_list_append_int (slist, prog->findid);
    2.34 -    gmyth_string_list_append_string (slist, prog->hostname);
    2.35 -    gmyth_string_list_append_int (slist, prog->sourceid);
    2.36 -    gmyth_string_list_append_int (slist, prog->cardid);
    2.37 -    gmyth_string_list_append_int (slist, prog->inputid);
    2.38 -    gmyth_string_list_append_int (slist, prog->recpriority);
    2.39 -    gmyth_string_list_append_int (slist, 0 /*prog->recstatus*/);
    2.40 -    gmyth_string_list_append_int (slist, prog->recordid);
    2.41 -    gmyth_string_list_append_int (slist, 0 /*prog->rectype*/);
    2.42 -    gmyth_string_list_append_int (slist, 0 /*prog->dupin*/);
    2.43 -    gmyth_string_list_append_int (slist, 0 /*prog->dupmethod*/);
    2.44 -    gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(recstartts)
    2.45 -    gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(recendts)
    2.46 -    gmyth_string_list_append_int (slist, prog->repeat);
    2.47 -    gmyth_string_list_append_int (slist, prog->programflags);
    2.48 -    gmyth_string_list_append_char_array (slist, "Default"); //prog->(recgroup != "") ? recgroup : "Default")
    2.49 -    gmyth_string_list_append_int (slist, prog->chancommfree);
    2.50 -    gmyth_string_list_append_string (slist, prog->chanOutputFilters);
    2.51 -    gmyth_string_list_append_string (slist, prog->seriesid);
    2.52 -    gmyth_string_list_append_string (slist, prog->programid);
    2.53 -    gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(lastmodified)
    2.54 -    gmyth_string_list_append_int (slist, 0); //FLOAT_TO_LIST(stars)
    2.55 -    gmyth_string_list_append_int (slist, 0); //DATETIME_TO_LIST(QDateTime(originalAirDate))
    2.56 -    gmyth_string_list_append_int (slist, prog->hasAirDate);
    2.57 -    gmyth_string_list_append_char_array (slist, "Default"); //prog->(playgroup != "") ? playgroup : "Default")
    2.58 -    gmyth_string_list_append_int (slist, prog->recpriority2);
    2.59 +    gmyth_string_list_append_int (slist, prog->startts->tv_sec);  /* 11 */ //DATETIME_TO_LIST(startts)
    2.60 +    gmyth_string_list_append_int (slist, prog->endts->tv_sec);  /* 12 */ //DATETIME_TO_LIST(endts)
    2.61 +    gmyth_string_list_append_int (slist, prog->duplicate); /* 13 */
    2.62 +    gmyth_string_list_append_int (slist, prog->shareable); /* 14 */
    2.63 +    gmyth_string_list_append_int (slist, prog->findid); /* 15 */
    2.64 +    gmyth_string_list_append_string (slist, prog->hostname); /* 16 */
    2.65 +    gmyth_string_list_append_int (slist, prog->sourceid); /* 17 */
    2.66 +    gmyth_string_list_append_int (slist, prog->cardid); /* 18 */
    2.67 +    gmyth_string_list_append_int (slist, prog->inputid); /* 19 */
    2.68 +    gmyth_string_list_append_int (slist, prog->recpriority); /* 20 */
    2.69 +    gmyth_string_list_append_int (slist, 0 /*prog->recstatus*/); /* 21 */
    2.70 +    gmyth_string_list_append_int (slist, prog->recordid); /* 22 */
    2.71 +    gmyth_string_list_append_int (slist, 0 /*prog->rectype*/); /* 23 */
    2.72 +    gmyth_string_list_append_int (slist, 0 /*prog->dupin*/); /* 24 */
    2.73 +    gmyth_string_list_append_int (slist, 0 /*prog->dupmethod*/); /* 25 */
    2.74 +    gmyth_string_list_append_int (slist, prog->recstartts != NULL ? prog->recstartts->tv_sec : 0);  /* 26 */ //DATETIME_TO_LIST(recstartts)
    2.75 +    gmyth_string_list_append_int (slist, prog->recendts != NULL ? prog->recendts->tv_sec : 0);  /* 27 */ //DATETIME_TO_LIST(recendts)
    2.76 +    gmyth_string_list_append_int (slist, prog->repeat); /* 28 */
    2.77 +    gmyth_string_list_append_int (slist, prog->programflags); /* 29 */
    2.78 +    gmyth_string_list_append_char_array (slist, "Default"); /* 30 */ //prog->(recgroup != "") ? recgroup : "Default")
    2.79 +    gmyth_string_list_append_int (slist, prog->chancommfree); /* 31 */
    2.80 +    gmyth_string_list_append_string (slist, prog->chanOutputFilters); /* 32 */
    2.81 +    gmyth_string_list_append_string (slist, prog->seriesid); /* 33 */
    2.82 +    gmyth_string_list_append_string (slist, prog->programid); /* 34 */
    2.83 +    gmyth_string_list_append_string (slist, ""); /* 35 */
    2.84 +    gmyth_string_list_append_int (slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0);  /* 36 */ //DATETIME_TO_LIST(lastmodified)
    2.85 +    gmyth_string_list_append_int (slist, 0);  /* 37 */ //FLOAT_TO_LIST(stars)
    2.86 +    gmyth_string_list_append_int (slist, prog->originalAirDate != NULL ? prog->originalAirDate->tv_sec : 0);  /* 38 */ //DATETIME_TO_LIST(QDateTime(originalAirDate))
    2.87 +    gmyth_string_list_append_int (slist, prog->hasAirDate); /* 39 */
    2.88 +    gmyth_string_list_append_char_array (slist, "Default");  /* 40 */ //prog->(playgroup != "") ? playgroup : "Default")
    2.89 +    gmyth_string_list_append_int (slist, prog->recpriority2); /* 41 */
    2.90     
    2.91      return slist;
    2.92  }
    2.93 @@ -433,13 +435,15 @@
    2.94      prog->chanOutputFilters = gmyth_string_list_get_string (slist, 32);
    2.95      prog->seriesid = gmyth_string_list_get_string (slist, 33);
    2.96      prog->programid = gmyth_string_list_get_string (slist, 34);
    2.97 -    prog->lastmodified = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 35) ); //DATETIME_TO_LIST(lastmodified)
    2.98 -    gmyth_string_list_get_int (slist, 36); //FLOAT_TO_LIST(stars)
    2.99 -    prog->originalAirDate = gmyth_util_string_to_time_val( gmyth_string_list_get_char_array (slist, 37) ); //DATETIME_TO_LIST(QDateTime(originalAirDate))
   2.100 -    prog->hasAirDate = gmyth_string_list_get_int (slist, 38);
   2.101 -    prog->playgroup = gmyth_string_list_get_string (slist, 39); //prog->(playgroup != "") ? playgroup : "Default")
   2.102 -    prog->recpriority2 = gmyth_string_list_get_int (slist, 40);
   2.103 +    gmyth_string_list_get_string (slist, 35);
   2.104 +    prog->lastmodified = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat( 
   2.105 +    					(time_t)gmyth_string_list_get_int (slist, 36) ))->str ); //DATETIME_TO_LIST(lastmodified)
   2.106 +    gmyth_string_list_get_int (slist, 37); //FLOAT_TO_LIST(stars)
   2.107 +    prog->originalAirDate = gmyth_util_string_to_time_val( (gmyth_util_time_to_isoformat( 
   2.108 +    					(time_t)gmyth_string_list_get_int (slist, 38) ))->str ); //DATETIME_TO_LIST(QDateTime(originalAirDate))
   2.109 +    prog->hasAirDate = gmyth_string_list_get_int (slist, 39);
   2.110 +    prog->playgroup = gmyth_string_list_get_string (slist, 40); //prog->(playgroup != "") ? playgroup : "Default")
   2.111 +    prog->recpriority2 = gmyth_string_list_get_int (slist, 41);
   2.112     
   2.113      return prog;
   2.114  }
   2.115 -
     3.1 --- a/gmyth/src/gmyth_recorder.c	Mon Jan 29 14:14:26 2007 +0000
     3.2 +++ b/gmyth/src/gmyth_recorder.c	Mon Jan 29 23:35:37 2007 +0000
     3.3 @@ -178,6 +178,50 @@
     3.4  
     3.5  }
     3.6  
     3.7 +/** 
     3.8 + * Sends the SPAWN_LIVETV command through Mythtv protocol. This command
     3.9 + * requests the backend to start capturing TV content, but it doesn't need
    3.10 + * the TV chain ID.
    3.11 + * 
    3.12 + * @param recorder The GMythRecorder instance.
    3.13 + * @return true if success, false if any error happens.
    3.14 + */
    3.15 +gboolean
    3.16 +gmyth_recorder_spawntv_no_tvchain (GMythRecorder *recorder)
    3.17 +{
    3.18 +	GMythStringList *str_list;
    3.19 +	GString *tmp_str = g_string_new( GMYTHTV_RECORDER_HEADER );
    3.20 +	
    3.21 +	gmyth_debug ("[%s] Spawntv, no TV chain!", __FUNCTION__);
    3.22 +	
    3.23 +	str_list = gmyth_string_list_new ();
    3.24 +	
    3.25 +	g_string_append_printf ( tmp_str, " %d", recorder->recorder_num ); 
    3.26 +	
    3.27 +	gmyth_string_list_append_string (str_list, tmp_str);
    3.28 +	gmyth_string_list_append_string (str_list, g_string_new ("SPAWN_LIVETV"));
    3.29 +
    3.30 +	gmyth_socket_sendreceive_stringlist (recorder->myth_socket, str_list);
    3.31 +	
    3.32 +    g_string_free (tmp_str, TRUE);
    3.33 +    
    3.34 +    tmp_str = gmyth_string_list_get_string (str_list, 0);
    3.35 +    if (tmp_str == NULL) {
    3.36 +    	g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str);
    3.37 +    	return FALSE;
    3.38 +	}
    3.39 +	
    3.40 +    if (g_ascii_strncasecmp (tmp_str->str, "ok", 2)) {
    3.41 +    	g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str);
    3.42 +	    g_object_unref (str_list);
    3.43 +    	return FALSE;
    3.44 +    }
    3.45 +
    3.46 +    g_object_unref (str_list);
    3.47 +    return TRUE;
    3.48 +
    3.49 +}
    3.50 +
    3.51  /** Sends the command STOP_LIVETV to Mythtv backend.
    3.52   * 
    3.53   * @param recorder the GMythRecorder instance.
     4.1 --- a/gmyth/src/gmyth_recorder.h	Mon Jan 29 14:14:26 2007 +0000
     4.2 +++ b/gmyth/src/gmyth_recorder.h	Mon Jan 29 23:35:37 2007 +0000
     4.3 @@ -89,6 +89,9 @@
     4.4  gboolean gmyth_recorder_setup     (GMythRecorder *recorder);
     4.5  gboolean gmyth_recorder_spawntv   (GMythRecorder *recorder,
     4.6                                           GString *tvchain_id);
     4.7 +                                         
     4.8 +gboolean gmyth_recorder_spawntv_no_tvchain (GMythRecorder *recorder);
     4.9 +
    4.10  gboolean gmyth_recorder_stop_livetv (GMythRecorder *recorder);
    4.11  
    4.12  gboolean gmyth_recorder_send_frontend_ready_command (GMythRecorder *recorder);