wallpapers

package module
v0.0.0-...-83bed1c Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 11 Imported by: 0

README

Wallpapers

A site that lists the photos currently in my Wallpaper rotation. Hosts the images in Google Cloud Storage, and the site on my dev server. Eventually, I'd like it to pull from Dropbox instead.

Documentation

Index

Constants

View Source
const (
	Bucket = "iccowalls"
)

Variables

View Source
var (
	NameRegex = regexp.MustCompile("[^a-z0-9]")
)

Functions

func DeleteFile

func DeleteFile(ctx context.Context, filename string) error

func FormatName

func FormatName(in string) string

FormatName formats a filename to match our requirements.

func FullRezURL

func FullRezURL(key string) string

FullRezURL returns the URL a cropped version hosted by imgix.

func GetFileCRC

func GetFileCRC(content []byte) uint32

func GetGoogleCRC

func GetGoogleCRC(ctx context.Context, filename string) (uint32, error)

func ThumbURL

func ThumbURL(key string) string

ThumbUrl returns the URL a small cropped version hosted by imgix.

func UploadFile

func UploadFile(ctx context.Context, filename string, content []byte) error

UploadFile takes a file name and content and uploads it to GoogleCloud.

Types

type File

type File struct {
	CRC32C       uint32    `json:"-"`
	Etag         string    `json:"etag"`
	FileURL      string    `json:"-"`
	FullRezURL   string    `json:"cdn"`
	Name         string    `json:"key"`
	Size         int64     `json:"-"`
	ThumbnailURL string    `json:"thumbnail"`
	Created      time.Time `json:"created_at"`
	Updated      time.Time `json:"updated_at"`
}

File is a subset of storage.ObjectAttrs that we need.

func GetAll

func GetAll(ctx context.Context) ([]*File, error)

GetAll returns all of the attributes for files in GCS.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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