<commit_before>package test

import (
	"bufio"
	"fmt"
	"os"
	"strings"

	"github.com/fabiofalci/sconsify/events"
	"github.com/fabiofalci/sconsify/spotify"
	"github.com/howeyc/gopass"
)

func main2() {
	username, pass := credentials()
	events := events.InitialiseEvents()

	go spotify.Initialise(username, pass, events)
	playlists := <-events.WaitForPlaylists()

	playlist := playlists["Ramones"]
	playlist.Wait()
	track := playlist.Track(3).Track()
	track.Wait()

	events.ToPlay <- track

	println(track.Name())
	<-events.WaitForStatus()
	<-events.NextPlay
}

func credentials() (*string, *[]byte) {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("Username: ")
	username, _ := reader.ReadString('\n')
	username = strings.Trim(username, " \n\r")
	fmt.Print("Password: ")
	pass := gopass.GetPasswd()
	return &username, &pass
}
<commit_msg>Make no gui test random all tracks<commit_after>package test

import (
	"bufio"
	"fmt"
	"math/rand"
	"os"
	"strings"

	"github.com/fabiofalci/sconsify/events"
	"github.com/fabiofalci/sconsify/spotify"
	ui "github.com/fabiofalci/sconsify/ui"
	"github.com/howeyc/gopass"
	sp "github.com/op/go-libspotify/spotify"
)

func main2() {
	username, pass := credentials()
	events := events.InitialiseEvents()

	go spotify.Initialise(username, pass, events)
	playlists := <-events.WaitForPlaylists()

	allTracks := getAllTracks(playlists).Contents()

	for {
		index := rand.Intn(len(allTracks))
		track := allTracks[index]

		events.ToPlay <- track

		println(<-events.WaitForStatus())
		<-events.NextPlay
	}
}

func getAllTracks(playlists map[string]*sp.Playlist) *ui.Queue {
	queue := ui.InitQueue()

	for _, playlist := range playlists {
		playlist.Wait()
		for i := 0; i < playlist.Tracks(); i++ {
			track := playlist.Track(i).Track()
			track.Wait()
			queue.Add(track)
		}
	}

	return queue
}

func credentials() (*string, *[]byte) {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("Username: ")
	username, _ := reader.ReadString('\n')
	username = strings.Trim(username, " \n\r")
	fmt.Print("Password: ")
	pass := <PASSWORD>()
	return &username, &pass
}

{'fraction_non_alphanumeric': 0.17097701149425287, 'fraction_numerical': 0.0019157088122605363, 'mean_word_length': 4.497368421052632, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 4, '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': '6835289', 'n_tokens_mistral': 828, 'n_tokens_neox': 785, 'n_words': 138}