player

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeekMaxHours             = 600
	SeekMaxMinutesAndSeconds = 59

	SeekInputHoursLength             = 3
	SeekInputMinutesAndSecondsLength = 2

	SeekInputByPosition      = 0
	SeekInputHoursPosition   = 1
	SeekInputMinutesPosition = 2
	SeekInputSecondsPosition = 3
)
View Source
const (
	FetchColumnSize = 7

	FetchStatusMarker = FetchColumnSize - 1
)
View Source
const (
	QueueColumnSize = 10

	QueuePlayingMarker = QueueColumnSize - 2
	QueueMediaMarker   = QueueColumnSize - 5
)

Variables

This section is empty.

Functions

func AttachableReference added in v0.4.2

func AttachableReference(v inv.VideoData) inv.SearchData

AttachableReference returns an attachable reference to the video item.

func Context added in v0.3.7

func Context(cancel bool) context.Context

Context cancels and/or returns the player's context.

func Hide

func Hide()

Hide hides the player.

func IsHistoryInputFocused

func IsHistoryInputFocused() bool

IsHistoryInputFocused returns whether the history search bar is focused.

func IsInfoShown

func IsInfoShown() bool

IsInfoShown returns whether the player information is shown.

func IsPlayerShown added in v0.3.3

func IsPlayerShown() bool

IsPlayerShown returns whether the player is shown.

func IsQueueAreaFocused added in v0.4.3

func IsQueueAreaFocused() bool

IsQueueAreaFocused returns whether the queue area is focused.

func IsQueueEmpty

func IsQueueEmpty() bool

IsQueueEmpty returns whether the queue is empty.

func IsQueueFocused

func IsQueueFocused() bool

IsQueueFocused returns whether the queue is focused.

func IsQueueRecommendsFocused added in v0.4.3

func IsQueueRecommendsFocused() bool

IsQueueRecommendsFocused returns whether the queue recommendations page is focused.

func Keybindings

func Keybindings(event *tcell.EventKey) *tcell.EventKey

Keybindings define the main player keybindings.

func ParseQuery

func ParseQuery()

ParseQuery parses the play-audio or play-video commandline parameters, and plays the provided URL.

func Play

func Play(audio, current bool, mediaInfo ...inv.SearchData)

Play plays the currently selected audio/video entry.

func Resize

func Resize(width int, force ...struct{})

Resize resizes the player according to the screen width.

func Show

func Show()

Show shows the player.

func Start

func Start()

Start starts the player and loads its history and states.

func Stop

func Stop()

Stop stops the player.

func ToggleInfo

func ToggleInfo(hide ...struct{})

ToggleInfo toggle the player information view.

Types

type CustomSeeker added in v0.4.3

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

CustomSeeker describes the custom playback seeker.

func (*CustomSeeker) Hide added in v0.4.3

func (c *CustomSeeker) Hide()

Hide hides the custom seeker.

func (*CustomSeeker) IsOpen added in v0.4.3

func (c *CustomSeeker) IsOpen() bool

IsOpen returns whether the custom seeker is open.

func (*CustomSeeker) Keybindings added in v0.4.3

func (c *CustomSeeker) Keybindings(event *tcell.EventKey) *tcell.EventKey

Keybindings define the keybindings for the custom seeker.

func (*CustomSeeker) SeekToPosition added in v0.4.3

func (c *CustomSeeker) SeekToPosition()

SeekToPosition seeks to the specified position.

func (*CustomSeeker) Setup added in v0.4.3

func (c *CustomSeeker) Setup()

Setup sets up the custom seeker.

func (*CustomSeeker) Show added in v0.4.3

func (c *CustomSeeker) Show()

Show shows the custom seeker.

func (*CustomSeeker) ThemeProperty added in v0.4.3

func (c *CustomSeeker) ThemeProperty() theme.ThemeProperty

ThemeProperty returns the custom seeker's theme property.

type Fetcher added in v0.3.7

type Fetcher struct {
	tview.TableContentReadOnly
	// contains filtered or unexported fields
}

Fetcher describes the media fetcher.

func (*Fetcher) Add added in v0.3.7

