utils

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultArtistPictureName = "default/default_artist.png"
	DefaultAlbumCoverArtName = "default/default_album.png"
	DefaultTrackCoverArtName = "default/default_album.png"
)

Variables

View Source
var CreateAlbumId = createIdGenerator(16)
View Source
var CreateApiTokenId = createIdGenerator(32)
View Source
var CreateArtistId = createIdGenerator(10)
View Source
var CreateId = createIdGenerator(32)
View Source
var CreateSmallId = createIdGenerator(8)
View Source
var CreateTrackId = createIdGenerator(32)

Functions

func ConvertAlbumCoverURL

func ConvertAlbumCoverURL(c pyrin.Context, albumId string, val sql.NullString) types.Images

func ConvertArtistPicture added in v0.17.0

func ConvertArtistPicture(c pyrin.Context, artistId string, val sql.NullString) types.Images

func ConvertImageURL

func ConvertImageURL(c pyrin.Context, albumId string, val sql.NullString, def string) string

func ConvertURL

func ConvertURL(c pyrin.Context, path string) string

func CopyFile

func CopyFile(src, dst string) (int64, error)

func CreateResizedImage added in v0.16.2

func CreateResizedImage(src string, dest string, dim int) error

TODO(patrik): Update to the new from sewaddle

func Decode

func Decode(input interface{}, output interface{}) error

func ExtractNumber added in v0.16.2

func ExtractNumber(s string) int

func FormatTime

func FormatTime(t int) string

func GetSingleFile

func GetSingleFile(form *multipart.Form, name string) (*multipart.FileHeader, error)

func HasMusic

func HasMusic(entries []fs.DirEntry) bool

func IsFileLossyFormat

func IsFileLossyFormat(file string) bool

func IsLossyFormatExt

func IsLossyFormatExt(ext string) bool

func IsMultiDisc

func IsMultiDisc(entries []fs.DirEntry) bool

func IsMultiDiscName

func IsMultiDiscName(name string) bool

func IsMusicFile

func IsMusicFile(p string) bool

func IsValidImageExt

func IsValidImageExt(ext string) bool

func IsValidTrackExt

func IsValidTrackExt(ext string) bool

func ParseAuthHeader

func ParseAuthHeader(authHeader string) string

func ProcessMobileVersion added in v0.16.2

func ProcessMobileVersion(input string, outputDir, name string) (string, error)

TODO(patrik): Move this

func ProcessOriginalVersion added in v0.16.2

func ProcessOriginalVersion(input string, outputDir, name string) (string, error)

func RunFFprobe added in v0.16.2

func RunFFprobe(verbose bool, args ...string) ([]byte, error)

func Slug added in v0.16.2

func Slug(s string) string

func SplitString added in v0.15.0

func SplitString(s string) []string

func SymlinkReplace

func SymlinkReplace(src, dst string) error

func TotalPages added in v0.18.0

func TotalPages(perPage, totalItems int) int

func WriteFormFile

func WriteFormFile(file *multipart.FileHeader, dst string) error

Types

type ProbeResult added in v0.16.2

type ProbeResult struct {
	Tags     map[string]string
	Duration int
}

func ProbeTrack added in v0.16.2

func ProbeTrack(filepath string) (ProbeResult, error)

type TrackInfo added in v0.16.2

type TrackInfo struct {
	Path string

	Duration int
	Tags     map[string]string
}

func GetTrackInfo added in v0.16.2

func GetTrackInfo(filepath string) (TrackInfo, error)

Jump to

Keyboard shortcuts

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