Documentation
¶
Overview ¶
Package wallpapers provides helpers for managing wallpaper files stored in Google Cloud Storage, including CRC checksums, URL generation, and metadata.
Index ¶
- Constants
- Variables
- func DeleteFile(ctx context.Context, filename string) error
- func FormatName(in string) string
- func FullRezURL(key string) string
- func GetFileCRC(content []byte) uint32
- func GetGoogleCRC(ctx context.Context, filename string) (uint32, error)
- func RawURL(key string) string
- func ThumbURL(key string) string
- func UploadFile(ctx context.Context, filename string, content []byte) error
- type File
Constants ¶
const (
Bucket = "iccowalls"
)
Bucket is the GCS bucket name where wallpaper files are stored.
Variables ¶
var (
NameRegex = regexp.MustCompile("[^a-z0-9]")
)
NameRegex matches characters that are not allowed in normalized wallpaper file names.
Functions ¶
func DeleteFile ¶
DeleteFile removes the named object from the wallpaper GCS bucket.
func FormatName ¶
FormatName formats a filename to match our requirements.
func FullRezURL ¶
FullRezURL returns the URL a cropped version hosted by imgix.
func GetFileCRC ¶
GetFileCRC computes the CRC32C (Castagnoli) checksum of the given content.
func GetGoogleCRC ¶
GetGoogleCRC returns the CRC32C checksum that GCS has stored for the given object. If the object does not exist, it returns 0 with a nil error.
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.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package analysis provides image analysis functionality including color extraction, resolution detection, and Gemini API integration.
|
Package analysis provides image analysis functionality including color extraction, resolution detection, and Gemini API integration. |
|
cmd
|
|
|
server
command
Command server runs the wallpapers HTTP service: it serves the web UI, JSON API, and metrics endpoint backed by the wallpapers SQLite database.
|
Command server runs the wallpapers HTTP service: it serves the web UI, JSON API, and metrics endpoint backed by the wallpapers SQLite database. |
|
server/static
Package static embeds the HTML templates, CSS, and other static assets served by the wallpapers HTTP server.
|
Package static embeds the HTML templates, CSS, and other static assets served by the wallpapers HTTP server. |
|
uploader
command
Command uploader walks the local Dropbox wallpapers folder, normalizes filenames, upscales small images, uploads new/changed files to GCS, and records image metadata in the wallpapers database.
|
Command uploader walks the local Dropbox wallpapers folder, normalizes filenames, upscales small images, uploads new/changed files to GCS, and records image metadata in the wallpapers database. |
|
Package db provides SQLite database operations for image metadata.
|
Package db provides SQLite database operations for image metadata. |