Esempio n. 1
0
static gboolean
ol_player_listen_next ()
{
  ol_logf (OL_DEBUG, "%s\n", __FUNCTION__);
  if (connection == NULL || proxy == NULL)
    if (!ol_player_listen_init_dbus ())
      return FALSE;
  return ol_dbus_invoke (proxy, next);
}
Esempio n. 2
0
static gboolean
ol_player_listen_pause ()
{
  ol_logf (OL_DEBUG, "%s\n", __FUNCTION__);
  if (connection == NULL || proxy == NULL)
    if (!ol_player_listen_init_dbus ())
      return FALSE;
  enum OlPlayerStatus status = ol_player_listen_get_status ();
  if (status == OL_PLAYER_ERROR)
    return FALSE;
  if (status == OL_PLAYER_PLAYING)
    return ol_dbus_invoke (proxy, play_pause);
}
Esempio n. 3
0
static gboolean
ol_player_listen_play ()
{
  ol_logf (OL_DEBUG, "%s\n", __FUNCTION__);
  if (connection == NULL || proxy == NULL)
    if (!ol_player_listen_init_dbus ())
      return FALSE;
  enum OlPlayerStatus status = ol_player_listen_get_status ();
  if (status == OL_PLAYER_ERROR)
    return FALSE;
  switch (status)
  {
  case OL_PLAYER_PLAYING:
    return TRUE;
  case OL_PLAYER_STOPPED:
  default:
    return ol_dbus_invoke (proxy, play);
  }
}
Esempio n. 4
0
static gboolean
ol_player_xmms2_get_music_info (OlMusicInfo *info)
{
  /* ol_log_func (); */
  ol_assert_ret (info != NULL, FALSE);
  if (!ol_player_xmms2_ensure_connection ())
    return FALSE;
  ol_music_info_clear (info);
  int32_t id = ol_player_xmms2_get_currend_id ();
  if (id > 0)
  {
    xmmsc_result_t *result = xmmsc_medialib_get_info (connection, id);
    xmmsc_result_wait (result);
    xmmsv_t *return_value = xmmsc_result_get_value (result);
    if (xmmsv_is_error (return_value))
    {
      ol_error ("Get music info from XMMS2 failed.");
    }
    else
    {
      xmmsv_t *dict = xmmsv_propdict_to_dict (return_value, NULL);
      info->title = ol_player_xmms2_get_dict_string (dict, "title");
      info->artist = ol_player_xmms2_get_dict_string (dict, "artist");
      info->album = ol_player_xmms2_get_dict_string (dict, "album");
      info->track_number = ol_player_xmms2_get_dict_int (dict, "tracknr");
      info->uri = ol_player_xmms2_get_dict_string (dict, "url");
      ol_logf (OL_DEBUG,
               "%s\n"
               "  title:%s\n"
               "  artist:%s\n"
               "  album:%s\n"
               "  uri:%s\n",
               __FUNCTION__,
               info->title,
               info->artist,
               info->album,
               info->uri);
      xmmsv_unref (dict);
    }
    xmmsc_result_unref (result);
  }
  return TRUE;
}
Esempio n. 5
0
struct OlPlayer*
ol_player_listen_get ()
{
  ol_logf (OL_DEBUG, "%s\n",__FUNCTION__);
  struct OlPlayer *controller = ol_player_new ("Listen Music Player");
  ol_player_set_cmd (controller, "listen");
  controller->get_music_info = ol_player_listen_get_music_info;
  controller->get_activated = ol_player_listen_get_activated;
  controller->get_played_time = ol_player_listen_get_played_time;
  controller->get_music_length = ol_player_listen_get_music_length;
  controller->get_capacity = ol_player_listen_get_capacity;
  controller->get_status = ol_player_listen_get_status;
  controller->play = ol_player_listen_play;
  controller->pause = ol_player_listen_pause;
  controller->prev = ol_player_listen_prev;
  controller->next = ol_player_listen_next;
  controller->seek = NULL;
  controller->stop = ol_player_listen_stop;
  controller->get_icon_path = _get_icon_path;
  return controller;
}