Documentation
¶
Overview ¶
Package export provides functionality for exporting music to external devices.
Index ¶
- func BatchCmd(params Params) tea.Cmd
- func ContinueExportCmd(params Params, nextIndex int) tea.Cmd
- func GenerateExportPath(t TrackInfo, structure FolderStructure) string
- func NeedsConversion(ext string) bool
- type CompleteMsg
- type Exporter
- type FileExportedMsg
- type FolderStructure
- type Job
- type Params
- type ProgressMsg
- type StartExportMsg
- type Target
- type TargetRepository
- func (r *TargetRepository) Create(t Target) (int64, error)
- func (r *TargetRepository) Delete(id int64) error
- func (r *TargetRepository) FindByUUID(uuid string) ([]Target, error)
- func (r *TargetRepository) Get(id int64) (Target, error)
- func (r *TargetRepository) List() ([]Target, error)
- func (r *TargetRepository) Update(t Target) error
- type Track
- type TrackError
- type TrackInfo
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContinueExportCmd ¶
ContinueExportCmd returns a command to export the next file.
func GenerateExportPath ¶
func GenerateExportPath(t TrackInfo, structure FolderStructure) string
GenerateExportPath creates the relative path for an exported track.
func NeedsConversion ¶
NeedsConversion returns true if the file extension requires conversion.
Types ¶
type CompleteMsg ¶
type CompleteMsg struct {
JobID string
Artist string
Album string
TargetName string
Failed int
Total int
Errors []TrackError
}
CompleteMsg signals the export finished.
type Exporter ¶
type Exporter struct{}
Exporter handles copying and converting files for export.
func (*Exporter) ConvertToMP3 ¶
ConvertToMP3 converts a FLAC file to MP3 using ffmpeg. Uses 320kbps CBR preset.
type FileExportedMsg ¶
FileExportedMsg reports progress on a single file.
type FolderStructure ¶
type FolderStructure string
FolderStructure defines how exported files are organized.
const ( FolderStructureFlat FolderStructure = "flat" // Artist - Album/01 - Track.mp3 FolderStructureHierarchical FolderStructure = "hierarchical" // Artist/Album/01 - Track.mp3 FolderStructureSingle FolderStructure = "single" // Artist - Album - 01 - Track.mp3 )
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job tracks the progress of an export operation.
func (*Job) IsCanceled ¶
IsCanceled returns true if the job was canceled.
func (*Job) RecordError ¶
RecordError records a failed export.
type ProgressMsg ¶
ProgressMsg reports export progress for UI updates.
type StartExportMsg ¶
StartExportMsg initiates an export operation.
type Target ¶
type Target struct {
ID int64
Name string
DeviceUUID string
DeviceLabel string
Subfolder string
FolderStructure FolderStructure
CreatedAt int64
}
Target represents a saved export destination.
type TargetRepository ¶
type TargetRepository struct {
// contains filtered or unexported fields
}
TargetRepository handles persistence of export targets.
func NewTargetRepository ¶
func NewTargetRepository(db *sql.DB) *TargetRepository
NewTargetRepository creates a new repository.
func (*TargetRepository) Create ¶
func (r *TargetRepository) Create(t Target) (int64, error)
Create adds a new target and returns its ID.
func (*TargetRepository) Delete ¶
func (r *TargetRepository) Delete(id int64) error
Delete removes a target.
func (*TargetRepository) FindByUUID ¶
func (r *TargetRepository) FindByUUID(uuid string) ([]Target, error)
FindByUUID returns the targets matching a device UUID.
func (*TargetRepository) Get ¶
func (r *TargetRepository) Get(id int64) (Target, error)
Get returns a target by ID.
func (*TargetRepository) List ¶
func (r *TargetRepository) List() ([]Target, error)
List returns all saved targets.
func (*TargetRepository) Update ¶
func (r *TargetRepository) Update(t Target) error
Update modifies an existing target.
type Track ¶
type Track struct {
ID int64
SrcPath string
Artist string
Album string
Title string
TrackNum int
DiscNum int
DiscTotal int
Extension string
}
Track contains info needed to export a single track.
type TrackError ¶
TrackError records a failed export.
type TrackInfo ¶
type TrackInfo struct {
Artist string
Album string
Title string
TrackNumber int
DiscNumber int
TotalDiscs int
Extension string // e.g., ".flac", ".mp3"
}
TrackInfo contains metadata needed for export path generation.
type Volume ¶
Volume represents a mounted removable device.
func DetectVolumes ¶
DetectVolumes scans for mounted USB devices.