Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultMixxxDBPath = func() string { switch runtime.GOOS { case "linux": fallthrough case "freebsd": fallthrough case "netbsd": fallthrough case "openbsd": fallthrough case "plan9": fallthrough case "solaris": return path.Join(utils.HomeDir(), ".mixxx", "mixxxdb.sqlite") case "windows": return path.Join(utils.HomeDir(), "Local Settings", "Application Data", "Mixxx", "mixxxdb.sqlite") case "darwin": return path.Join(utils.HomeDir(), "Library", "Containers", "org.mixxx.mixxx", "Data", "Library", "Application Support", "Mixxx", "mixxxdb.sqlite") default: return "" } }()
See https://manual.mixxx.org/2.3/en/chapters/appendix/settings_directory.html?#location If this is an empty string, then the current OS is not supported.
Functions ¶
func OpenSession ¶
OpenSession opens a db.Session to the Mixxx DB SQLite file at the given location. Use with `NewMixxxDB(session)`, or open a `session.Tx(func (tx db.Session) error)` first, then use the `tx` session in its callback to call `NewMixxxDB(tx)` such that all updates are bundled in one transaction.
Types ¶
type Crate ¶
type CrateTrack ¶
type CrateTrack struct { // ID of the crate in CratesDB CrateID int `db:"crate_id"` // ID of the track in TracksDB TrackID int `db:"track_id"` }
CrateTrack is the couple table enabling the many-to-many relationship between crates and tracks
func (*CrateTrack) Store ¶
func (_ *CrateTrack) Store(sess db.Session) db.Store
type CrateTracksDB ¶
type CrateTracksDB interface { db.Collection InsertTracks(crateID int, trackIDs []int) error WipeCrate(crateID int) error }
func NewCrateTracksDB ¶
func NewCrateTracksDB(sess db.Session) CrateTracksDB
type CratesDB ¶
type CratesDB interface { db.Collection FindByName(name string) (*Crate, error) InsertCrate(crate Crate) (*Crate, error) }
func NewCratesDB ¶
func NewCratesDB(sess db.Session) CratesDB
type MixxxDB ¶
type MixxxDB interface { Session() db.Session Crates() CratesDB CrateTracks() CrateTracksDB Tracks() TracksDB TrackLocations() TrackLocationsDB }
func NewMixxxDB ¶
func NewMixxxDB(session db.Session) MixxxDB
NewMixxxDB creates a new instance of a struct fulfilling the MixxxDB interface. No fancy trickery here, just an object instantiation.
func OpenDefault ¶
Opens the default MixxxDB SQLite file, as defined by the platform-specific `DefaultMixxxDBPath` variable.
type Track ¶
type Track struct { // The track's ID in Mixxx DB. Can be found in `library` table. Note: do not confuse with the ID in `track_locations` table. ID int `db:"id,omitempty"` // ID of the current TrackLocation of this music track. Location int `db:"location"` }
Track represents a music file that can be played by Mixxx.
type TrackLocation ¶
type TrackLocation struct { // ID of this track location entity. NOTE: this is NOT the track ID. ID int `db:"id,omitempty"` // The full filepath to the track on disk. Location string `db:"location"` // The filename of the track, i.e. only the last section of the path. `this.Directory + this.Filename == this.Location` Filename string `db:"filename"` // The directory the music file is located in. `this.Directory + this.Filename == this.Location` Directory string `db:"directory"` // Size of the music file on disk FileSize int `db:"filesize"` // Whether the file is deleted from disk (no longer available on this.Location) IsDeleted bool `db:"fs_deleted"` // Whether the track needs verification. No idea what kind of verification though, check the Mixxx docs for this. NeedsVerification bool `db:"needs_verification"` }
func (*TrackLocation) Store ¶
func (_ *TrackLocation) Store(sess db.Session) db.Store
type TrackLocationsDB ¶
type TrackLocationsDB interface {
db.Collection
FindByLocation(filepath string) (*TrackLocation, error)
}
func NewTrackLocationsDB ¶
func NewTrackLocationsDB(sess db.Session) TrackLocationsDB