Documentation
¶
Index ¶
- Variables
- func CacheClear() error
- func CacheRemove(videoPath string) error
- func CacheShow()
- func CheckForUpdates(currentVersion string)
- func CheckPathExists(filePath string) bool
- func CleanupLogs()
- func ClearTemp()
- func CloseLogger()
- func FetchAndCache(repoURL, preparedURL, owner, repo, branch, folderPath, token string) ([]map[string]any, error)
- func GetIrisDir() string
- func GetLatestCommitSHA(owner, repo, branch, folderPath, token string) (string, error)
- func GetWallpaper() string
- func GitHubCacheShow()
- func InitLogger()
- func ItemInSlice[T comparable](s T, slice []T) bool
- func LogErrorf(component string, format string, v ...any)
- func LogInfof(component string, format string, v ...any)
- func LogWarnf(component string, format string, v ...any)
- func SaveGitHubCache(cache GitHubCacheMap) error
- func SetVideoWallpaper(videoPath string) error
- func SetWallpaper(filename string) error
- type ByteSize
- type Configuration
- type GitHubCacheMap
- type GitHubRepoCache
Constants ¶
This section is empty.
Variables ¶
var AllowedVideoExtensions = []string{"mp4", "mkv", "gif"}
Functions ¶
func CacheClear ¶
func CacheClear() error
CacheClear empties all iris cache, including videos and remote source results.
func CacheRemove ¶
CacheRemove removes a single item from the iris video cache.
func CheckForUpdates ¶
func CheckForUpdates(currentVersion string)
func CheckPathExists ¶
Checks whether a given path exists.
func FetchAndCache ¶
func GetIrisDir ¶
func GetIrisDir() string
GetIrisDir returns the iris home directory, namely `~/.iris`. Also creates the directory if it doesn't exists, and the necessary subfolders wallpapers, temp and cache.
func GetLatestCommitSHA ¶
func GitHubCacheShow ¶
func GitHubCacheShow()
func InitLogger ¶
func InitLogger()
InitLogger initializes the logger to write to a daily file in ~/.iris/logs
func ItemInSlice ¶
func ItemInSlice[T comparable](s T, slice []T) bool
Checks whether the given item exists in the slice.
func SaveGitHubCache ¶
func SaveGitHubCache(cache GitHubCacheMap) error
func SetVideoWallpaper ¶
SetVideoWallpaper sets a video as wallpaper by breaking the video into frames and then changes the wallpaper every few milliseconds to imitate that wallpaper is a video.
func SetWallpaper ¶
SetWallpaper sets the wallpaper to thegiven file.
Types ¶
type ByteSize ¶
type ByteSize float64
type Configuration ¶
type Configuration struct {
RemoteSource string `json:"remote_source"` // remote source to fetch wallpapers from
SearchTerms []string `json:"search_terms"` // wallpaper search terms
ChangeWallpaper bool `json:"change_wallpaper"` // whether change wallpaper after a duration
ChangeWallpaperDuration string `json:"change_wallpaper_duration"` // if wallpaper has to be changed, then after how many minutes
WallpaperFile string `json:"wallpaper_file"` // path to the wallpaper file, might be a video as well
WallpaperDirectory string `json:"wallpaper_directory"` // use wallpapers from a user specified directory
SelectionType string `json:"selection_type"` // directory wallpaper selection type, either sorted or random
SaveWallpaper bool `json:"save_wallpaper"` // whether to save the used wallpapers or not
SaveWallpaperDirectory string `json:"save_wallpaper_directory"` // directory to save the used wallpapers
CheckForUpdates bool `json:"check_for_updates"` // whether to check for updates
GitHubAPIToken string `json:"github_api_token"` // github api token to perform auth requests
}
func ReadConfig ¶
func ReadConfig() *Configuration
func (*Configuration) DirectoryWallpaper ¶
func (c *Configuration) DirectoryWallpaper()
func (*Configuration) RemoteWallpaper ¶
func (c *Configuration) RemoteWallpaper()
RemoteWallpaper dispatches the appropriate function to change wallpaper.
func (*Configuration) Show ¶
func (c *Configuration) Show()
func (*Configuration) SyncGitHubCache ¶
func (c *Configuration) SyncGitHubCache(repoURL string) error
func (*Configuration) WriteConfig ¶
func (c *Configuration) WriteConfig()
type GitHubCacheMap ¶
type GitHubCacheMap map[string]GitHubRepoCache
func LoadGitHubCache ¶
func LoadGitHubCache() GitHubCacheMap