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
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_library
(tiz_gmusic_t *ap_gmusic)¶ Add all tracks in the user’s library 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.
-
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 tracks are included. Otherwise, only tracks 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 namea_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 namea_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 namea_unlimited_search
: If true, Google Play Unlimited playlists are included. Otherwise, only playlists from the user’s library are considered.
-
int
tiz_gmusic_play_free_station
(tiz_gmusic_t *ap_gmusic, const char *ap_station)¶ Add the tracks of a free station 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_station
: The station name
-
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, const char *ap_additional_keywords)¶ 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 name (e.g. working out, office radio)ap_additional_keywords
: An additional search term to filter the stations returned by the situation search.
-
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.
-
const char *
tiz_gmusic_get_current_queue_length
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current length of playback queue.
- Parameters
ap_gmusic
: The tiz_gmusic handle.
-
int
tiz_gmusic_get_current_queue_length_as_int
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current length of the playback queue as integer.
- Parameters
ap_gmusic
: The tiz_gmusic handle.
-
const char *
tiz_gmusic_get_current_queue_progress
(tiz_gmusic_t *ap_gmusic)¶ 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_gmusic
: The tiz_gmusic handle.
-
void
tiz_gmusic_clear_queue
(tiz_gmusic_t *ap_gmusic)¶ Clear the playback queue.
- Parameters
ap_gmusic
: The gmusic handle.
-
void
tiz_gmusic_print_queue
(tiz_gmusic_t *ap_gmusic)¶ Print to standard output the contents of the playback queue.
- Parameters
ap_gmusic
: The tiz_gmusic handle.
-
const char *
tiz_gmusic_get_url
(tiz_gmusic_t *ap_gmusic, const int a_position)¶ Retrieve the stream 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_gmusic
: The tiz_gmusic handle.a_position
: A position value in the range [1, len(queue)].
-
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_track_artist
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s artist.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_title
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s title.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_album
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s album.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_duration
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s duration.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_track_number
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s track number.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_tracks_in_album
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the number of tracks in the current track’s album.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_year
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s publication year.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_genre
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’s genre.
- Parameters
ap_gmusic
: The gmusic handle.
-
const char *
tiz_gmusic_get_current_track_album_art
(tiz_gmusic_t *ap_gmusic)¶ Retrieve the current track’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.
-
typedef struct tiz_gmusic