itunes

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 28 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Conjunction_AND = Conjunction(0x0)
	Conjunction_OR  = Conjunction(0x1)
)
View Source
const (
	Field_NAME                   = Field(0x2)
	Field_ALBUM                  = Field(0x3)
	Field_ARTIST                 = Field(0x4)
	Field_BIT_RATE               = Field(0x5)
	Field_SAMPLE_RATE            = Field(0x6)
	Field_YEAR                   = Field(0x7)
	Field_GENRE                  = Field(0x8)
	Field_KIND                   = Field(0x9)
	Field_DATE_MODIFIED          = Field(0xA)
	Field_TRACK_NUMBER           = Field(0xB)
	Field_SIZE                   = Field(0xC)
	Field_TOTAL_TIME             = Field(0xD)
	Field_COMMENTS               = Field(0xE)
	Field_DATE_ADDED             = Field(0x10)
	Field_COMPOSER               = Field(0x12)
	Field_PLAY_COUNT             = Field(0x16)
	Field_PLAY_DATE_UTC          = Field(0x17)
	Field_DISK_NUMBER            = Field(0x18)
	Field_RATING                 = Field(0x19)
	Field_DISABLED               = Field(0x1D)
	Field_COMPILATION            = Field(0x1F)
	Field_BPM                    = Field(0x23)
	Field_HAS_ARTWORK            = Field(0x25)
	Field_GROUPING               = Field(0x27)
	Field_PLAYLIST_PERSISTENT_ID = Field(0x28)
	Field_PURCHASED              = Field(0x29)
	Field_DESCRIPTION            = Field(0x36)
	Field_CATEGORY               = Field(0x37)
	Field_PODCAST                = Field(0x39)
	Field_MEDIA_KIND             = Field(0x3C)
	Field_SERIES                 = Field(0x3E)
	Field_SEASON                 = Field(0x3F)
	Field_SKIP_COUNT             = Field(0x44)
	Field_SKIP_DATE              = Field(0x45)
	Field_ALBUM_ARTIST           = Field(0x47)
	Field_SORT_NAME              = Field(0x4E)
	Field_SORT_ALBUM             = Field(0x4F)
	Field_SORT_ALBUM_ARTIST      = Field(0x51)
	Field_SORT_COMPOSER          = Field(0x52)
	Field_SORT_SERIES            = Field(0x53)
	Field_VIDEO_RATING           = Field(0x59)
	Field_ALBUM_RATING           = Field(0x5A)
	Field_LOCATION               = Field(0x85)
	Field_ICLOUD_STATUS          = Field(0x86)
	Field_LOVE                   = Field(0x9A)
)
View Source
const (
	ICloudStatus_PURCHASED  = ICloudStatus(0x1)
	ICloudStatus_MATCHED    = ICloudStatus(0x2)
	ICloudStatus_UPLOADED   = ICloudStatus(0x3)
	ICloudStatus_INELIGIBLE = ICloudStatus(0x4)
	ICloudStatus_LOCALONLY  = ICloudStatus(0x5)
	ICloudStatus_DUPLICATE  = ICloudStatus(0x6)
)
View Source
const (
	LimitMethod_MINUTES = LimitMethod(0x1)
	LimitMethod_MB      = LimitMethod(0x2)
	LimitMethod_ITEMS   = LimitMethod(0x3)
	LimitMethod_HOURS   = LimitMethod(0x4)
	LimitMethod_GB      = LimitMethod(0x5)
)
View Source
const (
	LocationStatus_COMPUTER = LocationStatus(0x1)
	LocationStatus_ICLOUD   = LocationStatus(0x10)
)
View Source
const (
	LogicRule_OTHER       = LogicRule(0x0)
	LogicRule_IS          = LogicRule(0x1)
	LogicRule_CONTAINS    = LogicRule(0x2)
	LogicRule_STARTSWITH  = LogicRule(0x4)
	LogicRule_ENDSWITH    = LogicRule(0x8)
	LogicRule_GREATERTHAN = LogicRule(0x10)
	LogicRule_LESSTHAN    = LogicRule(0x40)
	LogicRule_BETWEEN     = LogicRule(0x100)
	LogicRule_WITHIN      = LogicRule(0x200)
)
View Source
const (
	LogicSign_INT_POS = LogicSign(0x0)
	LogicSign_STR_POS = LogicSign(0x1)
	LogicSign_INT_NEG = LogicSign(0x2)
	LogicSign_STR_NEG = LogicSign(0x3)
)
View Source
const (
	LoveStatus_NONE     = LoveStatus(0x0)
	LoveStatus_LOVED    = LoveStatus(0x2)
	LoveStatus_DISLIKED = LoveStatus(0x3)
)
View Source
const (
	MediaKind_MUSIC           = MediaKind(0x1)
	MediaKind_MOVIE           = MediaKind(0x2)
	MediaKind_PODCAST         = MediaKind(0x4)
	MediaKind_AUDIOBOOK       = MediaKind(0x8)
	MediaKind_MUSICVIDEO      = MediaKind(0x20)
	MediaKind_TVSHOW          = MediaKind(0x40)
	MediaKind_HOMEVIDEO       = MediaKind(0x400)
	MediaKind_ITUNESEXTRAS    = MediaKind(0x10000)
	MediaKind_VOICEMEMO       = MediaKind(0x100000)
	MediaKind_OTHERMUSIC      = MediaKind(0x1021B1)
	MediaKind_ITUNESU         = MediaKind(0x200000)
	MediaKind_UNDESIREDMUSIC  = MediaKind(0x208004)
	MediaKind_UNDESIREDOTHER  = MediaKind(0x20A004)
	MediaKind_BOOK            = MediaKind(0xC00000)
	MediaKind_BOOKORAUDIOBOOK = MediaKind(0xC00008)
)
View Source
const (
	SelectionMethod_LOWEST_RATING = SelectionMethod(0x1)
	SelectionMethod_RANDOM        = SelectionMethod(0x2)
	SelectionMethod_NAME          = SelectionMethod(0x5)
	SelectionMethod_ALBUM         = SelectionMethod(0x6)
	SelectionMethod_ARTIST        = SelectionMethod(0x7)
	SelectionMethod_GENRE         = SelectionMethod(0x9)
	SelectionMethod_DATE_ADDED    = SelectionMethod(0x15)
	SelectionMethod_PLAY_COUNT    = SelectionMethod(0x19)
	SelectionMethod_PLAY_DATE_UTC = SelectionMethod(0x1A)
	SelectionMethod_RATING        = SelectionMethod(0x1C)
)
View Source
const (
	RulesetField = iota + 1
	StringField
	IntField
	BooleanField
	DateField
	MediaKindField
	PlaylistField
	LoveField
	CloudField
	LocationField
)
View Source
const DateStartFromUnix = int64(-2082844800)

