seratoparser

package module
v0.0.0-...-3c7fbd5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 16 Imported by: 0

README

Serato Parser

Go Report Card

A GoLang library for reading Serato database files.

Data Types Supported:

  • Database V2
  • Crates
  • History Database
  • History Sessions

Installation

This package can be installed with the go get command:

go get -u github.com/SpinTools/seratoparser

Usage

func main() {
    // Provide Serato Folder
    p := seratoparser.New("/Users/Stoyvo/Music/_Serato_")
    
    // Get All Tracks in Serato Database
    Tracks := p.GetAllTracks()
    log.Println("Database V2:", Tracks)
    
    // Get all Crates
    crates := p.GetCrates()
    log.Println("Crates:", crates)
    
    // Read crate and get all Tracks
    mediaEntities := p.GetCrateTracks(crates[0].Name())
    log.Println("Crate Tracks:", mediaEntities)

    // Get all session files
    sessions := p.GetHistorySessions()
    log.Println("History Sessions:", sessions)
    
    // Read History Session
    historyEntities := p.ReadHistorySession(sessions[0].Name())
    log.Println("History Tracks:", historyEntities)
}

Contributing

Pull requests are welcome, update tests as appropriate.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HistoryPath = "/History"

HistoryPath is the path inside the _Serato_ folder that contains History data

View Source
var SeratoAdatMap = map[int]string{
	1:  "RROW",
	2:  "RDIR",
	28: "TTMS",
	29: "TTME",
	31: "TDCK",

	41: "RDTE",
	43: "RSRT",
	44: "REND",

	45: "TPTM",
	48: "RSES",
	50: "RPLY",
	52: "RADD",
	53: "RUPD",
	54: "RUNK",

	57: "RSWR",
	58: "RSWB",

	63: "RDEV",
}

SeratoAdatMap Defines all the known keys with their integer key found in Serato Databases TODO: Identify all fields of an ADAT object

View Source
var SessionPath = HistoryPath + "/Sessions"

SessionPath is the path inside the _Serato_/History folder that contains all the played Sessions.

Functions

This section is empty.

Types

type HistoryEntity

type HistoryEntity struct {
	RROW int    // rrow
	RDIR string // rfullpath
	TTMS int    // rstarttime
	TTME int    // rendtime
	TDCK int    // rdeck
	RDTE string // rdate*
	RSRT int    // rstart*
	REND int    // rend*
	TPTM int    // rplaytime
	RSES int    // rsessionId
	RPLY int    // rplayed = 1
	RADD int    // radded
	RUPD int    // rupdatedAt
	RSWR string // rsoftware*
	RSWB int    // rsoftwareBuild*
	RDEV string // rdevice
}

HistoryEntity defines Tracks/Songs entities in a History Session

type MediaEntity

type MediaEntity struct {
	// META
	DVOL string // volume

	// UTFSTR
	PTRK string // filetrack
	PFIL string // filebase

	// INT1
	BMIS bool // missing
	BCRT bool // corrupt

	// INT4
	UADD int // timeadded

	// BYTE SLICE
	ULBL []byte // color - track colour
}

MediaEntity defines Tracks/Songs entities in a Database or Crate

type Parser

type Parser struct {
	FilePath string
}

Parser holds the filepath of all databases

var SeratoParser Parser

SeratoParser is the Parser for this Serato Database module. Exported for future option of override

func New

func New(seratoPath string) Parser

New creates a new object with the provided Serato Database Path

func (Parser) GetAllTracks

func (p Parser) GetAllTracks() []MediaEntity

GetAllTracks returns all the tracks/entities inside the Database

func (Parser) GetCrateTracks

func (p Parser) GetCrateTracks(fileName string) []MediaEntity

GetCrateTracks takes a filename and returns all the tracks/entities inside the crate

func (Parser) GetCrates

func (p Parser) GetCrates() []os.FileInfo

GetCrates returns files of all crates found in Serato Path TODO: Should we parse meta data of theses files, or only provide OS level elements. Weird to be a parser library and no parsing. TODO: Is there Serato Crate meta data?

func (Parser) GetHistorySessions

func (p Parser) GetHistorySessions() []fs.FileInfo

GetHistorySessions returns a list of all Serato History session files in the users Serato directory.

func (Parser) ReadHistorySession

func (p Parser) ReadHistorySession(fileName string) []HistoryEntity

ReadHistorySession returns all track entities within the provided filepath.

Jump to

Keyboard shortcuts

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