mdb

package
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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BomaTypeNumeric = iota
	BomaTypeWideChar
	BomaTypeShortHeader
	BomaTypeLongHeader
	BomaTypeBook
	BomaTypePlaylistItem
	BomaTypeVideoInfo
	BomaTypeUnknown
	BomaTypeTimestamps
	BomaTypeGeniusInfo
)

Variables

View Source
var ErrInvalidHeader = errors.New("invalid library header")
View Source
var ErrTooBig = errors.New("object bigger than encoded size")
View Source
var ErrUnexpectedObject = errors.New("unexpected object")
View Source
var PLAYLIST_KIND_TYPE = map[uint32]string{}

var COLUMN_TYPE = map[uint32]string{}

View Source
var SORT_FIELD_TYPE = map[uint32]string{}

var UTF16_TYPES = map[uint32]bool{} var DATA_TYPE = map[uint32]string{} var DATASET_TYPE = map[uint32]string{}

Functions

func ReadObject

func ReadObject(r io.Reader, offset int) (int, interface{}, error)

Types

type Album

type Album struct {
	*StandardObject
	Parsed          *AlbumInner
	PersistentID    pid.PersistentID
	DataObjectCount int
	AlbumRating     uint8
}

func (*Album) Read

func (o *Album) Read() error

type AlbumInner

type AlbumInner struct {
	Type            ObjectSignature
	Size            uint32
	SectionsLength  uint32
	DataObjectCount uint32
	PersistentID    pid.PersistentID
	Unknown1        [2]uint32
	Unknown2        pid.PersistentID
	AlbumRating     uint8
	Unknown3        uint8
	Unknown4        uint16
	Unknown5        [5]uint32
	Unknown6        pid.PersistentID
}

type AlbumList

type AlbumList struct {
	*StandardObject
	Parsed     *AlbumListInner
	AlbumCount int
}

func (*AlbumList) Read

func (o *AlbumList) Read() error

type AlbumListInner

type AlbumListInner struct {
	Type       ObjectSignature
	Size       uint32
	AlbumCount uint32
	Unknown    [4]byte
}

type ApplicationVersion

type ApplicationVersion [32]byte

func (ApplicationVersion) MarshalJSON

func (v ApplicationVersion) MarshalJSON() ([]byte, error)

func (ApplicationVersion) String

func (v ApplicationVersion) String() string

type Artist

type Artist struct {
	*StandardObject
	Parsed          *ArtistInner
	PersistentID    pid.PersistentID
	DataObjectCount int
}

func (*Artist) Read

func (o *Artist) Read() error

type ArtistInner

type ArtistInner struct {
	Type            ObjectSignature
	Size            uint32
	SectionsLength  uint32
	DataObjectCount uint32
	PersistentID    pid.PersistentID
}

type ArtistList

type ArtistList struct {
	*StandardObject
	Parsed      *ArtistListInner
	ArtistCount int
}

func (*ArtistList) Read

func (o *ArtistList) Read() error

type ArtistListInner

type ArtistListInner struct {
	Type        ObjectSignature
	Size        uint32
	ArtistCount uint32
}

type BomaSubType

type BomaSubType uint32

func (BomaSubType) Kind

func (b BomaSubType) Kind() int

func (BomaSubType) MarshalJSON

func (b BomaSubType) MarshalJSON() ([]byte, error)

func (BomaSubType) String

func (b BomaSubType) String() string

type BookDataObject

type BookDataObject struct {
	Unknown1  uint32
	Signature string
	Unknown2  [12]uint32
	Strings   []string
}

func (*BookDataObject) Read

func (o *BookDataObject) Read(r io.Reader) error

type DataObject

