clean up scan files

This commit is contained in:
sentriz
2019-06-27 15:20:07 +01:00
parent ee48dcf213
commit 7def528717
2 changed files with 15 additions and 18 deletions

View File

@@ -1,6 +1,9 @@
package tags
import (
"strconv"
"strings"
"github.com/nicksellen/audiotags"
"github.com/pkg/errors"
)
@@ -39,3 +42,15 @@ func (t *Tags) TrackNumber() int { return intSep(t.firstTag("tracknumber"), "
func (t *Tags) DiscNumber() int { return intSep(t.firstTag("discnumber"), "/") } // eg. 1/2
func (t *Tags) Length() int { return t.props.Length }
func (t *Tags) Bitrate() int { return t.props.Bitrate }
func intSep(in, sep string) int {
if in == "" {
return 0
}
start := strings.SplitN(in, sep, 2)[0]
out, err := strconv.Atoi(start)
if err != nil {
return 0
}
return out
}

View File

@@ -1,18 +0,0 @@
package tags
import (
"strconv"
"strings"
)
func intSep(in, sep string) int {
if in == "" {
return 0
}
start := strings.SplitN(in, sep, 2)[0]
out, err := strconv.Atoi(start)
if err != nil {
return 0
}
return out
}