wallpapers

package
v0.0.0-...-cc4b841 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Eyy_Indexer WallpaperRepoType = "eyy-indexer"

	// There is no catagory
	No_Catagory WallpaperCatagory = "NO CATAGORY"
	// May also include subcatagory "Roads" - could be moved to seperate
	Cityscapes  WallpaperCatagory = "Cityscapes"
	Creepy      WallpaperCatagory = "Creepy"
	Ancient     WallpaperCatagory = "Ancient"
	AsiaRussia  WallpaperCatagory = "Asia/Russia"
	Blurry      WallpaperCatagory = "Blurry"
	Calm        WallpaperCatagory = "Calm"
	Cyberpunk   WallpaperCatagory = "Cyberpunk"
	Dark        WallpaperCatagory = "Dark"
	Dreamy      WallpaperCatagory = "Dreamy"
	Dystopian   WallpaperCatagory = "Dystopian"
	Fantasy     WallpaperCatagory = "Fantasy"
	Grainy      WallpaperCatagory = "Grainy"
	Nature      WallpaperCatagory = "Nature"
	Purple      WallpaperCatagory = "Purple"
	Perspective WallpaperCatagory = "Perspective"
	Snow        WallpaperCatagory = "Snow"
	Space       WallpaperCatagory = "Space"
	Synthwave   WallpaperCatagory = "Synthwave"
	Technology  WallpaperCatagory = "Technology"
	Triangular  WallpaperCatagory = "Triangular"
	VHS_Box_Art WallpaperCatagory = "VHS Box"
	Games       WallpaperCatagory = "Games"
)

Variables

View Source
var CloudProxyCookies []CloudProxyCookie

Cookies created in cloudproxy sessions

View Source
var ErrUnrecognisedWallpaperRepoType = fmt.Errorf("unrecognised wallpaper repo type")
View Source
var Playlists = make(mappedPlaylists)

Playlists created by user

Functions

func AddFile

func AddFile(Url, originalPath string) error

saves a file as specific url, but copies the file at `path` rather than downloading

func AddUrl

func AddUrl(Url string) (string, error)

downloads file and saves it, returning path if successful

func CalculatePath

func CalculatePath(Url string) (string, error)

Calculates the cache path for the given url

func CalculateURL

func CalculateURL(Path string) (string, error)

Calculates the origin URL for the given cache path

func ClearCache

func ClearCache() error

delete all cached images

func CloudProxyGetContent

func CloudProxyGetContent(Url string) (response string, err error)

Uses cloudproxy (if availible on local port 8191) to get the content of a website. Does not solve captchas, only bypasses CloudFlare IUAM.

CloudProxy: https://github.com/NoahCardoza/CloudProxy

func CurrentFilePath

func CurrentFilePath() (string, error)

func CurrentURL

func CurrentURL() (string, error)

func DownloadFile

func DownloadFile(url, path string) error

download a file with HTTP GET and (if code 2xx) set the response as the contents of the path, if path doesnt exist. Otherwise you will get an error

func GetFiles

func GetFiles(repoType WallpaperRepoType, Url string) ([]string, error)

Will get all download links to files located in the directory Ignores subdirectories.

func GetPlaylistsByPath

func GetPlaylistsByPath(Path string) ([]string, error)

Get the playlists that the file is in.

func LoadPlaylists

func LoadPlaylists() (mappedPlaylists, error)

func PrintCurrentWallpaperInfo

func PrintCurrentWallpaperInfo() error

func SanitizePlaylists

func SanitizePlaylists()

remove duplicates from playlists, and remove empty playlists

func SavePlaylists

func SavePlaylists() error

func SetFromFile

func SetFromFile(fp string) error

func SetFromURL

func SetFromURL(Url string) error

func SetRandom

func SetRandom() error

func SetRandomUntagged

func SetRandomUntagged() error

Types

type CloudProxyCookie

type CloudProxyCookie struct {
	Name     string  `json:"name"`
	Value    string  `json:"value"`
	Domain   string  `json:"domain"`
	Path     string  `json:"path"`
	Expires  float64 `json:"expires"`
	Size     int     `json:"size"`
	Httponly bool    `json:"httpOnly"`
	Secure   bool    `json:"secure"`
	Session  bool    `json:"session"`
	Samesite string  `json:"sameSite"`
}

A browser cookie

type CloudProxyResponse

type CloudProxyResponse struct {
	Solution *CloudProxySolution `json:"solution"`
	// "ok" or "error"
	Status string `json:"status"`
	// Error message
	Message        string `json:"message"`
	Starttimestamp int64  `json:"startTimestamp"`
	Endtimestamp   int64  `json:"endTimestamp"`
	// CloudProxy version
	Version string `json:"version"`
}

type CloudProxySolution

type CloudProxySolution struct {
	// URL requested
	URL string `json:"url"`
	// HTTP status from request
	Status int `json:"status"`
	// Headers in response
	Headers map[string]string `json:"headers"`
	// Raw text response of page
	Response string `json:"response"`
	// Our user-agent
	Useragent string `json:"userAgent"`
	// Cookies returned
	Cookies []CloudProxyCookie `json:"cookies"`
}

Solution to a cloudproxy request

type WallpaperCatagory

type WallpaperCatagory string

A catagory a wallpaper can have

func NewRandomURL

func NewRandomURL(Exclude []WallpaperCatagory, Include []WallpaperCatagory) (string, WallpaperCatagory, error)

Returns a semi-random URL to a new wallpaper. Error if none can be found.

If Include and Exclude have any overlap, the overlapping catagories are not included. By default all catagories are included, however if `len(Include) > 0` then only the specified catagories are used.

type WallpaperRepo

type WallpaperRepo struct {
	// A URL that contains all of the wallpapers.
	BaseWallpaperURL string `json:"BaseWallpaperURL"`
	//
	Subsections []WallpaperSubsection `json:"Subsections"`
	// Strings that can be appended to the base URL for access to uncatagorized sections.
	UncatagorizedPaths []string `json:"UncatagorizedPaths"`
	// The type of wallpaper repo
	Type WallpaperRepoType `json:"type"`
}

type WallpaperRepoType

type WallpaperRepoType string

type WallpaperSubsection

type WallpaperSubsection struct {
	Catagory WallpaperCatagory `json:"Catagory"`
	URLs     []string          `json:"URLs"`
}

Jump to

Keyboard shortcuts

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