libtiztunein

group libtiztunein

library

A C library to access the Tunein streaming service.

Typedefs

typedef struct tiz_tunein tiz_tunein_t

The tunein opaque structure

typedef enum tiz_tunein_playback_mode tiz_tunein_playback_mode_t

Various playback modes that control the playback queue.

typedef enum tiz_tunein_search_mode tiz_tunein_search_mode_t

Various search modes that act as a way to filter the elements that are added to the queue.

Enums

enum tiz_tunein_playback_mode

Various playback modes that control the playback queue.

Values:

enumerator ETIZTuneinPlaybackModeNormal
enumerator ETIZTuneinPlaybackModeShuffle
enumerator ETIZTuneinPlaybackModeMax
enum tiz_tunein_search_mode

Various search modes that act as a way to filter the elements that are added to the queue.

Values:

enumerator ETIZTuneinSearchModeAll
enumerator ETIZTuneinSearchModeStations
enumerator ETIZTuneinSearchModeShows
enumerator ETIZTuneinSearchModeMax

Functions

int tiz_tunein_init(tiz_tunein_ptr_t *app_tunein)

Initialize the tunein handle.

Return

0 on success.

Parameters
  • app_tunein: A pointer to the tunein handle which will be initialised.

void tiz_tunein_set_playback_mode(tiz_tunein_t *ap_tunein, const tiz_tunein_playback_mode_t a_mode)

Set the playback mode.

Parameters
  • ap_tunein: The tunein handle.

  • a_mode: The playback mode.

void tiz_tunein_set_search_mode(tiz_tunein_t *ap_tunein, const tiz_tunein_search_mode_t mode)

Set the search mode.

Parameters
  • ap_tunein: The tunein handle.

  • a_mode: The search mode.

int tiz_tunein_play_radios(tiz_tunein_t *ap_tunein, const char *ap_query, const char *ap_keywords1, const char *ap_keywords2, const char *ap_keywords3)

Add radio stations/shows matching the query string to the playback queue.

After calling this method, the various tiz_tunein_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_tunein: The tunein handle.

  • ap_query: The main query string.

  • ap_keywords1: First set of optional keywords.

  • ap_keywords2: Second set of optional keywords.

  • ap_keywords3: Third set of optional keywords.

int tiz_tunein_play_category(tiz_tunein_t *ap_tunein, const char *ap_category, const char *ap_keywords1, const char *ap_keywords2, const char *ap_keywords3)

Search Tunein for a category and add matching stations to the playback queue.

After calling this method, the various tiz_tunein_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_tunein: The tunein handle.

  • ap_category: The category.

  • ap_keywords1: First set of optional keywords.

  • ap_keywords2: Second set of optional keywords.

  • ap_keywords3: Third set of optional keywords.

void tiz_tunein_clear_queue(tiz_tunein_t *ap_tunein)

Clear the playback queue.

Parameters
  • ap_tunein: The tunein handle.

void tiz_tunein_print_queue(tiz_tunein_t *ap_tunein)

Print to standard output the contents of the playback queue.

Parameters
  • ap_tunein: The tiz_tunein handle.

const char *tiz_tunein_get_current_radio_index(tiz_tunein_t *ap_tunein)

Retrieve the index in the playback queue of the stream currently selected.

Parameters
  • ap_tunein: The tiz_tunein handle.

const char *tiz_tunein_get_current_queue_length(tiz_tunein_t *ap_tunein)

Retrieve the current length of playback queue.

Parameters
  • ap_tunein: The tiz_tunein handle.

int tiz_tunein_get_current_queue_length_as_int(tiz_tunein_t *ap_tunein)

Retrieve the current length of playback queue.

Parameters
  • ap_tunein: The tiz_tunein handle.

const char *tiz_tunein_get_current_queue_progress(tiz_tunein_t *ap_tunein)

Retrieve the current queue progress (e.g. ‘5 of 17’, where 5 is the current stream index, and 17 is the total streams in the queue).

Parameters
  • ap_tunein: The tiz_tunein handle.

const char *tiz_tunein_get_url(tiz_tunein_t *ap_tunein, const int a_position)

Retrieve the station url as the specified position in the play queue.

On success, the playback queue pointer moves to the position indicated.

Return

The specified url in the playback queue or NULL if the playback queue is empty or the the specified position is out of range.

Parameters
  • ap_tunein: The tiz_tunein handle.

  • a_position: A position value in the range [1, len(queue)].

const char *tiz_tunein_get_next_url(tiz_tunein_t *ap_tunein, const bool a_remove_current_url)

Retrieve the next station url

The playback queue pointer moves one position forwards.

Return

The next url in the playback queue or NULL if the playback queue is empty.

Parameters
  • ap_tunein: The tunein handle.

  • a_remove_current_url: If true, delete the current url from the playback queue before moving to the next url.

const char *tiz_tunein_get_prev_url(tiz_tunein_t *ap_tunein, const bool a_remove_current_url)

Retrieve the previous station url.

The playback queue pointer moves one position backwards.

Return

The previous url in the playback queue or NULL if the playback queue is empty.

Parameters
  • ap_tunein: The tunein handle.

  • a_remove_current_url: If true, delete the current url from the playback queue before moving to the previous url.

const char *tiz_tunein_get_current_radio_name(tiz_tunein_t *ap_tunein)

Retrieve the current station’s name.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_description(tiz_tunein_t *ap_tunein)

Retrieve the current station’s description.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_reliability(tiz_tunein_t *ap_tunein)

Retrieve the current station’s reliability.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_type(tiz_tunein_t *ap_tunein)

Retrieve the type of the current radio (usually ‘station’ or ‘show’).

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_website(tiz_tunein_t *ap_tunein)

Retrieve the current station’s website.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_bitrate(tiz_tunein_t *ap_tunein)

Retrieve the current station’s bitrate.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_format(tiz_tunein_t *ap_tunein)

Retrieve the current station’s format.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_stream_url(tiz_tunein_t *ap_tunein)

Retrieve the current station’s stream url.

Parameters
  • ap_tunein: The tunein handle.

const char *tiz_tunein_get_current_radio_thumbnail_url(tiz_tunein_t *ap_tunein)

Retrieve the current station’s thumbnail image url.

Parameters
  • ap_tunein: The tunein handle.

void tiz_tunein_destroy(tiz_tunein_t *ap_tunein)

Destroy the tunein handle.

Parameters
  • ap_tunein: The tunein handle.