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
+1
View File
@@ -46,6 +46,7 @@ func (c *GetMusicDirectoryController) Get() {
dir.Child[i].Album = al.Name dir.Child[i].Album = al.Name
dir.Child[i].Year = al.Year dir.Child[i].Year = al.Year
dir.Child[i].Artist = a.Name dir.Child[i].Artist = a.Name
dir.Child[i].Genre = al.Genre
} }
} else { } else {
beego.Info("Artist", id, "not found") beego.Info("Artist", id, "not found")
+1
View File
@@ -8,6 +8,7 @@ type Album struct {
Year int Year int
Compilation bool Compilation bool
Rating int Rating int
Genre string
} }
type AlbumRepository interface { type AlbumRepository interface {
+2
View File
@@ -12,6 +12,8 @@ type MediaFile struct {
Artist string Artist string
AlbumArtist string AlbumArtist string
AlbumId string `parent:"album"` AlbumId string `parent:"album"`
Track int
Genre string
Compilation bool Compilation bool
CreatedAt time.Time CreatedAt time.Time
UpdatedAt time.Time UpdatedAt time.Time
+2
View File
@@ -22,8 +22,10 @@ func (s *ItunesScanner) LoadFolder(path string) []Track {
mediaFiles[i].Title = unescape(t.Name) mediaFiles[i].Title = unescape(t.Name)
mediaFiles[i].Artist = unescape(t.Artist) mediaFiles[i].Artist = unescape(t.Artist)
mediaFiles[i].AlbumArtist = unescape(t.AlbumArtist) mediaFiles[i].AlbumArtist = unescape(t.AlbumArtist)
mediaFiles[i].Genre = unescape(t.Genre)
mediaFiles[i].Compilation = t.Compilation mediaFiles[i].Compilation = t.Compilation
mediaFiles[i].Year = t.Year mediaFiles[i].Year = t.Year
mediaFiles[i].TrackNumber = t.TrackNumber
path, _ = url.QueryUnescape(t.Location) path, _ = url.QueryUnescape(t.Location)
mediaFiles[i].Path = strings.TrimPrefix(path, "file://") mediaFiles[i].Path = strings.TrimPrefix(path, "file://")
mediaFiles[i].CreatedAt = t.DateAdded mediaFiles[i].CreatedAt = t.DateAdded
+3
View File
@@ -74,12 +74,15 @@ func parseTrack(t *Track) (*domain.MediaFile, *domain.Album, *domain.Artist) {
Path: t.Path, Path: t.Path,
CreatedAt: t.CreatedAt, CreatedAt: t.CreatedAt,
UpdatedAt: t.UpdatedAt, UpdatedAt: t.UpdatedAt,
Track: t.TrackNumber,
Genre: t.Genre,
} }
album := &domain.Album{ album := &domain.Album{
Name: t.Album, Name: t.Album,
Year: t.Year, Year: t.Year,
Compilation: t.Compilation, Compilation: t.Compilation,
Genre: t.Genre,
} }
artist := &domain.Artist{ artist := &domain.Artist{
+2
View File
@@ -11,6 +11,8 @@ type Track struct {
Album string Album string
Artist string Artist string
AlbumArtist string AlbumArtist string
Genre string
TrackNumber int
Year int Year int
Compilation bool Compilation bool
CreatedAt time.Time CreatedAt time.Time