Variables

View Source
var BadFieldError = errors.New("bad rule field")
View Source
var ConjunctionNames = map[Conjunction]string{
	Conjunction(0x0): "AND",
	Conjunction(0x1): "OR",
}
View Source
var ConjunctionValues = map[string]Conjunction{
	"AND": Conjunction(0x0),
	"OR":  Conjunction(0x1),
}
View Source
var FieldNames = map[Field]string{
	Field(0x2):  "name",
	Field(0x3):  "album",
	Field(0x4):  "artist",
	Field(0x5):  "bit_rate",
	Field(0x6):  "sample_rate",
	Field(0x7):  "year",
	Field(0x8):  "genre",
	Field(0x9):  "kind",
	Field(0xA):  "date_modified",
	Field(0xB):  "track_number",
	Field(0xC):  "size",
	Field(0xD):  "total_time",
	Field(0xE):  "comments",
	Field(0x10): "date_added",
	Field(0x12): "composer",
	Field(0x16): "play_count",
	Field(0x17): "play_date_utc",
	Field(0x18): "disk_number",
	Field(0x19): "rating",
	Field(0x1D): "disabled",
	Field(0x1F): "compilation",
	Field(0x23): "bpm",
	Field(0x25): "has_artwork",
	Field(0x27): "grouping",
	Field(0x28): "playlist_persistent_id",
	Field(0x29): "purchased",
	Field(0x36): "description",
	Field(0x37): "category",
	Field(0x39): "podcast",
	Field(0x3C): "media_kind",
	Field(0x3E): "series",
	Field(0x3F): "season",
	Field(0x44): "skip_count",
	Field(0x45): "skip_date",
	Field(0x47): "album_artist",
	Field(0x4E): "sort_name",
	Field(0x4F): "sort_album",
	Field(0x51): "sort_album_artist",
	Field(0x52): "sort_composer",
	Field(0x53): "sort_series",
	Field(0x59): "video_rating",
	Field(0x5A): "album_rating",
	Field(0x85): "location",
	Field(0x86): "icloud_status",
	Field(0x9A): "love",
}
View Source
var FieldValues = map[string]Field{
	"name":                   Field(0x2),
	"album":                  Field(0x3),
	"artist":                 Field(0x4),
	"bit_rate":               Field(0x5),
	"sample_rate":            Field(0x6),
	"year":                   Field(0x7),
	"genre":                  Field(0x8),
	"kind":                   Field(0x9),
	"date_modified":          Field(0xA),
	"track_number":           Field(0xB),
	"size":                   Field(0xC),
	"total_time":             Field(0xD),
	"comments":               Field(0xE),
	"date_added":             Field(0x10),
	"composer":               Field(0x12),
	"play_count":             Field(0x16),
	"play_date_utc":          Field(0x17),
	"disk_number":            Field(0x18),
	"rating":                 Field(0x19),
	"disabled":               Field(0x1D),
	"compilation":            Field(0x1F),
	"bpm":                    Field(0x23),
	"has_artwork":            Field(0x25),
	"grouping":               Field(0x27),
	"playlist_persistent_id": Field(0x28),
	"purchased":              Field(0x29),
	"description":            Field(0x36),
	"category":               Field(0x37),
	"podcast":                Field(0x39),
	"media_kind":             Field(0x3C),
	"series":                 Field(0x3E),
	"season":                 Field(0x3F),
	"skip_count":             Field(0x44),
	"skip_date":              Field(0x45),
	"album_artist":           Field(0x47),
	"sort_name":              Field(0x4E),
	"sort_album":             Field(0x4F),
	"sort_album_artist":      Field(0x51),
	"sort_composer":          Field(0x52),
	"sort_series":            Field(0x53),
	"video_rating":           Field(0x59),
	"album_rating":           Field(0x5A),
	"location":               Field(0x85),
	"icloud_status":          Field(0x86),
	"love":                   Field(0x9A),
}
View Source
var FileKinds = []FileKind{
	FileKind{"Protected AAC audio file", ".m4p"},
	FileKind{"MPEG audio file", ".mp3"},
	FileKind{"AIFF audio file", ".aiff"},
	FileKind{"WAV audio file", ".wav"},
	FileKind{"QuickTime movie file", ".mov"},
	FileKind{"MPEG-4 video file", ".mp4"},
	FileKind{"AAC audio file", ".m4a"},
}
View Source
var ICloudStatusNames = map[ICloudStatus]string{
	ICloudStatus(0x1): "Purchased",
	ICloudStatus(0x2): "Matched",
	ICloudStatus(0x3): "Uploaded",
	ICloudStatus(0x4): "Ineligible",
	ICloudStatus(0x5): "LocalOnly",
	ICloudStatus(0x6): "Duplicate",
}
View Source
var ICloudStatusValues = map[string]ICloudStatus{
	"Purchased":  ICloudStatus(0x1),
	"Matched":    ICloudStatus(0x2),
	"Uploaded":   ICloudStatus(0x3),
	"Ineligible": ICloudStatus(0x4),
	"LocalOnly":  ICloudStatus(0x5),
	"Duplicate":  ICloudStatus(0x6),
}
View Source
var LimitMethodNames = map[LimitMethod]string{
	LimitMethod(0x1): "minutes",
	LimitMethod(0x2): "MB",
	LimitMethod(0x3): "items",
	LimitMethod(0x4): "hours",
	LimitMethod(0x5): "GB",
}
View Source
var LimitMethodValues = map[string]LimitMethod{
	"minutes": LimitMethod(0x1),
	"MB":      LimitMethod(0x2),
	"items":   LimitMethod(0x3),
	"hours":   LimitMethod(0x4),
	"GB":      LimitMethod(0x5),
}
View Source
var LocationStatusNames = map[LocationStatus]string{
	LocationStatus(0x1):  "Computer",
	LocationStatus(0x10): "iCloud",
}
View Source
var LocationStatusValues = map[string]LocationStatus{
	"Computer": LocationStatus(0x1),
	"iCloud":   LocationStatus(0x10),
}
View Source
var LogicRuleNames = map[LogicRule]string{
	LogicRule(0x0):   "other",
	LogicRule(0x1):   "is",
	LogicRule(0x2):   "contains",
	LogicRule(0x4):   "startswith",
	LogicRule(0x8):   "endswith",
	LogicRule(0x10):  "greaterthan",
	LogicRule(0x40):  "lessthan",
	LogicRule(0x100): "between",
	LogicRule(0x200): "within",
}
View Source
var LogicRuleValues = map[string]LogicRule{
	"other":       LogicRule(0x0),
	"is":          LogicRule(0x1),
	"contains":    LogicRule(0x2),
	"startswith":  LogicRule(0x4),
	"endswith":    LogicRule(0x8),
	"greaterthan": LogicRule(0x10),
	"lessthan":    LogicRule(0x40),
	"between":     LogicRule(0x100),
	"within":      LogicRule(0x200),
}
View Source
var LogicSignNames = map[LogicSign]string{
	LogicSign(0x0): "int_pos",
	LogicSign(0x1): "str_pos",
	LogicSign(0x2): "int_neg",
	LogicSign(0x3): "str_neg",
}
View Source
var LogicSignValues = map[string]LogicSign{
	"int_pos": LogicSign(0x0),
	"str_pos": LogicSign(0x1),
	"int_neg": LogicSign(0x2),
	"str_neg": LogicSign(0x3),
}
View Source
var LoveStatusNames = map[LoveStatus]string{
	LoveStatus(0x0): "None",
	LoveStatus(0x2): "Loved",
	LoveStatus(0x3): "Disliked",
}
View Source
var LoveStatusValues = map[string]LoveStatus{
	"None":     LoveStatus(0x0),
	"Loved":    LoveStatus(0x2),
	"Disliked": LoveStatus(0x3),
}
View Source
var MediaKindNames = map[MediaKind]string{
	MediaKind(0x1):      "Music",
	MediaKind(0x2):      "Movie",
	MediaKind(0x4):      "Podcast",
	MediaKind(0x8):      "Audiobook",
	MediaKind(0x20):     "MusicVideo",
	MediaKind(0x40):     "TVShow",
	MediaKind(0x400):    "HomeVideo",
	MediaKind(0x10000):  "ITunesExtras",
	MediaKind(0x100000): "VoiceMemo",
	MediaKind(0x1021B1): "OtherMusic",
	MediaKind(0x200000): "ITunesU",
	MediaKind(0x208004): "UndesiredMusic",
	MediaKind(0x20A004): "UndesiredOther",
	MediaKind(0xC00000): "Book",
	MediaKind(0xC00008): "BookOrAudiobook",
}
View Source
var MediaKindValues = map[string]MediaKind{
	"Music":           MediaKind(0x1),
	"Movie":           MediaKind(0x2),
	"Podcast":         MediaKind(0x4),
	"Audiobook":       MediaKind(0x8),
	"MusicVideo":      MediaKind(0x20),
	"TVShow":          MediaKind(0x40),
	"HomeVideo":       MediaKind(0x400),
	"ITunesExtras":    MediaKind(0x10000),
	"VoiceMemo":       MediaKind(0x100000),
	"OtherMusic":      MediaKind(0x1021B1),
	"ITunesU":         MediaKind(0x200000),
	"UndesiredMusic":  MediaKind(0x208004),
	"UndesiredOther":  MediaKind(0x20A004),
	"Book":            MediaKind(0xC00000),
	"BookOrAudiobook": MediaKind(0xC00008),
}
View Source
var SelectionMethodNames = map[SelectionMethod]string{
	SelectionMethod(0x1):  "lowest_rating",
	SelectionMethod(0x2):  "<random>",
	SelectionMethod(0x5):  "name",
	SelectionMethod(0x6):  "album",
	SelectionMethod(0x7):  "artist",
	SelectionMethod(0x9):  "genre",
	SelectionMethod(0x15): "date_added",
	SelectionMethod(0x19): "play_count",
	SelectionMethod(0x1A): "play_date_utc",
	SelectionMethod(0x1C): "rating",
}
View Source
var SelectionMethodValues = map[string]SelectionMethod{
	"lowest_rating": SelectionMethod(0x1),
	"<random>":      SelectionMethod(0x2),
	"name":          SelectionMethod(0x5),
	"album":         SelectionMethod(0x6),
	"artist":        SelectionMethod(0x7),
	"genre":         SelectionMethod(0x9),
	"date_added":    SelectionMethod(0x15),
	"play_count":    SelectionMethod(0x19),
	"play_date_utc": SelectionMethod(0x1A),
	"rating":        SelectionMethod(0x1C),
}

Functions

func EnsureDir

func EnsureDir(fn string) error

func MakeKey

func MakeKey(v string) string

func NewLoader added in v0.1.0

func NewLoader(fn string) loader.Loader

func Serialize

func Serialize(obj Serializable) error

func SetField

func SetField(s interface{}, key []byte, kind string, val []byte) bool

func SetGlobalFinder

func SetGlobalFinder(finder *FileFinder)

func SetSerializationRoot

func SetSerializationRoot(dn string)

func StringToUTF16Bytes

func StringToUTF16Bytes(s string, o binary.ByteOrder) []byte

func ThreeWayMerge

func ThreeWayMerge(base, delta_one, delta_two []pid.PersistentID) ([]pid.PersistentID, bool)

func UTF16BytesToString

func UTF16BytesToString(b []byte, o binary.ByteOrder) string

UTF16BytesToString converts UTF-16 encoded bytes, in big or little endian byte order, to a UTF-8 encoded string.

Types

type Conjunction

type Conjunction int

func (Conjunction) MarshalJSON

func (e Conjunction) MarshalJSON() ([]byte, error)

func (Conjunction) String

func (e Conjunction) String() string

func (*Conjunction) UnmarshalJSON

func (e *Conjunction) UnmarshalJSON(data []byte) error

type Field

