Documentation
¶
Index ¶
- Constants
- Variables
- func AnimeProviderID(anime *Anime) (string, string)
- func ApplyCastSubStyle(config *Config, explicitlyAskedSoft bool)
- func ApplyTheme(palette theme.Palette)
- func AwaitEnter() bool
- func BeginBusy(config *Config, stage string) func()
- func BestLink(links []string) string
- func CastEpisode(config *Config, anime *Anime) error
- func ChangeMyAnimeListToken(config *Config, user *User) error
- func ChangeToken(config *Config, user *User)
- func ChangeTracker(config *Config, user *User)
- func ClearLogFile(path string) error
- func CloseLogFile() error
- func ConfigFileName() string
- func ConvertSecondsToMinutes(seconds int) int
- func CurrentAnimeProviderName(anime *Anime) string
- func DeleteAniListListEntry(token string, entryID int) error
- func DisplayVersion() string
- func DownloadFormat(config *Config) string
- func EndAllBusy()
- func EndCrashWatch()
- func EndStartupProgress()
- func EnsureConfiguredTrackersReady(cfg *Config, user *User) error
- func EnterAppScreen()
- func EpisodesList(showID, mode string) ([]string, error)
- func Exit(err error)
- func ExitMPV(socket string) error
- func FormatAnimeSearchLabel(title string, count int) string
- func FormatProviderStatus(report []ProviderHealth, query string) string
- func FormatProviderStatusSummary(report []ProviderHealth, adult bool) string
- func FormatStreamInfo(info StreamInfo) string
- func GetAnilistUserID(token string) (int, string, error)
- func GetAnimeMalID(mediaID int) (int, error)
- func GetAnimeName(show Anime) string
- func GetEpisodeURL(config Config, id string, epNo int) ([]string, error)
- func GetGlobalLogFile() string
- func GetMPVPlaybackSpeed(socket string) (float64, error)
- func GetMyAnimeListAccessToken(config *Config) (string, error)
- func GetStoragePath() string
- func GetTokenFromFile(path string) (string, error)
- func GetUserData(token string, viewerID int) (map[string]interface{}, error)
- func GetUserInputFromRofi(question string) (string, error)
- func GridRowMarkup(label string, capacity int) string
- func HistoryFile(storagePath string) string
- func InitializeAniListUserAnimeList(userConfig *Config, user *User) error
- func InitializeMyAnimeListUserAnimeList(config *Config, user *User) error
- func IsFiller(filler []int, episode int) bool
- func IsMPVRunning(socket string) bool
- func JoinWatchPartyFromMenu(config *Config, databaseFile string)
- func KnownConfigKeys() []string
- func LastAnimeFile(storagePath string) string
- func LeaveAppScreen()
- func LoadConfigFromFile(path string) (map[string]string, error)
- func LoadTokenForConfiguredTracking(cfg *Config, user *User) error
- func LocalRemapAnimeProvider(historyPath string, anilistID int, providerName, providerID, title string, ...) error
- func LocalUpdateAnime(databaseFile string, anilistID int, providerID string, watchingEpisode int, ...) error
- func Log(data any) error
- func MPVConnectionGone(err error) bool
- func MPVSendCommand(socket string, command []interface{}) (interface{}, error)
- func ManualProviderSearchEnabled(config *Config) bool
- func ManualProviderSearchHint(config *Config, entry *Entry, query, subOrDub string) string
- func MergeRemoteLists(config *Config) error
- func MigrateOnVersionUpgrade(configPath string, config *Config, appVersion string) (bool, error)
- func MovieRoomFilm(dir, presenter, anilistToken string) ([]string, float64, error)
- func MpvPlaybackStartTimeoutDuration(config *Config) time.Duration
- func NextCanonEpisode(filler []int, current int) int
- func Out(data interface{})
- func ParseProviderQualifiedID(qualified string) (providerName, rawProviderID string, ok bool)
- func ParseStreamInfoArg(arg string) (anilistID, episode int, err error)
- func PercentageWatched(position, duration int) float64
- func PlayOtakaseMovie(config *Config, user *User, milestone int)
- func PlaylistSwitchInProgress() bool
- func PromptShowQuality(config *Config, anilistID int) (bool, error)
- func ProviderDisabledReason(provider string) string
- func ProviderEnabled(name string) bool
- func ProviderStackContains(config *Config, providerName string) bool
- func QualifyProviderID(provider, id string) string
- func RateAnime(token string, mediaID int) error
- func RateAnimeWithScore(token string, mediaID int, score float64) error
- func ReauthenticateAniList(config *Config, user *User, reason string) (string, error)
- func RefreshAniListUserAnimeList(userConfig *Config, user *User) error
- func RefreshCombinedRemoteAnimeList(config *Config, user *User) error
- func RefreshMyAnimeListUserAnimeList(config *Config, user *User) error
- func RefreshUserAnimeList(cfg *Config, user *User) error
- func RegisterExitCleanup(fn func()) (cancel func())
- func RemapAnimeProviderOnEpisodeFailure(config *Config, anime *Anime, anilistEntry *Entry) bool
- func RemapProviderAnime(userConfig *Config, user *User, databaseAnimes *[]Anime)
- func RemoteTrackingDisplayName(cfg *Config) string
- func ReplaceAniListWithMyAnimeList(config *Config) error
- func ReplaceMyAnimeListWithAniList(config *Config) error
- func ResolveDownloadDir(config *Config) string
- func ResolveEpisodeLinks(config *Config, anime *Anime) bool
- func RunCheatCode(config *Config)
- func SanitizeFilename(name string) string
- func SaveAniListAnimeListEntry(token string, mediaID int, status *string, progress, repeat *int, ...) error
- func SaveConfigToFile(path string, values map[string]string) error
- func SeekMPV(socket string, seconds int) (interface{}, error)
- func SelectionMeansBack(option SelectionOption) bool
- func SelectionMeansQuit(option SelectionOption) bool
- func SendSkipTimesToMPV(anime *Anime) error
- func SetGlobalAnime(anime *Anime)
- func SetGlobalConfig(config *Config)
- func SetGlobalLogFile(path string)
- func SetGlobalUser(user *User)
- func SetOpenLink(link OpenLink)
- func SetVersion(version string)
- func ShouldWriteRemoteTracking(cfg *Config, show *Anime) bool
- func ShowCommunity(config *Config) bool
- func ShowPictures(malID int) ([]string, error)
- func ShowWatchStats(config *Config)
- func SkipSeekTarget(times SkipTimes, position int, config *Config) (int, bool)
- func SplitMenuOrder(menuOrder string) ([]Tab, []FooterAction)
- func StartVideo(link string, args []string, title string, anime *Anime) (string, error)
- func StartVideoWithProviderFallback(config *Config, anime *Anime, title string) string
- func StartWatchParty(config *Config, databaseFile, input string) (hosting bool, err error)
- func SurpriseMe(config *Config, list AnimeList) (int, bool)
- func TrackerEpisodeHint(config *Config, entry *Entry) string
- func UnknownConfigKeys(configMap map[string]string) map[string]string
- func UpdateAniListAnimeProgress(accessToken string, mediaID, progress int) error
- func UpdateAniListAnimeStatus(accessToken string, mediaID int, status string) error
- func UpdateAnimeEntry(userConfig *Config, user *User)
- func UpdateAnimeProgress(token string, mediaID, progress int) error
- func UpdateAnimeStatus(token string, mediaID int, status string) error
- func UsePrefetchedEpisode(anime *Anime) bool
- func UsesAniListTracking(cfg *Config) bool
- func UsesMyAnimeListTracking(cfg *Config) bool
- func UsesRemoteTracking(cfg *Config) bool
- func Version() string
- func VimKeysEnabled(config *Config) bool
- func WaitForMPVPlaybackStart(socket string, timeout time.Duration) bool
- func WarnAboutUnknownConfigKeys(configMap map[string]string)
- func WatchMovies(config *Config)
- func WatchUntracked(userConfig *Config)
- func WithEpisodeCountsAndNote(title string, entry Entry, resume string) string
- func WithEpisodeCountsForGrid(title string, entry Entry, resume string) string
- type AniListAnime
- type AnilistToken
- type Anime
- func GetAnimeDataByID(mediaID int, token string) (Anime, error)
- func GetGlobalAnime() *Anime
- func LocalFindAnime(animeList []Anime, anilistID int, providerID string) *Anime
- func LocalFindEpisode(animeList []Anime, anilistID, episode int, providerName string) *Anime
- func LocalGetAllAnime(historyPath string) []Anime
- type AnimeList
- type AnimeListSync
- type AnimeTitle
- type Config
- type DownloadInfo
- type DownloadResult
- type Entry
- type Episode
- type EpisodeProgress
- type FooterAction
- type FuzzyDate
- type Media
- type MoviePlayback
- type NextAiringEpisodeInfo
- type NextEpisode
- type OAuthToken
- type OpenLink
- type Page
- type PlaybackLossAction
- type PreviewSelectionRefreshConfig
- type Provider
- type ProviderEpisodeResult
- func ResolveEpisodeURL(config Config, anime *Anime, epNo int) (ProviderEpisodeResult, error)
- func ResolveEpisodeURLAlternateModeAfterFailure(config Config, anime *Anime, epNo int, exclude []string, failed []string) (ProviderEpisodeResult, error)
- func ResolveEpisodeURLAlternateModeAuto(config Config, anime *Anime, epNo int, exclude []string) (ProviderEpisodeResult, error)
- func ResolveEpisodeURLAlternateModeWithPrompt(config Config, anime *Anime, epNo int, exclude []string) (ProviderEpisodeResult, error)
- func ResolveEpisodeURLExcludingProvidersMode(config Config, anime *Anime, epNo int, exclude []string, mode string) (ProviderEpisodeResult, error)
- func ResolveEpisodeURLForPlayback(config Config, anime *Anime, epNo int) (ProviderEpisodeResult, error)
- type ProviderHealth
- type ProviderMappingOutcome
- type ProviderModeResolver
- type ResponseData
- type RofiSelectPreview
- type SelectionOption
- func DynamicSelect(choices []SelectionOption) (SelectionOption, error)
- func DynamicSelectPreserveOrder(choices []SelectionOption) (SelectionOption, error)
- func DynamicSelectPreview(previews map[string]RofiSelectPreview, addNew bool) (SelectionOption, error)
- func DynamicSelectPreviewWithRefresh(previews map[string]RofiSelectPreview, addNew bool, ...) (SelectionOption, error)
- func DynamicSelectWithRefresh(choices []SelectionOption, refreshConfig *SelectionRefreshConfig) (SelectionOption, error)
- func NormalizeSelectionKey(option SelectionOption) SelectionOption
- func ProviderSearchOptionsForDisplay(results []SelectionOption, entry *Entry) []SelectionOption
- func ResolveUntrackedProviderSearch(config *Config, initialQuery string) (providerID, providerName string, picked SelectionOption, back bool, err error)
- func RofiSelectWithMessage(choices []SelectionOption, isHomeMenu bool, prompt, message string) (SelectionOption, error)
- type SelectionRefreshConfig
- type SequelInfo
- type ShowPrefs
- type Skip
- type SkipIDs
- type SkipRef
- type SkipResolution
- type SkipSource
- type SkipSubmission
- type SkipTimes
- type StreamInfo
- type StreamLink
- type StreamPlaybackHint
- type StreamSubtitle
- type SubtitleTrack
- type Tab
- type TorrentLink
- type User
Constants ¶
const ( CastBrowserSubtitlesSoft = "soft" CastBrowserSubtitlesBurn = "burn" )
The CastBrowserSubtitles values.
const ( CastNextEpisodeCountdown = "countdown" CastNextEpisodeStop = "stop" )
The CastNextEpisode values.
const ( // DefaultDiscordBotURL is the bot's public API. DefaultDiscordBotURL = "https://bot.xyverion.com" // DiscordInviteURL is the invite to the Otakase Discord, which is also // where the support forum lives. DiscordInviteURL = "https://otakase.com/discord/" )
const ( DownloadFormatMKV = "mkv" DownloadFormatMP4 = "mp4" )
Download containers.
const ( IconsAuto = "auto" IconsOn = "true" IconsOff = "false" )
Icons setting values. auto draws them where the glyphs can be relied on.
const ( MovieRoomWidth = 1280 MovieRoomHeight = 720 )
MovieRoomWidth and MovieRoomHeight are the size the room's copy is encoded at: the film is drawn on its 1080p canvas, then scaled to what the room plays everything else at.
const ( DefaultStatusQuery = "one piece" DefaultAdultStatusQuery = "overflow" )
Default probe queries. 18+ providers carry nothing under a general title, so they get one of their own.
const ( // AppName names the config and storage directories. AppName = "otakase" // DisplayName is AppName as notifications and window titles show it. DisplayName = "Otakase" StoragePathDefault = "$HOME/.local/share/" + AppName )
const ( // TrackingRemoteNone keeps local history only. TrackingRemoteNone = "none" // TrackingRemoteAniList and TrackingRemoteMyAnimeList track on one site. TrackingRemoteAniList = "anilist" TrackingRemoteMyAnimeList = "myanimelist" // TrackingRemoteBoth keeps AniList and MyAnimeList in step. TrackingRemoteBoth = "anilist+myanimelist" )
Values of Config.TrackingRemote.
const ( // AnimeSkipAutoClientID is the config value that asks for the client id to // be fetched rather than typed. AnimeSkipAutoClientID = "auto" )
const ( // DefaultUpdateRepo is the fork every update path pulls from: the // launch check, the update prompt, and `otakase -u` alike. DefaultUpdateRepo = "TheXykril/otakase" )
const LinkMenusTerminal = "terminal"
LinkMenusTerminal is the LinkMenus value that opens links in a terminal.
const LogFileName = "otakase-debug.log"
LogFileName is the debug log inside the storage directory.
It carries the program's name rather than being a bare debug.log, because it leaves that directory constantly: it is the first thing a bug report asks for, and a file called debug.log in someone's downloads folder says nothing about what produced it.
const (
MpvStartWaitSeconds = 20
)
MpvPlaybackStartTimeout is in seconds: 20 unless set, never more than ten minutes.
const OpenLinkScheme = "otakase"
OpenLinkScheme is the URL scheme otakase is registered for.
const OtakaseDiscordAppID = "1556589176164589578"
OtakaseDiscordAppID is the Discord application profiles show as "Watching Otakase".
const ProviderStatusDetailsEnv = "OTAKASE_PROVIDER_STATUS_DETAILS"
ProviderStatusDetailsEnv set to 1 makes -provider-status print every source by name, for the Discord bot and debugging. Viewers otherwise see counts only.
Variables ¶
var ConfigFilePath string
ConfigFilePath is the config file this run loaded.
var ErrCastNonInteractive = errors.New("selection: interactive menu unavailable in a spawned cast window")
ErrCastNonInteractive is what a menu returns rather than draw itself in a window whose viewer is not at the keyboard.
It exists as a last resort. Every prompt reachable from a spawned cast takes a declared default before it gets here, but that list was built by reading call sites, and reading call sites is how a function with no callers came to be listed as a live consent prompt. A prompt added later on any path should decline and say so, not block a season on a window nobody is watching.
var ErrCastStopped = errors.New("cast: stopped by the viewer")
ErrCastStopped reports that the viewer ended the cast themselves.
It is not a failure and it is not a finished episode: nothing is wrong, and nothing should advance. Without it both look like the nil a finished episode returns, and pressing q would start the next episode.
var ErrFFmpegMissing = fmt.Errorf("ffmpeg is required to download episodes")
ErrFFmpegMissing reports that ffmpeg is not installed.
var ErrMPVNoSocket = mpv.ErrNoSocket
ErrMPVNoSocket reports that no MPV IPC socket is available. Callers treat it like a closed connection: MPV is not reachable, so polling must stop.
var ErrRatingDeclined = errors.New("rating declined")
ErrRatingDeclined means the viewer chose not to rate, as opposed to the rating failing.
The two used to look the same: RateAnime returned nil when the score prompt was cancelled, every caller took that as success, and announced a rating that was never saved. Escaping the prompt in a terminal did it, and a cast window did it every time.
Functions ¶
func AnimeProviderID ¶
AnimeProviderID returns the anime's provider and its id there.
func ApplyCastSubStyle ¶
ApplyCastSubStyle makes a cast ask for the burned-in subtitle variant.
The Default Media Receiver renders WebVTT only, and no provider here supplies WebVTT, so a soft-subbed cast plays with no subtitles at all. In memory only: providers read the live preference through providerhost.CurrentSubStyle, which reads this field, so nothing needs to be written to disk -- and rewriting the viewer's stored preference because they cast once would change every later local playback.
explicitlyAskedSoft says the viewer passed -softsub on this same run, which is the one case worth answering out loud rather than silently overriding.
func ApplyTheme ¶
ApplyTheme rebuilds the menu styles from a palette.
func AwaitEnter ¶
func AwaitEnter() bool
AwaitEnter waits for enter to be pressed, and reports whether it was.
It returns false when stdin has ended, which is not someone pressing enter. The waits that use this sit in loops that start the next episode each time round, and a stdin that answers instantly and forever would spin them -- opening a player per turn, with nobody there to watch it.
func BeginBusy ¶
BeginBusy shows that otakase is working on stage until the returned function runs. The function is safe to call more than once.
func BestLink ¶
BestLink picks the link to play from those a provider resolved: a preferred host first, then the highest resolution named in the URL. Ties keep the provider's order.
func CastEpisode ¶
CastEpisode plays the already-resolved episode on a Chromecast instead of in mpv, and keeps tracking it while it plays.
func ChangeMyAnimeListToken ¶
func ChangeToken ¶
ChangeToken signs in to AniList and stores the new token. It opens the browser first; when that fails it asks for a token pasted by hand.
func ChangeTracker ¶
ChangeTracker switches tracking mode from the menu, signs in where needed, optionally reconciles the two lists, and reloads.
func ClearLogFile ¶
ClearLogFile empties the log at path, creating it and its folder when they are missing. Every launch starts a fresh log.
func CloseLogFile ¶
func CloseLogFile() error
CloseLogFile releases the log handle. Safe to call more than once.
func ConfigFileName ¶
func ConfigFileName() string
ConfigFileName is the config file inside the config directory.
func ConvertSecondsToMinutes ¶
ConvertSecondsToMinutes turns a length in seconds into whole minutes.
func CurrentAnimeProviderName ¶
CurrentAnimeProviderName is the provider an anime's stored id belongs to.
func DeleteAniListListEntry ¶
DeleteAniListListEntry removes a list entry by its list (not media) ID.
func DisplayVersion ¶
func DisplayVersion() string
DisplayVersion is the version as menus show it: "v26.1.0" for a release, the raw string for anything else.
func DownloadFormat ¶
DownloadFormat reads the configured container, defaulting to MKV.
func EndAllBusy ¶
func EndAllBusy()
EndAllBusy stops any indicator, for exit paths that never reach the caller's end function.
func EndCrashWatch ¶
func EndCrashWatch()
EndCrashWatch marks this run as ended well. It runs on every exit.
func EndStartupProgress ¶
func EndStartupProgress()
EndStartupProgress stops reporting. It is safe to call more than once, and is called from the menus themselves: a visible menu is its own proof that otakase started, and any message still on screen at that point is stale.
func EnsureConfiguredTrackersReady ¶
EnsureConfiguredTrackersReady signs in to whichever trackers are configured and lack a token, then loads the one the session runs on.
func EnterAppScreen ¶
func EnterAppScreen()
EnterAppScreen moves the terminal to its alternate buffer, which the menus draw on, so the shell's scrollback is left as it was. AlternateScreen=false turns it off.
func EpisodesList ¶
EpisodesList lists a show's episode numbers as its provider writes them.
func FormatAnimeSearchLabel ¶
FormatAnimeSearchLabel is a search result's label: the title, followed by its episode count when that is known.
func FormatProviderStatus ¶
func FormatProviderStatus(report []ProviderHealth, query string) string
FormatProviderStatus renders the health report as plain text.
func FormatProviderStatusSummary ¶
func FormatProviderStatusSummary(report []ProviderHealth, adult bool) string
FormatProviderStatusSummary is the health report as viewers see it: how many sources work, never which. 18+ sources get their own count, shown only with adult on.
func FormatStreamInfo ¶
func FormatStreamInfo(info StreamInfo) string
FormatStreamInfo is the one JSON line -stream-info prints last.
func GetAnilistUserID ¶
GetAnilistUserID returns the signed-in viewer's ID and name.
func GetAnimeMalID ¶
GetAnimeMalID maps an AniList media ID to its MyAnimeList ID.
func GetAnimeName ¶
GetAnimeName is the title to display for show: the configured language when it has one, then whichever title it does have, then its AniList id.
func GetEpisodeURL ¶
GetEpisodeURL resolves an episode of a show by id, in config.SubOrDub.
func GetMPVPlaybackSpeed ¶
func GetMyAnimeListAccessToken ¶
GetMyAnimeListAccessToken returns a usable access token, refreshing it or signing in again when the stored one has expired.
func GetStoragePath ¶
func GetStoragePath() string
GetStoragePath is the storage directory of the running config, or the default one before a config is loaded.
func GetTokenFromFile ¶
GetTokenFromFile returns the access token stored at path. The file is JSON; a file holding just the token as text is read too.
func GetUserData ¶
GetUserData returns the viewer's whole anime list collection, undecoded, for ParseAnimeList.
func GetUserInputFromRofi ¶
GetUserInputFromRofi asks for a line of text in rofi, with question shown above the entry. Dismissing rofi is an error, as is any other failure to run it.
func GridRowMarkup ¶
GridRowMarkup renders one poster-grid label, budgeting the title so the episode counts always survive.
The grid clips a label at the column width, and a long anime title used the whole line, so the counts -- the one thing a cover cannot tell you -- were the part that disappeared. The title absorbs the truncation instead, and the counts stay pinned at the end.
The budget is in characters, which is only meaningful because the menus are set in a monospace face; see theme.MonospaceFont.
func HistoryFile ¶
HistoryFile is the local watch history inside the storage directory.
func InitializeAniListUserAnimeList ¶
InitializeAniListUserAnimeList shows the cached list at once and refreshes it behind the menu. Start-up only waits on AniList when there is no cache.
func InitializeMyAnimeListUserAnimeList ¶
InitializeMyAnimeListUserAnimeList loads the list for user. A cached list is shown straight away and refreshed in the background; without one the list is fetched before returning.
func IsMPVRunning ¶
IsMPVRunning reports whether an mpv answers on the socket.
func JoinWatchPartyFromMenu ¶
JoinWatchPartyFromMenu asks for the party link and joins it. A member watches the party and comes back; the host comes back to pick the show, with the state already being sent.
func KnownConfigKeys ¶
func KnownConfigKeys() []string
KnownConfigKeys returns every key the config struct understands.
func LastAnimeFile ¶
LastAnimeFile holds the AniList id of the show played last.
func LeaveAppScreen ¶
func LeaveAppScreen()
LeaveAppScreen leaves the alternate buffer, if EnterAppScreen entered it.
func LoadConfigFromFile ¶
LoadConfigFromFile reads a key=value file. Blank lines and lines starting with # are skipped; spaces around keys and values are trimmed.
func LoadTokenForConfiguredTracking ¶
LoadTokenForConfiguredTracking sets user.Token to the token the session runs on. With both trackers that is AniList's, or MyAnimeList's when there is no AniList token; with none it is empty.
func LocalRemapAnimeProvider ¶
func LocalRemapAnimeProvider(historyPath string, anilistID int, providerName, providerID, title string, episode, position, duration int) error
LocalRemapAnimeProvider moves a show's history onto another provider, or adds it when the history has no row for it.
Every row the show has under its current provider moves, not just the furthest one: a duplicate left behind would still point at the old provider.
func LocalUpdateAnime ¶
func LocalUpdateAnime(databaseFile string, anilistID int, providerID string, watchingEpisode int, playbackTime int, animeDuration int, animeName string, providerName string) error
LocalUpdateAnime records progress for one show under one provider id, adding a row when it has none yet, and rewrites the history file.
func Log ¶
Log appends data to the debug log as JSON, stamped with the time and the file and line it was logged from.
func MPVConnectionGone ¶
MPVConnectionGone reports that the MPV session is over: the socket is missing, closed, or refusing connections. Polling loops must stop when it returns true, or they spin forever logging the same error.
func MPVSendCommand ¶
MPVSendCommand sends one command to mpv, trying again a couple of times when the socket hiccups. An empty socket path and an unavailable property are answers, not hiccups, and return at once: retrying an empty path is what once turned a failed launch into a loop logging thousands of lines a second.
func ManualProviderSearchEnabled ¶
ManualProviderSearchEnabled reports whether provider matches are always picked by hand rather than automatically.
func ManualProviderSearchHint ¶
ManualProviderSearchHint says what is being searched for, so the right provider entry can be picked by hand: title, format, episode count and sub or dub.
func MergeRemoteLists ¶
MergeRemoteLists reconciles both lists and writes the result to both.
func MigrateOnVersionUpgrade ¶
MigrateOnVersionUpgrade brings the config up to date the first time a new release runs: menu entries and options it introduced are added, unless AddMissingOptions is off, and an old Provider value is migrated. A launch of the same release as last time changes nothing. It reports whether the config was updated.
func MovieRoomFilm ¶
MovieRoomFilm writes the film for the watch room into dir and returns the ffmpeg arguments, to be run in dir, that draw it to dir/playlist.m3u8 with four-second segments, and how many seconds it lasts. presenter is the host's name, used when AniList does not answer with one; anilistToken, when not empty, is the host's AniList sign-in, which makes the film about them.
func MpvPlaybackStartTimeoutDuration ¶
MpvPlaybackStartTimeoutDuration is how long to wait for mpv to start playing.
func NextCanonEpisode ¶
NextCanonEpisode is the first episode after current that is not filler.
func ParseProviderQualifiedID ¶
ParseProviderQualifiedID splits an id made by QualifyProviderID. A bare id comes back unchanged with ok false.
func ParseStreamInfoArg ¶
ParseStreamInfoArg reads "154587:12" as an AniList id and an episode.
func PercentageWatched ¶
func PlayOtakaseMovie ¶
PlayOtakaseMovie plays the film and returns once it is closed. milestone is the episode count being celebrated, or 0.
func PlaylistSwitchInProgress ¶
func PlaylistSwitchInProgress() bool
PlaylistSwitchInProgress is true while the playlist is swapping episodes.
func PromptShowQuality ¶
PromptShowQuality asks which quality one show should play at and stores the answer. It reports false when the viewer backed out, leaving it unchanged.
func ProviderDisabledReason ¶
ProviderDisabledReason is why a provider cannot be used; "" means it can.
func ProviderEnabled ¶
ProviderEnabled says whether a provider can be used in this run.
A name nothing registers is not a provider that happens to be switched on -- it is one this build does not have. Reading it as enabled is how a config naming a provider that has since been removed would survive migration untouched, leaving the user pointed at nothing.
func ProviderStackContains ¶
ProviderStackContains reports whether the configured stack includes the named provider.
func QualifyProviderID ¶
QualifyProviderID prefixes a show id with the provider it belongs to.
func RateAnimeWithScore ¶
RateAnimeWithScore writes a rating that has already been decided.
Choosing and writing are separate because the cast panel picks the score with arrow keys and cannot open a prompt, and because a caller that already has a score should not have to answer a question to use it.
Both single-tracker routes write the score passed in. They used to call RateAniListAnime or rateMyAnimeListAnime, which prompted again and threw this argument away; on a cast the prompt was auto-cancelled by CastNonInteractive, the cancel came back as nil, and the panel said "Rated 9." with nothing saved. Asking is RateAnime's job.
func ReauthenticateAniList ¶
ReauthenticateAniList discards the saved AniList token and runs the browser sign-in again. A non-empty reason is included in what is shown and logged.
func RefreshCombinedRemoteAnimeList ¶
RefreshCombinedRemoteAnimeList re-reads both trackers and publishes the merge, queuing whatever writes it calls for.
func RefreshMyAnimeListUserAnimeList ¶
RefreshMyAnimeListUserAnimeList fetches the list now and replaces user's.
func RefreshUserAnimeList ¶
RefreshUserAnimeList reloads the list for the configured tracker.
func RegisterExitCleanup ¶
func RegisterExitCleanup(fn func()) (cancel func())
RegisterExitCleanup adds work that must happen before the process exits on a signal. The interrupt handler calls os.Exit, so a deferred cleanup in a caller never runs; anything holding a resource outside this process -- a child process, a device playing a stream, a scratch directory -- registers here instead.
func RemapAnimeProviderOnEpisodeFailure ¶
RemapAnimeProviderOnEpisodeFailure drops the anime's mapping and searches for it again, after its episode could not be found. It reports whether a new mapping was made.
func RemapProviderAnime ¶
RemapProviderAnime lets the user pick a show from their lists and map it to a provider entry by hand, replacing the saved mapping.
func RemoteTrackingDisplayName ¶
RemoteTrackingDisplayName names the configured tracker for messages.
func ResolveDownloadDir ¶
ResolveDownloadDir expands the configured download directory, defaulting to ~/Downloads/otakase.
func ResolveEpisodeLinks ¶
ResolveEpisodeLinks fills anime.Ep with a playable stream for the episode it names, reporting whether it found one.
Preferred-first resolve; the diagnosed recovery menu only after that fails. ok=false means nothing played and the caller should stop -- either the resolve found nothing or the viewer backed out of the recovery menu.
It is shared rather than inlined into StartPlayback because the process spawned for a rofi cast never reaches StartPlayback: it casts episode after episode itself, and StartNextEpisode clears Ep.Links "to force fetching new ones" without fetching anything. This is that fetch, for both callers.
func SanitizeFilename ¶
SanitizeFilename makes a title safe to use as a filename on every platform.
func SaveAniListAnimeListEntry ¶
func SaveAniListAnimeListEntry(token string, mediaID int, status *string, progress, repeat *int, score *float64, startedAt, completedAt *FuzzyDate) error
SaveAniListAnimeListEntry writes the given fields of a list entry; a nil argument leaves that field as it is on AniList. A zero date is sent as null, which clears the date there.
func SaveConfigToFile ¶
SaveConfigToFile writes the settings sorted by key. The file is replaced in one rename, so a crash or a second running copy never leaves it half written.
func SelectionMeansBack ¶
func SelectionMeansBack(option SelectionOption) bool
SelectionMeansBack reports whether a menu answer is Back, by key or by any of the labels menus have used for it.
func SelectionMeansQuit ¶
func SelectionMeansQuit(option SelectionOption) bool
SelectionMeansQuit reports whether a menu answer is Quit, by key or label.
func SendSkipTimesToMPV ¶
SendSkipTimesToMPV marks the opening and ending as chapters in mpv, so they show on the seek bar and can be jumped with the chapter keys.
func SetGlobalAnime ¶
func SetGlobalAnime(anime *Anime)
SetGlobalAnime makes anime the show the rest of the program acts on.
func SetGlobalConfig ¶
func SetGlobalConfig(config *Config)
func SetGlobalLogFile ¶
func SetGlobalLogFile(path string)
SetGlobalLogFile points the debug log at path.
func SetOpenLink ¶
func SetOpenLink(link OpenLink)
SetOpenLink makes the next pick of a show the link's, instead of a menu.
func SetVersion ¶
func SetVersion(version string)
SetVersion records the version of the running build.
func ShouldWriteRemoteTracking ¶
ShouldWriteRemoteTracking is false for local-only tracking and for a show marked to stay off the remote lists.
func ShowCommunity ¶
ShowCommunity is the Community menu: the server's news, the invite, the Discord link and its sharing switch, and problem reports. It reports true when a pick queued a show to play (SetOpenLink), for the caller to go to.
func ShowPictures ¶
ShowPictures lists every picture MyAnimeList has for a show.
func ShowWatchStats ¶
func ShowWatchStats(config *Config)
ShowWatchStats opens the stats page and returns when the viewer leaves it. There is nothing to choose on it, so every way out leads back to the menu.
func SkipSeekTarget ¶
usableSpan rejects a span that would send the player somewhere wrong. A zero span means "not known"; a reversed or negative one means the service answered with something broken, and skipping to it is worse than not skipping. SkipSeekTarget says where to jump from position, if anywhere: the end of the opening, ending or recap the viewer has just entered, among those the config asks to skip. Only the first two seconds of a span count, so seeking back into one to watch it is left alone.
func SplitMenuOrder ¶
func SplitMenuOrder(menuOrder string) ([]Tab, []FooterAction)
SplitMenuOrder divides a MenuOrder setting into the categories that become tabs and the actions that become footer entries, keeping the order the user wrote in each case.
MenuOrder mixes two kinds of thing that used to sit in one list: lists you look at, and things you do. Rather than introduce a second setting and a migration to fill it, the one setting keeps its name and is read as both. A key belonging to neither group is ignored rather than guessed at.
func StartVideo ¶
StartVideo plays link and returns the socket of the player it went to. A player that is still open from the last episode loads it in the same window; otherwise a new one starts.
func StartVideoWithProviderFallback ¶
StartVideoWithProviderFallback plays the episode's links and, when mpv never gets a frame up, works through the other providers. Every provider in the configured audio is tried first; only then is the other audio offered, behind a prompt. Returns the socket of the player that started and exits the program when nothing plays.
func StartWatchParty ¶
StartWatchParty joins the party that input names (an event id or a party link). For the host it starts sending the player state in the background and returns true: the host then picks the show and episode as usual. For a member it plays along until they close mpv or the party ends, and returns false.
func SurpriseMe ¶
SurpriseMe offers random shows from Plan to Watch until one is started or the viewer goes back. It returns the AniList id of the show to start.
func TrackerEpisodeHint ¶
func UnknownConfigKeys ¶
UnknownConfigKeys returns the keys in a config map that otakase does not understand, sorted, each paired with the closest known key when there is one.
func UpdateAnimeEntry ¶
UpdateAnimeEntry edits a show on the tracker list: its status, progress, score, or the quality kept for it locally.
func UpdateAnimeProgress ¶
func UsePrefetchedEpisode ¶
UsePrefetchedEpisode makes the prefetched next episode the one to play, if it is the episode anime is now on. It reports whether it did.
The links and their playback hints are taken together. Taking the links alone left the subtitles unset, and the player went on showing the ones it was given for the previous episode.
func UsesAniListTracking ¶
func UsesMyAnimeListTracking ¶
func UsesRemoteTracking ¶
func Version ¶
func Version() string
Version is the version of the running build, "dev" when it has none.
func VimKeysEnabled ¶
VimKeysEnabled reports whether menus take vim-style motions.
func WaitForMPVPlaybackStart ¶
WaitForMPVPlaybackStart blocks until mpv reports a time-pos, i.e. the first frame is up. It gives up early if mpv goes away and returns false on timeout. Players without IPC count as started.
func WarnAboutUnknownConfigKeys ¶
WarnAboutUnknownConfigKeys tells the user about settings otakase ignores, so a typo is not silently dropped. Keys are never removed: an unrecognised key may belong to a newer otakase the user also runs.
func WatchMovies ¶
func WatchMovies(config *Config)
WatchMovies runs the Movies section until the viewer backs out of it.
func WatchUntracked ¶
func WatchUntracked(userConfig *Config)
WatchUntracked plays a show picked by search, without reading or writing any history or remote list.
func WithEpisodeCountsAndNote ¶
WithEpisodeCountsAndNote appends the counts and, when there is one, a single status note: a resume point, or how long until the next episode airs.
Types ¶
type AniListAnime ¶
type AniListAnime struct {
ID int `json:"id"`
Episodes int `json:"episodes"`
Title struct {
Romaji string `json:"romaji"`
English string `json:"english"`
Native string `json:"native"`
} `json:"title"`
CoverImage struct {
Large string `json:"large"`
} `json:"coverImage"`
}
AniListAnime is one show in an AniList search result.
type AnilistToken ¶
type AnilistToken struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
ExpiresAt time.Time `json:"expires_at"`
}
AnilistToken is a stored OAuth token. MyAnimeList tokens use the same shape.
type Anime ¶
type Anime struct {
Title AnimeTitle `json:"title"`
Ep Episode `json:"ep"`
// CoverImage is a URL; kept under "url" from the history's first format.
CoverImage string `json:"url"`
// TotalEpisodes is 0 while it is not known, which for a show still
// airing can be for good.
TotalEpisodes int `json:"total_episodes"`
MalId int `json:"mal_id"`
AnilistId int `json:"anilist_id"`
// Rewatching is a show the tracker has on Rewatching; it is never
// scored at the end. Repeat and the dates are carried to write back
// when the rewatch is completed.
Rewatching bool
Repeat int
StartedAt FuzzyDate
CompletedAt FuzzyDate
// ProviderId and ProviderName are where the episodes come from: the
// show's id on that provider and the provider's name.
ProviderId string
ProviderName string
FillerEpisodes []int
IsAiring bool
// IsAdult is the tracker's 18+ flag. With AdultContent on, such a show
// is looked for only on adult providers, which are the only ones that
// carry it.
IsAdult bool `json:"-"`
// SkipRemoteSync is set for a session that should leave the tracker
// alone, such as watching a completed show again without a rewatch.
SkipRemoteSync bool `json:"-"`
// Untracked is an episode from Untracked Watching: played, never written
// to the history file or a tracker. A cast reads it to skip every write.
Untracked bool `json:"-"`
// Movie is set when this is a movie from the Movies section, which is
// Untracked too: a cast starts it where the movie history says and
// reports where it got to there instead of to the anime history.
Movie *MoviePlayback `json:"-"`
// contains filtered or unexported fields
}
Anime is the show being watched and where the viewer is in it.
func GetAnimeDataByID ¶
GetAnimeDataByID fetches the details of one show that the player needs before the list entry, if any, is known.
func GetGlobalAnime ¶
func GetGlobalAnime() *Anime
GetGlobalAnime is the show set by SetGlobalAnime, or nil.
func LocalFindAnime ¶
LocalFindAnime returns the furthest-along row matching either id, or nil. An empty providerID matches on the AniList id alone.
func LocalFindEpisode ¶
LocalFindEpisode returns the history row for one episode of one show.
LocalFindAnime answers a different question: it returns the furthest-ahead row for the show, which is what "where is this show up to" needs. For "where in this episode was I" it is wrong, and wrong in a way that hides itself. A show watched through more than one provider has a row each, and if any of them is further ahead its position wins -- so a nine minute position in the episode about to play was replaced by a one second position in a later one, and the resume did nothing at all.
The row written by providerName is preferred, because that is the one the position being looked for was written to, and a position from another provider is a position in a different encode of the episode.
func LocalGetAllAnime ¶
LocalGetAllAnime reads every valid row of the history file. It never returns nil, even when the file cannot be read.
type AnimeList ¶
type AnimeList struct {
Watching []Entry `json:"watching"`
Completed []Entry `json:"completed"`
Paused []Entry `json:"paused"`
Dropped []Entry `json:"dropped"`
Planning []Entry `json:"planning"`
Rewatching []Entry `json:"rewatching"`
}
AnimeList is the viewer's list, one slice per status.
func BuildLocalAnimeList ¶
func FetchLatestAniListAnimeList ¶
FetchLatestAniListAnimeList reads the viewer's list with cover images.
func FetchLatestMyAnimeList ¶
FetchLatestMyAnimeList downloads the whole MyAnimeList list. The app keys everything by AniList id, so a title AniList cannot match is skipped. With a user, its MyAnimeList id and name are filled in too.
func ParseAnimeList ¶
ParseAnimeList sorts a MediaListCollection answer (as GetUserData returns it) into status buckets.
type AnimeListSync ¶
type AnimeListSync struct {
// contains filtered or unexported fields
}
AnimeListSync is the list menus draw from while a refresh runs behind them. Only the newest list is ever queued on Updates: a menu that was busy has no use for the ones it missed.
func NewAnimeListSync ¶
func NewAnimeListSync(start AnimeList) *AnimeListSync
func (*AnimeListSync) Current ¶
func (ls *AnimeListSync) Current() AnimeList
func (*AnimeListSync) MarkRefreshDone ¶
func (ls *AnimeListSync) MarkRefreshDone()
MarkRefreshDone is safe to call repeatedly; calls after the first do nothing.
func (*AnimeListSync) RefreshDone ¶
func (ls *AnimeListSync) RefreshDone() <-chan struct{}
RefreshDone is closed when the background refresh ends, successful or not.
func (*AnimeListSync) Replace ¶
func (ls *AnimeListSync) Replace(next AnimeList, notify bool) bool
Replace installs next and reports whether it differs from what was there. When it does and notify is set, next is also queued on Updates.
func (*AnimeListSync) Updates ¶
func (ls *AnimeListSync) Updates() <-chan AnimeList
type AnimeTitle ¶
type AnimeTitle struct {
Romaji string `json:"title_romanji"`
English string `json:"title"`
Japanese string `json:"title_japanese"`
}
AnimeTitle is a show's name in the languages trackers give it in. The json names are the ones the watch history has always been written with.
type Config ¶
type Config struct {
Player string `config:"Player"`
MpvArgs []string `config:"MpvArgs"`
MpvSkin string `config:"MpvSkin"`
MpvPlaybackStartTimeout int `config:"MpvPlaybackStartTimeout"`
SubsLanguage string `config:"SubsLanguage"`
SubOrDub string `config:"SubOrDub"`
SubStyle string `config:"SubStyle"`
StoragePath string `config:"StoragePath"`
AnimeNameLanguage string `config:"AnimeNameLanguage"`
Theme string `config:"Theme"`
ThemeOverrides string `config:"ThemeOverrides"`
ThemeFile string `config:"ThemeFile"`
Icons string `config:"Icons"`
DownloadDir string `config:"DownloadDir"`
DownloadFormat string `config:"DownloadFormat"`
MenuOrder string `config:"MenuOrder"`
MenuActions string `config:"MenuActions"`
ContinueWatchingRows int `config:"ContinueWatchingRows"`
PercentageToMarkComplete int `config:"PercentageToMarkComplete"`
NextEpisodePrompt bool `config:"NextEpisodePrompt"`
AutoAudioFallback bool `config:"AutoAudioFallback"`
SkipOp bool `config:"SkipOp"`
SkipEd bool `config:"SkipEd"`
SkipFiller bool `config:"SkipFiller"`
ImagePreview bool `config:"ImagePreview"`
SkipRecap bool `config:"SkipRecap"`
// NormalizeVolume evens out loudness in mpv: quiet dialogue comes up and
// loud effects come down. Left alone when MpvArgs set audio filters.
NormalizeVolume bool `config:"NormalizeVolume"`
RofiSelection bool `config:"RofiSelection"`
// SubOrDubFlag records that -sub or -dub was given for this run, which
// outranks the audio remembered for a show. Not a setting either.
SubOrDubFlag bool `config:"-"`
ScoreOnCompletion bool `config:"ScoreOnCompletion"`
SaveMpvSpeed bool `config:"SaveMpvSpeed"`
AddMissingOptions bool `config:"AddMissingOptions"`
AlternateScreen bool `config:"AlternateScreen"`
DiscordPresence bool `config:"DiscordPresence"`
DiscordClientId string `config:"DiscordClientId"`
VimKeys bool `config:"VimKeys"`
AnimeSkipClientID string `config:"AnimeSkipClientID"`
ContributeSkipTimes bool `config:"ContributeSkipTimes"`
IntroDBSkipTimes bool `config:"IntroDBSkipTimes"`
CheckUpdates bool `config:"CheckUpdates"`
DevBuilds bool `config:"DevBuilds"`
MpvEpisodePlaylist bool `config:"MpvEpisodePlaylist"`
// Provider, DisabledProviders and ManualProviderSearch are no longer
// settings: sources are always picked automatically from the whole stack
// and never named to the viewer. PopulateConfig fixes their values; tests
// and debugging may still set them in code.
Provider string `config:"-"`
DisabledProviders string `config:"-"`
ManualProviderSearch bool `config:"-"`
TrackingLocal bool `config:"TrackingLocal"`
TrackingRemote string `config:"TrackingRemote"`
TrackingConfigured bool `config:"TrackingConfigured"`
MyAnimeListClientID string `config:"MyAnimeListClientID"`
MyAnimeListClientSecret string `config:"MyAnimeListClientSecret"`
MyAnimeListImported bool `config:"MyAnimeListImported"`
MyAnimeListImportDismissed bool `config:"MyAnimeListImportDismissed"`
ShowNewEpisodes bool `config:"ShowNewEpisodes"`
CastDevice string `config:"CastDevice"`
// CastTerminal is the terminal emulator to open for a cast started from
// rofi, which has no terminal of its own to show controls in. Empty means
// $TERMINAL, then whatever is installed.
CastTerminal string `config:"CastTerminal"`
// LinkMenus is where an otakase:// link opened from the desktop shows
// its menus: "rofi" or "terminal". rofi falls back to a terminal when it
// is not installed.
LinkMenus string `config:"LinkMenus"`
// CastPort is the port the stream server listens on, or 0 for a random
// free one. Set it when a firewall drops inbound connections by default:
// a random port cannot be allowed through without opening the whole
// ephemeral range, and a device that cannot fetch looks identical to one
// that never started.
CastPort int `config:"CastPort"`
// CastDiscoveryPort is the UDP port discovery sends from and hears TVs
// answer on, or 0 for a random one. Fixed by default so a firewall needs
// one rule for it rather than every UDP port.
CastDiscoveryPort int `config:"CastDiscoveryPort"`
// KodiHost names Kodi instances to offer as cast devices when discovery
// does not find them -- another subnet, or zeroconf turned off in Kodi.
// host or host:port, several separated by commas.
KodiHost string `config:"KodiHost"`
KodiUser string `config:"KodiUser"`
KodiPassword string `config:"KodiPassword"`
// CastBurnSubtitles draws a stream's subtitles into the picture when
// casting it. The Chromecast cannot render the subtitle files these
// providers supply, so this is the only way to see them on a soft-subbed
// stream -- at the cost of re-encoding the video, which the copy path
// never does.
CastBurnSubtitles bool `config:"CastBurnSubtitles"`
// CastWaitForSubtitles holds a cast whose subtitles are inside the file (a
// torrent release) until the whole file has downloaded, so they are drawn
// from the first frame with no rebuilds. Off, the cast starts within
// seconds and the stream is rebuilt a few times early on as more of them
// are read.
CastWaitForSubtitles bool `config:"CastWaitForSubtitles"`
// CastSubtitleSize is the size of dialogue in burned ASS subtitles, as a
// percentage of what the release wrote: they are sized for a screen up
// close, and a TV is watched from across the room. Signs and typesetting
// keep their size.
CastSubtitleSize int `config:"CastSubtitleSize"`
// CastBrowser lists "Browser" among the cast devices: otakase serves a
// player page on the LAN, and any phone, TV or console with a browser
// plays the episode by opening its link.
CastBrowser bool `config:"CastBrowser"`
// CastBrowserPort is the port that page is served on. Fixed so the link
// stays the same between episodes and runs, and a firewall needs one rule.
CastBrowserPort int `config:"CastBrowserPort"`
// CastBrowserSubtitles is how a browser shows a provider's subtitles:
// "soft" hands it the subtitle file to draw and switch on or off, plain
// text without the release's styling; "burn" draws them into the picture,
// styled, at the cost of re-encoding the video.
CastBrowserSubtitles string `config:"CastBrowserSubtitles"`
// CastEncoder forces the encoder used for that: "vaapi", "software", or
// empty to detect what this machine can actually do.
CastEncoder string `config:"CastEncoder"`
// CastNextEpisode is what a cast does when an episode ends: "countdown"
// counts down on the panel and plays the next one, "stop" ends the cast.
// Local playback has NextEpisodePrompt for the same question.
CastNextEpisode string `config:"CastNextEpisode"`
// Quality is the picture height to play HLS streams at: "best" leaves
// the master playlist as the provider gave it, a number of lines (1080,
// 720, 480) picks the nearest variant at or below. A show can override
// it in show_prefs.json.
Quality string `config:"Quality"`
// AdultContent shows 18+ titles in your lists and in search. Off hides
// them; they stay on the tracker and keep syncing.
AdultContent bool `config:"AdultContent"`
// ContinueWatchingAdult lets 18+ shows into the continue-watching rows.
// They open the home menu, so it is off by default and needs AdultContent.
ContinueWatchingAdult bool `config:"ContinueWatchingAdult"`
// CastToDevice records that -cast was given for this run. It is not a
// setting, so it carries no config tag.
CastToDevice bool `config:"-"`
// CastNonInteractive records that this process is the terminal a rofi cast
// was handed off to, and so has a viewer who is not at the keyboard.
//
// It is not a setting either. What it changes is that a prompt with no
// answer available resolves to its declared default instead of drawing a
// menu: the process-global cast reader is parked in os.Stdin.Read for the
// whole run and would split the keystrokes with a Bubble Tea reader on the
// same descriptor, and a menu nobody is at blocks the season outright.
// See the cast window prompts dev notes.
CastNonInteractive bool `config:"-"`
// ExperimentalMovies turns on the Movies menu: non-anime movies from a
// site outside AniList and MyAnimeList, tracked locally only. Off by
// default while it is experimental.
ExperimentalMovies bool `config:"ExperimentalMovies"`
// MovieProvider is where movies are searched. No longer a setting:
// PopulateConfig always sets "all" (every provider at once).
MovieProvider string `config:"-"`
// TraktClientID and TraktClientSecret name another Trakt app to sync
// movies through than otakase's own, which is used when they are empty.
TraktClientID string `config:"TraktClientID"`
TraktClientSecret string `config:"TraktClientSecret"`
// DiscordBotURL is the Otakase Discord bot's API, for linking the app to
// the server, news and reports. Empty turns all of that off.
DiscordBotURL string `config:"DiscordBotURL"`
DiscordShareWatching bool `config:"DiscordShareWatching"`
// DiscordWatchWithMe puts a Watch with me button in the Discord status
// while an episode plays: it joins a synced party this app hosts.
DiscordWatchWithMe bool `config:"DiscordWatchWithMe"`
// finishing a show in the Otakase Discord, "never" to not ask.
DiscordShareRatings string `config:"DiscordShareRatings"`
}
Config is every setting in otakase.conf. A field's config tag is its key in the file; "-" marks per-run state that is never written.
func GetGlobalConfig ¶
func GetGlobalConfig() *Config
func LoadConfig ¶
LoadConfig reads the config file, creating it with the defaults when there is none. Settings the file leaves out take their defaults in memory; they are written to the file only by MigrateOnVersionUpgrade, so an ordinary start does not rewrite it.
func PopulateConfig ¶
PopulateConfig builds a Config from raw values. A missing, empty or unreadable value takes the setting's default.
type DownloadInfo ¶
type DownloadInfo struct {
Version int `json:"version"`
Title string `json:"title"`
AnilistID int `json:"anilist_id,omitempty"`
MalID int `json:"mal_id,omitempty"`
Episode int `json:"episode"`
TotalEpisodes int `json:"total_episodes,omitempty"`
Mode string `json:"mode"`
Provider string `json:"provider,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
File string `json:"file"`
SkipTimes SkipTimes `json:"skip_times"`
DownloadedAt time.Time `json:"downloaded_at"`
}
DownloadInfo describes one downloaded episode.
type DownloadResult ¶
DownloadResult reports what happened for one episode.
type Entry ¶
type Entry struct {
// ListID is the list entry's own id, not the show's.
ListID int `json:"id"`
Media Media `json:"media"`
Progress int `json:"progress"`
Repeat int `json:"repeat"`
Score float64 `json:"score"`
// Status is the list the entry is on, in AniList's names: CURRENT,
// REPEATING, COMPLETED, PAUSED, DROPPED or PLANNING.
Status string `json:"status"`
StartedAt FuzzyDate `json:"startedAt"`
CompletedAt FuzzyDate `json:"completedAt"`
CoverImage string `json:"coverImage"`
UpdatedAt time.Time `json:"updatedAt"`
// Private is AniList's "hide from other users" flag. MyAnimeList has no
// such flag, so a private entry is kept off MyAnimeList entirely.
Private bool `json:"private,omitempty"`
}
Entry is a show on the viewer's list.
type Episode ¶
type Episode struct {
Title AnimeTitle `json:"title"`
Number int `json:"number"`
SkipTimes SkipTimes `json:"skip_times"`
Player playingVideo `json:"player"`
Resume bool `json:"resume"`
Started bool `json:"started"`
Duration int `json:"duration"`
Links []string `json:"links"`
StreamReferrer string `json:"-"`
SubtitleURL string `json:"-"`
// SubtitleTracks is every subtitle the provider offered for this episode,
// SubtitleURL among them; the rest are offered to mpv to switch to.
SubtitleTracks []SubtitleTrack `json:"-"`
StreamHeaders map[string]string `json:"-"`
StreamFlixKey string `json:"-"`
// StreamHLSBitrate caps mpv at one variant of an HLS master whose audio
// is a separate rendition; see applyQualityPreference. Zero is no cap.
StreamHLSBitrate int `json:"-"`
// Mode is the audio actually playing, which is not always the audio that was
// asked for: AutoAudioFallback plays sub when a show has no dub. Anything
// resolving a further episode has to follow what is playing rather than the
// preference, or it asks for audio this show does not have and fails.
Mode string `json:"-"`
NextEpisode NextEpisode `json:"next_episode"`
IsFiller bool `json:"filler"`
IsRecap bool `json:"recap"`
Aired string `json:"aired"`
Synopsis string `json:"synopsis"`
// ContinueLast picks the last watched show instead of showing the list
// (-c, or Continue from the menu).
ContinueLast bool
// LastWasSkipped marks that filler or recap was skipped to reach this
// episode, so the skipped ones are counted as watched once it plays.
LastWasSkipped bool
// IsCompleted is set once the episode counts as watched.
IsCompleted bool
}
Episode is the episode being played and what is known about it.
type EpisodeProgress ¶
type EpisodeProgress struct {
// Watched is how many episodes the tracker records as seen.
Watched int
// Total is the season's episode count, or 0 when AniList does not know it
// yet — common for shows announced before a count is fixed.
Total int
// Aired is how many episodes have been broadcast, or 0 when unknown.
Aired int
// Releasing reports whether the show is still airing.
Releasing bool
}
EpisodeProgress is what is known about one entry's episode counts.
func (EpisodeProgress) Summary ¶
func (p EpisodeProgress) Summary() string
Summary renders the counts for a list row, or "" when nothing is known.
type FooterAction ¶
type FooterAction struct {
}
FooterAction is one entry in the bar along the bottom: the things you do to the list rather than a list you look at.
type Media ¶
type Media struct {
// Duration is the average episode length in minutes.
Duration int `json:"duration"`
Episodes int `json:"episodes"`
Format string `json:"format"`
ID int `json:"id"`
MalID int `json:"mal_id"`
Title AnimeTitle `json:"title"`
// Status is AniList's: FINISHED, RELEASING, NOT_YET_RELEASED and so on.
Status string `json:"status"`
NextAiringEpisode *NextAiringEpisodeInfo `json:"nextAiringEpisode,omitempty"`
// IsAdult marks 18+ titles: AniList's isAdult, or MyAnimeList rating
// them "black" (explicit). AdultContent=false hides them.
IsAdult bool `json:"isAdult,omitempty"`
}
Media is a show as the trackers describe it.
type MoviePlayback ¶
type MoviePlayback struct {
// Start is the position to start from, in seconds.
Start float64
// Progress is told the position and duration, in seconds, when the cast
// stops, and whether the movie counts as watched.
Progress func(position float64, duration int, watched bool)
}
MoviePlayback is what a cast needs to know about a movie.
type NextAiringEpisodeInfo ¶
NextAiringEpisodeInfo is AniList's next broadcast: the episode and the seconds until it airs.
type NextEpisode ¶
type NextEpisode struct {
Number int
Links []string
ProviderName string
ProviderId string
Mode string
// LinkHints are the referrer, subtitles and headers each link was resolved
// with. They belong to this episode's links, so they travel with them.
LinkHints map[string]StreamPlaybackHint
}
NextEpisode is the following episode, resolved during playback so it can start without a wait.
type OAuthToken ¶
type OAuthToken = AnilistToken
OAuthToken is a stored MyAnimeList token. It has the same shape as AniList's.
type OpenLink ¶
type OpenLink struct {
AnilistID int
// Episode is the episode to start, 0 to start where the viewer is up to.
Episode int
}
OpenLink is what an otakase:// link asks for.
type Page ¶
type Page struct {
Media []AniListAnime `json:"media"`
}
Page is the page of results an AniList search returns.
type PlaybackLossAction ¶
type PlaybackLossAction int
PlaybackLossAction is the monitor's response when time-pos or has-playback stops answering.
const ( // PlaybackLossWait means the gap is expected (playlist switch, demuxer // reload, buffering); keep polling. PlaybackLossWait PlaybackLossAction = iota // PlaybackLossComplete means the episode got past the completion // threshold, so it counts as watched however playback ended. PlaybackLossComplete // PlaybackLossExit means the viewer closed mpv before the threshold. PlaybackLossExit )
func ClassifyPlaybackLoss ¶
func ClassifyPlaybackLoss(socket string, started bool, percentageWatched float64, completeThreshold int) PlaybackLossAction
ClassifyPlaybackLoss maps a lost time-pos to a PlaybackLossAction.
mpv answers "property unavailable" while it swaps playlist entries, and that must not end the session. Only an mpv that is actually gone, or an episode already watched far enough, does.
type PreviewSelectionRefreshConfig ¶
type PreviewSelectionRefreshConfig struct {
Updates <-chan AnimeList
BuildOptions func(AnimeList) map[string]RofiSelectPreview // keyed by row key
Refreshed <-chan struct{}
// Main, Prompt, Categories and Actions are as in SelectionRefreshConfig:
// the poster grid is the main list in rofi when posters are on.
Main bool
Toolbar bool
Prompt string
Categories []Tab
Actions []FooterAction
}
PreviewSelectionRefreshConfig is SelectionRefreshConfig for the poster grid.
type Provider ¶
type Provider interface {
// Name is the provider's id as the Provider setting spells it.
Name() string
// SearchAnime finds shows by title in the given audio (sub or dub).
SearchAnime(title, mode string) ([]SelectionOption, error)
// EpisodesList is a show's episodes, labelled as the host labels them.
EpisodesList(id, mode string) ([]string, error)
// GetEpisodeURL resolves one episode in config.SubOrDub.
GetEpisodeURL(config Config, id string, epNo int) ([]string, error)
}
Provider is a streaming host as the rest of the app sees it: a providers.Provider whose episode lookups take the whole Config.
var CurrentProvider Provider
CurrentProvider caches GetProvider's answer. Changing the Provider setting resets it to nil.
func GetProvider ¶
func GetProvider() Provider
GetProvider returns the provider at the head of the configured stack, falling back to the first enabled one. It is only the right provider for ids that came from it; a show's own provider is providerIDForAnime's.
func ProviderByName ¶
ProviderByName returns a fresh instance of a provider, unless it is disabled.
type ProviderEpisodeResult ¶
type ProviderEpisodeResult struct {
Links []string // stream URLs, preferred first
LinkHints map[string]StreamPlaybackHint // keyed by link; may be nil
ProviderName string // host the links came from
ProviderID string // the show's id on that host
Mode string // audio the links are in
}
ProviderEpisodeResult is a resolved episode: its stream links and which provider, show id and audio they came from.
func ResolveEpisodeURL ¶
func ResolveEpisodeURL(config Config, anime *Anime, epNo int) (ProviderEpisodeResult, error)
ResolveEpisodeURL resolves an episode in config.SubOrDub, with no fallback.
func ResolveEpisodeURLAlternateModeAfterFailure ¶
func ResolveEpisodeURLAlternateModeAfterFailure(config Config, anime *Anime, epNo int, exclude []string, failed []string) (ProviderEpisodeResult, error)
ResolveEpisodeURLAlternateModeAfterFailure is the prompt variant for a stream that never started. When the other audio resolves to the very links that just failed -- a dual-audio torrent serves both -- switching cannot help, so it reports that instead of announcing a missing dub.
func ResolveEpisodeURLAlternateModeAuto ¶
func ResolveEpisodeURLAlternateModeAuto(config Config, anime *Anime, epNo int, exclude []string) (ProviderEpisodeResult, error)
ResolveEpisodeURLAlternateModeAuto switches to the other audio without asking.
Some shows exist in one language only, and for those the prompt has a single useful answer -- it just stands between the user and the episode. What was played is still reported, so an automatic switch is never a silent one.
func ResolveEpisodeURLAlternateModeWithPrompt ¶
func ResolveEpisodeURLAlternateModeWithPrompt(config Config, anime *Anime, epNo int, exclude []string) (ProviderEpisodeResult, error)
ResolveEpisodeURLAlternateModeWithPrompt probes the non-preferred audio and, with AutoAudioFallback off, asks before switching to it. The preferred audio is never given up silently.
func ResolveEpisodeURLExcludingProvidersMode ¶
func ResolveEpisodeURLExcludingProvidersMode(config Config, anime *Anime, epNo int, exclude []string, mode string) (ProviderEpisodeResult, error)
ResolveEpisodeURLExcludingProvidersMode resolves an episode in an explicit audio, skipping the providers in exclude: the ones whose stream just failed.
func ResolveEpisodeURLForPlayback ¶
func ResolveEpisodeURLForPlayback(config Config, anime *Anime, epNo int) (ProviderEpisodeResult, error)
ResolveEpisodeURLForPlayback resolves an episode for playing. The preferred audio is tried on every provider before the other audio is considered: another host having the dub beats switching to the sub.
type ProviderHealth ¶
type ProviderHealth struct {
Name string
Query string // what the probe searched for
Enabled bool
DisabledReason string
InStack bool
Results int
Latency time.Duration
Err error
}
ProviderHealth is the outcome of probing one provider.
func CheckProviders ¶
func CheckProviders(config *Config, query, adultQuery string) []ProviderHealth
CheckProviders probes every registered provider with a search and reports what each one did. Disabled providers are probed too, so the report can show whether a provider is down or merely switched off. 18+ providers search adultQuery.
func (ProviderHealth) OK ¶
func (h ProviderHealth) OK() bool
OK reports whether the provider returned usable search results.
func (ProviderHealth) Summary ¶
func (h ProviderHealth) Summary() string
Summary renders a single status line for the report.
type ProviderMappingOutcome ¶
type ProviderMappingOutcome int
ProviderMappingOutcome is how a provider search for a show ended.
const ( ProviderMappingOK ProviderMappingOutcome = iota // the show is mapped ProviderMappingBack // the user backed out ProviderMappingQuit // the user quit, or a menu broke )
How a provider search can end.
func ResolveAnimeProviderMapping ¶
func ResolveAnimeProviderMapping(config *Config, anime *Anime, query string, anilistEntry *Entry) (ProviderMappingOutcome, error)
ResolveAnimeProviderMapping finds the anime on the providers and stores the match in anime.ProviderName and anime.ProviderId.
type ProviderModeResolver ¶
type ProviderModeResolver interface {
GetEpisodeURLForMode(config Config, id string, epNo int, mode string) ([]string, error)
}
ProviderModeResolver is a Provider that can be asked for a given audio rather than the one config.SubOrDub names.
type ResponseData ¶
type ResponseData struct {
Page Page `json:"Page"`
}
ResponseData is the data of an AniList search response.
type RofiSelectPreview ¶
type RofiSelectPreview struct {
Title string `json:"title"`
CoverImage string `json:"coverImage"`
// HasNewEpisodes marks a show with aired episodes the viewer has not
// seen (ShowNewEpisodes).
HasNewEpisodes bool `json:"-"`
// Rank is the display position this entry should hold. The grid is built
// from a map, which has no order, so the ordering has to travel with the
// value rather than being recovered by sorting titles at render time.
Rank int `json:"-"`
}
RofiSelectPreview is one tile of the rofi cover grid.
type SelectionOption ¶
type SelectionOption struct {
Title string
Label string
// Icon is drawn before the label when icons are on (see internal/icons).
// It is not part of the label, so matching, filtering and sorting by
// label are the same with icons on or off.
Icon icons.Icon
// Key is what the caller gets back. The menus answer "-1" for quit and
// "-2" for back.
Key string
Thumbnail string
// ExtraData is whatever the source of the row wants back with it, such
// as a provider's search hit.
ExtraData any
HasNewEpisodes bool
// Details, when set, is what the terminal's detail pane shows under the
// title instead of what it would make of the label.
Details []string
}
SelectionOption is one row of a menu: what is shown and the key it answers with.
func DynamicSelect ¶
func DynamicSelect(choices []SelectionOption) (SelectionOption, error)
DynamicSelect shows a menu of choices sorted by label, in rofi or the terminal depending on the config.
func DynamicSelectPreserveOrder ¶
func DynamicSelectPreserveOrder(choices []SelectionOption) (SelectionOption, error)
DynamicSelectPreserveOrder is DynamicSelect without the sorting, for action menus whose first entry is the main action.
func DynamicSelectPreview ¶
func DynamicSelectPreview(previews map[string]RofiSelectPreview, addNew bool) (SelectionOption, error)
DynamicSelectPreview shows the poster grid in rofi.
func DynamicSelectPreviewWithRefresh ¶
func DynamicSelectPreviewWithRefresh(previews map[string]RofiSelectPreview, addNew bool, refreshConfig *PreviewSelectionRefreshConfig) (SelectionOption, error)
func DynamicSelectWithRefresh ¶
func DynamicSelectWithRefresh(choices []SelectionOption, refreshConfig *SelectionRefreshConfig) (SelectionOption, error)
DynamicSelectWithRefresh is DynamicSelect for a list that may be replaced while it is open.
func NormalizeSelectionKey ¶
func NormalizeSelectionKey(option SelectionOption) SelectionOption
NormalizeSelectionKey maps any form of Quit or Back onto the one option callers compare against.
func ProviderSearchOptionsForDisplay ¶
func ProviderSearchOptionsForDisplay(results []SelectionOption, entry *Entry) []SelectionOption
ProviderSearchOptionsForDisplay labels provider search results with their episode counts and ticks the ones whose count matches the tracker entry, which is usually the right season.
func ResolveUntrackedProviderSearch ¶
func ResolveUntrackedProviderSearch(config *Config, initialQuery string) (providerID, providerName string, picked SelectionOption, back bool, err error)
ResolveUntrackedProviderSearch asks for the show to watch untracked. The picked option is returned alongside its id, because its title and any MAL id the provider attached are the only things that can identify the show later: an untracked show has no tracker entry to look them up from.
func RofiSelectWithMessage ¶
func RofiSelectWithMessage(choices []SelectionOption, isHomeMenu bool, prompt, message string) (SelectionOption, error)
RofiSelectWithMessage shows a rofi menu with message as a banner above it (release notes, a diagnosis), rather than a separate notification.
type SelectionRefreshConfig ¶
type SelectionRefreshConfig struct {
Updates <-chan AnimeList // lists fetched in the background
BuildOptions func(AnimeList) []SelectionOption // turns one into menu rows
// Refreshed closes when the background list refresh has finished. Rofi
// cannot change a menu it is showing, so it waits a moment for this before
// opening rather than reopening once the fresh list lands.
Refreshed <-chan struct{}
// Categories, when set, draws a tab bar and lets Tab move between them
// without leaving the list. LoadCategory supplies the entries for one, and
// is expected to be cheap: the whole list is already in memory, so
// switching a category is a filter rather than a fetch.
Categories []Tab
ActiveCategory string
LoadCategory func(key string) []SelectionOption
// Actions appear along the bottom and end the menu with that action as the
// result when their key is pressed.
Actions []FooterAction
// Main marks the main list, the first thing otakase shows. Nothing is
// behind it, so escape quits rather than going back, and in rofi it gets
// the toolbar that stands in for the terminal's tabs and bottom bar.
Main bool
// Toolbar gives a menu that is not the main list rofi's toolbar too,
// with Esc going back rather than quitting.
Toolbar bool
// Prompt names the list in rofi's prompt.
Prompt string
}
SelectionRefreshConfig lets a menu take a newer list while it is open, along with the extras only the main list uses.
type SequelInfo ¶
type SequelInfo struct {
ID, Episodes int
Title AnimeTitle
CoverImage string
// Status is AniList's: FINISHED, RELEASING or NOT_YET_RELEASED.
Status string
SiteURL string
}
SequelInfo is one show AniList lists as a sequel, enough to offer it.
type ShowPrefs ¶
type ShowPrefs struct {
// SubtitleLanguage is the canonical language name ("english",
// "portuguese") the viewer last picked in the player for this show.
SubtitleLanguage string `json:"subtitleLanguage,omitempty"`
// Quality overrides the Quality setting for this show: "best" or a
// number of lines. Empty follows the setting.
Quality string `json:"quality,omitempty"`
// AudioMode is "sub" or "dub", whichever the viewer last switched this
// show to.
AudioMode string `json:"audioMode,omitempty"`
}
ShowPrefs is what otakase remembers about how one show is watched.
type SkipIDs ¶
SkipIDs names the entries a resolution came from, where the source has names for them. Only AniSkip does, and only so that an entry that sent the player to the wrong place can be voted down by the person who noticed.
type SkipRef ¶
type SkipRef struct {
MalID int
AniListID int
Episode int
Mode string
Provider string
ProviderID string
// EpisodeLength is how long the file being played is, in seconds, or zero
// when that is not known yet. AniSkip files each entry with the length of
// the release it was timed against, and an entry for a different cut of the
// episode skips the wrong stretch of this one.
EpisodeLength float64
}
SkipRef is everything known about an episode that a skip service might key on. Each service identifies shows differently -- AniSkip by MyAnimeList id, Anime-Skip by its own id found from an AniList id, a provider by whatever it calls the show -- so the reference carries all of them rather than each source having to reach back for what it needs.
type SkipResolution ¶
type SkipResolution struct {
Times SkipTimes
OpSource string
EdSource string
RecapSource string
IDs SkipIDs
Attempted []string
Errors []error
}
SkipResolution records what was found and where each half came from, so a log can say "opening from anikoto, ending from aniskip" rather than leaving the user to guess why only half an episode skipped.
func ApplySkipTimes ¶
func ApplySkipTimes(anime *Anime, episode int, config *Config, provider any) SkipResolution
ApplySkipTimes resolves an episode's timings and hands them to the player. It reports what happened rather than returning an error: skipping is a convenience, and failing to find timings must never interrupt playback.
func ResolveSkipTimes ¶
func ResolveSkipTimes(ref SkipRef, sources ...SkipSource) SkipResolution
ResolveSkipTimes asks each source in turn and takes the opening from the first that has one and the ending from the first that has one.
They need not be the same source. AniSkip frequently knows an opening and not an ending, and a provider that ships timings with the stream often knows both; taking each half independently means a half-answer from one service is completed by the next rather than discarded. Asking stops once both halves are filled, so the cheapest source being first actually saves the requests.
func (SkipResolution) Describe ¶
func (r SkipResolution) Describe() string
Describe summarises the outcome for a log line.
func (SkipResolution) Found ¶
func (r SkipResolution) Found() bool
Found reports whether anything usable was resolved at all.
type SkipSource ¶
type SkipSource interface {
Name() string
Lookup(ref SkipRef) (times SkipTimes, found bool, err error)
}
SkipSource is one place intro and outro timings can come from.
Returning found=false is the ordinary case, not a failure: most services know nothing about most episodes. An error means the service was asked and could not answer, which is worth logging but is equally not fatal.
func DefaultSkipSources ¶
func DefaultSkipSources(config *Config, provider any) []SkipSource
DefaultSkipSources builds the chain in the order that costs least.
The active provider comes first because a provider that ships timings with the stream has already paid for that request. AniSkip follows: it is keyless and covers a great deal. Anime-Skip is last because it needs two requests and a client id, and is therefore the one most often unavailable.
type SkipSubmission ¶
type SkipSubmission struct {
MalID int
Episode int
SkipType string
StartTime float64
EndTime float64
EpisodeLength float64
}
SkipSubmission is one opening or ending offered to AniSkip.
type SkipTimes ¶
type SkipTimes struct {
Op Skip `json:"op"`
Ed Skip `json:"ed"`
// Recap is a "previously on" stretch inside an episode, where one is on
// file. Skipped under SkipRecap, like a whole recap episode.
Recap Skip `json:"recap,omitempty"`
}
SkipTimes are the parts of an episode that can be skipped.
type StreamInfo ¶
type StreamInfo struct {
AnilistID int `json:"anilist_id"`
Episode int `json:"episode"`
Title string `json:"title"`
Episodes int `json:"episodes,omitempty"`
Provider string `json:"provider"`
ProviderID string `json:"provider_id,omitempty"`
Mode string `json:"mode"`
Streams []StreamLink `json:"streams"`
AudioVariants map[string]StreamLink `json:"audio_variants,omitempty"`
Torrents []TorrentLink `json:"torrents,omitempty"`
}
StreamInfo is one episode's streams, found without asking anything. The Discord bot runs `otakase -stream-info <anilist id>:<episode>` to fetch the episode it plays in its watch room, so this never prompts: a show no provider can be matched to on its own is an error, not a menu.
func ResolveStreamInfo ¶
func ResolveStreamInfo(config Config, anilistID, episode int) (StreamInfo, error)
ResolveStreamInfo finds an episode on the configured providers, preferred audio first, then the other. Only http(s) links count: torrents need the app's own streamer, which a server relaying the episode doesn't have.
func ResolveStreamInfoFast ¶
func ResolveStreamInfoFast(config Config, anilistID, episode int) (StreamInfo, error)
ResolveStreamInfoFast leaves the optional per-language provider lookup to the caller. The watch room starts playback with this result, then discovers the additional releases in the background.
func ResolveStreamLanguages ¶
func ResolveStreamLanguages(provider, providerID string, episode int) (StreamInfo, error)
ResolveStreamLanguages finds the other spoken-language releases of an episode the fast lookup already matched, by the provider's show id, so the watch room does not search for the show a second time.
type StreamLink ¶
type StreamLink struct {
URL string `json:"url"`
Referrer string `json:"referrer,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
FlixCloudKey string `json:"flixcloud_key,omitempty"`
Subtitles []StreamSubtitle `json:"subtitles,omitempty"`
// HLS is set for a playlist whose address does not end in .m3u8, so the
// watch room relays it as one.
HLS bool `json:"hls,omitempty"`
}
StreamLink is one playable link and what fetching it takes.
type StreamPlaybackHint ¶
type StreamPlaybackHint struct {
Referrer string
Subtitle string
// Headers are extra HTTP headers the stream's CDN requires; see the
// providers package for why a referrer alone is sometimes not enough.
Headers map[string]string
FlixCloudKey string
// Subtitles is every subtitle track the provider offered; Subtitle is the
// one its own default picked.
Subtitles []SubtitleTrack
// HLSBitrate is the bandwidth of the variant Quality chose, when the link
// had to stay the master; zero when nothing was chosen.
HLSBitrate int
// HLS marks a playlist whose address does not end in .m3u8; see
// providers.StreamPlaybackHint.
HLS bool
}
StreamPlaybackHint is what mpv needs besides the URL to play a resolved stream.
type StreamSubtitle ¶
type StreamSubtitle struct {
URL string `json:"url"`
Language string `json:"language,omitempty"`
Label string `json:"label,omitempty"`
}
StreamSubtitle is a subtitle track of a link.
type SubtitleTrack ¶
type SubtitleTrack = providers.SubtitleTrack
SubtitleTrack is one external subtitle file a provider offers.
type Tab ¶
type Tab struct {
Key string
Label string
// Count is how many entries the category holds. Shown beside the label,
// because a bare word reads as decoration while a number reads as a view
// of something that exists.
Count int
// Icon goes before the label, the same one the category has in the main
// menu, so a tab reads as the list it opens.
Icon icons.Icon
}
Tab is one category along the top of the menu. Tabs are the tracker's own list statuses -- watching, planning, completed -- so switching one changes which list is shown rather than navigating anywhere.
type TorrentLink ¶
type TorrentLink struct {
InfoHash string `json:"info_hash"`
}
TorrentLink identifies a torrent without exposing the CLI's temporary local server.
type User ¶
type User struct {
Token string
Username string
Id int
AnimeList AnimeList
// ListSync, when set, refreshes AnimeList in the background; read its
// Current list rather than AnimeList while it runs.
ListSync *AnimeListSync
}
User is the signed-in tracker account and its list.
func GetGlobalUser ¶
func GetGlobalUser() *User
GetGlobalUser is the account set by SetGlobalUser, or nil.
Source Files
¶
- adult_content.go
- anilist.go
- anilist_cache.go
- anilist_login.go
- anilist_private.go
- anime.go
- anime_list.go
- anime_skip_client_id.go
- anime_skip_setup.go
- aniskip_contrib.go
- audio_memory.go
- auth_token.go
- busy_indicator.go
- cast_browser.go
- cast_burn.go
- cast_controls.go
- cast_firewall.go
- cast_handoff.go
- cast_menu.go
- cast_next_episode.go
- cast_panel.go
- cast_playback.go
- cast_seek.go
- cast_setup.go
- cast_skip.go
- cheat_code.go
- config.go
- config_defaults.go
- config_file.go
- config_integrity.go
- continue_watching.go
- crash_watch.go
- desktop_notify.go
- dev_builds.go
- discord_airing.go
- discord_ask.go
- discord_backup.go
- discord_club.go
- discord_heartbeat.go
- discord_inbox.go
- discord_link.go
- discord_news.go
- discord_parties.go
- discord_presence.go
- discord_provider_report.go
- discord_remote.go
- discord_report.go
- download.go
- download_info.go
- dual_sync_background.go
- episode_counts.go
- episode_flow.go
- episode_info.go
- flix_playback.go
- globals.go
- http_client.go
- icon_setup.go
- input.go
- keybind.go
- late_night.go
- lifecycle_notice.go
- list_edit.go
- list_ordering.go
- localTracking.go
- logging.go
- main_menu.go
- menu_layout.go
- menu_option.go
- milestones.go
- movies_cast.go
- movies_elsewhere.go
- movies_menu.go
- movies_play.go
- movies_providers.go
- movies_series.go
- movies_trakt.go
- mpv_events.go
- mpv_playlist.go
- mpv_playlist_switch.go
- mpv_skin.go
- mpv_window.go
- myanimelist.go
- myanimelist_login.go
- open_link.go
- open_link_desktop.go
- otakase.go
- otakase_movie.go
- otakase_movie_extras.go
- otakase_movie_music.go
- otakase_movie_room.go
- otakase_movie_script.go
- otakase_movie_story.go
- partysync.go
- partysync_client.go
- partysync_fx.go
- partysync_link.go
- partysync_logic.go
- player.go
- player_args.go
- player_binary.go
- player_ipc.go
- player_loss.go
- prompt_model.go
- provider.go
- provider_bridge.go
- provider_disabled.go
- provider_episode.go
- provider_health.go
- provider_mapping.go
- provider_match.go
- provider_migrate.go
- provider_search_error.go
- provider_status.go
- quality.go
- rofi.go
- rofi_labels.go
- rofi_toolbar.go
- search_queries.go
- selection_labels.go
- selection_menu.go
- show_setup.go
- skip_aniskip.go
- skip_engine.go
- skip_marker.go
- skip_sources.go
- skip_sources_introdb.go
- startup_progress.go
- stdin.go
- storage_files.go
- stream_info.go
- stream_pick.go
- subtitle_language.go
- sudo_prompt.go
- surprise.go
- synced_resume.go
- terminal_screen.go
- time_capsule.go
- tmdb_mapping.go
- touch_grass_badge.go
- tracking.go
- tracking_merge.go
- tracking_sync_actions.go
- tracking_writes.go
- untracked_playback.go
- update.go
- update_changelog.go
- update_prompt.go
- update_release.go
- version.go
- watch_stats.go
- watch_stats_fetch.go
- watch_stats_page.go
- watch_with_me.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aniskip reads opening, ending and recap times from api.aniskip.com.
|
Package aniskip reads opening, ending and recap times from api.aniskip.com. |
|
Package appicon carries the app icon and puts it where the desktop looks.
|
Package appicon carries the app icon and puts it where the desktop looks. |
|
Package cast plays a stream on a cast device on the local network.
|
Package cast plays a stream on a cast device on the local network. |
|
Package icons draws the small line icons in front of menu rows.
|
Package icons draws the small line icons in front of menu rows. |
|
Package jikan reads MyAnimeList data through the Jikan API (api.jikan.moe).
|
Package jikan reads MyAnimeList data through the Jikan API (api.jikan.moe). |
|
Package loadproviders exists to be imported for its side effect: each provider below registers itself from its init.
|
Package loadproviders exists to be imported for its side effect: each provider below registers itself from its init. |
|
Package movies finds and resolves non-anime movies, an experimental feature switched on by ExperimentalMovies.
|
Package movies finds and resolves non-anime movies, an experimental feature switched on by ExperimentalMovies. |
|
Package mpv talks to a running mpv over its JSON IPC protocol.
|
Package mpv talks to a running mpv over its JSON IPC protocol. |
|
Package mpvskin gives mpv otakase's own look while otakase plays in it.
|
Package mpvskin gives mpv otakase's own look while otakase plays in it. |
|
Package providerhost is what providers may use of the app.
|
Package providerhost is what providers may use of the app. |
|
anikoto
Package anikoto scrapes the anikoto site (anikototv.to and its mirrors).
|
Package anikoto scrapes the anikoto site (anikototv.to and its mirrors). |
|
animex
Package animex plays episodes through animex.one's player API.
|
Package animex plays episodes through animex.one's player API. |
|
anizone
Package anizone resolves streams from anizone.to.
|
Package anizone resolves streams from anizone.to. |
|
kickassanime
Package kickassanime resolves episodes from KickassAnime (kaa.lt).
|
Package kickassanime resolves episodes from KickassAnime (kaa.lt). |
|
megavid
Package megavid plays episodes from megavid.buzz, the player animekai uses.
|
Package megavid plays episodes from megavid.buzz, the player animekai uses. |
|
nyaa
Package nyaa resolves episodes from Nyaa's public torrent index.
|
Package nyaa resolves episodes from Nyaa's public torrent index. |
|
reanime
Package reanime resolves episodes from ReAnime and HLS streams from FlixCloud.
|
Package reanime resolves episodes from ReAnime and HLS streams from FlixCloud. |
|
substyle
Package substyle settles how subtitles are delivered in sub mode: as a separate file the player loads (soft) or burned into the video (hard).
|
Package substyle settles how subtitles are delivered in sub mode: as a separate file the player loads (soft) or burned into the video (hard). |
|
Package rofitheme renders otakase's rofi menu themes from the active colour palette.
|
Package rofitheme renders otakase's rofi menu themes from the active colour palette. |
|
Package skiptimes finds opening, ending and recap times for an episode in every skip time service the app knows: AniSkip, TheIntroDB and Anime-Skip.
|
Package skiptimes finds opening, ending and recap times for an episode in every skip time service the app knows: AniSkip, TheIntroDB and Anime-Skip. |
|
Package theme resolves the colour palette otakase draws its menus with.
|
Package theme resolves the colour palette otakase draws its menus with. |
|
Package torrentstream plays a torrent without waiting for it to finish.
|
Package torrentstream plays a torrent without waiting for it to finish. |