2016-03-02 15:07:24 +01:00
|
|
|
package domain
|
2016-02-24 21:30:28 +01:00
|
|
|
|
2016-02-27 09:35:01 +01:00
|
|
|
import (
|
|
|
|
"time"
|
2016-03-03 20:14:15 +01:00
|
|
|
"mime"
|
2016-02-27 09:35:01 +01:00
|
|
|
)
|
2016-02-24 21:30:28 +01:00
|
|
|
|
|
|
|
type MediaFile struct {
|
2016-02-27 09:35:01 +01:00
|
|
|
Id string
|
|
|
|
Path string
|
|
|
|
Title string
|
|
|
|
Album string
|
|
|
|
Artist string
|
|
|
|
AlbumArtist string
|
2016-03-02 19:18:39 +01:00
|
|
|
AlbumId string `parent:"album"`
|
2016-03-03 16:34:17 +01:00
|
|
|
HasCoverArt bool
|
2016-03-03 06:42:42 +01:00
|
|
|
TrackNumber int
|
|
|
|
DiscNumber int
|
2016-03-03 05:15:17 +01:00
|
|
|
Year int
|
2016-03-03 05:51:26 +01:00
|
|
|
Size string
|
|
|
|
Suffix string
|
|
|
|
Duration int
|
|
|
|
BitRate int
|
2016-03-03 04:43:31 +01:00
|
|
|
Genre string
|
2016-02-27 09:35:01 +01:00
|
|
|
Compilation bool
|
2016-03-03 07:07:13 +01:00
|
|
|
Starred bool
|
2016-02-27 09:35:01 +01:00
|
|
|
CreatedAt time.Time
|
|
|
|
UpdatedAt time.Time
|
2016-03-02 15:33:49 +01:00
|
|
|
}
|
|
|
|
|
2016-03-03 20:14:15 +01:00
|
|
|
func (mf *MediaFile) ContentType() string {
|
|
|
|
return mime.TypeByExtension("." + mf.Suffix)
|
|
|
|
}
|
|
|
|
|
2016-03-02 15:33:49 +01:00
|
|
|
type MediaFileRepository interface {
|
|
|
|
BaseRepository
|
|
|
|
Put(m *MediaFile) error
|
2016-03-03 18:08:44 +01:00
|
|
|
Get(id string) (*MediaFile, error)
|
2016-03-03 05:15:17 +01:00
|
|
|
FindByAlbum(albumId string) ([]MediaFile, error)
|
2016-03-02 19:18:39 +01:00
|
|
|
}
|