type DataObject struct {
	*StandardObject
	Parsed           *DataObjectInner
	Raw              []byte
	Nums             []uint32
	Key              string
	NumericData      *NumericDataObject      `json:"NumericData,omitempty"`
	WideCharData     *WideCharDataObject     `json:"WideCharData,omitempty"`
	ShortHeaderData  *ShortHeaderDataObject  `json:"ShortHeaderData,omitempty"`
	LongHeaderData   *LongHeaderDataObject   `json:"LongHeaderData,omitempty"`
	PlaylistItemData *PlaylistItemDataObject `json:"PlaylistItemData,omitempty"`
	VideoInfoData    *VideoInfoDataObject    `json:"VideoInfoData,omitempty"`
	BookData         *BookDataObject         `json:"BookData,omitempty"`
	TimestampsData   *TimestampsDataObject   `json:"TimestampsData,omitempty"`
	GeniusInfoData   *GeniusInfoDataObject   `json:"GeniusInfoData,omitempty"`
}

func (*DataObject) Read

func (o *DataObject) Read() error

type DataObjectInner

type DataObjectInner struct {
	Type    ObjectSignature
	Unknown uint32
	Size    uint32
	Subtype BomaSubType
}

type Envelope

type Envelope struct {
	*StandardObject
	Parsed             *EnvelopeInner
	PersistentID       pid.PersistentID
	ApplicationVersion ApplicationVersion
	MajorVersion       int
	MinorVersion       int
	MaxCryptSize       int
	ItemCount          int
	PlaylistCount      int
	TZOffset           int
}

func (*Envelope) Read

func (o *Envelope) Read() error

hfma

type EnvelopeInner

type EnvelopeInner struct {
	Type                      ObjectSignature
	Size                      uint32
	FileLength                uint32
	MajorVersion              uint16
	MinorVersion              uint16
	ApplicationVersion        ApplicationVersion
	PersistentID              pid.PersistentID
	FileTypeID                uint32
	Unknown1                  [2]uint32
	ItemCount                 uint32
	PlaylistCount             uint32
	CollectionCount           uint32
	ArtistCount               uint32
	MaxCryptSize              uint32
	TZOffset                  int32
	AppleStoreID              pid.PersistentID
	LibraryDate               Time
	Unknown3                  uint32
	ITunesLibraryPersistentID pid.PersistentID
}

type GeniusInfoDataObject

type GeniusInfoDataObject struct {
	Unknown1      uint32
	GeniusTrackID pid.PersistentID
}

func (*GeniusInfoDataObject) Read

func (o *GeniusInfoDataObject) Read(r io.Reader) error

type LibraryMaster

type LibraryMaster struct {
	*StandardObject
	Parsed          *LibraryMasterInner
	PersistentID    pid.PersistentID
	DataObjectCount int
}

func (*LibraryMaster) Read

func (o *LibraryMaster) Read() error

type LibraryMasterInner

type LibraryMasterInner struct {
	Type                 ObjectSignature
	Size                 uint32
	DataObjectCount      uint32
	Unknown1             [11]uint32
	Unknown2             uint16
	LibraryPersistentID  pid.PersistentID
	Unknown3             [5]uint32
	LibraryPersistentID2 pid.PersistentID
}

type Loader