type Field int

func (Field) MarshalJSON

func (e Field) MarshalJSON() ([]byte, error)

func (Field) String

func (e Field) String() string

func (Field) Type

func (f Field) Type() FieldType

func (*Field) UnmarshalJSON

func (e *Field) UnmarshalJSON(data []byte) error

type FieldType

type FieldType int

type FileFinder

type FileFinder struct {
	MediaFolder []string
	SourcePath  []string
	TargetPath  []string
}

func GetGlobalFinder

func GetGlobalFinder() *FileFinder

func NewFileFinder

func NewFileFinder(mediaFolder string, sourcePath, targetPath []string) *FileFinder

func (*FileFinder) Clean

func (ff *FileFinder) Clean(fn string) string

func (*FileFinder) FindFile

func (ff *FileFinder) FindFile(fn string) (string, error)

type FileKind

type FileKind struct {
	Name      string `json:"name"`
	Extension string `json:"ext"`
}

type FilterTable

type FilterTable map[string]map[string]int

func (FilterTable) Add

func (ft FilterTable) Add(name, sname string)

func (FilterTable) Values

func (ft FilterTable) Values() [][2]string

type ICloudStatus

type ICloudStatus int

func (ICloudStatus) MarshalJSON

func (e ICloudStatus) MarshalJSON() ([]byte, error)

func (ICloudStatus) String

func (e ICloudStatus) String() string

func (*ICloudStatus) UnmarshalJSON

func (e *ICloudStatus) UnmarshalJSON(data []byte) error

type IntRuleData

type IntRuleData struct {
	Junk1 [4]byte
	IntA  uint32
	RelA  int64
	Junk2 [4]byte
	BoolB uint32
	Junk3 [4]byte
	IntB  uint32
	Junk4 [12]byte
	BoolC uint32
	Junk5 [4]byte
	IntC  uint32
	Junk6 [12]byte
}

func (*IntRuleData) Decode

func (ird *IntRuleData) Decode(data []byte) error