func (f *Fetcher) Add(
	info inv.SearchData, audio bool,
	newdata ...*FetcherData,
) (*FetcherData, context.Context)

Add sets/adds entry data in the media fetcher.

func (*Fetcher) Cancel added in v0.3.7

func (f *Fetcher) Cancel(data *FetcherData)

Cancel cancels fetching an item in the media fetcher.

func (*Fetcher) CancelAll added in v0.3.7

func (f *Fetcher) CancelAll(clear bool)

Cancel cancels fetching all the items in the media fetcher.

func (*Fetcher) Clear added in v0.3.7

func (f *Fetcher) Clear()

Clear clears the media fetcher.

func (*Fetcher) ClearErrors added in v0.3.7

func (f *Fetcher) ClearErrors()

ClearErrors clears all the errors in the media fetcher.

func (*Fetcher) Count added in v0.3.7

func (f *Fetcher) Count() int

Count returns the number of items in the media fetcher.

func (*Fetcher) Fetch added in v0.3.7

func (f *Fetcher) Fetch(info inv.SearchData, audio bool, newdata ...*FetcherData) (inv.SearchData, error)

Fetch loads media and adds it to the media fetcher.

func (*Fetcher) FetchAll added in v0.3.7

func (f *Fetcher) FetchAll()

FetchAll fetches all the items in the media fetcher.

func (*Fetcher) Get added in v0.3.7

func (f *Fetcher) Get(position int) (FetcherData, bool)

Get returns the entry data at the specified position from the media fetcher.

func (*Fetcher) GetCell added in v0.3.7

func (f *Fetcher) GetCell(row, column int) *tview.TableCell

GetCell returns a TableCell from the media fetcher entry data at the specified row and column.

func (*Fetcher) GetColumnCount added in v0.3.7

func (f *Fetcher) GetColumnCount() int

GetColumnCount returns the number of columns in the table.

func (*Fetcher) GetReference added in v0.3.7

func (f *Fetcher) GetReference(do ...func(d *FetcherData)) (*FetcherData, bool)

GetReference returns the reference of the currently selected column in the table.

func (*Fetcher) GetRowCount added in v0.3.7

func (f *Fetcher) GetRowCount() int

GetRowCount returns the number of rows in the table.

func (*Fetcher) Hide added in v0.3.7

func (f *Fetcher) Hide()

Hide hides the media fetcher.

func (*Fetcher) IsOpen added in v0.3.7

func (f *Fetcher) IsOpen() bool

IsOpen returns whether the media fetcher is open.

func (*Fetcher) Keybindings added in v0.3.7

func (f *Fetcher) Keybindings(event *tcell.EventKey) *tcell.EventKey

Keybindings define the keybindings for the media fetcher.

func (*Fetcher) MarkStatus added in v0.3.7

func (f *Fetcher) MarkStatus(data *FetcherData, status FetcherStatus, err error, text ...string)

MarkStatus marks the status of the media fetcher entry.

func (*Fetcher) Remove added in v0.3.7

func (f *Fetcher) Remove(data *FetcherData)

Remove removes entry data from the media fetcher.

func (*Fetcher) Setup added in v0.3.7

func (f *Fetcher) Setup()

Setup sets up the media fetcher.

func (*Fetcher) Show added in v0.3.7

func (f *Fetcher) Show()

Show shows the media fetcher.

func (*Fetcher) ThemeProperty added in v0.3.8

func (f *Fetcher) ThemeProperty() theme.ThemeProperty

ThemeProperty returns the media fetcher's theme property.

func (*Fetcher) UpdateTag added in v0.3.7

func (f *Fetcher) UpdateTag(clear bool)

UpdateTag updates the status bar tag according to the media fetcher status.

type FetcherData added in v0.3.7

type FetcherData struct {
	Columns [FetchColumnSize]*tview.TableCell
	Info    inv.SearchData
	Error   error
	Audio   bool
	// contains filtered or unexported fields
}

FetcherData describes the media fetcher data.

type FetcherStatus added in v0.3.7

type FetcherStatus string

FetcherStatus describes the status of each media fetcher entry.

