run gofumpt / format comments / comment blocks

This commit is contained in:
sentriz
2020-03-12 15:17:36 +00:00
parent fae804ed5c
commit 3a8e5b9205
15 changed files with 43 additions and 89 deletions

View File

@@ -81,8 +81,7 @@ func (s *Scanner) Start() error {
s.seenTracksNew = 0
s.seenTracksErr = 0
}()
//
// being walking
// ** begin being walking
start := time.Now()
err := godirwalk.Walk(s.musicPath, &godirwalk.Options{
Callback: s.callbackItem,
@@ -99,8 +98,7 @@ func (s *Scanner) Start() error {
len(s.seenTracks),
s.seenTracksErr,
)
//
// begin cleaning
// ** begin cleaning
start = time.Now()
var deleted uint
// delete tracks not on filesystem
@@ -301,8 +299,7 @@ func (s *Scanner) handleTrack(it *item) error {
s.trTx = s.db.Begin()
s.trTxOpen = true
}
//
// set track basics
// ** begin set track basics
track := &db.Track{}
err := s.trTx.
Select("id, updated_at").
@@ -339,8 +336,7 @@ func (s *Scanner) handleTrack(it *item) error {
track.TagBrainzID = trTags.BrainzID()
track.Length = trTags.Length() // these two should be calculated
track.Bitrate = trTags.Bitrate() // ...from the file instead of tags
//
// set album artist basics
// ** begin set album artist basics
artistName := func() string {
if r := trTags.AlbumArtist(); r != "" {
return r
@@ -362,8 +358,7 @@ func (s *Scanner) handleTrack(it *item) error {
s.trTx.Save(artist)
}
track.ArtistID = artist.ID
//
// set genre
// ** begin set genre
genreName := func() string {
if r := trTags.Genre(); r != "" {
return r
@@ -381,13 +376,11 @@ func (s *Scanner) handleTrack(it *item) error {
s.trTx.Save(genre)
}
track.TagGenreID = genre.ID
//
// save the track
// ** begin save the track
s.trTx.Save(track)
s.seenTracks[track.ID] = struct{}{}
s.seenTracksNew++
//
// set album if this is the first track in the folder
// ** begin set album if this is the first track in the folder
folder := s.curFolders.Peek()
if !folder.ReceivedPaths || folder.ReceivedTags {
// the folder hasn't been modified or already has it's tags

View File

@@ -32,7 +32,6 @@ func (t *Tags) firstTag(keys ...string) string {
}
return ""
}
func (t *Tags) Title() string { return t.firstTag("title") }
func (t *Tags) BrainzID() string { return t.firstTag("musicbrainz_trackid") }
func (t *Tags) Artist() string { return t.firstTag("artist") }
@@ -45,7 +44,6 @@ 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