func (*IntRuleData) Encode

func (ird *IntRuleData) Encode() ([]byte, error)

func (IntRuleData) Ints

func (ird IntRuleData) Ints() []int64

func (IntRuleData) Times

func (ird IntRuleData) Times() []*Time

type Library

type Library struct {
	FileName           string
	MajorVersion       int
	MinorVersion       int
	ApplicationVersion string
	Date               Time
	Features           int
	ShowContentRatings bool
	PersistentID       pid.PersistentID
	MusicFolder        string
	Tracks             []*Track
	Playlists          map[pid.PersistentID]*Playlist
	PlaylistTree       []*Playlist
}

func NewLibrary

func NewLibrary() *Library

func (*Library) AddTrack

func (lib *Library) AddTrack(tr *Track)

func (*Library) CreatePlaylist

func (lib *Library) CreatePlaylist(name string, parentId *pid.PersistentID) *Playlist

func (*Library) FindPlaylists

func (lib *Library) FindPlaylists(name string) []*Playlist

func (*Library) GetPlaylistByPath

func (lib *Library) GetPlaylistByPath(path string) *Playlist

func (*Library) GetTrack

func (lib *Library) GetTrack(id pid.PersistentID) *Track

func (*Library) Load

func (lib *Library) Load(fn string) error

func (*Library) MovePlaylist

func (l *Library) MovePlaylist(p *Playlist, parentId *pid.PersistentID) error

func (*Library) RemoveTrack

func (lib *Library) RemoveTrack(id pid.PersistentID)

func (*Library) RenestPlaylists

func (l *Library) RenestPlaylists()

func (*Library) TrackList

func (lib *Library) TrackList() *TrackList

type LimitMethod

type LimitMethod int

func (LimitMethod) MarshalJSON

func (e LimitMethod) MarshalJSON() ([]byte, error)

func (LimitMethod) String

func (e LimitMethod) String() string

func (*LimitMethod) UnmarshalJSON

func (e *LimitMethod) UnmarshalJSON(data []byte) error

type LocationStatus

type LocationStatus int

func (LocationStatus) MarshalJSON

func (e LocationStatus) MarshalJSON() ([]byte, error)

func (LocationStatus) String

func (e LocationStatus) String() string

func (*LocationStatus) UnmarshalJSON

func (e *LocationStatus) UnmarshalJSON(data []byte) error

type LogicRule

type LogicRule int

func (LogicRule) MarshalJSON

func (e LogicRule) MarshalJSON() ([]byte, error)

func (LogicRule) String

func (e LogicRule) String() string

func (*LogicRule) UnmarshalJSON

func (e *LogicRule) UnmarshalJSON(data []byte) error

type LogicSign

type LogicSign int

func (LogicSign) MarshalJSON

func (e LogicSign) MarshalJSON() ([]byte, error)

func (LogicSign) String

func (e LogicSign) String() string

func (*LogicSign) UnmarshalJSON

func (e *LogicSign) UnmarshalJSON(data []byte) error

type LoveStatus

type LoveStatus int

func (LoveStatus) MarshalJSON

func (e LoveStatus) MarshalJSON() ([]byte, error)

func (LoveStatus) String

func (e LoveStatus) String() string

func (*LoveStatus) UnmarshalJSON

func (e *LoveStatus) UnmarshalJSON(data []byte) error

type MediaKind

type MediaKind int

func (MediaKind) MarshalJSON

func (e MediaKind) MarshalJSON() ([]byte, error)

func (MediaKind) String

func (e MediaKind) String() string

func (*MediaKind) UnmarshalJSON

func (e *MediaKind) UnmarshalJSON(data []byte) error

type Playlist

type Playlist struct {
	PersistentID       pid.PersistentID   `json:"persistent_id,omitempty"`
	ParentPersistentID *pid.PersistentID  `json:"parent_persistent_id,omitempty"`
	Folder             bool               `json:"folder,omitempty"`
	Name               string             `json:"name,omitempty"`
	Smart              *SmartPlaylist     `json:"smart,omitempty"`
	GeniusTrackID      *pid.PersistentID  `json:"genius_track_id,omitempty"`
	TrackIDs           []pid.PersistentID `json:"track_ids"`
	Children           []*Playlist        `json:"children,omitempty"`
	PlaylistItems      []*Track           `json:"items,omitempty"`
	SortField          string             `json:"sort_field,omitempty"`
}

func NewPlaylist

func NewPlaylist() *Playlist

func (*Playlist) AddTrack

func (p *Playlist) AddTrack(t *Track)

func (*Playlist) Dedup

func (p *Playlist) Dedup()

func (*Playlist) DescendantCount

func (p *Playlist) DescendantCount() int

func (*Playlist) FindByName

func (p *Playlist) FindByName(name string) []*Playlist

func (*Playlist) GetByName

func (p *Playlist) GetByName(name string) *Playlist

func (*Playlist) GetByPath

func (p *Playlist) GetByPath(path string) *Playlist

func (*Playlist) Kind

func (p *Playlist) Kind() string

func (*Playlist) Move

func (p *Playlist) Move(lib *Library, parentId *pid.PersistentID) error

func (*Playlist) Nest

func (p *Playlist) Nest(lib *Library)

