media

package
v0.0.0-...-476b611 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMediaURLs = errors.New("no media URLs found in metadata")

Functions

func FindMediaURLs

func FindMediaURLs(metadata persist.TokenMetadata, imgKeywords []string, animKeywords []string) (imgURL ImageURL, animURL AnimationURL, err error)

FindMediaURLs finds the image and animation URLs from a token's metadata

func FindMediaURLsChain

func FindMediaURLsChain(metadata persist.TokenMetadata, chain persist.Chain) (imgURL ImageURL, animURL AnimationURL, err error)

FindMediaURLsChain finds the image and animation URLs from a token's metadata, using the chain's base keywords

func FindMediaURLsKeys

func FindMediaURLsKeys(metadata persist.TokenMetadata, imgKeywords []string, animKeywords []string) (imgKey string, imgURL ImageURL, animKey string, animURL AnimationURL, err error)

FindMediaURLsKeys finds the image and animation URLs and corresponding keywords from a token's metadata

func FindMediaURLsKeysChain

func FindMediaURLsKeysChain(metadata persist.TokenMetadata, chain persist.Chain) (imgKey string, imgURL ImageURL, animKey string, animURL AnimationURL, err error)

FindMediaURLsKeysChain finds the image and animation URLs and corresponding keywords from a token's metadata, using the chain's base keywords

func MediaFromContentType

func MediaFromContentType(contentType string) persist.MediaType

MediaFromContentType will attempt to convert a content type to a media type

func PredictMediaType

func PredictMediaType(ctx context.Context, url string) (persist.MediaType, string, *int64, error)

PredictMediaType guesses the media type of the given URL.

func PredictMediaURLs

func PredictMediaURLs(ctx context.Context, metadata persist.TokenMetadata, imgKeywords []string, animKeywords []string) (imgURL ImageURL, animURL AnimationURL, err error)

PredictMediaURLs finds the image and animation URLs from a token's metadata and accesses them to predict the true URLs

func RawFormatToMediaType

func RawFormatToMediaType(format string) persist.MediaType

func SniffMediaType

func SniffMediaType(buf []byte) (persist.MediaType, string)

SniffMediaType will attempt to detect the media type for a given array of bytes

Types

type AnimationURL

type AnimationURL string

type ImageURL

type ImageURL string

Jump to

Keyboard shortcuts

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