track

package
v0.0.0-...-f539960 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ID3FrameTitle : ID3 title frame tag identifier
	ID3FrameTitle = iota
	// ID3FrameSong : ID3 song frame tag identifier
	ID3FrameSong
	// ID3FrameArtist : ID3 artist frame tag identifier
	ID3FrameArtist
	// ID3FrameAlbum : ID3 album frame tag identifier
	ID3FrameAlbum
	// ID3FrameGenre : ID3 genre frame tag identifier
	ID3FrameGenre
	// ID3FrameYear : ID3 year frame tag identifier
	ID3FrameYear
	// ID3FrameFeaturings : ID3 featurings frame tag identifier
	ID3FrameFeaturings
	// ID3FrameTrackNumber : ID3 track number frame tag identifier
	ID3FrameTrackNumber
	// ID3FrameTrackTotals : ID3 total tracks number frame tag identifier
	ID3FrameTrackTotals
	// ID3FrameArtwork : ID3 artwork frame tag identifier
	ID3FrameArtwork
	// ID3FrameArtworkURL : ID3 artwork URL frame tag identifier
	ID3FrameArtworkURL
	// ID3FrameLyrics : ID3 lyrics frame tag identifier
	ID3FrameLyrics
	// ID3FrameOrigin : ID3 origin frame tag identifier
	ID3FrameOrigin
	// ID3FrameDuration : ID3 duration frame tag identifier
	ID3FrameDuration
	// ID3FrameSpotifyID : ID3 Spotify ID frame tag identifier
	ID3FrameSpotifyID
)
View Source
const (
	// SongTypeAlbum : identifier for Song in its album variant
	SongTypeAlbum = iota
	// SongTypeLive : identifier for Song in its live variant
	SongTypeLive
	// SongTypeCover : identifier for Song in its cover variant
	SongTypeCover
	// SongTypeRemix : identifier for Song in its remix variant
	SongTypeRemix
	// SongTypeAcoustic : identifier for Song in its acoustic variant
	SongTypeAcoustic
	// SongTypeKaraoke : identifier for Song in its karaoke variant
	SongTypeKaraoke
	// SongTypeParody : identifier for Song in its parody variant
	SongTypeParody
	// SongTypeReverse : identifier for Song in its reverse variant
	SongTypeReverse
)

Variables

View Source
var (

	// JunkSuffixes : array containing every file suffix considered junk
	JunkSuffixes = []string{".ytdl", ".webm", ".opus", ".part", ".jpg", ".tmp", "-id3v2"}
)
View Source
var (
	// SongTypes : array containing every song variant identifier
	SongTypes = []int{SongTypeLive, SongTypeCover, SongTypeRemix,
		SongTypeAcoustic, SongTypeKaraoke, SongTypeParody}
)

Functions

func CountOffline

func CountOffline(tracks []*Track) int

CountOffline : return offline (local) songs count from Tracks

func CountOnline

func CountOnline(tracks []*Track) int

CountOnline : return online songs count from Tracks

func GetTag

func GetTag(path string, frame int) string

GetTag : open, parse and return filename ID3 tag

func IndexWait

func IndexWait()

IndexWait returns as Index(path) function is done

func IsType

func IsType(sequence string, songType int) bool

IsType : return True if input sequence matches with selected input songType variant

func JunkWildcards

func JunkWildcards() []string

JunkWildcards : return strings array containing all possible junk filenames wilcards

func TagGetFrame

func TagGetFrame(tag *id3v2.Tag, frame int) string

TagGetFrame : get input frame from open input Tag

func TagGetFrameArtwork

func TagGetFrameArtwork(tag *id3v2.Tag) string

TagGetFrameArtwork : get artwork frame from input Tag

func TagGetFrameArtworkURL

func TagGetFrameArtworkURL(tag *id3v2.Tag) string

TagGetFrameArtworkURL : get artwork URL frame from input Tag

func TagGetFrameDuration

func TagGetFrameDuration(tag *id3v2.Tag) string

TagGetFrameDuration : get duration frame from input Tag

func TagGetFrameFeaturings

func TagGetFrameFeaturings(tag *id3v2.Tag) string

TagGetFrameFeaturings : get track featurings frame from input Tag

func TagGetFrameLyrics

func TagGetFrameLyrics(tag *id3v2.Tag) string

TagGetFrameLyrics : get lyrics frame from input Tag