func (*Playlist) Populate

func (p *Playlist) Populate(lib *Library) *Playlist

func (*Playlist) Priority

func (p *Playlist) Priority() int

func (*Playlist) Prune

func (p *Playlist) Prune() *Playlist

func (*Playlist) TotalTime

func (p *Playlist) TotalTime() time.Duration

func (*Playlist) Unnest

func (p *Playlist) Unnest(lib *Library)

func (*Playlist) Update

func (p *Playlist) Update(orig, cur *Playlist) (*pid.PersistentID, bool)

type RuleHeader

type RuleHeader struct {
	FieldId     uint32
	LogicSignId uint8
	Junk1       byte
	LogicRuleId uint16
	Junk2       [44]byte
	Length      uint32
}

func (RuleHeader) Field

func (rh RuleHeader) Field() Field

func (RuleHeader) LogicRule

func (rh RuleHeader) LogicRule() LogicRule

func (RuleHeader) LogicSign

func (rh RuleHeader) LogicSign() LogicSign

type RuleSetHeader

type RuleSetHeader struct {
	Junk1         [8]byte
	RuleCount     uint32
	ConjunctionId uint32
	Junk2         [120]byte
}

type SelectionMethod

type SelectionMethod int

func (SelectionMethod) MarshalJSON

func (e SelectionMethod) MarshalJSON() ([]byte, error)

func (SelectionMethod) String

func (e SelectionMethod) String() string

func (*SelectionMethod) UnmarshalJSON

func (e *SelectionMethod) UnmarshalJSON(data []byte) error

type Serializable

type Serializable interface {
	Serialize(int) ([]byte, error)
	SerializationPath() []string
}

type SmartPlaylist

type SmartPlaylist struct {
	Info     *SmartPlaylistInfo     `json:"info"`
	Criteria *SmartPlaylistCriteria `json:"criteria"`
	// contains filtered or unexported fields
}

func ParseSmartPlaylist

func ParseSmartPlaylist(info, criteria []byte) (*SmartPlaylist, error)

func (*SmartPlaylist) Encode

func (s *SmartPlaylist) Encode() (info []byte, criteria []byte, err error)

type SmartPlaylistBooleanRule

type SmartPlaylistBooleanRule struct {
	*SmartPlaylistCommonRule
	RuleType string `json:"type"`
	Value    bool   `json:"value"`
}

func NewSmartPlaylistBooleanRule

func NewSmartPlaylistBooleanRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistBooleanRule

func (*SmartPlaylistBooleanRule) Encode

func (r *SmartPlaylistBooleanRule) Encode() ([]byte, error)

func (*SmartPlaylistBooleanRule) Match

func (r *SmartPlaylistBooleanRule) Match(track *Track, lib *Library) bool

type SmartPlaylistCloudRule

type SmartPlaylistCloudRule struct {
	*SmartPlaylistCommonRule
	RuleType string       `json:"type"`
	Value    ICloudStatus `json:"value"`
}

func NewSmartPlaylistCloudRule

func NewSmartPlaylistCloudRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistCloudRule

func (*SmartPlaylistCloudRule) Encode

func (r *SmartPlaylistCloudRule) Encode() ([]byte, error)

func (*SmartPlaylistCloudRule) Match

func (r *SmartPlaylistCloudRule) Match(track *Track, lib *Library) bool

type SmartPlaylistCommonRule

type SmartPlaylistCommonRule struct {
	Field    Field     `json:"field"`
	Sign     LogicSign `json:"sign"`
	Operator LogicRule `json:"operator"`
	// contains filtered or unexported fields
}

func NewSmartPlaylistCommonRule

func NewSmartPlaylistCommonRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistCommonRule

func (*SmartPlaylistCommonRule) EncodeHeader

func (r *SmartPlaylistCommonRule) EncodeHeader(value []byte) ([]byte, error)

func (*SmartPlaylistCommonRule) GetField

func (r *SmartPlaylistCommonRule) GetField(track *Track, kind reflect.Kind, typ reflect.Type) (reflect.Value, error)

type SmartPlaylistCriteria

type SmartPlaylistCriteria struct {
	Conjunction Conjunction `json:"conjunction"`
	Rules       []SmartRule `json:"rules"`
}

func (*SmartPlaylistCriteria) Encode

func (c *SmartPlaylistCriteria) Encode() ([]byte, error)

func (*SmartPlaylistCriteria) EncodeHeader

func (c *SmartPlaylistCriteria) EncodeHeader(value []byte) ([]byte, error)

func (*SmartPlaylistCriteria) Match

func (r *SmartPlaylistCriteria) Match(track *Track, lib *Library) bool

func (*SmartPlaylistCriteria) Parse

func (c *SmartPlaylistCriteria) Parse(raw []byte) error

type SmartPlaylistDateRule

type SmartPlaylistDateRule struct {
	*SmartPlaylistCommonRule
	RuleType string  `json:"type"`
	Values   []*Time `json:"values"`
	Relative int64   `json:"relative"`
}

func NewSmartPlaylistDateRule

func NewSmartPlaylistDateRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistDateRule

func (*SmartPlaylistDateRule) Encode

func (r *SmartPlaylistDateRule) Encode() ([]byte, error)

