backend

package
v0.0.0-...-00d3fb9 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppVersion = "Unknown"
View Source
var SpotifyError = errors.New("spotify error")

Functions

func AddFetchHistoryItem

func AddFetchHistoryItem(item FetchHistoryItem, appName string) error

func AddHistoryItem

func AddHistoryItem(item HistoryItem, appName string) error

func AddToQueue

func AddToQueue(id, trackName, artistName, albumName, spotifyID string)

func BuildExpectedFilename

func BuildExpectedFilename(trackName, artistName, albumName, albumArtist, releaseDate, filenameFormat, playlistName, playlistOwner string, includeTrackNumber bool, position, discNumber int, useAlbumTrackNumber bool) string

func CancelAllQueuedItems

func CancelAllQueuedItems()

func ClearAllDownloads

func ClearAllDownloads()

func ClearDownloadQueue

func ClearDownloadQueue()

func ClearFetchHistory

func ClearFetchHistory(appName string) error

func ClearFetchHistoryByType

func ClearFetchHistoryByType(itemType string, appName string) error

func ClearHistory

func ClearHistory(appName string) error

func CloseHistoryDB

func CloseHistoryDB()

func CompleteDownloadItem

func CompleteDownloadItem(id, filePath string, finalSize float64)

func DeleteFetchHistoryItem

func DeleteFetchHistoryItem(id string, appName string) error

func DeleteHistoryItem

func DeleteHistoryItem(id string, appName string) error

func DownloadFFmpeg

func DownloadFFmpeg(progressCallback func(int)) error

func EmbedCoverArtOnly

func EmbedCoverArtOnly(filePath string, coverPath string) error

func EmbedLyricsOnly

func EmbedLyricsOnly(filepath string, lyrics string) error

func EmbedLyricsOnlyMP3

func EmbedLyricsOnlyMP3(filepath string, lyrics string) error

func EmbedLyricsOnlyUniversal

func EmbedLyricsOnlyUniversal(filepath string, lyrics string) error

func EmbedMetadata

func EmbedMetadata(filepath string, metadata Metadata, coverPath string) error

func EmbedMetadataToConvertedFile

func EmbedMetadataToConvertedFile(filePath string, metadata Metadata, coverPath string) error

func ExtractCoverArt

func ExtractCoverArt(filePath string) (string, error)

func ExtractLyrics

func ExtractLyrics(filePath string) (string, error)

func FailDownloadItem

func FailDownloadItem(id, errorMsg string)

func FilterAlbum

func FilterAlbum(data map[string]interface{}) map[string]interface{}

func FilterArtist

func FilterArtist(data map[string]interface{}) map[string]interface{}

func FilterPlaylist

func FilterPlaylist(data map[string]interface{}) map[string]interface{}

func FilterSearch

func FilterSearch(data map[string]interface{}) map[string]interface{}

func FilterTrack

func FilterTrack(data map[string]interface{}, albumFetchData ...map[string]interface{}) map[string]interface{}

func GenerateFilename

func GenerateFilename(metadata *AudioMetadata, format string, ext string) string

func GetAudioDuration

func GetAudioDuration(filepath string) (float64, error)

func GetCurrentItemID

func GetCurrentItemID() string

func GetDefaultMusicPath

func GetDefaultMusicPath() string

func GetFFmpegDir

func GetFFmpegDir() (string, error)

func GetFFmpegPath

func GetFFmpegPath() (string, error)

func GetFFprobePath

func GetFFprobePath() (string, error)

func GetFileSize

func GetFileSize(filepath string) (int64, error)

func GetFileSizes

func GetFileSizes(files []string) map[string]int64

func GetFilteredSpotifyData

func GetFilteredSpotifyData(ctx context.Context, spotifyURL string, batch bool, delay time.Duration) (interface{}, error)

func GetFirstArtist

func GetFirstArtist(artistString string) string

func GetOSInfo

func GetOSInfo() (string, error)

func GetPreviewURL

func GetPreviewURL(trackID string) (string, error)

func GetSpotifyDataWithAPI

func GetSpotifyDataWithAPI(ctx context.Context, spotifyURL string, useAPI bool, apiBaseURL string, batch bool, delay time.Duration) (interface{}, error)

func InitHistoryDB

func InitHistoryDB(appName string) error

func IsFFmpegInstalled

func IsFFmpegInstalled() (bool, error)

func IsFFprobeInstalled

func IsFFprobeInstalled() (bool, error)

func NormalizePath

func NormalizePath(folderPath string) string

func OpenFolderInExplorer

func OpenFolderInExplorer(path string) error

func ResetSessionIfComplete

func ResetSessionIfComplete()

func SanitizeFilename

func SanitizeFilename(name string) string

func SanitizeFolderPath

func SanitizeFolderPath(folderPath string) string

func SelectFileDialog

func SelectFileDialog(ctx context.Context) (string, error)

func SelectFolderDialog

func SelectFolderDialog(ctx context.Context, defaultPath string) (string, error)

func SelectImageVideoDialog

func SelectImageVideoDialog(ctx context.Context) ([]string, error)

func SelectMultipleFiles

func SelectMultipleFiles(ctx context.Context) ([]string, error)

func SelectOutputDirectory

