-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrobble.go
More file actions
38 lines (29 loc) · 733 Bytes
/
scrobble.go
File metadata and controls
38 lines (29 loc) · 733 Bytes
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
package trakt
import (
"encoding/json"
"strings"
)
type Event string
const (
EventStart Event = "start"
EventPause Event = "pause"
EventScrobble Event = "scrobble"
)
type ScrobbleParams struct {
Params
Type Type `json:"-" url:"-"`
Element *GenericElementParams `json:"-" url:"-"`
AppVersion string `json:"app_version" url:"-"`
AppDate string `json:"app_date" url:"-"`
Progress float64 `json:"progress" url:"-"`
}
func (s *ScrobbleParams) MarshalJSON() ([]byte, error) {
m := marshalToMap(s)
m[strings.ToLower(s.Type.String())] = s.Element
return json.Marshal(m)
}
type Scrobble struct {
basePlaybackItem
Event Event `json:"action"`
Progress float64 `json:"progress"`
}