func (*SmartPlaylistDateRule) Match

func (r *SmartPlaylistDateRule) Match(track *Track, lib *Library) bool

type SmartPlaylistInfo

type SmartPlaylistInfo struct {
	CheckedOnly  bool             `json:"checked_only"`
	Descending   bool             `json:"descending"`
	HasLimit     bool             `json:"has_limit"`
	LiveUpdating bool             `json:"live_updating"`
	LimitUnit    *LimitMethod     `json:"limit_method"`
	LimitSize    *int             `json:"limit_size"`
	SortField    *SelectionMethod `json:"sort_field"`
}

func (*SmartPlaylistInfo) Encode

func (inf *SmartPlaylistInfo) Encode() ([]byte, error)

func (*SmartPlaylistInfo) Parse

func (inf *SmartPlaylistInfo) Parse(raw []byte) error

type SmartPlaylistIntegerRule

type SmartPlaylistIntegerRule struct {
	*SmartPlaylistCommonRule
	RuleType string  `json:"type"`
	Values   []int64 `json:"values"`
}

func NewSmartPlaylistIntegerRule

func NewSmartPlaylistIntegerRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistIntegerRule

func (*SmartPlaylistIntegerRule) Encode

func (r *SmartPlaylistIntegerRule) Encode() ([]byte, error)

func (*SmartPlaylistIntegerRule) Match

func (r *SmartPlaylistIntegerRule) Match(track *Track, lib *Library) bool

type SmartPlaylistLocationRule

type SmartPlaylistLocationRule struct {
	*SmartPlaylistCommonRule
	RuleType string         `json:"type"`
	Value    LocationStatus `json:"value"`
}

func NewSmartPlaylistLocationRule

func NewSmartPlaylistLocationRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistLocationRule

func (*SmartPlaylistLocationRule) Encode

func (r *SmartPlaylistLocationRule) Encode() ([]byte, error)

func (*SmartPlaylistLocationRule) Match

func (r *SmartPlaylistLocationRule) Match(track *Track, lib *Library) bool

type SmartPlaylistLoveRule

type SmartPlaylistLoveRule struct {
	*SmartPlaylistCommonRule
	RuleType string     `json:"type"`
	Value    LoveStatus `json:"value"`
}

func NewSmartPlaylistLoveRule

func NewSmartPlaylistLoveRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistLoveRule

func (*SmartPlaylistLoveRule) Encode

func (r *SmartPlaylistLoveRule) Encode() ([]byte, error)

func (*SmartPlaylistLoveRule) Match

func (r *SmartPlaylistLoveRule) Match(track *Track, lib *Library) bool

type SmartPlaylistMediaKindRule

type SmartPlaylistMediaKindRule struct {
	*SmartPlaylistCommonRule
	RuleType string    `json:"type"`
	Value    MediaKind `json:"value"`
}

func NewSmartPlaylistMediaKindRule

func NewSmartPlaylistMediaKindRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistMediaKindRule

func (*SmartPlaylistMediaKindRule) Encode

func (r *SmartPlaylistMediaKindRule) Encode() ([]byte, error)

func (*SmartPlaylistMediaKindRule) Match

func (r *SmartPlaylistMediaKindRule) Match(track *Track, lib *Library) bool

type SmartPlaylistPlaylistRule

type SmartPlaylistPlaylistRule struct {
	*SmartPlaylistCommonRule
	RuleType string           `json:"type"`
	Value    pid.PersistentID `json:"value"`
	// contains filtered or unexported fields
}

func NewSmartPlaylistPlaylistRule

func NewSmartPlaylistPlaylistRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistPlaylistRule

func (*SmartPlaylistPlaylistRule) Encode

func (r *SmartPlaylistPlaylistRule) Encode() ([]byte, error)

func (*SmartPlaylistPlaylistRule) Match

func (r *SmartPlaylistPlaylistRule) Match(track *Track, lib *Library) bool

type SmartPlaylistStringRule

type SmartPlaylistStringRule struct {
	*SmartPlaylistCommonRule
	RuleType string `json:"type"`
	Value    string `json:"value"`
}

func NewSmartPlaylistStringRule

func NewSmartPlaylistStringRule(ruleHeader *RuleHeader, value []byte) *SmartPlaylistStringRule

func (*SmartPlaylistStringRule) Encode

func (r *SmartPlaylistStringRule) Encode() ([]byte, error)

func (*SmartPlaylistStringRule) Match

func (r *SmartPlaylistStringRule) Match(track *Track, lib *Library) bool

type SmartRule

type SmartRule interface {
	EncodeHeader([]byte) ([]byte, error)
	Encode() ([]byte, error)
	Match(track *Track, lib *Library) bool
}

type SortablePlaylistList

type SortablePlaylistList []*Playlist

func (SortablePlaylistList) Len

func (spl SortablePlaylistList) Len() int

func (SortablePlaylistList) Less

func (spl SortablePlaylistList) Less(i, j int) bool

func (SortablePlaylistList) Swap

func (spl SortablePlaylistList) Swap(i, j int)

type SortableTrackList

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

func (*SortableTrackList) Len

func (stl *SortableTrackList) Len() int

func (*SortableTrackList) Less

