player

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBackRequested = errors.New("back requested")

ErrBackRequested is returned when user selects the back option

View Source
var ErrBackToAnimeSelection = errors.New("back to anime selection")

ErrBackToAnimeSelection is returned when user wants to go back to anime selection

View Source
var ErrBackToDownloadOptions = errors.New("back to download options")

ErrBackToDownloadOptions is returned when user wants to go back to download options

View Source
var ErrBackToEpisodeSelection = errors.New("back to episode selection")

ErrBackToEpisodeSelection is returned when user wants to go back to episode selection

View Source
var ErrChangeAnime = errors.New("user requested to change anime")

ErrChangeAnime is returned when the user chooses to change anime

View Source
var ErrUserQuit = errors.New("user requested to quit application")

ErrUserQuit is returned when the user chooses to quit the application

Functions

func CycleAudioTrack added in v1.6.0

func CycleAudioTrack(socketPath string) error

CycleAudioTrack cycles through available audio tracks

func CycleSubtitleTrack added in v1.6.0

func CycleSubtitleTrack(socketPath string) error

CycleSubtitleTrack cycles through available subtitle tracks

func DownloadFolderFormatter added in v1.0.6

func DownloadFolderFormatter(str string) string

DownloadFolderFormatter formats the anime URL to create a download folder name.

This function extracts a specific part of the anime video URL to use it as the name for the download folder. It uses a regular expression to capture the part of the URL after "/video/", which is often unique and suitable as a folder name.

Steps: 1. Compiles a regular expression that matches URLs of the form "https://<domain>/video/<unique-part>". 2. Extracts the "<unique-part>" from the URL. 3. If the match is successful, it returns the extracted part as the folder name. 4. If no match is found, it returns an empty string.

Parameters: - str: The anime video URL as a string.

Returns: - A string representing the formatted folder name, or an empty string if no match is found.

func DownloadVideo added in v1.0.6

func DownloadVideo(url, destPath string, numThreads int, m *model) error

DownloadVideo downloads a video using multiple threads.

func ExtractEpisodeNumber

func ExtractEpisodeNumber(episodeStr string) string

ExtractEpisodeNumber extracts the episode number from the episode string

func ExtractVideoSources added in v1.1.0

func ExtractVideoSources(episodeURL string) ([]struct {
	Quality int
	URL     string
}, error)

ExtractVideoSources returns the available video sources for an episode.

func ExtractVideoSourcesWithPrompt added in v1.1.0

func ExtractVideoSourcesWithPrompt(episodeURL string) (string, error)

ExtractVideoSourcesWithPrompt allows the user to choose video quality.

func GetAudioTracks added in v1.6.0

func GetAudioTracks(socketPath string) ([]map[string]interface{}, error)

GetAudioTracks returns list of available audio tracks

func GetCurrentAudioTrack added in v1.6.0

func GetCurrentAudioTrack(socketPath string) (int, error)

GetCurrentAudioTrack returns the current audio track ID

func GetCurrentSubtitleTrack added in v1.6.0

func GetCurrentSubtitleTrack(socketPath string) (int, error)

GetCurrentSubtitleTrack returns the current subtitle track ID

func GetPlaybackStats added in v1.0.9

func GetPlaybackStats(socketPath string) (map[string]interface{}, error)

GetPlaybackStats returns current playback statistics

func GetSubtitleTracks added in v1.6.0

func GetSubtitleTracks(socketPath string) ([]map[string]interface{}, error)

GetSubtitleTracks returns list of available subtitle tracks

func GetVideoURLForEpisode

func GetVideoURLForEpisode(episodeURL string) (string, error)

GetVideoURLForEpisode gets the video URL for a given episode URL

func GetVideoURLForEpisodeEnhanced added in v1.6.0

func GetVideoURLForEpisodeEnhanced(episode *models.Episode, anime *models.Anime) (string, error)

GetVideoURLForEpisodeEnhanced gets the video URL using the enhanced API with AllAnime navigation support

func HandleBatchDownload added in v1.0.7

func HandleBatchDownload(episodes []models.Episode, animeURL string) error

HandleBatchDownload performs batch download of episodes.

func HandleBatchDownloadRange added in v1.6.0

func HandleBatchDownloadRange(episodes []models.Episode, animeURL string, startNum, endNum int) error

HandleBatchDownloadRange performs batch download of episodes using a provided range. It mirrors HandleBatchDownload but skips prompting for the range and enables optional AniSkip sidecar generation when AllAnime Smart is enabled.

func HandleDownloadAndPlay

func HandleDownloadAndPlay(
	videoURL string,
	episodes []models.Episode,
	selectedEpisodeNum int,
	animeURL string,
	episodeNumberStr string,
	animeMalID int,
	updater *discord.RichPresenceUpdater,
) error

HandleDownloadAndPlay handles the download and playback of the video

func InitTrackerAsync added in v1.6.0

func InitTrackerAsync()

InitTrackerAsync initializes the tracker in the background. Call this early in the application lifecycle to avoid delays later.

func MpvSendCommand added in v1.1.0

func MpvSendCommand(socketPath string, command []interface{}) (interface{}, error)

MpvSendCommand is a wrapper function to expose mpvSendCommand to other packages

func SelectEpisodeWithFuzzyFinder

func SelectEpisodeWithFuzzyFinder(episodes []models.Episode) (string, string, error)

SelectEpisodeWithFuzzyFinder allows the user to select an episode using fuzzy finder

func SetAudioTrack added in v1.6.0

func SetAudioTrack(socketPath string, trackID int) error

SetAudioTrack sets a specific audio track by ID

func SetPlaybackSpeed added in v1.0.9

func SetPlaybackSpeed(socketPath string, speed float64) error

SetPlaybackSpeed sets the video playback speed

func SetSubtitleTrack added in v1.6.0

func SetSubtitleTrack(socketPath string, trackID int) error

SetSubtitleTrack sets a specific subtitle track by ID

func StartVideo added in v1.0.9

func StartVideo(link string, args []string) (string, error)

StartVideo opens mpv with a socket for IPC Modify the StartVideo function in player.go

func ToggleSubtitle added in v1.0.9

func ToggleSubtitle(socketPath string) error

ToggleSubtitle toggles subtitle visibility

Types

type VideoData

type VideoData struct {
	Src   string `json:"src"`
	Label string `json:"label"`
}

VideoData represents the video data structure, with a source URL and a label

type VideoResponse

type VideoResponse struct {
	Data []VideoData `json:"data"`
}

VideoResponse represents the video response structure with a slice of VideoData

Jump to

Keyboard shortcuts

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