Documentation ¶
Overview ¶
Package gmusic provides methods to list and play music from Google Play Music.
Index ¶
- Constants
- type Album
- type ArtRefs
- type Artist
- type ArtistBioAttribution
- type ArtistInfoParams
- type CreateMutations
- type CreatePlaylistParams
- type DescriptionAttribution
- type GMusic
- func (g *GMusic) AddSongsToPlaylist(pid string, trackIds []string) (PlaylistMutateResponse, error)
- func (g *GMusic) CreatePlaylist(cparams CreatePlaylistParams) (PlaylistMutateResponse, error)
- func (g *GMusic) GetArtistInfo(params ArtistInfoParams) (Artist, error)
- func (g *GMusic) ListPlaylistEntries() ([]*PlaylistEntry, error)
- func (g *GMusic) ListPlaylists() ([]*Playlist, error)
- func (g *GMusic) ListTracks() ([]*Track, error)
- func (g *GMusic) Search(opts SearchParams) (SearchResponse, error)
- type ListPlaylistEntries
- type ListPlaylists
- type ListTracks
- type Playlist
- type PlaylistEntry
- type PlaylistMutateResponse
- type SearchEntriesResponse
- type SearchParams
- type SearchResponse
- type Settings
- type SettingsData
- type Track
Constants ¶
View Source
const ( TRACK_TYPE = "1" ARTIST_TYPE = "2" ALBUM_TYPE = "3" PLAYLIST_TYPE = "4" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { Kind string `json:"kind"` Name string `json:"name"` AlbumArtist string `json:"albumArtist"` AlbumArtRef string `json:"albumArtRef"` AlbumID string `json:"albumId"` Artist string `json:"artist"` ArtistID []string `json:"artistId"` DescriptionAttribution DescriptionAttribution `json:"description_attribution"` Year int `json:"year"` ExplicitType string `json:"explicitType"` }
JSON example:
{ "kind": "sj#album", "name": "2014 S/S", "albumArtist": "WINNER", "albumArtRef": "http://lh3.googleusercontent.com/oIRCWf0HS-RYw2jhU4deDqgAoWAyJJHGkpEZUi8qqz09aTXuww1W7Qe7AlT56mofoctXasEguQ", "albumId": "Bsdo22syyl2p2s5jqasgexmgph4", "artist": "WINNER", "artistId": [ "Aglg43ajc3toter3svcvwjp3vky" ], "description_attribution": { "kind": "sj#attribution", "source_title": "Wikipedia", "source_url": "https://en.wikipedia.org/wiki/2014_S/S", "license_title": "Creative Commons Attribution CC-BY-SA 4.0", "license_url": "http://creativecommons.org/licenses/by-sa/4.0/legalcode" }, "year": 2014, "explicitType": "2" }
type Artist ¶
type Artist struct { ID string `json:"artistId"` Name string `json:"name"` ArtistArtRef string `json:"artistArtRef"` ArtistArtRefs []ArtRefs `json:"artRefs"` ArtistBioAttribution ArtistBioAttribution `json:"artist_bio_attribution"` TopTracks []Track `json:"topTracks"` }
JSON example:
{ "kind": "sj#artist", "name": "WINNER", "artistArtRef": "http://lh3.googleusercontent.com/sU8NsTudlWZ4TQP2hgNQDjkN3RM0xGy5J9k8m3G6LeAX0Yk4hoXrzLZEkgfkVTWvGX9taawz0ao", "artistArtRefs": [ { "kind": "sj#imageRef", "url": "http://lh3.googleusercontent.com/sU8NsTudlWZ4TQP2hgNQDjkN3RM0xGy5J9k8m3G6LeAX0Yk4hoXrzLZEkgfkVTWvGX9taawz0ao", "aspectRatio": "2", "autogen": false } ], "artistId": "Aglg43ajc3toter3svcvwjp3vky", "artist_bio_attribution": { "kind": "sj#attribution", "source_title": "artist representative" } }
type ArtistBioAttribution ¶
type ArtistInfoParams ¶
type CreateMutations ¶
type CreateMutations struct {
Mutations []map[string]interface{} `json:"mutations"`
}
type CreatePlaylistParams ¶
type DescriptionAttribution ¶
type GMusic ¶
func Login ¶
Login logs in with a username and password and androidID from a MAC address of the machine.
func LoginAndroid ¶
LoginAndroid logs in with a username and password and given androidID.
func (*GMusic) AddSongsToPlaylist ¶
func (g *GMusic) AddSongsToPlaylist(pid string, trackIds []string) (PlaylistMutateResponse, error)
* Response example:
{ "mutate_response": [ { "id": "dd2197a2-3f19-3668-874f-512760f84a62", "client_id": "39a55b1c-403a-4cc1-a0a0-aace50ca2d2e", "response_code": "OK" }, { "id": "b30bebd8-fc23-36e8-8c41-45f127f49baa", "client_id": "26690b16-b6fb-41fa-becb-cfa6ef90f358", "response_code": "OK" }, { "id": "4e7154c9-3eda-3bf1-b62b-d98c43094c7e", "client_id": "dffb83f1-a42e-4ed8-8180-1197c75fc7df", "response_code": "OK" }, { "id": "2f6cbcd3-a233-31e9-9989-1f4f26e69515", "client_id": "d3d81efc-1561-429e-aab6-544ce8ae1e92", "response_code": "OK" }, { "id": "6dd36f02-681f-37a3-bad3-f18d7c9aae8f", "client_id": "c2913f61-ca98-4599-863a-0de9f7b53fdb", "response_code": "OK" } ] }
func (*GMusic) CreatePlaylist ¶
func (g *GMusic) CreatePlaylist(cparams CreatePlaylistParams) (PlaylistMutateResponse, error)
Params example:
{ "name": "playlist name", "description": "playlist description", "sharedState": "PRIVATE | PUBLIC", "creationTimestamp": 0, "deleted": false, "lastModifiedTimestamp": -1, "type": "USER_GENERATED", }
Response example:
{ "mutate_response": [ { "id": "24e6e72e-0565-40a6-8523-12e1c9090241", "client_id": "", "response_code": "OK" } ] }
func (*GMusic) GetArtistInfo ¶
func (g *GMusic) GetArtistInfo(params ArtistInfoParams) (Artist, error)
func (*GMusic) ListPlaylistEntries ¶
func (g *GMusic) ListPlaylistEntries() ([]*PlaylistEntry, error)
func (*GMusic) ListPlaylists ¶
func (*GMusic) ListTracks ¶
func (*GMusic) Search ¶
func (g *GMusic) Search(opts SearchParams) (SearchResponse, error)
type ListPlaylistEntries ¶
type ListPlaylistEntries struct { Data struct { Items []*PlaylistEntry `json:"items"` } `json:"data"` Kind string `json:"kind"` NextPageToken string `json:"nextPageToken"` }
type ListPlaylists ¶
type ListTracks ¶
type Playlist ¶
type Playlist struct { AccessControlled bool `json:"accessControlled"` CreationTimestamp string `json:"creationTimestamp"` Deleted bool `json:"deleted"` ID string `json:"id"` Kind string `json:"kind"` LastModifiedTimestamp string `json:"lastModifiedTimestamp"` Name string `json:"name"` OwnerName string `json:"ownerName"` OwnerProfilePhotoUrl string `json:"ownerProfilePhotoUrl"` RecentTimestamp string `json:"recentTimestamp"` Type string `json:"type"` }
type PlaylistEntry ¶
type PlaylistEntry struct { AbsolutePosition string `json:"absolutePosition"` ClientId string `json:"clientId"` CreationTimestamp string `json:"creationTimestamp"` Deleted bool `json:"deleted"` ID string `json:"id"` Kind string `json:"kind"` LastModifiedTimestamp string `json:"lastModifiedTimestamp"` PlaylistId string `json:"playlistId"` Source string `json:"source"` TrackId string `json:"trackId"` }
type PlaylistMutateResponse ¶
type SearchEntriesResponse ¶
type SearchParams ¶
type SearchResponse ¶
type SearchResponse struct { Kind string `json:"kind"` Entries []SearchEntriesResponse `json:"entries"` }
type Settings ¶
type Settings struct { EntitlementInfo struct { ExpirationMillis int `json:"expirationMillis"` IsCanceled bool `json:"isCanceled"` IsSubscription bool `json:"isSubscription"` IsTrial bool `json:"isTrial"` } `json:"entitlementInfo"` Lab []struct { Description string `json:"description"` DisplayName string `json:"displayName"` Enabled bool `json:"enabled"` ExperimentName string `json:"experimentName"` } `json:"lab"` MaxUploadedTracks int `json:"maxUploadedTracks"` SubscriptionNewsletter bool `json:"subscriptionNewsletter"` UploadDevice []struct { DeviceType int `json:"deviceType"` ID string `json:"id"` LastAccessedFormatted string `json:"lastAccessedFormatted"` LastAccessedTimeMillis int `json:"lastAccessedTimeMillis"` LastEventTimeMillis int `json:"lastEventTimeMillis"` Name string `json:"name"` } `json:"uploadDevice"` }
type SettingsData ¶
type SettingsData struct {
Settings Settings `json:"settings"`
}
type Track ¶
type Track struct { Album string `json:"album"` AlbumArtRef []struct { URL string `json:"url"` } `json:"albumArtRef"` AlbumArtist string `json:"albumArtist"` AlbumId string `json:"albumId"` Artist string `json:"artist"` ArtistArtRef []struct { URL string `json:"url"` } `json:"artistArtRef"` ArtistId []string `json:"artistId"` ClientId string `json:"clientId"` CreationTimestamp string `json:"creationTimestamp"` Deleted bool `json:"deleted"` DiscNumber int `json:"discNumber"` DurationMillis string `json:"durationMillis"` EstimatedSize string `json:"estimatedSize"` ID string `json:"id"` Kind string `json:"kind"` LastModifiedTimestamp string `json:"lastModifiedTimestamp"` Nid string `json:"nid"` PlayCount int `json:"playCount"` RecentTimestamp string `json:"recentTimestamp"` StoreId string `json:"storeId"` Title string `json:"title"` TrackNumber int `json:"trackNumber"` TrackType string `json:"trackType"` Year int `json:"year"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.