func SelectOutputDirectory(ctx context.Context) (string, error)

func SetDownloadProgress

func SetDownloadProgress(mbDownloaded float64)

func SetDownloadSpeed

func SetDownloadSpeed(mbps float64)

func SetDownloading

func SetDownloading(downloading bool)

func SkipDownloadItem

func SkipDownloadItem(id, filePath string)

func StartDownloadItem

func StartDownloadItem(id string)

func UpdateItemProgress

func UpdateItemProgress(id string, progress, speed float64)

func UploadBytesToSendNow

func UploadBytesToSendNow(filename string, data []byte) (string, error)

func UploadToSendNow

func UploadToSendNow(filePath string) (string, error)

func ValidateExecutable

func ValidateExecutable(path string) error

Types

type AlbumInfoMetadata

type AlbumInfoMetadata struct {
	TotalTracks int    `json:"total_tracks"`
	Name        string `json:"name"`
	ReleaseDate string `json:"release_date"`
	Artists     string `json:"artists"`
	Images      string `json:"images"`
	Batch       string `json:"batch,omitempty"`
	ArtistID    string `json:"artist_id,omitempty"`
	ArtistURL   string `json:"artist_url,omitempty"`
}

type AlbumResponsePayload

type AlbumResponsePayload struct {
	AlbumInfo AlbumInfoMetadata    `json:"album_info"`
	TrackList []AlbumTrackMetadata `json:"track_list"`
}

type AlbumTrackMetadata

type AlbumTrackMetadata struct {
	SpotifyID   string         `json:"spotify_id,omitempty"`
	Artists     string         `json:"artists"`
	Name        string         `json:"name"`
	AlbumName   string         `json:"album_name"`
	AlbumArtist string         `json:"album_artist,omitempty"`
	DurationMS  int            `json:"duration_ms"`
	Images      string         `json:"images"`
	ReleaseDate string         `json:"release_date"`
	TrackNumber int            `json:"track_number"`
	TotalTracks int            `json:"total_tracks,omitempty"`
	DiscNumber  int            `json:"disc_number,omitempty"`
	TotalDiscs  int            `json:"total_discs,omitempty"`
	ExternalURL string         `json:"external_urls"`
	AlbumType   string         `json:"album_type,omitempty"`
	AlbumID     string         `json:"album_id,omitempty"`
	AlbumURL    string         `json:"album_url,omitempty"`
	ArtistID    string         `json:"artist_id,omitempty"`
	ArtistURL   string         `json:"artist_url,omitempty"`
	ArtistsData []ArtistSimple `json:"artists_data,omitempty"`
	Plays       string         `json:"plays,omitempty"`
	Status      string         `json:"status,omitempty"`
	PreviewURL  string         `json:"preview_url,omitempty"`
	IsExplicit  bool           `json:"is_explicit,omitempty"`
}

type AmazonDownloader

type AmazonDownloader struct {
	// contains filtered or unexported fields
}

func NewAmazonDownloader

func NewAmazonDownloader() *AmazonDownloader

func (*AmazonDownloader) DownloadBySpotifyID

func (a *AmazonDownloader) DownloadBySpotifyID(spotifyTrackID, outputDir, quality, filenameFormat, playlistName, playlistOwner string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate, spotifyCoverURL string, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, embedMaxQualityCover bool, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string,
	useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool,
) (string, error)

func (*AmazonDownloader) DownloadByURL

func (a *AmazonDownloader) DownloadByURL(amazonURL, outputDir, quality, filenameFormat, playlistName, playlistOwner string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate, spotifyCoverURL string, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, embedMaxQualityCover bool, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*AmazonDownloader) DownloadFromAfkarXYZ

func (a *AmazonDownloader) DownloadFromAfkarXYZ(amazonURL, outputDir, quality string) (string, error)

func (*AmazonDownloader) DownloadFromService

func (a *AmazonDownloader) DownloadFromService(amazonURL, outputDir, quality string) (string, error)

func (*AmazonDownloader) GetAmazonURLFromSpotify

func (a *AmazonDownloader) GetAmazonURLFromSpotify(spotifyTrackID string) (string, error)

type AmazonStreamResponse

type AmazonStreamResponse struct {
	StreamURL     string `json:"streamUrl"`
	DecryptionKey string `json:"decryptionKey"`
}

type AnalysisResult

type AnalysisResult struct {
	FilePath      string        `json:"file_path"`
	FileSize      int64         `json:"file_size"`
	SampleRate    uint32        `json:"sample_rate"`
	Channels      uint8         `json:"channels"`
	BitsPerSample uint8         `json:"bits_per_sample"`
	TotalSamples  uint64        `json:"total_samples"`
	Duration      float64       `json:"duration"`
	Bitrate       int           `json:"bit_rate"`
	BitDepth      string        `json:"bit_depth"`
	DynamicRange  float64       `json:"dynamic_range"`
	PeakAmplitude float64       `json:"peak_amplitude"`
	RMSLevel      float64       `json:"rms_level"`
	Spectrum      *SpectrumData `json:"spectrum,omitempty"`
}

func AnalyzeTrack

func AnalyzeTrack(filepath string) (*AnalysisResult, error)

func GetMetadataWithFFprobe

