download

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadTrack

func DownloadTrack(options TrackDownloadOptions) (string, error)

DownloadTrack downloads a track, adds metadata, and saves it to the specified directory.

func GetTrackUrlFromServer

func GetTrackUrlFromServer(trackToken, format string) (string, error)

GetTrackUrlFromServer fetches the track URL from the server based on the track token and format.

Types

type GeoBlocked

type GeoBlocked struct {
	Country string
}

GeoBlocked error for when the track is not available in the user's country.

func (*GeoBlocked) Error

func (e *GeoBlocked) Error() string

type ProgressCallback

type ProgressCallback func(progress float64, totalBytesRead, contentLength int64)

ProgressCallback defines a function type for tracking download progress.

type TrackDownloadOptions

type TrackDownloadOptions struct {
	SngID      string                                          // The ID of the track to download.
	Quality    int                                             // The quality of the track (e.g., 1 for MP3_128, 3 for MP3_320, 9 for FLAC).
	CoverSize  int                                             // The size of the album cover in pixels.
	SaveToDir  string                                          // The directory where the track will be saved.
	OnProgress func(progress float64, downloaded, total int64) // The progress callback function.
}

TrackDownloadOptions contains all the details needed for downloading a track.

type TrackDownloadUrl

type TrackDownloadUrl struct {
	TrackUrl    string // The URL to download the track.
	IsEncrypted bool   // Indicates if the track URL points to an encrypted file.
	FileSize    int64  // The size of the track file in bytes.
}

TrackDownloadUrl represents the details of a track's download URL.

func GetTrackDownloadUrl

func GetTrackDownloadUrl(track types.TrackType, quality int) (*TrackDownloadUrl, error)

GetTrackDownloadUrl retrieves the download URL of a track based on quality.

type UserData

type UserData struct {
	LicenseToken      string
	CanStreamLossless bool
	CanStreamHQ       bool
	Country           string
}

UserData struct stores user license and streaming capabilities

func DzAuthenticate

func DzAuthenticate() (*UserData, error)

DzAuthenticate authenticates with Deezer and retrieves user data.

type WrongLicense

type WrongLicense struct {
	Format string
}

WrongLicense error for when the user's license doesn't allow streaming certain formats.

func (*WrongLicense) Error

func (e *WrongLicense) Error() string

Jump to

Keyboard shortcuts

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