END_TEST

START_TEST (test_scloud_play_creator)
{
  tiz_scloud_t *p_soundcloud = NULL;
  int rc = tiz_scloud_init (&p_soundcloud, SOUNDCLOUD_USERNAME, SOUNDCLOUD_PASS);
  ck_assert (0 == rc);
  ck_assert (p_soundcloud);

  rc = tiz_scloud_play_creator (p_soundcloud, SOUNDCLOUD_USER);
  ck_assert (0 == rc);

/*   while (1) */
  {
/*     char cmd[CMD_LEN]; */

    {
      const char *next_url = tiz_scloud_get_next_url (p_soundcloud);
      ck_assert (next_url);
      fprintf (stderr, "url = %s\n", next_url);
    }

    {
      const char *user = tiz_scloud_get_current_track_user (p_soundcloud);
      ck_assert (user);
      fprintf (stderr, "user = %s\n", user);
    }

    {
      const char *title = tiz_scloud_get_current_track_title (p_soundcloud);
      ck_assert (title);
      fprintf (stderr, "title = %s\n", title);
    }

    {
      const char *duration
          = tiz_scloud_get_current_track_duration (p_soundcloud);
      ck_assert (duration);
      fprintf (stderr, "duration = %s\n", duration);
    }

    {
      const char *year = tiz_scloud_get_current_track_year (p_soundcloud);
      ck_assert (year);
      fprintf (stderr, "year = %s\n", year);
    }

    {
      const char *permalink = tiz_scloud_get_current_track_permalink (p_soundcloud);
      ck_assert (permalink);
      fprintf (stderr, "permalink = %s\n", permalink);
    }

    {
      const char *license = tiz_scloud_get_current_track_license (p_soundcloud);
      ck_assert (license);
      fprintf (stderr, "license = %s\n", license);
    }

    /*     snprintf (cmd, CMD_LEN, "%s \"%s\"", PLAYER, next_url); */
    /*     fprintf (stderr, "cmd = %s\n", cmd); */
    /*     ck_assert (-1 != system (cmd)); */
  }

  tiz_scloud_destroy (p_soundcloud);
}
Пример #2
0
static OMX_ERRORTYPE
enqueue_playlist_items (scloud_prc_t * ap_prc)
{
  int rc = 1;

  assert (ap_prc);
  assert (ap_prc->p_scloud_);

  {
    const char * p_playlist = (const char *) ap_prc->playlist_.cPlaylistName;
    const OMX_BOOL shuffle = ap_prc->playlist_.bShuffle;

    tiz_scloud_set_playback_mode (
      ap_prc->p_scloud_, (shuffle == OMX_TRUE ? ETIZScloudPlaybackModeShuffle
                                              : ETIZScloudPlaybackModeNormal));

    switch (ap_prc->playlist_.ePlaylistType)
      {
        case OMX_AUDIO_SoundCloudPlaylistTypeUnknown:
          {
            /* TODO */
            assert (0);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeUserStream:
          {
            rc = tiz_scloud_play_user_stream (ap_prc->p_scloud_);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeUserLikes:
          {
            rc = tiz_scloud_play_user_likes (ap_prc->p_scloud_);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeUserPlaylist:
          {
            rc = tiz_scloud_play_user_playlist (ap_prc->p_scloud_, p_playlist);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeCreator:
          {
            rc = tiz_scloud_play_creator (ap_prc->p_scloud_, p_playlist);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeTracks:
          {
            rc = tiz_scloud_play_tracks (ap_prc->p_scloud_, p_playlist);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypePlaylists:
          {
            rc = tiz_scloud_play_playlists (ap_prc->p_scloud_, p_playlist);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeGenres:
          {
            rc = tiz_scloud_play_genres (ap_prc->p_scloud_, p_playlist);
          }
          break;
        case OMX_AUDIO_SoundCloudPlaylistTypeTags:
          {
            rc = tiz_scloud_play_tags (ap_prc->p_scloud_, p_playlist);
          }
          break;
        default:
          {
            assert (0);
          }
          break;
      };
  }
  return (rc == 0 ? OMX_ErrorNone : OMX_ErrorInsufficientResources);
}