utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtistNameStrOfAlbum

func ArtistNameStrOfAlbum(s *spotify.SimpleAlbum) string

func ArtistNameStrOfSong

func ArtistNameStrOfSong(s *spotify.FullTrack) string

func ArtistNamesOfAlbum

func ArtistNamesOfAlbum(s *spotify.SimpleAlbum) []string

func ArtistNamesOfSong

func ArtistNamesOfSong(s *spotify.FullTrack) []string

func BinToID

func BinToID(bin []byte) uint64

BinToID convert []byte to autoincrement ID

func CheckUpdate

func CheckUpdate() (bool, string)

func CompareSong

func CompareSong(s1, s2 spotify.FullTrack) bool

func CopyClose

func CopyClose(ctx context.Context, dst io.Writer, src io.ReadCloser) (int64, error)

func CopyDirFromEmbed

func CopyDirFromEmbed(src, dst string) error

func CopyFileFromEmbed

func CopyFileFromEmbed(src, dst string) error

func FileOrDirExists

func FileOrDirExists(filename string) bool

func GetLocalDataDir

func GetLocalDataDir() string

func IDToBin

func IDToBin(ID uint64) []byte

IDToBin convert autoincrement ID to []byte

func LoadIniConfig

func LoadIniConfig()

func LogWriter

func LogWriter() io.Writer

func Logger

func Logger() *log.Logger
func MenuItemsFromAlbums(albums []spotify.SimpleAlbum) []model.MenuItem
func MenuItemsFromArtists(artists []spotify.SimpleArtist) []model.MenuItem
func MenuItemsFromPlaylists(playlists []spotify.SimplePlaylist) []model.MenuItem
func MenuItemsFromSongs(songs []spotify.FullTrack) []model.MenuItem

func Notify

func Notify(content NotifyContent)

func PanicRecoverWrapper

func PanicRecoverWrapper(ignorePanic bool, f func())

func PicURLOfSong

func PicURLOfSong(song *spotify.FullTrack) (url string)

func Recover

func Recover(ignore bool) (hasCaught bool)

func ReplaceSpecialStr

func ReplaceSpecialStr(str string) string

func ResetError

func ResetError(i interface{})

func SetLogger

func SetLogger(l *log.Logger)

func WaitForNBytes

func WaitForNBytes(r io.ReadSeeker, N int, interval time.Duration, retryTime int) (err error)

func WebURLOfAlbum

func WebURLOfAlbum(artistId spotify.ID) string

func WebURLOfArtist

func WebURLOfArtist(artistId spotify.ID) string

func WebURLOfLibrary

func WebURLOfLibrary() string

func WebURLOfPlaylist

func WebURLOfPlaylist(playlistId spotify.ID) string

func WebURLOfSong

func WebURLOfSong(songId spotify.ID) string

Types

type Lines

type Lines struct {
	StartTimeMs string        `json:"startTimeMs"`
	Words       string        `json:"words"`
	Syllables   []interface{} `json:"syllables"`
	EndTimeMs   string        `json:"endTimeMs"`
}

type LyricsResp

type LyricsResp struct {
	Error    bool    `json:"error"`
	SyncType string  `json:"syncType"`
	Lines    []Lines `json:"lines"`
}

type Notificator

type Notificator struct {
	*notificator.Notificator
	// contains filtered or unexported fields
}

func NewNotificator

func NewNotificator(o notificator.Options) *Notificator

func (Notificator) Push

func (n Notificator) Push(urgency, title, text, iconPath, redirectUrl, groupId string) error

type NotifyContent

type NotifyContent struct {
	Title   string
	Text    string
	Url     string
	Icon    string
	GroupId string
}

type Options

type Options struct {
	Duration       time.Duration
	Passed         time.Duration
	TickerInternal time.Duration
	OnPaused       func()
	OnDone         func(stopped bool)
	OnTick         func()
	OnRun          func(started bool)
}

Options represents configuration for timer.

type QNode

type QNode struct {
	// contains filtered or unexported fields
}

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func (*Queue) Dequeue

func (q *Queue) Dequeue() interface{}

func (*Queue) Enqueue

func (q *Queue) Enqueue(value interface{})

func (*Queue) Len

func (q *Queue) Len() int

func (*Queue) Peek

func (q *Queue) Peek() interface{}

type ResCode

type ResCode uint8
const (
	Success ResCode = iota
	UnknownError
	NeedLogin
	NeedReconnect
	TokenExpired
)

func CheckSpotifyErr

func CheckSpotifyErr(err error) ResCode

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer represents timer with pause/resume features.

func NewTimer

func NewTimer(options Options) *Timer

NewTimer creates instance of timer.

func (*Timer) Passed

func (t *Timer) Passed() time.Duration

Passed returns how much done is already passed.

func (*Timer) Pause

func (t *Timer) Pause()

Pause temporarily pauses active timer.

func (*Timer) Remaining

func (t *Timer) Remaining() time.Duration

Remaining returns how much time is left to end.

func (*Timer) Run

func (t *Timer) Run()

Run starts just created timer and resumes paused.

func (*Timer) SetPassed

func (t *Timer) SetPassed(passed time.Duration)

SetPassed update passed.

func (*Timer) Stop

func (t *Timer) Stop()

Stop finishes the timer.

type XScrollBar

type XScrollBar struct {
	// contains filtered or unexported fields
}

func NewXScrollBar

func NewXScrollBar() *XScrollBar

func (*XScrollBar) Tick

func (b *XScrollBar) Tick(width int, content string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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