func GetMetadataWithFFprobe(filePath string) (*AnalysisResult, error)

func GetTrackMetadata

func GetTrackMetadata(filepath string) (*AnalysisResult, error)

type ArtistDiscographyPayload

type ArtistDiscographyPayload struct {
	ArtistInfo ArtistInfoMetadata         `json:"artist_info"`
	AlbumList  []DiscographyAlbumMetadata `json:"album_list"`
	TrackList  []AlbumTrackMetadata       `json:"track_list"`
}

type ArtistInfoMetadata

type ArtistInfoMetadata struct {
	Name            string   `json:"name"`
	Followers       int      `json:"followers"`
	Genres          []string `json:"genres"`
	Images          string   `json:"images"`
	Header          string   `json:"header,omitempty"`
	Gallery         []string `json:"gallery,omitempty"`
	ExternalURL     string   `json:"external_urls"`
	DiscographyType string   `json:"discography_type"`
	TotalAlbums     int      `json:"total_albums"`
	Biography       string   `json:"biography,omitempty"`
	Verified        bool     `json:"verified,omitempty"`
	Listeners       int      `json:"listeners,omitempty"`
	Rank            int      `json:"rank,omitempty"`
	Batch           string   `json:"batch,omitempty"`
}

type ArtistResponsePayload

type ArtistResponsePayload struct {
	Artist struct {
		Name        string   `json:"name"`
		Followers   int      `json:"followers"`
		Genres      []string `json:"genres"`
		Images      string   `json:"images"`
		ExternalURL string   `json:"external_urls"`
		Popularity  int      `json:"popularity"`
	} `json:"artist"`
}

type ArtistSimple

type ArtistSimple struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	ExternalURL string `json:"external_urls"`
}

type AudioFileInfo

type AudioFileInfo struct {
	Path     string `json:"path"`
	Filename string `json:"filename"`
	Format   string `json:"format"`
	Size     int64  `json:"size"`
}

func GetAudioFileInfo

func GetAudioFileInfo(filePath string) (*AudioFileInfo, error)

type AudioMetadata

type AudioMetadata struct {
	Title       string `json:"title"`
	Artist      string `json:"artist"`
	Album       string `json:"album"`
	AlbumArtist string `json:"album_artist"`
	TrackNumber int    `json:"track_number"`
	DiscNumber  int    `json:"disc_number"`
	Year        string `json:"year"`
}

func ReadAudioMetadata

func ReadAudioMetadata(filePath string) (*AudioMetadata, error)

type AvatarDownloadRequest

type AvatarDownloadRequest struct {
	AvatarURL  string `json:"avatar_url"`
	ArtistName string `json:"artist_name"`
	OutputDir  string `json:"output_dir"`
}

type AvatarDownloadResponse

type AvatarDownloadResponse struct {
	Success       bool   `json:"success"`
	Message       string `json:"message"`
	File          string `json:"file,omitempty"`
	Error         string `json:"error,omitempty"`
	AlreadyExists bool   `json:"already_exists,omitempty"`
}

type ConvertAudioRequest

type ConvertAudioRequest struct {
	InputFiles   []string `json:"input_files"`
	OutputFormat string   `json:"output_format"`
	Bitrate      string   `json:"bitrate"`
	Codec        string   `json:"codec"`
}

type ConvertAudioResult

type ConvertAudioResult struct {
	InputFile  string `json:"input_file"`
	OutputFile string `json:"output_file"`
	Success    bool   `json:"success"`
	Error      string `json:"error,omitempty"`
}

func ConvertAudio

func ConvertAudio(req ConvertAudioRequest) ([]ConvertAudioResult, error)

type CoverClient

type CoverClient struct {
	// contains filtered or unexported fields
}

func NewCoverClient

func NewCoverClient() *CoverClient

func (*CoverClient) DownloadAvatar

func (*CoverClient) DownloadCover

func (c *CoverClient) DownloadCover(req CoverDownloadRequest) (*CoverDownloadResponse, error)

func (*CoverClient) DownloadCoverToPath

func (c *CoverClient) DownloadCoverToPath(coverURL, outputPath string, embedMaxQualityCover bool) error

func (*CoverClient) DownloadGalleryImage

func (*CoverClient) DownloadHeader

type CoverDownloadRequest

type CoverDownloadRequest struct {
	CoverURL       string `json:"cover_url"`
	TrackName      string `json:"track_name"`
	ArtistName     string `json:"artist_name"`
	AlbumName      string `json:"album_name"`
	AlbumArtist    string `json:"album_artist"`
	ReleaseDate    string `json:"release_date"`
	OutputDir      string `json:"output_dir"`
	FilenameFormat string `json:"filename_format"`
	TrackNumber    bool   `json:"track_number"`
	Position       int    `json:"position"`
	DiscNumber     int    `json:"disc_number"`
}

type CoverDownloadResponse

type CoverDownloadResponse struct {
	Success       bool   `json:"success"`
	Message       string `json:"message"`
	File          string `json:"file,omitempty"`
	Error         string `json:"error,omitempty"`
	AlreadyExists bool   `json:"already_exists,omitempty"`
}

type DeezerDownloader

type DeezerDownloader struct {
	// contains filtered or unexported fields
}

