# HG changeset patch # User rosfran # Date 1175292579 -3600 # Node ID e5618b012121504fd9bc0bdcb5c90ed040ebc1a7 # Parent 2eef408853227196b3ed09dd764ae3c42c2e8376 [svn r477] Added functions to get the channel's list from the MythTV, using the normal backend server messages. diff -r 2eef40885322 -r e5618b012121 gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Fri Mar 30 23:07:54 2007 +0100 +++ b/gmyth/src/gmyth_livetv.c Fri Mar 30 23:09:39 2007 +0100 @@ -460,13 +460,13 @@ goto error; } - if ( gmyth_recorder_check_channel_name( livetv->recorder, channel ) ) - { - if ( gmyth_recorder_set_channel_name( livetv->recorder, channel ) ) - { - gmyth_debug( "Channel changed!!! [%s].\n", channel ); - } - } + if ( gmyth_recorder_check_channel_name( livetv->recorder, channel ) ) + { + if ( gmyth_recorder_set_channel_name( livetv->recorder, channel ) ) + { + gmyth_debug( "Channel changed!!! [%s].\n", channel ); + } + } } /* if - changes the channel number */ diff -r 2eef40885322 -r e5618b012121 gmyth/src/gmyth_recorder.c --- a/gmyth/src/gmyth_recorder.c Fri Mar 30 23:07:54 2007 +0100 +++ b/gmyth/src/gmyth_recorder.c Fri Mar 30 23:09:39 2007 +0100 @@ -585,6 +585,37 @@ return ret; } +/** + * Gets the channel's list from the MythTV backend server. + * + * @param recorder The GMythRecorder instance. + * + * @return a GList* instance with all the channel names. + */ +GList* +gmyth_recorder_get_channel_list(GMythRecorder *recorder ) { + + GList* channel_list = NULL; + gchar* channel = NULL; + guint i; + + for ( i = 0; i < 1000; i++ ) + { + channel = g_strdup_printf( "%u", i ); + + if ( gmyth_recorder_check_channel_name( recorder, channel ) ) + { + channel_list = g_list_append( channel_list, g_strdup( channel ) ); + } + + g_free( channel ); + + } /* for - channel list */ + + return channel_list; + +} + /** Send a PAUSE command request to the backend, to pause streaming on another * TV content channel. * diff -r 2eef40885322 -r e5618b012121 gmyth/src/gmyth_recorder.h --- a/gmyth/src/gmyth_recorder.h Fri Mar 30 23:07:54 2007 +0100 +++ b/gmyth/src/gmyth_recorder.h Fri Mar 30 23:09:39 2007 +0100 @@ -126,6 +126,8 @@ gboolean gmyth_recorder_change_channel (GMythRecorder *recorder, const GMythRecorderChannelChangeDirection direction); + +GList* gmyth_recorder_get_channel_list(GMythRecorder *recorder ); gboolean gmyth_recorder_pause_recording ( GMythRecorder *recorder );