files

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VaildFiletypes = []string{"jpeg", "jpg", "png", "gif", "mp4", "mp3", "wav", "avi", "mkv", "mov", "webm"}

Functions

This section is empty.

Types

type Client

type Client struct {
	// Host is the URL to the server where the files are hosted.
	Host string
	// Folders contains folder and the amount of files they contain.
	Folders map[string]int
	// RootFolder is the root folder of the media files.
	// It's only used to generate a correct URL to the media being served.
	RootFolder string
}

func NewClient

func NewClient(host, rootFolder string) *Client

func (*Client) HandleFolder

func (c *Client) HandleFolder(path string) error

HandleFolder will update the `Client.Folders` variable depending on what has happened with the supplied path.

A path with no extension will be treated as a folder.

func (*Client) Init

func (c *Client) Init(path string) error

func (*Client) RandomFile

func (c *Client) RandomFile() (*File, error)

type File

type File struct {
	Url   string `json:"url"`
	Title string `json:"title"`
}

Jump to

Keyboard shortcuts

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