Documentation
¶
Index ¶
- Variables
- 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(clientId string, anime Anime, IsPaused bool) error
- func EditConfig(configFilePath string)
- func EpisodesList(showID, mode string) ([]string, error)
- func ExitCurd(err error)
- func FindKeyByValue(m map[string]string, value string) (string, error)
- 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 GetMPVPausedStatus(ipcSocketPath string) (bool, error)
- func GetMPVPlaybackSpeed(ipcSocketPath string) (float64, error)
- func GetPercentageWatched(ipcSocketPath string) (float64, error)
- func GetTokenFromFile(filePath 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 HasActivePlayback(ipcSocketPath string) (bool, error)
- func IsMPVRunning(socketPath string) bool
- 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{}, logFile string) error
- func MPVSendCommand(ipcSocketPath string, command []interface{}) (interface{}, error)
- 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 SearchAnime(query, mode string) (map[string]string, error)
- func SearchAnimeAnilist(query, token string) (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 SetGlobalConfig(config *CurdConfig)
- func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime, ...)
- func StartCurd(userCurdConfig *CurdConfig, anime *Anime, logFile string) string
- func StartVideo(link string, args []string, title string, anime *Anime) (string, error)
- func UpdateAnimeEntry(userCurdConfig *CurdConfig, user *User, logFile string)
- 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, logFile string)
- func WriteTokenToFile(token string, filePath string) error
- type AniListAnime
- type Anime
- type AnimeList
- type AnimeTitle
- type CurdConfig
- type Entry
- type Episode
- type Media
- type Model
- type Page
- type ResponseData
- type RofiSelectPreview
- type SelectionOption
- func AddNewAnime(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime, ...) SelectionOption
- func DynamicSelect(options map[string]string, addnewoption bool) (SelectionOption, error)
- func DynamicSelectPreview(options map[string]RofiSelectPreview, addnewoption bool) (SelectionOption, error)
- func RofiSelect(options map[string]string, addanimeopt bool) (SelectionOption, error)
- 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 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 EditConfig ¶
func EditConfig(configFilePath string)
func EpisodesList ¶
episodesList performs the API call and fetches the episodes list
func FindKeyByValue ¶
FindKeyByValue searches for a key associated with a given value in a map[string]string
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 GetMPVPausedStatus ¶
func GetMPVPlaybackSpeed ¶
func GetPercentageWatched ¶
func GetTokenFromFile ¶
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 HasActivePlayback ¶ added in v1.0.7
func IsMPVRunning ¶ added in v1.0.7
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 ¶
LogData logs the input data into a specified log file with the format [LOG] time lineNumber: logData
func MPVSendCommand ¶
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 SearchAnimeAnilist ¶
SearchAnimeAnilist sends the query to AniList and returns a map of title to ID
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 SetGlobalConfig ¶ added in v0.0.5
func SetGlobalConfig(config *CurdConfig)
func SetupCurd ¶
func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAnimes *[]Anime, logFile string)
func StartVideo ¶
func UpdateAnimeEntry ¶ added in v0.0.9
func UpdateAnimeEntry(userCurdConfig *CurdConfig, user *User, logFile string)
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, logFile string)
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 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
}
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 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 AnimeList ¶
type AnimeList struct {
Watching []Entry `json:"watching"`
Completed []Entry `json:"completed"`
Paused []Entry `json:"paused"`
Dropped []Entry `json:"dropped"`
Planning []Entry `json:"planning"`
}
func ParseAnimeList ¶
type AnimeTitle ¶
type CurdConfig ¶
type CurdConfig struct {
Player string `config:"Player"`
SubsLanguage string `config:"SubsLanguage"`
SubOrDub string `config:"SubOrDub"`
StoragePath string `config:"StoragePath"`
AnimeNameLanguage string `config:"AnimeNameLanguage"`
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"`
}
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
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"`
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 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 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, logFile string) SelectionOption
func DynamicSelect ¶
func DynamicSelect(options map[string]string, addnewoption bool) (SelectionOption, error)
DynamicSelect displays a simple selection prompt without extra features
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 map[string]string, addanimeopt bool) (SelectionOption, error)