Added Genre and Track Number to getMusicDirectory

This commit is contained in:
Deluan 2016-03-02 22:43:31 -05:00
parent 838d4bf38f
commit 51bae19191
6 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,7 @@ func (c *GetMusicDirectoryController) Get() {
dir.Child[i].Album = al.Name
dir.Child[i].Year = al.Year
dir.Child[i].Artist = a.Name
dir.Child[i].Genre = al.Genre
}
} else {
beego.Info("Artist", id, "not found")

View File

@ -8,6 +8,7 @@ type Album struct {
Year int
Compilation bool
Rating int
Genre string
}
type AlbumRepository interface {

View File

@ -12,6 +12,8 @@ type MediaFile struct {
Artist string
AlbumArtist string
AlbumId string `parent:"album"`
Track int
Genre string
Compilation bool
CreatedAt time.Time
UpdatedAt time.Time

View File

@ -22,8 +22,10 @@ func (s *ItunesScanner) LoadFolder(path string) []Track {
mediaFiles[i].Title = unescape(t.Name)
mediaFiles[i].Artist = unescape(t.Artist)
mediaFiles[i].AlbumArtist = unescape(t.AlbumArtist)
mediaFiles[i].Genre = unescape(t.Genre)
mediaFiles[i].Compilation = t.Compilation
mediaFiles[i].Year = t.Year
mediaFiles[i].TrackNumber = t.TrackNumber
path, _ = url.QueryUnescape(t.Location)
mediaFiles[i].Path = strings.TrimPrefix(path, "file://")
mediaFiles[i].CreatedAt = t.DateAdded

View File

@ -74,12 +74,15 @@ func parseTrack(t *Track) (*domain.MediaFile, *domain.Album, *domain.Artist) {
Path: t.Path,
CreatedAt: t.CreatedAt,
UpdatedAt: t.UpdatedAt,
Track: t.TrackNumber,
Genre: t.Genre,
}
album := &domain.Album{
Name: t.Album,
Year: t.Year,
Compilation: t.Compilation,
Genre: t.Genre,
}
artist := &domain.Artist{

View File

@ -11,6 +11,8 @@ type Track struct {
Album string
Artist string
AlbumArtist string
Genre string
TrackNumber int
Year int
Compilation bool
CreatedAt time.Time