func (stl *SortableTrackList) Less(i, j int) bool

func (*SortableTrackList) Swap

func (stl *SortableTrackList) Swap(i, j int)

type Time

type Time struct {
	time.Time
}

func (*Time) EpochMS

func (t *Time) EpochMS() int64

func (*Time) Get

func (t *Time) Get() time.Time

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) Set

func (t *Time) Set(tm time.Time)

func (*Time) SetEpochMS

func (t *Time) SetEpochMS(ms int64)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

func (*Time) UnmarshalPlist

func (t *Time) UnmarshalPlist(obj interface{}) error

type Track

type Track struct {
	PersistentID       pid.PersistentID `json:"persistent_id"`
	Album              string           `json:"album,omitempty"`
	AlbumArtist        string           `json:"album_artist,omitempty"`
	AlbumRating        uint8            `json:"album_rating,omitempty"`
	Artist             string           `json:"artist,omitempty"`
	Comments           string           `json:"comments,omitempty"`
	Compilation        bool             `json:"compilation,omitempty"`
	Composer           string           `json:"composer,omitempty"`
	DateAdded          *Time            `json:"date_added,omitempty"`
	DateModified       *Time            `json:"date_modified,omitempty"`
	DiscCount          uint8            `json:"disc_count,omitempty"`
	DiscNumber         uint8            `json:"disc_number,omitempty"`
	Genre              string           `json:"genre,omitempty"`
	Grouping           string           `json:"grouping,omitempty"`
	Kind               string           `json:"kind,omitempty"`
	Location           string           `json:"location"`
	Loved              *bool            `json:"loved"`
	Name               string           `json:"name,omitempty"`
	PartOfGaplessAlbum bool             `json:"part_of_gapless_album,omitempty"`
	PlayCount          uint             `json:"play_count,omitempty"`
	PlayDate           *Time            `json:"play_date,omitempty"`
	Purchased          bool             `json:"purchased,omitempty"`
	PurchaseDate       *Time            `json:"purchase_date,omitempty"`
	Rating             uint8            `json:"rating,omitempty"`
	ReleaseDate        *Time            `json:"release_date,omitempty"`
	Size               uint64           `json:"size,omitempty"`
	SkipCount          uint             `json:"skip_count,omitempty"`
	SkipDate           *Time            `json:"skip_date,omitempty"`
	SortAlbum          string           `json:"sort_album,omitempty"`
	SortAlbumArtist    string           `json:"sort_album_artist,omitempty"`
	SortArtist         string           `json:"sort_artist,omitempty"`
	SortComposer       string           `json:"sort_composer,omitempty"`
	SortName           string           `json:"sort_name,omitempty"`
	TotalTime          uint             `json:"total_time,omitempty"`
	TrackCount         uint8            `json:"track_count,omitempty"`
	TrackNumber        uint8            `json:"track_number,omitempty"`
	Unplayed           bool             `json:"unplayed,omitempty"`
	VolumeAdjustment   uint8            `json:"volume_adjustment,omitempty"`
	Work               string           `json:"work,omitempty"`
}

func (*Track) GetAlbum

func (t *Track) GetAlbum() (string, error)

func (*Track) GetArtist

func (t *Track) GetArtist() (string, error)

func (*Track) GetExt

func (t *Track) GetExt() string

func (*Track) GetName

func (t *Track) GetName() (string, error)

func (*Track) GetPurchaseDate

func (t *Track) GetPurchaseDate() (*Time, error)

func (*Track) MediaKind

func (t *Track) MediaKind() MediaKind

func (*Track) ModDate

func (t *Track) ModDate() time.Time

func (*Track) Path

func (t *Track) Path() string

func (*Track) String

func (t *Track) String() string

func (*Track) Update

func (t *Track) Update(orig, cur *Track)

type TrackList

type TrackList []*Track

func (*TrackList) Add

func (tl *TrackList) Add(tr *Track)

func (*TrackList) Albums

func (tl *TrackList) Albums() [][3]string

func (*TrackList) Artists

func (tl *TrackList) Artists() [][2]string

func (*TrackList) Clone

func (tl *TrackList) Clone() *TrackList

func (*TrackList) DefaultSort

func (tl *TrackList) DefaultSort() *TrackList

func (*TrackList) Filter

func (tl *TrackList) Filter(genre, artist, album string) *TrackList

func (*TrackList) Genres

func (tl *TrackList) Genres() [][2]string

func (TrackList) Len

func (tl TrackList) Len() int

func (TrackList) Less

func (tl TrackList) Less(i, j int) bool

func (*TrackList) Randomize

func (tl *TrackList) Randomize()

func (*TrackList) SmartFilter

func (tl *TrackList) SmartFilter(s *SmartPlaylist, lib *Library) (*TrackList, error)

func (*TrackList) SmartLimit

func (tl *TrackList) SmartLimit(s *SmartPlaylist) (*TrackList, error)

func (*TrackList) SortBy

func (tl *TrackList) SortBy(key string, desc bool) error

func (TrackList) Swap

func (tl TrackList) Swap(i, j int)

func (*TrackList) TotalSize

func (tl *TrackList) TotalSize() int64

func (*TrackList) TotalTime

func (tl *TrackList) TotalTime() int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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