type Loader struct {
	*loader.BaseLoader
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader() *Loader

func (*Loader) Decrypt

func (l *Loader) Decrypt(f io.ReadCloser) (io.ReadCloser, error)

func (*Loader) Load

func (l *Loader) Load(f io.ReadCloser)

func (*Loader) LoadFile

func (l *Loader) LoadFile(fn string)

func (*Loader) Parse

func (l *Loader) Parse(f io.Reader)

type LongHeaderDataObject

type LongHeaderDataObject struct {
	//Unknown1 [2]uint32
	ByteLength uint32
	//Unknown2 [2]uint32
	XML string
}

func (*LongHeaderDataObject) Read

func (o *LongHeaderDataObject) Read(r io.Reader) error

type NumericDataObject

type NumericDataObject struct {
	Unknown1           [16]uint32
	SampleRate         float32
	Unknown2           uint32
	FileType           uint32
	FileFolderCount    int16
	LibraryFolderCount int16
	Unknown3           [3]uint32
	BitRate            uint32
	DateAdded          Time
	Unknown4           [8]uint32
	DateModified       Time
	Normalization      uint32
	DatePurchased      Time
	ReleaseDate        Time
	Unknown5           [3]uint32
	Duration           uint32
	Unknown6           [34]uint32
	FileSize           uint32
}

type ObjectSignature

type ObjectSignature [4]byte

func (ObjectSignature) MarshalJSON

func (v ObjectSignature) MarshalJSON() ([]byte, error)

func (ObjectSignature) String

func (v ObjectSignature) String() string

type Playlist

type Playlist struct {
	*StandardObject
	Parsed             *PlaylistInner
	PersistentID       pid.PersistentID
	ParentPersistentID pid.PersistentID
	DataObjectCount    int
	TrackCount         int
	DateAdded          time.Time
	DateModified       time.Time
	Folder             bool
	DistinguishedKind  PlaylistKind
}

func (*Playlist) Read

func (o *Playlist) Read() error

type PlaylistInner

type PlaylistInner struct {
	Type               ObjectSignature  // 0
	Size               uint32           // 4
	SectionsLength     uint32           // 8
	DataObjectCount    uint32           // 12
	TrackCount         uint32           // 16
	SortField          uint16           // 20
	DateAdded          Time             // 22
	Unknown2           uint16           // 26
	Unknown3           uint16           // 28
	PersistentID       pid.PersistentID // 30
	Unknown4           [2]uint32        // 38
	Unknown5           [3]byte          // 46
	Folder             uint8            // 49
	ParentPersistentID pid.PersistentID // 50
	Unknown6           [5]uint32        // 58
	SortDescending     byte             // 78
	PlaylistKind       uint8            // 79
	Unknown8           [2]byte          // 80
	Unknown9           [14]uint32       // 82
	DateModified       Time             // 138
}

type PlaylistItemDataObject

type PlaylistItemDataObject struct {
	Unknown1        uint32
	SubSectionStart uint32
	SectionLength   uint32
	Unknown2        uint32
	IpfaID          pid.PersistentID
	TrackID         pid.PersistentID
	Unknown3        [4]uint32
	IpfaID2         pid.PersistentID
}

func (*PlaylistItemDataObject) Read

type PlaylistKind

type PlaylistKind uint32

func (PlaylistKind) MarshalJSON

func (k PlaylistKind) MarshalJSON() ([]byte, error)

func (PlaylistKind) String

func (k PlaylistKind) String() string

type PlaylistList

type PlaylistList struct {
	*StandardObject
	Parsed        *PlaylistListInner
	PlaylistCount int
}

func (*PlaylistList) Read

func (o *PlaylistList) Read() error

type PlaylistListInner

type PlaylistListInner struct {
	Type          ObjectSignature
	Size          uint32
	PlaylistCount uint32
}

type ReadableObject

type ReadableObject interface {
	Read() error
}

type SectionBoundary

type SectionBoundary struct {
	*StandardObject
	Parsed         *SectionBoundaryInner
	SubType        int
	SectionsLength int
}

func (*SectionBoundary) Read

func (o *SectionBoundary) Read() error

type SectionBoundaryInner

type SectionBoundaryInner struct {
	Type           ObjectSignature
	Size           uint32
	SectionsLength uint32
	SubType        uint32
}

type ShortHeaderDataObject

type ShortHeaderDataObject struct {
	Unknown1 uint32
	XML      string
}

func (*ShortHeaderDataObject) Read

func (o *ShortHeaderDataObject) Read(r io.Reader) error

type Sized

type Sized interface {
	GetSize() int
}

type StandardObject

type StandardObject struct {
	Type    string
	Offset  int
	Preface interface{}
	Size    int
	Data    []byte
}

func NewStandardObject

func NewStandardObject(r io.Reader, offset int) (int, *StandardObject, error)

func (*StandardObject) Buffer

func (o *StandardObject) Buffer() *bytes.Buffer

func (*StandardObject) CreateSubObject

func (o *StandardObject) CreateSubObject() ReadableObject

func (*StandardObject) GetData

func (o *StandardObject) GetData() []byte

func (*StandardObject) GetOffset

func (o *StandardObject) GetOffset() int

func (*StandardObject) GetSize

func (o *StandardObject) GetSize() int

func (*StandardObject) GetType

func (o *StandardObject) GetType() string

func (*StandardObject) Parse

func (o *StandardObject) Parse(x interface{}) error

type Time

type Time uint32

func (Time) MarshalJSON

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

func (Time) String

func (t Time) String() string

func (Time) Time

func (t Time) Time() time.Time

type TimestampsDataObject

type TimestampsDataObject struct {
	Unknown1  uint32
	Unknown2  uint32
	Unknown3  uint32
	PlayDate  Time
	PlayCount uint32
	Unknown4  uint32
	Unknown5  uint32
	Unknown6  uint32
	SkipDate  Time
	SkipCount uint32
}

func (*TimestampsDataObject) Read

func (o *TimestampsDataObject) Read(r io.Reader) error

type Track

type Track struct {
	*StandardObject
	Parsed          *TrackInner
	PersistentID    pid.PersistentID
	DataObjectCount int
	Disabled        bool
	Love            bool
	Stars           int
	MovementCount   int
	MovementNumber  int
	TrackCount      int
	TrackNumber     int
	DiscCount       int
	DiscNumber      int
	Year            int
	AlbumID         pid.PersistentID
	ArtistID        pid.PersistentID
}

func (*Track) Read

func (o *Track) Read() error

type TrackInner

type TrackInner struct {
	Type            ObjectSignature  // 0
	Size            uint32           // 4
	Unknown1        uint32           // 8
	DataObjectCount uint32           // 12
	PersistentID    pid.PersistentID // 16
	Unknown2        [4]uint32        // 24
	Unknown3        uint16           // 40
	Disabled        uint16           // 42
	Unknown4        [4]uint32        // 44
	Unknown5        uint16           // 60
	Love            uint16           // 62
	Unknown6        uint8            // 64
	Stars           uint8            // 65
	Unknown7        [4]uint32        // 66
	Unknown8        uint16           // 82
	DiscNumber      uint16           // 84
	MovementCount   uint16           // 86
	MovementNumber  uint16           // 88
	DiscCount       uint16           // 90
	Unknown9        uint16           // 92
	Unknown10       [5]uint32        // 94
	Unknown11       uint16           // 114
	TrackCount      uint16           // 116
	Unknown12       [10]uint32       // 118
	Unknown13       uint16           // 158
	TrackNumber     uint16           // 162
	Unknown14       uint16           // 164
	Unknown15       uint32           // 166
	Year            uint16           // 170
	Unknown16       uint16           // 172
	AlbumID         pid.PersistentID // 174
	ArtistID        pid.PersistentID // 182
	Unknown17       [21]uint32       // 190
	PersistentID2   pid.PersistentID // 274
}

type TrackList

type TrackList struct {
	*StandardObject
	Parsed     *TrackListInner
	TrackCount int
}

func (*TrackList) Read

func (o *TrackList) Read() error

type TrackListInner

type TrackListInner struct {
	Type       ObjectSignature
	Size       uint32
	TrackCount uint32
}

type Unhandled

type Unhandled struct {
	*StandardObject
}

func (*Unhandled) Read

func (o *Unhandled) Read() error

type VideoInfoDataObject

type VideoInfoDataObject struct {
	Unknown1  uint32
	Height    uint32
	Width     uint32
	Unknown   [10]uint32
	FrameRate uint32
}

func (*VideoInfoDataObject) Read

func (o *VideoInfoDataObject) Read(r io.Reader) error

type WideCharDataObject

type WideCharDataObject struct {
	Unknown1         uint32
	CharType         uint32
	StringByteLength uint32
	Unknown2         [2]uint32
	Raw              []byte `json:",omitemtpy"`
	StrData          string `json:",omitemtpy"`
}

func (*WideCharDataObject) Read

func (o *WideCharDataObject) Read(r io.Reader) error

Jump to

Keyboard shortcuts

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