model

package
v0.0.0-...-046eb10 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCsvToTracks

func ParseCsvToTracks(csv [][]string) (Tracks, ArtistAlbumMap)

note Empty String for Album or Artist is Unknown

func ParseMp3Glob

func ParseMp3Glob(mp3Path string) (error, Tracks, ArtistAlbumMap)

Types

type AlbumMap

type AlbumMap map[string]Tracks

func (AlbumMap) Merge

func (m1 AlbumMap) Merge(m2 AlbumMap) AlbumMap

type AlbumSongsMap

type AlbumSongsMap map[string]Songs

type ArtistAlbumMap

type ArtistAlbumMap map[string]AlbumMap
"Tool": {
	"Fear Innoculumn": [
		"Tempest.mp3"
	]
}

func (ArtistAlbumMap) Add

func (trackMap ArtistAlbumMap) Add(track *Track)

warn about empty Artists??

func (ArtistAlbumMap) Analysis

func (tMap ArtistAlbumMap) Analysis() string

func (ArtistAlbumMap) Merge

Appears to be broken, need to find a reliable merge library, generics would be amazing for deepMerge

func (ArtistAlbumMap) Save

func (tMap ArtistAlbumMap) Save(src, dest string) error

Save All Tracks via ArtistAlbumMap structure using goroutines and works Async Save All

func (ArtistAlbumMap) SaveChunk

func (tMap ArtistAlbumMap) SaveChunk(src, dest string) error

func (ArtistAlbumMap) ToAlbumSongsMap

func (tMap ArtistAlbumMap) ToAlbumSongsMap() AlbumSongsMap

type CsvMapRow

type CsvMapRow map[string][]string

map to row

type CsvRows

type CsvRows [][]string

func ReadAllCsvRows

func ReadAllCsvRows(body string) (CsvRows, error)

func (CsvRows) ToMap

func (c CsvRows) ToMap() CsvMapRow

type Job

type Job struct {
	Csv   string
	Paths []string
}

type JobResult

type JobResult struct {
	Err error
	Tracks
	ArtistAlbumMap
}

func (JobResult) Error

func (j JobResult) Error() error

type OrigFilenameMap

type OrigFilenameMap map[string]int // TrackName Map counter

type SaveJob

type SaveJob struct {
	MapChunk ArtistAlbumMap
}

type SaveJobResult

type SaveJobResult struct {
	Err error
	ID  int
}

func (SaveJobResult) Error

func (j SaveJobResult) Error() error

type SaveOpts

type SaveOpts struct {
	Src    string
	Dest   string
	Artist string
	Album  string
	DoCopy bool
}

type Songs

type Songs []string

type Track

type Track struct {
	SupportArtists []string
	OrigFilename   string
	DurationSec    string

	// Begin id3 Metadata
	Format   id3.Format
	FileType id3.FileType
	Title    string

	Album       string
	Artist      string
	AlbumArtist string
	Composer    string
	Year        int
	Genre       string
	Picture     *id3.Picture
	Lyrics      string
	Comment     string

	Raw map[string]interface{}
}

func Id3MetadataToTrack

func Id3MetadataToTrack(meta id3.Metadata) *Track

func Id3V2TagToTrack

func Id3V2TagToTrack(tag *id3v2.Tag) *Track

func ParseId3ToTrack

func ParseId3ToTrack(mp3Path string) (error, Track, string)

Main entry to try out different Id3 libs

Also tried:

"github.com/bogem/id3v2/v2" kinda works "github.com/xonyagar/id3" v23 failures not much info but bad frames

func ToTrack

func ToTrack(csvRow []string, originalFilename string) Track

func (Track) GetArtistKey

func (t Track) GetArtistKey() string

func (Track) Save

func (track Track) Save(opts SaveOpts) error

func (Track) ToMetaRow

func (track Track) ToMetaRow() string

type TrackRegExpOpts

type TrackRegExpOpts struct {
	RegexStr      string
	TitleRegexStr string
	TrackRegex    *regexp.Regexp
	TitleRegex    *regexp.Regexp
}

type TrackSearch

type TrackSearch struct {
	Basename     string
	Mp3FileName  string
	MetaReg      *TrackRegExpOpts
	OrigFilename string
}

func InitTrackSearch

func InitTrackSearch(origFilename, filePath string) *TrackSearch

type Tracker

type Tracker struct{}

type Tracks

type Tracks []Track

func (Tracks) Analysis

func (tracks Tracks) Analysis() string

func (Tracks) Merge

func (t1 Tracks) Merge(t2 Tracks) Tracks

merge tracks array together

func (Tracks) ToSongs

func (tracks Tracks) ToSongs() Songs

Jump to

Keyboard shortcuts

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