move to audiotags

This commit is contained in:
sentriz
2019-06-11 13:42:42 +01:00
parent 435b6c1f8b
commit e5998dca02
7 changed files with 64 additions and 35 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/sentriz/gonic/mime"
"github.com/sentriz/gonic/model"
"github.com/sentriz/taggolib"
)
var (
@@ -37,19 +36,6 @@ var coverFilenames = map[string]struct{}{
"front.jpeg": {},
}
func readTags(path string) (taggolib.Parser, error) {
track, err := os.Open(path)
if err != nil {
return nil, errors.Wrap(err, "reading disk")
}
defer track.Close()
parser, err := taggolib.New(track)
if err != nil {
return nil, errors.Wrap(err, "parsing")
}
return parser, nil
}
type Scanner struct {
db, tx *gorm.DB
musicPath string
@@ -276,8 +262,8 @@ func (s *Scanner) handleTrack(it *item) error {
track.TagTrackArtist = tags.Artist()
track.TagTrackNumber = tags.TrackNumber()
track.TagDiscNumber = tags.DiscNumber()
track.Duration = tags.Duration() // these two should be calculated
track.Bitrate = tags.Bitrate() // from the file instead of tags
track.Length = tags.Length() // these two should be calculated
track.Bitrate = tags.Bitrate() // from the file instead of tags
//
// set album artist basics
artist := &model.Artist{}