libtizgmusic

group libtizgmusic

A C library to access the Google Play Music streaming service (using Simon Weber’s ‘gmusicapi’ python library).

Typedefs

typedef struct tiz_gmusic tiz_gmusic_t

The gmusic opaque structure

typedef enum tiz_gmusic_playback_mode tiz_gmusic_playback_mode_t

Various playback modes that control the playback queue.

Enums

enum tiz_gmusic_playback_mode

Various playback modes that control the playback queue.

Values:

ETIZGmusicPlaybackModeNormal
ETIZGmusicPlaybackModeShuffle
ETIZGmusicPlaybackModeMax

Functions

int tiz_gmusic_init(tiz_gmusic_ptr_t * app_gmusic, const char * ap_user, const char * ap_pass, const char * ap_device_id)

Initialize the gmusic handle.

Return
0 on success.
Parameters
  • app_gmusic: A pointer to the gmusic handle which will be initialised.
  • ap_user: A Google email account.
  • ap_pass: The password associated to the Google account.
  • ap_device_id: A 16-character string containing a device id associated to the Google Play Music account.

void tiz_gmusic_set_playback_mode(tiz_gmusic_t * ap_gmusic, const tiz_gmusic_playback_mode_t mode)

Set the playback mode.

Parameters
  • ap_gmusic: The gmusic handle.

int tiz_gmusic_play_tracks(tiz_gmusic_t * ap_gmusic, const char * ap_tracks, const bool a_unlimited_search)

Add the tracks corresponding to the specified search term to the playback queue.

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

Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_tracks: The tracks search term.
  • a_unlimited_search: If true, Google Play Unlimited trackss are included. Otherwise, only trackss from the user’s library are considered.

int tiz_gmusic_play_album(tiz_gmusic_t * ap_gmusic, const char * ap_album, const bool a_unlimited_search)

Add the tracks of the specified album to the playback queue.

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

Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_album: The album name
  • a_unlimited_search: If true, Google Play Unlimited albums are included. Otherwise, only albums from the user’s library are considered.

int tiz_gmusic_play_artist(tiz_gmusic_t * ap_gmusic, const char * ap_artist, const bool a_unlimited_search)

Add the tracks of the specified artist to the playback queue.

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

Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_artist: The artist name
  • a_unlimited_search: If true, Google Play Unlimited artists are included. Otherwise, only artists from the user’s library are considered.

int tiz_gmusic_play_playlist(tiz_gmusic_t * ap_gmusic, const char * ap_playlist, const bool a_unlimited_search)

Add the tracks of the specified playlist to the playback queue.

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

Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_playlist: The playlist name
  • a_unlimited_search: If true, Google Play Unlimited playlists are included. Otherwise, only playlists from the user’s library are considered.

int tiz_gmusic_play_station(tiz_gmusic_t * ap_gmusic, const char * ap_station)

Add the tracks of the specified station to the playback queue.

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

Note
An Google Play Unlimited subscription is required.
Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_station: The station name

int tiz_gmusic_play_genre(tiz_gmusic_t * ap_gmusic, const char * ap_genre)

Add the tracks of the specified genre to the playback queue.

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

Note
An Google Play Unlimited subscription is required.
Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_genre: The genre

int tiz_gmusic_play_situation(tiz_gmusic_t * ap_gmusic, const char * ap_situation)

Add the tracks of the specified situation to the playback queue.

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

Note
An Google Play Unlimited subscription is required.
Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_situation: The situation

int tiz_gmusic_play_podcast(tiz_gmusic_t * ap_gmusic, const char * ap_podcast)

Add the tracks of the specified podcast to the playback queue.

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

Note
Currently only available in the US and Canada (free tier, no subscription required).
Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.
  • ap_podcast: The podcast

int tiz_gmusic_play_promoted_tracks(tiz_gmusic_t * ap_gmusic)

Add Google Play Unlimited promoted tracks to the playback queue.

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

Note
An Google Play Unlimited subscription is required.
Return
0 on success
Parameters
  • ap_gmusic: The gmusic handle.

void tiz_gmusic_clear_queue(tiz_gmusic_t * ap_gmusic)

Clear the playback queue.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_next_url(tiz_gmusic_t * ap_gmusic)

Retrieve the next track url

The the playback queue pointer moves one position forwards.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_prev_url(tiz_gmusic_t * ap_gmusic)

Retrieve the previous track url.

The the playback queue pointer moves one position backwards.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_artist(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s artist.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_title(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s title.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_album(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s album.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_duration(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s duration.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_track_number(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s track number.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_tracks_in_album(tiz_gmusic_t * ap_gmusic)

Retrieve the number of tracks in the current song’s album.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_year(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s publication year.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_genre(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s genre.

Parameters
  • ap_gmusic: The gmusic handle.

const char* tiz_gmusic_get_current_song_album_art(tiz_gmusic_t * ap_gmusic)

Retrieve the current song’s album art.

Parameters
  • ap_gmusic: The gmusic handle.

void tiz_gmusic_destroy(tiz_gmusic_t * ap_gmusic)

Destroy the gmusic handle.

Parameters
  • ap_gmusic: The gmusic handle.