func NewDeezerDownloader

func NewDeezerDownloader() *DeezerDownloader

func (*DeezerDownloader) Download

func (d *DeezerDownloader) Download(spotifyID, outputDir, filenameFormat, playlistName, playlistOwner string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate, spotifyCoverURL string, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, embedMaxQualityCover bool, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*DeezerDownloader) DownloadFromYoinkify

func (d *DeezerDownloader) DownloadFromYoinkify(spotifyURL, outputDir string) (string, error)

type DiscographyAlbumMetadata

type DiscographyAlbumMetadata struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	AlbumType   string `json:"album_type"`
	ReleaseDate string `json:"release_date"`
	TotalTracks int    `json:"total_tracks"`
	Artists     string `json:"artists"`
	Images      string `json:"images"`
	ExternalURL string `json:"external_urls"`
}

type DownloadItem

type DownloadItem struct {
	ID           string         `json:"id"`
	TrackName    string         `json:"track_name"`
	ArtistName   string         `json:"artist_name"`
	AlbumName    string         `json:"album_name"`
	SpotifyID    string         `json:"spotify_id"`
	Status       DownloadStatus `json:"status"`
	Progress     float64        `json:"progress"`
	TotalSize    float64        `json:"total_size"`
	Speed        float64        `json:"speed"`
	StartTime    int64          `json:"start_time"`
	EndTime      int64          `json:"end_time"`
	ErrorMessage string         `json:"error_message"`
	FilePath     string         `json:"file_path"`
}

type DownloadQueueInfo

type DownloadQueueInfo struct {
	IsDownloading    bool           `json:"is_downloading"`
	Queue            []DownloadItem `json:"queue"`
	CurrentSpeed     float64        `json:"current_speed"`
	TotalDownloaded  float64        `json:"total_downloaded"`
	SessionStartTime int64          `json:"session_start_time"`
	QueuedCount      int            `json:"queued_count"`
	CompletedCount   int            `json:"completed_count"`
	FailedCount      int            `json:"failed_count"`
	SkippedCount     int            `json:"skipped_count"`
}

func GetDownloadQueue

func GetDownloadQueue() DownloadQueueInfo

type DownloadStatus

type DownloadStatus string
const (
	StatusQueued      DownloadStatus = "queued"
	StatusDownloading DownloadStatus = "downloading"
	StatusCompleted   DownloadStatus = "completed"
	StatusFailed      DownloadStatus = "failed"
	StatusSkipped     DownloadStatus = "skipped"
)

type FetchHistoryItem

type FetchHistoryItem struct {
	ID        string `json:"id"`
	URL       string `json:"url"`
	Type      string `json:"type"`
	Name      string `json:"name"`
	Info      string `json:"info"`
	Image     string `json:"image"`
	Data      string `json:"data"`
	Timestamp int64  `json:"timestamp"`
}

func GetFetchHistoryItems

func GetFetchHistoryItems(appName string) ([]FetchHistoryItem, error)

type FileInfo

type FileInfo struct {
	Name     string     `json:"name"`
	Path     string     `json:"path"`
	IsDir    bool       `json:"is_dir"`
	Size     int64      `json:"size"`
	Children []FileInfo `json:"children,omitempty"`
}

func ListAudioFiles

func ListAudioFiles(dirPath string) ([]FileInfo, error)

func ListDirectory

func ListDirectory(dirPath string) ([]FileInfo, error)

type GalleryImageDownloadRequest

type GalleryImageDownloadRequest struct {
	ImageURL   string `json:"image_url"`
	ArtistName string `json:"artist_name"`
	ImageIndex int    `json:"image_index"`
	OutputDir  string `json:"output_dir"`
}

type GalleryImageDownloadResponse

type GalleryImageDownloadResponse struct {
	Success       bool   `json:"success"`
	Message       string `json:"message"`
	File          string `json:"file,omitempty"`
	Error         string `json:"error,omitempty"`
	AlreadyExists bool   `json:"already_exists,omitempty"`
}

type HeaderDownloadRequest

type HeaderDownloadRequest struct {
	HeaderURL  string `json:"header_url"`
	ArtistName string `json:"artist_name"`
	OutputDir  string `json:"output_dir"`
}

type HeaderDownloadResponse

type HeaderDownloadResponse struct {
	Success       bool   `json:"success"`
	Message       string `json:"message"`
	File          string `json:"file,omitempty"`
	Error         string `json:"error,omitempty"`
	AlreadyExists bool   `json:"already_exists,omitempty"`
}

type HistoryItem

type HistoryItem struct {
	ID          string `json:"id"`
	SpotifyID   string `json:"spotify_id"`
	Title       string `json:"title"`
	Artists     string `json:"artists"`
	Album       string `json:"album"`
	DurationStr string `json:"duration_str"`
	CoverURL    string `json:"cover_url"`
	Quality     string `json:"quality"`
	Format      string `json:"format"`
	Path        string `json:"path"`
	Timestamp   int64  `json:"timestamp"`
}

func GetHistoryItems

func GetHistoryItems(appName string) ([]HistoryItem, error)

type LRCLibResponse

