<commit_before>package player

import (
	"fmt"
	"time"
)

type PlayTimer struct {
	*time.Timer

	end time.Time
}

type MemoryPlayer struct {
	Queue       Queue
	CurrentSong *QueueItem
	Status      Status

	timer     *PlayTimer
	remaining time.Duration
}

func NewMemoryPlayer() (p MusicPlayer) {
	p = &MemoryPlayer{
		Queue:  NewQueue(),
		Status: STOPPED,
	}

	p.Init()

	return
}

// Init - Initialize the player
func (p *MemoryPlayer) Init() {
	fmt.Print("MemoryPlayer - Init\n")

}

// GetStatus - Get the current status of the player
func (p *MemoryPlayer) GetStatus() Status {
	return p.Status
}

// Start - Start the player
func (p *MemoryPlayer) Start() error {
	fmt.Print("MemoryPlayer - Start\n")

	if p.Status == STOPPED {
		p.Status = RUNNING

		p.Next()
	}

	return nil
}

// Stop - Stop playing
func (p *MemoryPlayer) Stop() {
	fmt.Print("MemoryPlayer - Stop\n")

	if p.Status == RUNNING {
		p.Status = STOPPED
		p.timer.Stop()
	}
}

// Pause - Pause playing
func (p *MemoryPlayer) Pause() {
	fmt.Print("MemoryPlayer - Pause\n")

	if p.Status == STOPPED {
		p.Play()
		return
	}

	p.remaining = p.timer.end.Sub(time.Now())
	p.Stop()
}

// Next - Get and play the next item in the queue
func (p *MemoryPlayer) Next() {
	fmt.Print("MemoryPlayer - Next\n")

	if p.timer != nil {
		p.timer.Stop()
	}

	_, err := p.Queue.shift()
	if err != nil {
		p.Stop()
		return
	}

	//p.remaining = item.Duration

	p.Play()

}

// Play -
func (p *MemoryPlayer) Play() {
	fmt.Print("MemoryPlayer - Play\n")<commit_msg>Print -> Println<commit_after>package player

import (
	"fmt"
	"time"
)

type PlayTimer struct {
	*time.Timer

	end time.Time
}

type MemoryPlayer struct {
	Queue       Queue
	CurrentSong *QueueItem
	Status      Status

	timer     *PlayTimer
	remaining time.Duration
}

func NewMemoryPlayer() (p MusicPlayer) {
	p = &MemoryPlayer{
		Queue:  NewQueue(),
		Status: STOPPED,
	}

	p.Init()

	return
}

// Init - Initialize the player
func (p *MemoryPlayer) Init() {
	fmt.Println("MemoryPlayer - Init")

}

// GetStatus - Get the current status of the player
func (p *MemoryPlayer) GetStatus() Status {
	return p.Status
}

// Start - Start the player
func (p *MemoryPlayer) Start() error {
	fmt.Println("MemoryPlayer - Start")

	if p.Status == STOPPED {
		p.Status = RUNNING

		p.Next()
	}

	return nil
}

// Stop - Stop playing
func (p *MemoryPlayer) Stop() {
	fmt.Println("MemoryPlayer - Stop")

	if p.Status == RUNNING {
		p.Status = STOPPED
		p.timer.Stop()
	}
}

// Pause - Pause playing
func (p *MemoryPlayer) Pause() {
	fmt.Println("MemoryPlayer - Pause")

	if p.Status == STOPPED {
		p.Play()
		return
	}

	p.remaining = p.timer.end.Sub(time.Now())
	p.Stop()
}

// Next - Get and play the next item in the queue
func (p *MemoryPlayer) Next() {
	fmt.Println("MemoryPlayer - Next")

	if p.timer != nil {
		p.timer.Stop()
	}

	_, err := p.Queue.shift()
	if err != nil {
		p.Stop()
		return
	}

	//p.remaining = item.Duration

	p.Play()

}

// Play -
func (p *MemoryPlayer) Play() {
	fmt.Println("MemoryPlayer - Play")
{'fraction_non_alphanumeric': 0.14582645991421972, 'fraction_numerical': 0.0, 'mean_word_length': 2.968586387434555, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2845560', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1119, 'n_words': 298}