summaryrefslogtreecommitdiffstats
path: root/modern.go
diff options
context:
space:
mode:
Diffstat (limited to 'modern.go')
-rw-r--r--modern.go27
1 files changed, 20 insertions, 7 deletions
diff --git a/modern.go b/modern.go
index 4a95f32..8a384c3 100644
--- a/modern.go
+++ b/modern.go
@@ -25,18 +25,31 @@ type Token struct {
string
}
+type Attrs struct {
+ Accepted int `xml:"accepted,attr" json:"accepted"`
+ Ignored int `xml:"ignored,attr" json:"ignored"`
+}
+
type Scrobbles struct {
- XMLName xml.Name `xml:"scrobbles"`
- Scrobbles []Scrobble
+ XMLName xml.Name `xml:"scrobbles" json:scrobbles"`
+ Scrobbles []Scrobble `xml:"scrobble" json:scrobble`
+ Attrs `json:"@attr"`
}
-type Scrobble struct {
- Track Track `xml:"track"`
+type Correctable struct {
+ Corrected int `xml:"corrected,attr" json:"corrected"`
+ Name string `xml:",chardata" json:"#text"`
+}
+
+func NewCorrectable(name string) Correctable {
+ return Correctable{
+ Corrected: 0,
+ Name: name,
+ }
}
-type Track struct {
- Corrected int `xml:"corrected,attr"`
- Name string `xml:",chardata"`
+func (field *Correctable) String() string {
+ return field.Name
}
func (n Name) getName() string {