func TagGetFrameOrigin

func TagGetFrameOrigin(tag *id3v2.Tag) string

TagGetFrameOrigin : get origin frame from input Tag

func TagGetFrameSong

func TagGetFrameSong(tag *id3v2.Tag) string

TagGetFrameSong : get track song title frame from input Tag

func TagGetFrameSpotifyID

func TagGetFrameSpotifyID(tag *id3v2.Tag) string

TagGetFrameSpotifyID : get Spotify ID frame from input Tag

func TagGetFrameTrackNumber

func TagGetFrameTrackNumber(tag *id3v2.Tag) string

TagGetFrameTrackNumber : get track number frame from input Tag

func TagGetFrameTrackTotals

func TagGetFrameTrackTotals(tag *id3v2.Tag) string

TagGetFrameTrackTotals : get total tracks number frame from input Tag

func TagHasFrame

func TagHasFrame(tag *id3v2.Tag, frame int) bool

TagHasFrame : return True if open input Tag has valued input frame

Types

type Playlist

type Playlist struct {
	Tracks []*Track
	Name   string
	Owner  string
}

Playlist defines a playlist wrapper

func (*Playlist) M3U

func (p *Playlist) M3U(prefix string) string

M3U returns the M3U-compliant representation of the playlist

func (*Playlist) PLS

func (p *Playlist) PLS(prefix string) string

PLS returns the PLS-compliant representation of the playlist

type Track

type Track struct {
	Title       string
	Song        string
	Artist      string
	Album       string
	Year        string
	Featurings  []string
	Genre       string
	TrackNumber int
	TrackTotals int
	Duration    int
	Image       string
	URL         string
	SpotifyID   string
	Lyrics      string
}

Track : struct containing all the informations about a track

func OpenLocalTrack

func OpenLocalTrack(filename string) (*Track, error)

OpenLocalTrack : parse local filename track informations into a new Track object

func ParseSpotifyTrack

func ParseSpotifyTrack(spotifyTrack *spotify.FullTrack, spotifyAlbum *spotify.FullAlbum) *Track

ParseSpotifyTrack : parse Spotify track into a new Track object

func (Track) Basename

func (track Track) Basename() string

Basename : return track basename

func (Track) Filename

func (track Track) Filename() string

Filename : return track filename

func (Track) FilenameArtwork

func (track Track) FilenameArtwork() string

FilenameArtwork : return Track artwork filename

func (Track) FilenameTemporary

func (track Track) FilenameTemporary() string

FilenameTemporary : return Track temporary filename

func (Track) GetID3Frame

func (track Track) GetID3Frame(frame int) string

GetID3Frame : get Track ID3 input frame string value

func (*Track) HasID3Frame

func (track *Track) HasID3Frame(frame int) bool

HasID3Frame : return True if Track has input ID3 frame

func (*Track) Local

func (track *Track) Local() bool

Local returns a boolean indicating whether track is on filesystem or not

func (Track) Query

func (track Track) Query() string

Query : return string used to search song online

func (Track) Seems

func (track Track) Seems(sequence string) error

Seems : return nil error if sequence is input sequence string matches with Track

func (Track) SeemsByWordMatch

func (track Track) SeemsByWordMatch(sequence string) error

SeemsByWordMatch : return nil error if Track song name, artist and featurings are contained in sequence

func (Track) TempFiles

func (track Track) TempFiles() []string

TempFiles : return strings array containing all possible junk file names

func (Track) Type

func (track Track) Type() int

Type : return track variant

type TracksDump

type TracksDump struct {
	Tracks []*Track
	Time   time.Time
}

TracksDump : Tracks dumpable object

type TracksIndex

type TracksIndex struct {
	Tracks map[string]string
}

TracksIndex : Tracks index keeping ID - filename mapping and eventual filename links

func Index

func Index(path string) *TracksIndex

Index triggers a path scan searching for media files and populating a TracksIndex object in return

func (*TracksIndex) Match

func (index *TracksIndex) Match(id string, filename string) (string, bool, error)

Match returns whether an index element referenced by input id matches with input filename

func (*TracksIndex) Rename

func (index *TracksIndex) Rename(id string, filename string)

Rename replace input id element with input filename

func (*TracksIndex) Sync

func (index *TracksIndex) Sync(path string) error

Sync flushes tracks index object on disk at input passed path

Jump to

Keyboard shortcuts

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