2016-02-25 21:32:31 -09:00
|
|
|
package scanner
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Track struct {
|
2016-02-26 23:35:01 -09:00
|
|
|
Id string
|
|
|
|
|
Path string
|
|
|
|
|
Title string
|
|
|
|
|
Album string
|
|
|
|
|
Artist string
|
|
|
|
|
AlbumArtist string
|
2016-03-02 18:43:31 -09:00
|
|
|
Genre string
|
|
|
|
|
TrackNumber int
|
2016-03-02 20:42:42 -09:00
|
|
|
DiscNumber int
|
2016-02-28 09:50:05 -09:00
|
|
|
Year int
|
2016-03-02 19:51:26 -09:00
|
|
|
Size string
|
|
|
|
|
Suffix string
|
|
|
|
|
Duration int
|
|
|
|
|
BitRate int
|
2016-02-26 23:35:01 -09:00
|
|
|
Compilation bool
|
2016-03-02 21:07:13 -09:00
|
|
|
Loved bool
|
|
|
|
|
AlbumLoved bool
|
2016-02-26 23:35:01 -09:00
|
|
|
CreatedAt time.Time
|
|
|
|
|
UpdatedAt time.Time
|
2016-02-28 11:46:53 -09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Track) RealArtist() string {
|
2016-03-02 09:18:39 -09:00
|
|
|
if m.Compilation {
|
2016-02-28 11:46:53 -09:00
|
|
|
return "Various Artists"
|
|
|
|
|
}
|
2016-03-02 09:18:39 -09:00
|
|
|
if m.AlbumArtist != "" {
|
2016-02-28 11:46:53 -09:00
|
|
|
return m.AlbumArtist
|
|
|
|
|
}
|
|
|
|
|
return m.Artist
|
2016-03-02 09:18:39 -09:00
|
|
|
}
|