[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.
1.1 --- a/gmyth/src/gmyth_recorder.c Fri Jan 26 19:10:25 2007 +0000
1.2 +++ b/gmyth/src/gmyth_recorder.c Mon Jan 29 14:14:26 2007 +0000
1.3 @@ -399,6 +399,58 @@
1.4
1.5 }
1.6
1.7 +/**
1.8 + * Changes the channel of the actual Recorder.
1.9 + *
1.10 + * CHANNEL_DIRECTION_UP - Go up one channel in the listing
1.11 + *
1.12 + * CHANNEL_DIRECTION_DOWN - Go down one channel in the listing
1.13 + *
1.14 + * CHANNEL_DIRECTION_FAVORITE - Go to the next favorite channel
1.15 + *
1.16 + * CHANNEL_DIRECTION_SAME - Stay
1.17 + *
1.18 + * @param recorder The GMythRecorder instance.
1.19 + * @param direction The new channel direction where to move to.
1.20 + * @return true if success, false if any error happens.
1.21 + */
1.22 +gboolean
1.23 +gmyth_recorder_change_channel (GMythRecorder *recorder, const GMythRecorderChannelChangeDirection direction)
1.24 +{
1.25 + GMythStringList *str_list;
1.26 + GString *tmp_str = g_string_new( GMYTHTV_RECORDER_HEADER );
1.27 +
1.28 + gmyth_debug ("[%s] CHANGE_CHANNEL to the channel direction = %u", __FUNCTION__, direction);
1.29 +
1.30 + str_list = gmyth_string_list_new ();
1.31 +
1.32 + g_string_append_printf ( tmp_str, " %d", recorder->recorder_num );
1.33 +
1.34 + gmyth_string_list_append_string (str_list, tmp_str);
1.35 + gmyth_string_list_append_string (str_list, g_string_new ("CHANGE_CHANNEL"));
1.36 + gmyth_string_list_append_int (str_list, direction);
1.37 +
1.38 + gmyth_socket_sendreceive_stringlist (recorder->myth_socket, str_list);
1.39 +
1.40 + g_string_free (tmp_str, TRUE);
1.41 +
1.42 + tmp_str = gmyth_string_list_get_string (str_list, 0);
1.43 + if (tmp_str == NULL) {
1.44 + g_warning ("[%s] CHANGE_CHANNEL name request returned %s", __FUNCTION__, tmp_str->str );
1.45 + return FALSE;
1.46 + }
1.47 +
1.48 + if (g_ascii_strncasecmp (tmp_str->str, "ok", 2) || g_ascii_strtoull( tmp_str->str, NULL, 10 ) == 0 ) {
1.49 + g_warning ("[%s] CHANGE_CHANNEL name request returned %s", __FUNCTION__, tmp_str->str);
1.50 + g_object_unref (str_list);
1.51 + return FALSE;
1.52 + }
1.53 +
1.54 + g_object_unref (str_list);
1.55 + return TRUE;
1.56 +
1.57 +}
1.58 +
1.59 /** Send a PAUSE command request to the backend, to pause streaming on another
1.60 * TV content channel.
1.61 *
2.1 --- a/gmyth/src/gmyth_recorder.h Fri Jan 26 19:10:25 2007 +0000
2.2 +++ b/gmyth/src/gmyth_recorder.h Mon Jan 29 14:14:26 2007 +0000
2.3 @@ -73,6 +73,12 @@
2.4 gint port;
2.5 };
2.6
2.7 +typedef enum _GMythRecorderChannelChangeDirection {
2.8 + CHANNEL_DIRECTION_UP = 0,
2.9 + CHANNEL_DIRECTION_DOWN,
2.10 + CHANNEL_DIRECTION_FAVORITE,
2.11 + CHANNEL_DIRECTION_SAME
2.12 +} GMythRecorderChannelChangeDirection;
2.13
2.14 GType gmyth_recorder_get_type (void);
2.15
2.16 @@ -97,6 +103,9 @@
2.17 gboolean gmyth_recorder_set_channel_name (GMythRecorder *recorder,
2.18 const gchar* channel);
2.19
2.20 +gboolean gmyth_recorder_change_channel (GMythRecorder *recorder,
2.21 + const GMythRecorderChannelChangeDirection direction);
2.22 +
2.23 gboolean gmyth_recorder_pause_recording ( GMythRecorder *recorder );
2.24
2.25 GMythProgramInfo *gmyth_recorder_get_current_program_info ( GMythRecorder *recorder );
3.1 --- a/gmyth/src/gmyth_tvchain.c Fri Jan 26 19:10:25 2007 +0000
3.2 +++ b/gmyth/src/gmyth_tvchain.c Mon Jan 29 14:14:26 2007 +0000
3.3 @@ -383,7 +383,7 @@
3.4 if (proginfo) {
3.5 proginfo->pathname = g_string_prepend (proginfo->pathname, entry->hostprefix->str);
3.6 } else {
3.7 - g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %lld) failed!", entry->chanid->str, entry->starttime->tv_sec);
3.8 + g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %ld) failed!", entry->chanid->str, entry->starttime->tv_sec);
3.9 }
3.10
3.11 return proginfo;