utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckURLFileSize

func CheckURLFileSize(url string, timeout *time.Duration) (int64, error)

CheckURLFileSize performs a HEAD request to check the availability of a URL and returns the content length if available. The timeout parameter is optional; if nil, it defaults to 10 seconds.

func ConvertToQueryParams

func ConvertToQueryParams(params map[string]interface{}) map[string]string

ConvertToQueryParams converts map[string]interface{} to map[string]string

func GetNestedValue

func GetNestedValue(data map[string]interface{}, key string) (interface{}, bool)

GetNestedValue retrieves a value from a nested map given a dot-separated key.

func SanitizeFileName

func SanitizeFileName(name string) string

SanitizeFileName replaces characters that are not allowed in file names.

func SaveLayout

func SaveLayout(props SaveLayoutProps) string

SaveLayout formats the file path using placeholders and metadata from the track and album.

Types

type SaveLayoutProps

type SaveLayoutProps struct {
	Track                map[string]interface{}
	Album                map[string]interface{}
	Path                 string
	MinimumIntegerDigits int
	TrackNumber          bool
}

SaveLayoutProps holds the parameters required for the SaveLayout function.

Jump to

Keyboard shortcuts

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