# HG changeset patch # User rosfran # Date 1170080066 0 # Node ID 311da9c88a5354bd1cb5fa4a43ed36fde9638492 # Parent fb8c04a619ad7343d84475bd23c0b2629f64274d [svn r310] Added new function to recorder: CHANGE_CHANNEL, which try to move to the next valid channel, instead of passing a valid channel name. diff -r fb8c04a619ad -r 311da9c88a53 gmyth/src/gmyth_recorder.c --- a/gmyth/src/gmyth_recorder.c Fri Jan 26 19:10:25 2007 +0000 +++ b/gmyth/src/gmyth_recorder.c Mon Jan 29 14:14:26 2007 +0000 @@ -399,6 +399,58 @@ } +/** + * Changes the channel of the actual Recorder. + * + * CHANNEL_DIRECTION_UP - Go up one channel in the listing + * + * CHANNEL_DIRECTION_DOWN - Go down one channel in the listing + * + * CHANNEL_DIRECTION_FAVORITE - Go to the next favorite channel + * + * CHANNEL_DIRECTION_SAME - Stay + * + * @param recorder The GMythRecorder instance. + * @param direction The new channel direction where to move to. + * @return true if success, false if any error happens. + */ +gboolean +gmyth_recorder_change_channel (GMythRecorder *recorder, const GMythRecorderChannelChangeDirection direction) +{ + GMythStringList *str_list; + GString *tmp_str = g_string_new( GMYTHTV_RECORDER_HEADER ); + + gmyth_debug ("[%s] CHANGE_CHANNEL to the channel direction = %u", __FUNCTION__, direction); + + 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 ("CHANGE_CHANNEL")); + gmyth_string_list_append_int (str_list, direction); + + 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] CHANGE_CHANNEL name request returned %s", __FUNCTION__, tmp_str->str ); + return FALSE; + } + + if (g_ascii_strncasecmp (tmp_str->str, "ok", 2) || g_ascii_strtoull( tmp_str->str, NULL, 10 ) == 0 ) { + g_warning ("[%s] CHANGE_CHANNEL name request returned %s", __FUNCTION__, tmp_str->str); + g_object_unref (str_list); + return FALSE; + } + + g_object_unref (str_list); + return TRUE; + +} + /** Send a PAUSE command request to the backend, to pause streaming on another * TV content channel. * diff -r fb8c04a619ad -r 311da9c88a53 gmyth/src/gmyth_recorder.h --- a/gmyth/src/gmyth_recorder.h Fri Jan 26 19:10:25 2007 +0000 +++ b/gmyth/src/gmyth_recorder.h Mon Jan 29 14:14:26 2007 +0000 @@ -73,6 +73,12 @@ gint port; }; +typedef enum _GMythRecorderChannelChangeDirection { + CHANNEL_DIRECTION_UP = 0, + CHANNEL_DIRECTION_DOWN, + CHANNEL_DIRECTION_FAVORITE, + CHANNEL_DIRECTION_SAME +} GMythRecorderChannelChangeDirection; GType gmyth_recorder_get_type (void); @@ -97,6 +103,9 @@ gboolean gmyth_recorder_set_channel_name (GMythRecorder *recorder, const gchar* channel); +gboolean gmyth_recorder_change_channel (GMythRecorder *recorder, + const GMythRecorderChannelChangeDirection direction); + gboolean gmyth_recorder_pause_recording ( GMythRecorder *recorder ); GMythProgramInfo *gmyth_recorder_get_current_program_info ( GMythRecorder *recorder ); diff -r fb8c04a619ad -r 311da9c88a53 gmyth/src/gmyth_tvchain.c --- a/gmyth/src/gmyth_tvchain.c Fri Jan 26 19:10:25 2007 +0000 +++ b/gmyth/src/gmyth_tvchain.c Mon Jan 29 14:14:26 2007 +0000 @@ -383,7 +383,7 @@ if (proginfo) { proginfo->pathname = g_string_prepend (proginfo->pathname, entry->hostprefix->str); } else { - g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %lld) failed!", entry->chanid->str, entry->starttime->tv_sec); + g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %ld) failed!", entry->chanid->str, entry->starttime->tv_sec); } return proginfo;