const (
	FetcherStatusAdding FetcherStatus = "Adding"
	FetcherStatusError  FetcherStatus = "Error"
)

type History

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

History describes the layout of the history popup and stores the entries.

type Player

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

Player stores the layout for the player.

type Queue

type Queue struct {
	tview.TableContentReadOnly
	// contains filtered or unexported fields
}

Queue describes the media queue.

func (*Queue) Add added in v0.3.7

func (q *Queue) Add(video inv.VideoData, audio bool, uri ...[2]string)

Add adds an entry to the player queue.

func (*Queue) AddRecommendations added in v0.4.3

func (q *Queue) AddRecommendations(video inv.VideoData)

AddRecommendations adds the video-based recommendations to the queue modal.

func (*Queue) AutoPlay added in v0.3.7

func (q *Queue) AutoPlay(force bool)

AutoPlay automatically selects what to play after the current entry has finished playing.

func (*Queue) Clear added in v0.3.7

func (q *Queue) Clear()

Clear clears the queue.

func (*Queue) Context added in v0.3.7

func (q *Queue) Context(cancel bool) context.Context

Context returns/cancels the queue's context.

func (*Queue) Count added in v0.3.7

func (q *Queue) Count() int

Count returns the number of items in the queue.

func (*Queue) Delete added in v0.3.7

func (q *Queue) Delete(position int)

Delete removes a entry from the specified position within the queue.

func (*Queue) Get added in v0.3.7

func (q *Queue) Get(position int) (QueueData, bool)

Get returns the entry data at the specified position from the queue.

func (*Queue) GetCell added in v0.3.7

func (q *Queue) GetCell(row, column int) *tview.TableCell

GetCell returns a TableCell from the queue entry data at the specified row and column.

func (*Queue) GetColumnCount added in v0.3.7

func (q *Queue) GetColumnCount() int

GetColumnCount returns the number of columns in the table.

func (*Queue) GetCurrent added in v0.3.7

func (q *Queue) GetCurrent() (QueueData, bool)

GetCurrent returns the entry data at the current position from the queue.

func (*Queue) GetEntryPointer added in v0.3.7

func (q *Queue) GetEntryPointer(position int) (*QueueData, bool)

GetEntryPointer returns a pointer to the entry data at the specified position from the queue.

func (*Queue) GetMediaType added in v0.3.7

func (q *Queue) GetMediaType() string

GetMediaType returns the media type for the currently playing entry.

func (*Queue) GetPlayingIndex added in v0.3.7

func (q *Queue) GetPlayingIndex() int

GetPlayingIndex returns the index of the currently playing entry.

func (*Queue) GetRect added in v0.3.7

func (q *Queue) GetRect() (int, int, int, int)

GetRect returns the dimensions of the table.

func (*Queue) GetRepeatMode added in v0.3.7

func (q *Queue) GetRepeatMode() mp.RepeatMode

GetRepeatMode returns the current repeat mode.

func (*Queue) GetRowCount added in v0.3.7

func (q *Queue) GetRowCount() int

GetRowCount returns the number of rows in the table.

func (*Queue) GetShuffleMode added in v0.3.7

func (q *Queue) GetShuffleMode() bool

GetShuffleMode returns the current shuffle mode.

func (*Queue) GetTitle added in v0.3.7

func (q *Queue) GetTitle() string

GetTitle returns the title for the currently playing entry.

func (*Queue) Hide

func (q *Queue) Hide()

Hide hides the player queue.

func (*Queue) IsOpen added in v0.3.7

func (q *Queue) IsOpen() bool

IsOpen returns whether the queue is open.

func (*Queue) IsQueueShown added in v0.4.3

func (q *Queue) IsQueueShown() bool

IsQueueShown returns whether the queue page is shown.

func (*Queue) Keybindings

func (q *Queue) Keybindings(event *tcell.EventKey) *tcell.EventKey

Keybindings define the keybindings for the queue.

func (*Queue) LoadPlaylist added in v0.3.7

func (q *Queue) LoadPlaylist(ctx context.Context, plpath string, replace bool) error

