Documentation
¶
Index ¶
- func DownloadTrack(options DownloadTrackOptions) (string, error)
- func DownloadTrackToBuffer(options DownloadTrackToBufferOptions) ([]byte, error)
- func GetTrackUrlFromServer(trackToken, format string) (string, error)
- type DownloadTrackOptions
- type DownloadTrackToBufferOptions
- type GeoBlocked
- type ProgressCallback
- type TrackDownloadUrl
- type UserData
- type WrongLicense
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadTrack ¶
func DownloadTrack(options DownloadTrackOptions) (string, error)
DownloadTrack downloads a track, adds metadata, and saves it to the specified directory.
func DownloadTrackToBuffer ¶ added in v1.1.0
func DownloadTrackToBuffer(options DownloadTrackToBufferOptions) ([]byte, error)
DownloadTrackToBuffer downloads a track, decrypts if necessary, adds metadata, and returns the buffer.
func GetTrackUrlFromServer ¶
GetTrackUrlFromServer fetches the track URL from the server based on the track token and format.
Types ¶
type DownloadTrackOptions ¶ added in v1.1.0
type DownloadTrackOptions 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.
}
DownloadTrackOptions contains all the details needed for downloading a track.
type DownloadTrackToBufferOptions ¶ added in v1.1.0
type DownloadTrackToBufferOptions 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.
}
DownloadTrackToBufferOptions contains all the details needed for downloading a track to a buffer.
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 ¶
ProgressCallback defines a function type for tracking download progress.
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 ¶
UserData struct stores user license and streaming capabilities
func DzAuthenticate ¶
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