type LRCLibResponse struct {
	ID           int     `json:"id"`
	Name         string  `json:"name"`
	TrackName    string  `json:"trackName"`
	ArtistName   string  `json:"artistName"`
	AlbumName    string  `json:"albumName"`
	Duration     float64 `json:"duration"`
	Instrumental bool    `json:"instrumental"`
	PlainLyrics  string  `json:"plainLyrics"`
	SyncedLyrics string  `json:"syncedLyrics"`
}

type LyricsClient

type LyricsClient struct {
	// contains filtered or unexported fields
}

func NewLyricsClient

func NewLyricsClient() *LyricsClient

func (*LyricsClient) ConvertToLRC

func (c *LyricsClient) ConvertToLRC(lyrics *LyricsResponse, trackName, artistName string) string

func (*LyricsClient) DownloadLyrics

func (*LyricsClient) FetchLyricsAllSources

func (c *LyricsClient) FetchLyricsAllSources(spotifyID, trackName, artistName string, duration int) (*LyricsResponse, string, error)

func (*LyricsClient) FetchLyricsFromLRCLibSearch

func (c *LyricsClient) FetchLyricsFromLRCLibSearch(trackName, artistName string) (*LyricsResponse, error)

func (*LyricsClient) FetchLyricsFromSpotifyAPI

func (c *LyricsClient) FetchLyricsFromSpotifyAPI(spotifyID string) (*LyricsResponse, error)

func (*LyricsClient) FetchLyricsWithMetadata

func (c *LyricsClient) FetchLyricsWithMetadata(trackName, artistName string, duration int) (*LyricsResponse, error)

type LyricsDownloadRequest

type LyricsDownloadRequest struct {
	SpotifyID           string `json:"spotify_id"`
	TrackName           string `json:"track_name"`
	ArtistName          string `json:"artist_name"`
	AlbumName           string `json:"album_name"`
	AlbumArtist         string `json:"album_artist"`
	ReleaseDate         string `json:"release_date"`
	OutputDir           string `json:"output_dir"`
	FilenameFormat      string `json:"filename_format"`
	TrackNumber         bool   `json:"track_number"`
	Position            int    `json:"position"`
	UseAlbumTrackNumber bool   `json:"use_album_track_number"`
	DiscNumber          int    `json:"disc_number"`
}

type LyricsDownloadResponse

type LyricsDownloadResponse struct {
	Success       bool   `json:"success"`
	Message       string `json:"message"`
	File          string `json:"file,omitempty"`
	Error         string `json:"error,omitempty"`
	AlreadyExists bool   `json:"already_exists,omitempty"`
}

type LyricsLine

type LyricsLine struct {
	StartTimeMs string `json:"startTimeMs"`
	Words       string `json:"words"`
	EndTimeMs   string `json:"endTimeMs"`
}

type LyricsResponse

type LyricsResponse struct {
	Error    bool         `json:"error"`
	SyncType string       `json:"syncType"`
	Lines    []LyricsLine `json:"lines"`
}

type MPD

type MPD struct {
	XMLName xml.Name `xml:"MPD"`
	Period  struct {
		AdaptationSets []struct {
			MimeType        string `xml:"mimeType,attr"`
			Codecs          string `xml:"codecs,attr"`
			Representations []struct {
				ID              string           `xml:"id,attr"`
				Codecs          string           `xml:"codecs,attr"`
				Bandwidth       int              `xml:"bandwidth,attr"`
				SegmentTemplate *SegmentTemplate `xml:"SegmentTemplate"`
			} `xml:"Representation"`
			SegmentTemplate *SegmentTemplate `xml:"SegmentTemplate"`
		} `xml:"AdaptationSet"`
	} `xml:"Period"`
}

type Metadata

type Metadata struct {
	Title       string
	Artist      string
	Album       string
	AlbumArtist string
	Date        string
	ReleaseDate string
	TrackNumber int
	TotalTracks int
	DiscNumber  int
	TotalDiscs  int
	URL         string
	Copyright   string
	Publisher   string
	Lyrics      string
	Description string
	ISRC        string
	Genre       string
}

func ExtractFullMetadataFromFile

func ExtractFullMetadataFromFile(filePath string) (Metadata, error)

func FetchMusicBrainzMetadata

func FetchMusicBrainzMetadata(isrc, title, artist, album string, useSingleGenre bool, embedGenre bool) (Metadata, error)

type MusicBrainzRecordingResponse

type MusicBrainzRecordingResponse struct {
	Recordings []struct {
		ID       string `json:"id"`
		Title    string `json:"title"`
		Length   int    `json:"length"`
		Releases []struct {
			ID           string `json:"id"`
			Title        string `json:"title"`
			Status       string `json:"status"`
			ReleaseGroup struct {
				ID          string `json:"id"`
				Title       string `json:"title"`
				PrimaryType string `json:"primary-type"`
			} `json:"release-group"`
			Date    string `json:"date"`
			Country string `json:"country"`
			Media   []struct {
				Format string `json:"format"`
			} `json:"media"`
			LabelInfo []struct {
				Label struct {
					Name string `json:"name"`
				} `json:"label"`
			} `json:"label-info"`
		} `json:"releases"`
		ArtistCredit []struct {
			Artist struct {
				ID   string `json:"id"`
				Name string `json:"name"`
			} `json:"artist"`
		} `json:"artist-credit"`
		Tags []struct {
			Count int    `json:"count"`
			Name  string `json:"name"`
		} `json:"tags"`
	} `json:"recordings"`
}

type PlaylistInfoMetadata

type PlaylistInfoMetadata struct {
	Tracks struct {
		Total int `json:"total"`
	} `json:"tracks"`
	Followers struct {
		Total int `json:"total"`
	} `json:"followers"`
	Owner struct {
		DisplayName string `json:"display_name"`
		Name        string `json:"name"`
		Images      string `json:"images"`
	} `json:"owner"`
	Cover       string `json:"cover,omitempty"`
	Description string `json:"description,omitempty"`
	Batch       string `json:"batch,omitempty"`
}

type PlaylistResponsePayload

type PlaylistResponsePayload struct {
	PlaylistInfo PlaylistInfoMetadata `json:"playlist_info"`
	TrackList    []AlbumTrackMetadata `json:"track_list"`
}

type ProgressInfo

type ProgressInfo struct {
	IsDownloading bool    `json:"is_downloading"`
	MBDownloaded  float64 `json:"mb_downloaded"`
	SpeedMBps     float64 `json:"speed_mbps"`
}

func GetDownloadProgress

func GetDownloadProgress() ProgressInfo

type ProgressWriter

type ProgressWriter struct {
	// contains filtered or unexported fields
}

func NewProgressWriter

func NewProgressWriter(writer io.Writer) *ProgressWriter

func NewProgressWriterWithID

func NewProgressWriterWithID(writer io.Writer, itemID string) *ProgressWriter

func (*ProgressWriter) GetTotal

func (pw *ProgressWriter) GetTotal() int64

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(p []byte) (int, error)

type QobuzDownloader

type QobuzDownloader struct {
	// contains filtered or unexported fields
}

func NewQobuzDownloader

func NewQobuzDownloader() *QobuzDownloader

func (*QobuzDownloader) DownloadCoverArt

func (q *QobuzDownloader) DownloadCoverArt(coverURL, filepath string) error

func (*QobuzDownloader) DownloadFile

func (q *QobuzDownloader) DownloadFile(url, filepath string) error

func (*QobuzDownloader) DownloadFromStandard

func (q *QobuzDownloader) DownloadFromStandard(apiBase string, trackID int64, quality string) (string, error)

func (*QobuzDownloader) DownloadTrack

func (q *QobuzDownloader) DownloadTrack(spotifyID, outputDir, quality, filenameFormat string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate string, useAlbumTrackNumber bool, spotifyCoverURL string, embedMaxQualityCover bool, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, allowFallback bool, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*QobuzDownloader) DownloadTrackWithISRC

func (q *QobuzDownloader) DownloadTrackWithISRC(deezerISRC, spotifyID, outputDir, quality, filenameFormat string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate string, useAlbumTrackNumber bool, spotifyCoverURL string, embedMaxQualityCover bool, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, allowFallback bool, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*QobuzDownloader) GetDownloadURL

func (q *QobuzDownloader) GetDownloadURL(trackID int64, quality string, allowFallback bool) (string, error)

type QobuzSearchResponse

type QobuzSearchResponse struct {
	Query  string `json:"query"`
	Tracks struct {
		Limit  int          `json:"limit"`
		Offset int          `json:"offset"`
		Total  int          `json:"total"`
		Items  []QobuzTrack `json:"items"`
	} `json:"tracks"`
}

type QobuzStreamResponse

type QobuzStreamResponse struct {
	URL string `json:"url"`
}

type QobuzTrack

type QobuzTrack struct {
	ID                  int64   `json:"id"`
	Title               string  `json:"title"`
	Version             string  `json:"version"`
	Duration            int     `json:"duration"`
	TrackNumber         int     `json:"track_number"`
	MediaNumber         int     `json:"media_number"`
	ISRC                string  `json:"isrc"`
	Copyright           string  `json:"copyright"`
	MaximumBitDepth     int     `json:"maximum_bit_depth"`
	MaximumSamplingRate float64 `json:"maximum_sampling_rate"`
	Hires               bool    `json:"hires"`
	HiresStreamable     bool    `json:"hires_streamable"`
	ReleaseDateOriginal string  `json:"release_date_original"`
	Performer           struct {
		Name string `json:"name"`
		ID   int64  `json:"id"`
	} `json:"performer"`
	Album struct {
		Title string `json:"title"`
		ID    string `json:"id"`
		Image struct {
			Small     string `json:"small"`
			Thumbnail string `json:"thumbnail"`
			Large     string `json:"large"`
		} `json:"image"`
		Artist struct {
			Name string `json:"name"`
			ID   int64  `json:"id"`
		} `json:"artist"`
		Label struct {
			Name string `json:"name"`
		} `json:"label"`
	} `json:"album"`
}

type RenamePreview

type RenamePreview struct {
	OldPath  string        `json:"old_path"`
	OldName  string        `json:"old_name"`
	NewName  string        `json:"new_name"`
	NewPath  string        `json:"new_path"`
	Error    string        `json:"error,omitempty"`
	Metadata AudioMetadata `json:"metadata"`
}

func PreviewRename

func PreviewRename(files []string, format string) []RenamePreview

type RenameResult

type RenameResult struct {
	OldPath string `json:"old_path"`
	NewPath string `json:"new_path"`
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

func RenameFiles

func RenameFiles(files []string, format string) []RenameResult

type SearchResponse

type SearchResponse struct {
	Tracks    []SearchResult `json:"tracks"`
	Albums    []SearchResult `json:"albums"`
	Artists   []SearchResult `json:"artists"`
	Playlists []SearchResult `json:"playlists"`
}

func SearchSpotify

func SearchSpotify(ctx context.Context, query string, limit int) (*SearchResponse, error)

type SearchResult

type SearchResult struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Artists     string `json:"artists,omitempty"`
	AlbumName   string `json:"album_name,omitempty"`
	Images      string `json:"images"`
	ReleaseDate string `json:"release_date,omitempty"`
	ExternalURL string `json:"external_urls"`
	Duration    int    `json:"duration_ms,omitempty"`
	TotalTracks int    `json:"total_tracks,omitempty"`
	Owner       string `json:"owner,omitempty"`
	IsExplicit  bool   `json:"is_explicit,omitempty"`
}

func SearchSpotifyByType

func SearchSpotifyByType(ctx context.Context, query string, searchType string, limit int, offset int) ([]SearchResult, error)

type SegmentTemplate

type SegmentTemplate struct {
	Initialization string `xml:"initialization,attr"`
	Media          string `xml:"media,attr"`
	Timeline       struct {
		Segments []struct {
			Duration int64 `xml:"d,attr"`
			Repeat   int   `xml:"r,attr"`
		} `xml:"S"`
	} `xml:"SegmentTimeline"`
}

type SendNowResponse

type SendNowResponse []struct {
	FileCode string `json:"file_code"`
}

type SongLinkClient

type SongLinkClient struct {
	// contains filtered or unexported fields
}

func NewSongLinkClient

func NewSongLinkClient() *SongLinkClient

func (*SongLinkClient) CheckTrackAvailability

func (s *SongLinkClient) CheckTrackAvailability(spotifyTrackID string) (*TrackAvailability, error)

func (*SongLinkClient) GetAllURLsFromSpotify

func (s *SongLinkClient) GetAllURLsFromSpotify(spotifyTrackID string, region string) (*SongLinkURLs, error)

func (*SongLinkClient) GetDeezerURLFromSpotify

func (s *SongLinkClient) GetDeezerURLFromSpotify(spotifyTrackID string) (string, error)

func (*SongLinkClient) GetISRC

func (s *SongLinkClient) GetISRC(spotifyID string) (string, error)

type SongLinkResponse

type SongLinkResponse struct {
	LinksByPlatform map[string]struct {
		URL string `json:"url"`
	} `json:"linksByPlatform"`
}

type SongLinkURLs

type SongLinkURLs struct {
	TidalURL  string `json:"tidal_url"`
	AmazonURL string `json:"amazon_url"`
	ISRC      string `json:"isrc"`
}

type SpectrumData

type SpectrumData struct {
	TimeSlices []TimeSlice `json:"time_slices"`
	SampleRate int         `json:"sample_rate"`
	FreqBins   int         `json:"freq_bins"`
	Duration   float64     `json:"duration"`
	MaxFreq    float64     `json:"max_freq"`
}

func AnalyzeSpectrum

func AnalyzeSpectrum(filepath string) (*SpectrumData, error)

type SpotifyClient

type SpotifyClient struct {
	// contains filtered or unexported fields
}

func NewSpotifyClient

func NewSpotifyClient() *SpotifyClient

func (*SpotifyClient) Initialize

func (c *SpotifyClient) Initialize() error

func (*SpotifyClient) Query

func (c *SpotifyClient) Query(payload map[string]interface{}) (map[string]interface{}, error)

type SpotifyLyricsAPIResponse

type SpotifyLyricsAPIResponse struct {
	Error    bool                `json:"error"`
	SyncType string              `json:"syncType"`
	Lines    []SpotifyLyricsLine `json:"lines"`
}

type SpotifyLyricsLine

type SpotifyLyricsLine struct {
	TimeTag string `json:"timeTag"`
	Words   string `json:"words"`
}

type SpotifyMetadataClient

type SpotifyMetadataClient struct {
	// contains filtered or unexported fields
}

func NewSpotifyMetadataClient

func NewSpotifyMetadataClient() *SpotifyMetadataClient

func (*SpotifyMetadataClient) GetFilteredData

func (c *SpotifyMetadataClient) GetFilteredData(ctx context.Context, spotifyURL string, batch bool, delay time.Duration) (interface{}, error)

func (*SpotifyMetadataClient) Search

func (c *SpotifyMetadataClient) Search(ctx context.Context, query string, limit int) (*SearchResponse, error)

func (*SpotifyMetadataClient) SearchByType

func (c *SpotifyMetadataClient) SearchByType(ctx context.Context, query string, searchType string, limit int, offset int) ([]SearchResult, error)

type TidalAPIResponse

type TidalAPIResponse struct {
	OriginalTrackURL string `json:"OriginalTrackUrl"`
}

type TidalAPIResponseV2