LoadPlaylist loads the provided playlist into MPV. If replace is true, the provided playlist will replace the current playing queue. renewLiveURL is a function to check and renew expired liev URLs in the playlist.

func (*Queue) MarkEntryMediaType added in v0.3.7

func (q *Queue) MarkEntryMediaType(key keybinding.Key)

MarkEntryMediaType marks the selected queue entry as 'Audio/Video'.

func (*Queue) MarkPlayingEntry added in v0.3.7

func (q *Queue) MarkPlayingEntry(status QueueEntryStatus)

MarkPlayingEntry marks the current queue entry as 'playing/loading'.

func (*Queue) Move added in v0.3.7

func (q *Queue) Move(before, after int)

Move moves the position of the selected queue entry.

func (*Queue) Next added in v0.3.7

func (q *Queue) Next(force ...struct{})

Next selects the next entry from the current position in the queue.

func (*Queue) Play added in v0.3.7

func (q *Queue) Play(norender ...struct{})

Play plays the entry at the current queue position.

func (*Queue) Position added in v0.3.7

func (q *Queue) Position() int

Position returns the current position within the queue.

func (*Queue) Previous added in v0.3.7

func (q *Queue) Previous(force ...struct{})

Previous selects the previous entry from the current position in the queue.

func (*Queue) SelectCurrentRow added in v0.3.7

func (q *Queue) SelectCurrentRow(row ...int)

SelectCurrentRow selects the specified row within the table.

func (*Queue) SelectRecentEntry added in v0.3.7

func (q *Queue) SelectRecentEntry()

SelectRecentEntry selects the recent-most entry in the queue.

func (*Queue) SetData added in v0.3.7

func (q *Queue) SetData(row int, data QueueData)

SetData sets/adds entry data in the queue.

func (*Queue) SetPosition added in v0.3.7

func (q *Queue) SetPosition(position int)

SetPosition sets the current position within the queue.

func (*Queue) SetReference added in v0.3.7

func (q *Queue) SetReference(row int, video inv.VideoData, checkID ...struct{})

SetReference sets the reference for the data at the specified row in the queue.

func (*Queue) SetState added in v0.3.7

func (q *Queue) SetState(state string)

SetState sets the player states (repeat/shuffle).

func (*Queue) SetTimestamp added in v0.4.3

func (q *Queue) SetTimestamp(position int)

SetTimestamp seeks to the available timestamp during playback.

func (*Queue) Setup added in v0.3.7

func (q *Queue) Setup()

Setup sets up the queue.

func (*Queue) Show

func (q *Queue) Show()

Show shows the player queue.

func (*Queue) Shuffle added in v0.3.7

func (q *Queue) Shuffle(position, count int, force ...struct{}) bool

Shuffle chooses and plays a random entry.

func (*Queue) SwitchToPosition added in v0.3.7

func (q *Queue) SwitchToPosition(position int, autoplay ...struct{})

SwitchToPosition switches to the specified position within the queue.

func (*Queue) ThemeProperty added in v0.3.8

func (q *Queue) ThemeProperty() theme.ThemeProperty

ThemeProperty returns the queue's theme property.

func (*Queue) ToggleRepeatMode added in v0.3.7

func (q *Queue) ToggleRepeatMode()

ToggleRepeatMode toggles the repeat mode.

func (*Queue) ToggleShuffle added in v0.3.7

func (q *Queue) ToggleShuffle()

ToggleShuffle toggles the shuffle mode.

type QueueData

type QueueData struct {
	URI                       [2]string
	Reference                 inv.VideoData
	Columns                   [QueueColumnSize]*tview.TableCell
	Audio, Playing, HasPlayed bool
	Timestamp                 *int64
}

QueueData describes the queue entry data.

type QueueEntryStatus added in v0.3.7

type QueueEntryStatus string

QueueEntryStatus describes the status of a queue entry.

const (
	EntryFetching QueueEntryStatus = "Fetching"
	EntryLoading  QueueEntryStatus = "Loading"
	EntryPlaying  QueueEntryStatus = "Playing"
	EntryStopped  QueueEntryStatus = "Stopped"
)

Jump to

Keyboard shortcuts

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