forked from shkh/lastfm-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.go
95 lines (84 loc) · 2.96 KB
/
library.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package lastfm
type libraryApi struct {
params *apiParams
}
//library.addAlbum
func (api libraryApi) AddAlbum(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.AddAlbum") }()
err = callPost("library.addalbum", api.params, args, nil, P{
"indexing": []string{"artist", "album"},
})
return
}
//library.addArtist
func (api libraryApi) AddArtist(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.AddArtist") }()
err = callPost("library.addartist", api.params, args, nil, P{
"indexing": []string{"artist"},
})
return
}
//library.addTrack
func (api libraryApi) AddTrack(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.AddTrack") }()
err = callPost("library.addtrack", api.params, args, nil, P{
"plain": []string{"artist", "track"},
})
return
}
//library.getAlbums
func (api libraryApi) GetAlbums(args map[string]interface{}) (result LibraryGetAlbums, err error) {
defer func() { appendCaller(err, "lastfm.Library.GetAlbums") }()
err = callGet("library.getalbums", api.params, args, &result, P{
"plain": []string{"user", "artist", "limit", "page"},
})
return
}
//library.getArtists
func (api libraryApi) GetArtists(args map[string]interface{}) (result LibraryGetArtists, err error) {
defer func() { appendCaller(err, "lastfm.Library.GetArtists") }()
err = callGet("library.getartists", api.params, args, &result, P{
"plain": []string{"user", "limit", "page"},
})
return
}
//library.getTracks
func (api libraryApi) GetTracks(args map[string]interface{}) (result LibraryGetTracks, err error) {
defer func() { appendCaller(err, "lastfm.Library.GetTracks") }()
err = callGet("library.gettracks", api.params, args, &result, P{
"plain": []string{"user", "artist", "album", "limit", "page"},
})
return
}
//library.removeAlbum
func (api libraryApi) RemoveAllbum(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.RemoveAlbum") }()
err = callPost("library.removealbum", api.params, args, nil, P{
"plain": []string{"artist", "album"},
})
return
}
//library.removeArtist
func (api libraryApi) RemoveArtist(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.RemoveArtist") }()
err = callPost("library.removeartist", api.params, args, nil, P{
"plain": []string{"artist"},
})
return
}
//library.removeScrobble
func (api libraryApi) RemoveScrobble(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.RemoveScrobble") }()
err = callPost("library.removescrobble", api.params, args, nil, P{
"plain": []string{"artist", "track", "timestamp"},
})
return
}
//library.removeTrack
func (api libraryApi) RemoveTrack(args map[string]interface{}) (err error) {
defer func() { appendCaller(err, "lastfm.Library.RemoveTrack") }()
err = callPost("library.removetrack", api.params, args, nil, P{
"plain": []string{"artist", "track"},
})
return
}