Documentation
¶
Index ¶
- Variables
- func AddAnimeToList(animeID int, status string, token string) error
- func AddAnimeToWatchingList(animeID int, token string) error
- func ChangeToken(config *CurdConfig, user *User)
- func CheckAndDownloadFiles(storagePath string, filesToCheck []string) error
- func ClearLogFile(logFile string) error
- func ClearScreen()
- func ConvertSecondsToMinutes(seconds int) int
- func CurdOut(data interface{})
- func DiscordPresence(anime Anime, IsPaused bool, currentPosition int, totalDuration int, ...) error
- func DiscordPresenceWithForce(anime Anime, IsPaused bool, currentPosition int, totalDuration int, ...) error
- func EditConfig(configFilePath string)
- func EpisodesList(showID, mode string) ([]string, error)
- func ExitCurd(err error)
- func ExitMPV(ipcSocketPath string) error
- func FetchFillerEpisodes(malID int) ([]int, error)
- func FindKeyByValue(m map[string]string, value string) (string, error)
- func FindSequelInAnimeList(list AnimeList, sequelID int) (string, bool)
- func FormatTime(seconds int) string
- func GetAndParseAniSkipData(animeMalId int, episode int, timePrecision int, anime *Anime) error
- func GetAniSkipData(animeMalId int, episode int) (string, error)
- func GetAnilistUserID(token string) (int, string, error)
- func GetAnimeIDAndImage(anilistMediaID int) (int, string, error)
- func GetAnimeMalID(anilistMediaID int) (int, error)
- func GetAnimeMap(animeList AnimeList) map[string]string
- func GetAnimeMapPreview(animeList AnimeList) map[string]RofiSelectPreview
- func GetAnimeName(anime Anime) string
- func GetEpisodeData(animeID int, episodeNo int, anime *Anime) error
- func GetEpisodeURL(config CurdConfig, id string, epNo int) ([]string, error)
- func GetGlobalLogFile() string
- func GetMPVPausedStatus(ipcSocketPath string) (bool, error)
- func GetMPVPlaybackSpeed(ipcSocketPath string) (float64, error)
- func GetNextCanonEpisode(fillerEpisodes []int, currentEpisode int) int
- func GetPercentageWatched(ipcSocketPath string) (float64, error)
- func GetTokenFromFile(tokenPath string) (string, error)
- func GetTokenFromRofi() (string, error)
- func GetUserData(token string, userID int) (map[string]interface{}, error)
- func GetUserDataPreview(token string, userID int) (map[string]interface{}, error)
- func GetUserInputFromRofi(message string) (string, error)
- func HandleLastEpisodeCompletion(userCurdConfig *CurdConfig, anime *Anime, userToken string)
- func HasActivePlayback(ipcSocketPath string) (bool, error)
- func IsEpisodeFiller(fillerEpisodes []int, episodeNumber int) bool
- func IsMPVRunning(socketPath string) bool
- func LoadConfigFromFile(path string) (map[string]string, error)
- func LoadJSONFile(filePath string) (map[string]interface{}, error)
- func LocalAddAnime(databaseFile string, anilistID int, allanimeID string, watchingEpisode int, ...)
- func LocalDeleteAnime(databaseFile string, anilistID int, allanimeID string)
- func LocalUpdateAnime(databaseFile string, anilistID int, allanimeID string, watchingEpisode int, ...) error
- func Log(data interface{}) error
- func LoginClient(clientId string) error
- func LogoutClient() error
- func MPVSendCommand(ipcSocketPath string, command []interface{}) (interface{}, error)
- func NextEpisodePromptCLI(userCurdConfig *CurdConfig) bool
- func NextEpisodePromptContinuous(userCurdConfig *CurdConfig, databaseFile string, userToken string)
- func NextEpisodePromptRofi(userCurdConfig *CurdConfig) bool
- func ParseAniSkipResponse(responseText string, anime *Anime, timePrecision int) error
- func PercentageWatched(playbackTime int, duration int) float64
- func PrioritizeLink(links []string) string
- func RateAnime(token string, mediaID int) error
- func RestoreScreen()
- func RoundTime(timeValue float64, precision int) float64
- func SaveConfigToFile(path string, configMap map[string]string) error
- func SearchAnimeAnilistPreview(query, token string) (map[string]RofiSelectPreview, error)
- func SearchAnimeByTitle(jsonData map[string]interface{}, searchTitle string) []map[string]interface{}
- func SeekMPV(ipcSocketPath string, time int) (interface{}, error)
- func SendSkipTimesToMPV(anime *Anime) error
- func SetGlobalAnime(anime *Anime)
- func SetGlobalConfig(config *CurdConfig)
- func SetGlobalLogFile(logFile string)
- func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime)
- func SetupMPVEventListening(ipcSocketPath string) error
- func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string
- func StartMPVEventListener(ipcSocketPath string, eventCallback func(string, interface{})) error
- func StartNextEpisode(anime *Anime, userCurdConfig *CurdConfig, databaseFile string, ...)
- func StartVideo(link string, args []string, title string, anime *Anime) (string, error)
- func UpdateAnimeEntry(userCurdConfig *CurdConfig, user *User)
- func UpdateAnimeProgress(token string, mediaID, progress int) error
- func UpdateAnimeStatus(token string, mediaID int, status string) error
- func UpdateCurd(repo, fileName string) error
- func WatchUntracked(userCurdConfig *CurdConfig)
- func WriteTokenToFile(token string, filePath string) error
- type AniListAnime
- type AnilistToken
- type Anime
- type AnimeFillerListEpisode
- type AnimeList
- type AnimeTitle
- type CurdConfig
- type Entry
- type Episode
- type EpisodesResponse
- type MPVEventListener
- type Media
- type Model
- type NextEpisode
- type Page
- type ResponseData
- type RofiSelectPreview
- type SelectionOption
- func AddNewAnime(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime) SelectionOption
- func DynamicSelect(options []SelectionOption) (SelectionOption, error)
- func DynamicSelectFromSlice(options []SelectionOption) (SelectionOption, error)
- func DynamicSelectPreview(options map[string]RofiSelectPreview, addnewoption bool) (SelectionOption, error)
- func RofiSelect(options []SelectionOption, isHomeMenu bool) (SelectionOption, error)
- func SearchAnime(query, mode string) ([]SelectionOption, error)
- func SearchAnimeAnilist(query, token string) ([]SelectionOption, error)
- type SelectionOptionImage
- type SequelInfo
- type Skip
- type SkipTimes
- type User
Constants ¶
This section is empty.
Variables ¶
var LinkPriorities = []string{
"sharepoint.com",
"wixmp.com",
"dropbox.com",
"wetransfer.com",
"gogoanime.com",
}
LinkPriorities defines the order of priority for link domains
Functions ¶
func AddAnimeToList ¶ added in v1.1.7
AddAnimeToList adds an anime to a specified list (CURRENT, PLANNING, PAUSED, DROPPED)
func AddAnimeToWatchingList ¶
Function to add an anime to the watching list
func ChangeToken ¶ added in v0.0.6
func ChangeToken(config *CurdConfig, user *User)
func CheckAndDownloadFiles ¶ added in v0.0.7
func ClearLogFile ¶
ClearLogFile removes all contents from the specified log file
func ConvertSecondsToMinutes ¶
func DiscordPresence ¶
func DiscordPresenceWithForce ¶ added in v1.1.7
func EditConfig ¶
func EditConfig(configFilePath string)
func EpisodesList ¶
episodesList performs the API call and fetches the episodes list
func FetchFillerEpisodes ¶ added in v1.0.8
func FindKeyByValue ¶
FindKeyByValue searches for a key associated with a given value in a map[string]string
func FindSequelInAnimeList ¶ added in v1.1.7
FindSequelInAnimeList searches for a sequel in the user's anime list and returns its status
func FormatTime ¶ added in v1.0.4
func GetAndParseAniSkipData ¶
GetAndParseAniSkipData fetches and parses skip times for a given anime ID and episode
func GetAniSkipData ¶
GetAniSkipData fetches skip times data for a given anime ID and episode
func GetAnilistUserID ¶
Function to get AniList user ID and username
func GetAnimeIDAndImage ¶
This function retrieves the MAL ID and cover image URL for an anime from AniList
func GetAnimeMalID ¶
Function to get MAL ID using AniList media ID
func GetAnimeMap ¶
GetAnimeMap takes an AnimeList and returns a map with media.id as key and media.title.english as value.
func GetAnimeMapPreview ¶ added in v0.0.7
func GetAnimeMapPreview(animeList AnimeList) map[string]RofiSelectPreview
GetAnimeMapPreview takes an AnimeList and returns a map with media.id as key and media.title.english as value.
func GetAnimeName ¶
Function to get the anime name (English or Romaji) from an Anime struct
func GetEpisodeData ¶
GetEpisodeData fetches episode data for a given anime ID and episode number
func GetEpisodeURL ¶
func GetEpisodeURL(config CurdConfig, id string, epNo int) ([]string, error)
Get anime episode url respective to given config If the link is found, it returns a list of links. Otherwise, it returns an error.
Parameters: - config: Configuration of the anime search. - id: Allanime id of the anime to search for. - epNo: Anime episode number to get links for.
Returns: - []string: a list of links for specified episode. - error: an error if the episode is not found or if there is an issue during the search.
func GetGlobalLogFile ¶ added in v1.0.9
func GetGlobalLogFile() string
GetGlobalLogFile gets the global log file path
func GetMPVPausedStatus ¶
func GetMPVPlaybackSpeed ¶
func GetNextCanonEpisode ¶ added in v1.0.8
GetNextCanonEpisode returns the next non-filler episode number after the current episode
func GetPercentageWatched ¶
func GetTokenFromFile ¶
GetTokenFromFile loads the token from the token file (supports both old text format and new JSON format)
func GetTokenFromRofi ¶ added in v0.0.6
func GetUserData ¶
Function to get user data from AniList
func GetUserDataPreview ¶ added in v0.0.7
func GetUserInputFromRofi ¶ added in v0.0.6
GetUserInputFromRofi prompts the user for input using Rofi with a custom message
func HandleLastEpisodeCompletion ¶ added in v1.1.4
func HandleLastEpisodeCompletion(userCurdConfig *CurdConfig, anime *Anime, userToken string)
HandleLastEpisodeCompletion handles scoring and completion for the last episode
func HasActivePlayback ¶ added in v1.0.7
func IsEpisodeFiller ¶ added in v1.0.8
IsEpisodeFiller checks if a given episode number is in the filler episodes list
func IsMPVRunning ¶ added in v1.0.7
func LoadConfigFromFile ¶ added in v1.1.4
LoadConfigFromFile loads config file from disk into a map (key=value format)
func LoadJSONFile ¶
Function to load a JSON file
func LocalAddAnime ¶
func LocalAddAnime(databaseFile string, anilistID int, allanimeID string, watchingEpisode int, watchingTime int, animeDuration int, animeName string)
Function to add an anime entry
func LocalDeleteAnime ¶
Function to delete an anime entry by Anilist ID and Allanime ID
func LocalUpdateAnime ¶
func LocalUpdateAnime(databaseFile string, anilistID int, allanimeID string, watchingEpisode int, playbackTime int, animeDuration int, animeName string) error
Function to update or add a new anime entry
func Log ¶
func Log(data interface{}) error
LogData logs the input data into a specified log file with the format [LOG] time lineNumber: logData
func LoginClient ¶ added in v1.1.2
func LogoutClient ¶ added in v1.1.7
func LogoutClient() error
func MPVSendCommand ¶
func NextEpisodePromptCLI ¶ added in v1.1.4
func NextEpisodePromptCLI(userCurdConfig *CurdConfig) bool
func NextEpisodePromptContinuous ¶ added in v1.1.4
func NextEpisodePromptContinuous(userCurdConfig *CurdConfig, databaseFile string, userToken string)
NextEpisodePromptContinuous provides a continuous next episode prompt for CLI mode This runs throughout the episode duration and handles completion logic
func NextEpisodePromptRofi ¶ added in v1.1.4
func NextEpisodePromptRofi(userCurdConfig *CurdConfig) bool
Simple next episode prompt for Rofi mode - just asks if user wants to continue
func ParseAniSkipResponse ¶
ParseAniSkipResponse parses the response text from the AniSkip API and updates the Anime struct
func PercentageWatched ¶
func PrioritizeLink ¶
PrioritizeLink takes an array of links and returns a single link based on priority
func SaveConfigToFile ¶ added in v1.1.4
SaveConfigToFile saves updated config map to file in key=value format
func SearchAnimeAnilistPreview ¶ added in v0.0.7
func SearchAnimeAnilistPreview(query, token string) (map[string]RofiSelectPreview, error)
SearchAnimeAnilist sends the query to AniList and returns a map of title to ID
func SearchAnimeByTitle ¶
func SearchAnimeByTitle(jsonData map[string]interface{}, searchTitle string) []map[string]interface{}
Function to search for an anime by title in user data
func SendSkipTimesToMPV ¶ added in v1.1.0
Function to send OP and ED timings to MPV
func SetGlobalAnime ¶ added in v1.0.9
func SetGlobalAnime(anime *Anime)
SetGlobalAnime sets the global anime reference
func SetGlobalConfig ¶ added in v0.0.5
func SetGlobalConfig(config *CurdConfig)
func SetGlobalLogFile ¶ added in v1.0.9
func SetGlobalLogFile(logFile string)
SetGlobalLogFile sets the global log file path
func SetupCurd ¶
func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime)
func SetupMPVEventListening ¶ added in v1.1.7
SetupMPVEventListening configures MPV to send property change notifications
func StartCurd ¶
func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string
func StartMPVEventListener ¶ added in v1.1.7
StartMPVEventListener starts a dedicated goroutine to listen for MPV events
func StartNextEpisode ¶ added in v1.1.2
func StartNextEpisode(anime *Anime, userCurdConfig *CurdConfig, databaseFile string, userToken string)
StartNextEpisode handles the logic for starting the next episode It updates the episode number, resets necessary flags, and handles database updates
func StartVideo ¶
func UpdateAnimeEntry ¶ added in v0.0.9
func UpdateAnimeEntry(userCurdConfig *CurdConfig, user *User)
func UpdateAnimeProgress ¶
Function to update anime progress
func UpdateAnimeStatus ¶ added in v0.0.9
func UpdateCurd ¶
func WatchUntracked ¶ added in v1.0.2
func WatchUntracked(userCurdConfig *CurdConfig)
func WriteTokenToFile ¶
CreateOrWriteTokenFile creates the token file if it doesn't exist and writes the token to it
Types ¶
type AniListAnime ¶
type AniListAnime struct {
ID int `json:"id"`
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 the struct for the API response
type AnilistToken ¶ added in v1.1.5
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 represents the OAuth token response from Anilist
type Anime ¶
type Anime struct {
Title AnimeTitle `json:"title"`
Ep Episode `json:"ep"`
CoverImage string `json:"url"` // Assuming this field corresponds to the cover image URL
TotalEpisodes int `json:"total_episodes"` // If provided by the API
MalId int `json:"mal_id"`
AnilistId int `json:"anilist_id"` // Assuming you have an Anilist ID in your struct
Rewatching bool
AllanimeId string // Can be populated as necessary
FillerEpisodes []int
IsAiring bool
}
func FindAnimeByAnilistIDInAnimes ¶
FindAnimeByAnilistIDInAnimes searches for an anime by its AniList ID in a slice of Anime
func GetAnimeDataByID ¶
GetAnimeDataByID retrieves detailed anime data from AniList using the anime's ID and user token
func GetGlobalAnime ¶ added in v1.0.9
func GetGlobalAnime() *Anime
GetGlobalAnime gets the global anime reference
func LocalFindAnime ¶
Function to find an anime by either Anilist ID or Allanime ID
func LocalGetAllAnime ¶
Function to get all anime entries from the database
type AnimeFillerListEpisode ¶ added in v1.0.8
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"`
}
func ParseAnimeList ¶
type AnimeTitle ¶
type CurdConfig ¶
type CurdConfig struct {
Player string `config:"Player"`
MpvArgs []string `config:MpvArgs`
SubsLanguage string `config:"SubsLanguage"`
SubOrDub string `config:"SubOrDub"`
StoragePath string `config:"StoragePath"`
AnimeNameLanguage string `config:"AnimeNameLanguage"`
MenuOrder string `config:"MenuOrder"`
PercentageToMarkComplete int `config:"PercentageToMarkComplete"`
NextEpisodePrompt bool `config:"NextEpisodePrompt"`
SkipOp bool `config:"SkipOp"`
SkipEd bool `config:"SkipEd"`
SkipFiller bool `config:"SkipFiller"`
ImagePreview bool `config:"ImagePreview"`
SkipRecap bool `config:"SkipRecap"`
RofiSelection bool `config:"RofiSelection"`
CurrentCategory bool `config:"CurrentCategory"`
ScoreOnCompletion bool `config:"ScoreOnCompletion"`
SaveMpvSpeed bool `config:"SaveMpvSpeed"`
AddMissingOptions bool `config:"AddMissingOptions"`
AlternateScreen bool `config:"AlternateScreen"`
DiscordPresence bool `config:"DiscordPresence"`
DiscordClientId string `config:"DiscordClientId"`
}
CurdConfig struct with field names that match the config keys
func GetGlobalConfig ¶ added in v0.0.5
func GetGlobalConfig() *CurdConfig
func LoadConfig ¶
func LoadConfig(configPath string) (CurdConfig, error)
LoadConfig reads or creates the config file, adds missing fields, and returns the populated CurdConfig struct
func PopulateConfig ¶ added in v1.1.4
func PopulateConfig(configMap map[string]string) CurdConfig
PopulateConfig populates the CurdConfig struct from a map
type Entry ¶
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"`
NextEpisode NextEpisode `json:"next_episode"`
IsFiller bool `json:"filler"`
IsRecap bool `json:"recap"`
Aired string `json:"aired"`
Synopsis string `json:"synopsis"`
ContinueLast bool
LastWasSkipped bool // used in filler check
IsCompleted bool
}
type EpisodesResponse ¶ added in v1.0.8
type EpisodesResponse struct {
Data []AnimeFillerListEpisode `json:"data"`
Pagination struct {
HasNextPage bool `json:"has_next_page"`
} `json:"pagination"`
}
type MPVEventListener ¶ added in v1.1.7
type MPVEventListener struct {
SocketPath string
LastPosition float64
LastPauseState bool
SeekDetected bool
PlayPauseDetected bool
IsListening bool
// contains filtered or unexported fields
}
MPVEventListener represents a structure to track MPV events
func CreateMPVSeekDetector ¶ added in v1.1.7
func CreateMPVSeekDetector(ipcSocketPath string) *MPVEventListener
MPVSeekDetector provides enhanced seek detection using actual MPV events
func (*MPVEventListener) HasPlayPauseChanged ¶ added in v1.1.7
func (detector *MPVEventListener) HasPlayPauseChanged() bool
HasPlayPauseChanged checks and resets the play/pause detection flag
func (*MPVEventListener) HasSeekOccurred ¶ added in v1.1.7
func (detector *MPVEventListener) HasSeekOccurred() bool
HasSeekOccurred checks and resets the seek detection flag
func (*MPVEventListener) ProcessMPVEvent ¶ added in v1.1.7
func (detector *MPVEventListener) ProcessMPVEvent(propertyName string, data interface{})
ProcessMPVEvent processes incoming MPV events and detects seeks and play/pause changes
type Media ¶
type Media struct {
Duration int `json:"duration"`
Episodes int `json:"episodes"`
ID int `json:"id"`
Title AnimeTitle `json:"title"`
}
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents the application state for the selection prompt
type NextEpisode ¶ added in v1.0.8
type Page ¶
type Page struct {
Media []AniListAnime `json:"media"`
}
Page represents the page in AniList response
type ResponseData ¶
type ResponseData struct {
Page Page `json:"Page"`
}
ResponseData represents the full response structure
type RofiSelectPreview ¶ added in v0.0.7
type SelectionOption ¶
SelectionOption holds the label and the internal key
func AddNewAnime ¶ added in v0.0.3
func AddNewAnime(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime) SelectionOption
func DynamicSelect ¶
func DynamicSelect(options []SelectionOption) (SelectionOption, error)
DynamicSelect displays a simple selection prompt without extra features
func DynamicSelectFromSlice ¶ added in v1.1.3
func DynamicSelectFromSlice(options []SelectionOption) (SelectionOption, error)
func DynamicSelectPreview ¶ added in v0.0.7
func DynamicSelectPreview(options map[string]RofiSelectPreview, addnewoption bool) (SelectionOption, error)
func RofiSelect ¶ added in v0.0.5
func RofiSelect(options []SelectionOption, isHomeMenu bool) (SelectionOption, error)
func SearchAnime ¶
func SearchAnime(query, mode string) ([]SelectionOption, error)
func SearchAnimeAnilist ¶
func SearchAnimeAnilist(query, token string) ([]SelectionOption, error)
SearchAnimeAnilist sends the query to AniList and returns a map of title to ID
type SelectionOptionImage ¶ added in v1.1.4
type SequelInfo ¶ added in v1.1.7
type SequelInfo struct {
ID int
Title AnimeTitle
CoverImage string
Episodes int
Status string // "FINISHED", "RELEASING", "NOT_YET_RELEASED"
}
SequelInfo holds information about a sequel anime
func GetAnimeSequel ¶ added in v1.1.7
func GetAnimeSequel(animeID int, token string) (*SequelInfo, error)
GetAnimeSequel fetches sequel information for a given anime from AniList