diff options
| author | Franck Cuny <franck@fcuny.net> | 2021-10-10 13:00:38 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2021-10-10 13:00:38 -0700 |
| commit | ff915c334278d0e4d8acd8698f375022979a2c96 (patch) | |
| tree | 2350444555ccb331256349fb567f46cf824b9c0e /internal/scrobbler | |
| parent | scrobbler: add interface to the sqlite3 database (diff) | |
| download | x-ff915c334278d0e4d8acd8698f375022979a2c96.tar.gz | |
scrobbler: add timestamp to the record
When we create a new record, let's capture when this was created.
Diffstat (limited to 'internal/scrobbler')
| -rw-r--r-- | internal/scrobbler/record.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/internal/scrobbler/record.go b/internal/scrobbler/record.go index 927ed27..b9f95a0 100644 --- a/internal/scrobbler/record.go +++ b/internal/scrobbler/record.go @@ -9,19 +9,21 @@ import ( ) type Record struct { - Id uuid.UUID - Title string - Album string - Artist string - Duration time.Duration + Id uuid.UUID + Title string + Album string + Artist string + Duration time.Duration + Timestamp time.Time } func NewRecord(attrs mpd.Attrs) (*Record, error) { record := Record{ - Id: uuid.New(), - Title: attrs["Title"], - Album: attrs["Album"], - Artist: attrs["Artist"], + Id: uuid.New(), + Title: attrs["Title"], + Album: attrs["Album"], + Artist: attrs["Artist"], + Timestamp: time.Now(), } dur, err := strconv.ParseFloat(attrs["duration"], 32) |
