history

package
v0.0.0-...-ea66291 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type History

type History struct{}

History manages the history of songs played in the application.

func (*History) AddPlaybackAllStats

func (h *History) AddPlaybackAllStats(guildID, ytid string, duration float64) error

AddPlaybackStats updates all playback statistics (duration and count) for a track.

func (*History) AddPlaybackCountStats

func (h *History) AddPlaybackCountStats(guildID, ytid string) error

AddPlaybackCountStats updates playback count statistics for a track.

func (*History) AddPlaybackDurationStats

func (h *History) AddPlaybackDurationStats(guildID, ytid string, duration float64) error

AddPlaybackDurationStats updates playback duration statistics for a track.

func (*History) AddTrackToHistory

func (h *History) AddTrackToHistory(guildID string, song *Song) error

AddTrackToHistory adds a song to the application's play history.

func (*History) GetHistory

func (h *History) GetHistory(guildID string, sortBy string) ([]HistoryTrackInfo, error)

GetHistory retrieves the play history for a guild, sorted by the specified criteria.

func (*History) GetTrackFromHistory

func (h *History) GetTrackFromHistory(guildID string, trackID uint) (db.Track, error)

GetTrackFromHistory retrieves a track from the play history based on its ID and guild.

type HistoryTrackInfo

type HistoryTrackInfo struct {
	History db.History
	Track   db.Track
}

HistoryTrackInfo contains information about a history entry and its associated track.

type IHistory

type IHistory interface {
	AddTrackToHistory(guildID string, song *Song) error
	AddPlaybackAllStats(guildID, ytid string, duration float64) error
	AddPlaybackCountStats(guildID, ytid string) error
	AddPlaybackDurationStats(guildID, ytid string, duration float64) error
	GetHistory(guildID string, sortBy string) ([]HistoryTrackInfo, error)
	GetTrackFromHistory(guildID string, trackID uint) (db.Track, error)
}

IHistory defines the interface for managing the application's play history.

func NewHistory

func NewHistory() IHistory

NewHistory creates a new History instance.

type Song

type Song struct {
	Name        string        // Name of the song
	UserURL     string        // URL provided by the user
	DownloadURL string        // URL for downloading the song
	Thumbnail   Thumbnail     // Thumbnail image for the song
	Duration    time.Duration // Duration of the song
	ID          string        // Unique ID for the song
}

Song represents a song with relevant information.

type Thumbnail

type Thumbnail struct {
	URL    string
	Width  uint
	Height uint
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL