<commit_before>package main

import (
	"encoding/binary"
	"encoding/json"
	"strconv"

	"github.com/boltdb/bolt"
)

type bTrack struct {
	//AlbumArtist    string
	DiscNumber     uint8
	TrackNumber    uint8
	DurationMillis string
	EstimatedSize  string
	ID             string
	PlayCount      uint32
	Title          string
	Year           int
}

func refreshLibrary() {
	//db, err := bolt.Open(fullDbPath(), 0600, nil)
	//checkErr(err)
	//defer db.Close()

	tracks, err := gm.ListTracks()
	checkErr(err)
	err = db.Update(func(tx *bolt.Tx) error {
		tx.DeleteBucket([]byte("Library"))

		lib, err := tx.CreateBucketIfNotExists([]byte("Library"))
		checkErr(err)
		for _, t := range tracks {
			artist, err := lib.CreateBucketIfNotExists([]byte(t.Artist))
			checkErr(err)
			if t.Album == "" {
				t.Album = "Unknown Album"
			}
			album, err := artist.CreateBucketIfNotExists([]byte(t.Album))
			checkErr(err)

			//id, _ := album.NextSequence()

			bt := bTrack{t.DiscNumber, t.TrackNumber, t.DurationMillis,
				t.EstimatedSize, t.ID, t.PlayCount, t.Title, t.Year}
			//trackNumber, _ := album.NextSequence()<commit_msg>Fix types<commit_after>package main

import (
	"encoding/binary"
	"encoding/json"
	"strconv"

	"github.com/boltdb/bolt"
)

type bTrack struct {
	//AlbumArtist    string
	DiscNumber     float64 //uint8
	TrackNumber    float64 //uint8
	DurationMillis string
	EstimatedSize  string
	ID             string
	PlayCount      float64
	Title          string
	Year           float64
}

func refreshLibrary() {
	//db, err := bolt.Open(fullDbPath(), 0600, nil)
	//checkErr(err)
	//defer db.Close()

	tracks, err := gm.ListTracks()
	checkErr(err)
	err = db.Update(func(tx *bolt.Tx) error {
		tx.DeleteBucket([]byte("Library"))

		lib, err := tx.CreateBucketIfNotExists([]byte("Library"))
		checkErr(err)
		for _, t := range tracks {
			artist, err := lib.CreateBucketIfNotExists([]byte(t.Artist))
			checkErr(err)
			if t.Album == "" {
				t.Album = "Unknown Album"
			}
			album, err := artist.CreateBucketIfNotExists([]byte(t.Album))
			checkErr(err)

			//id, _ := album.NextSequence()

			bt := bTrack{t.DiscNumber, t.TrackNumber, t.DurationMillis,
				t.EstimatedSize, t.ID, t.PlayCount, t.Title, t.Year}
			//trackNumber, _ := album.NextSequence()
{'fraction_non_alphanumeric': 0.14431164231961044, 'fraction_numerical': 0.009738822487826471, 'mean_word_length': 3.2481203007518795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6102674', 'n_tokens_mistral': 884, 'n_tokens_neox': 792, 'n_words': 164}