More experimenting with tiedot
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type Artist struct {
|
||||
Id string
|
||||
Name string
|
||||
}
|
||||
|
||||
func NoArticle(name string) string {
|
||||
articles := strings.Split(beego.AppConfig.String("ignoredArticles"), " ")
|
||||
for _, a := range articles {
|
||||
n := strings.TrimPrefix(name, a + " ")
|
||||
if (n != name) {
|
||||
return n
|
||||
}
|
||||
}
|
||||
return name
|
||||
}
|
||||
+22
-8
@@ -1,13 +1,27 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type MediaFile struct {
|
||||
Id string
|
||||
Path string
|
||||
Album string
|
||||
Artist string
|
||||
Title string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Id string
|
||||
Path string
|
||||
Title string
|
||||
Album string
|
||||
Artist string
|
||||
AlbumArtist string
|
||||
Compilation bool
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (m*MediaFile) RealArtist() string {
|
||||
if (m.Compilation) {
|
||||
return "Various Artists"
|
||||
}
|
||||
if (m.AlbumArtist != "") {
|
||||
return m.AlbumArtist
|
||||
}
|
||||
return m.Artist
|
||||
}
|
||||
Reference in New Issue
Block a user