type TidalAPIResponseV2 struct {
	Version string `json:"version"`
	Data    struct {
		TrackID           int64  `json:"trackId"`
		AssetPresentation string `json:"assetPresentation"`
		AudioMode         string `json:"audioMode"`
		AudioQuality      string `json:"audioQuality"`
		ManifestMimeType  string `json:"manifestMimeType"`
		ManifestHash      string `json:"manifestHash"`
		Manifest          string `json:"manifest"`
		BitDepth          int    `json:"bitDepth"`
		SampleRate        int    `json:"sampleRate"`
	} `json:"data"`
}

type TidalBTSManifest

type TidalBTSManifest struct {
	MimeType       string   `json:"mimeType"`
	Codecs         string   `json:"codecs"`
	EncryptionType string   `json:"encryptionType"`
	URLs           []string `json:"urls"`
}

type TidalDownloader

type TidalDownloader struct {
	// contains filtered or unexported fields
}

func NewTidalDownloader

func NewTidalDownloader(apiURL string) *TidalDownloader

func (*TidalDownloader) Download

func (t *TidalDownloader) Download(spotifyTrackID, outputDir, quality, filenameFormat string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate string, useAlbumTrackNumber bool, spotifyCoverURL string, embedMaxQualityCover bool, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, allowFallback bool, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*TidalDownloader) DownloadByURL

func (t *TidalDownloader) DownloadByURL(tidalURL, outputDir, quality, filenameFormat string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate string, useAlbumTrackNumber bool, spotifyCoverURL string, embedMaxQualityCover bool, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, allowFallback bool, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*TidalDownloader) DownloadByURLWithFallback

func (t *TidalDownloader) DownloadByURLWithFallback(tidalURL, outputDir, quality, filenameFormat string, includeTrackNumber bool, position int, spotifyTrackName, spotifyArtistName, spotifyAlbumName, spotifyAlbumArtist, spotifyReleaseDate string, useAlbumTrackNumber bool, spotifyCoverURL string, embedMaxQualityCover bool, spotifyTrackNumber, spotifyDiscNumber, spotifyTotalTracks int, spotifyTotalDiscs int, spotifyCopyright, spotifyPublisher, spotifyURL string, allowFallback bool, useFirstArtistOnly bool, useSingleGenre bool, embedGenre bool) (string, error)

func (*TidalDownloader) DownloadFile

func (t *TidalDownloader) DownloadFile(url, filepath string) error

func (*TidalDownloader) DownloadFromManifest

func (t *TidalDownloader) DownloadFromManifest(manifestB64, outputPath string) error

func (*TidalDownloader) GetAvailableAPIs

func (t *TidalDownloader) GetAvailableAPIs() ([]string, error)

func (*TidalDownloader) GetDownloadURL

func (t *TidalDownloader) GetDownloadURL(trackID int64, quality string) (string, error)

func (*TidalDownloader) GetTidalURLFromSpotify

func (t *TidalDownloader) GetTidalURLFromSpotify(spotifyTrackID string) (string, error)

func (*TidalDownloader) GetTrackIDFromURL

func (t *TidalDownloader) GetTrackIDFromURL(tidalURL string) (int64, error)

type TimeSlice

type TimeSlice struct {
	Time       float64   `json:"time"`
	Magnitudes []float64 `json:"magnitudes"`
}

type TrackAvailability

type TrackAvailability struct {
	SpotifyID string `json:"spotify_id"`
	Tidal     bool   `json:"tidal"`
	Amazon    bool   `json:"amazon"`
	Qobuz     bool   `json:"qobuz"`
	Deezer    bool   `json:"deezer"`
	TidalURL  string `json:"tidal_url,omitempty"`
	AmazonURL string `json:"amazon_url,omitempty"`
	QobuzURL  string `json:"qobuz_url,omitempty"`
	DeezerURL string `json:"deezer_url,omitempty"`
}

type TrackMetadata

type TrackMetadata struct {
	SpotifyID   string `json:"spotify_id,omitempty"`
	Artists     string `json:"artists"`
	Name        string `json:"name"`
	AlbumName   string `json:"album_name"`
	AlbumArtist string `json:"album_artist,omitempty"`
	DurationMS  int    `json:"duration_ms"`
	Images      string `json:"images"`
	ReleaseDate string `json:"release_date"`
	TrackNumber int    `json:"track_number"`
	TotalTracks int    `json:"total_tracks,omitempty"`
	DiscNumber  int    `json:"disc_number,omitempty"`
	TotalDiscs  int    `json:"total_discs,omitempty"`
	ExternalURL string `json:"external_urls"`
	Copyright   string `json:"copyright,omitempty"`
	Publisher   string `json:"publisher,omitempty"`
	Plays       string `json:"plays,omitempty"`
	PreviewURL  string `json:"preview_url,omitempty"`
	IsExplicit  bool   `json:"is_explicit,omitempty"`
}

type TrackResponse

type TrackResponse struct {
	Track TrackMetadata `json:"track"`
}

type YoinkifyRequest

type YoinkifyRequest struct {
	URL         string `json:"url"`
	Format      string `json:"format"`
	GenreSource string `json:"genreSource"`
}

Jump to

Keyboard shortcuts

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