Added Genre and Track Number to getMusicDirectory
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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{
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user