seratoparser

package module
v0.0.0-...-cd949d7 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 16 Imported by: 0

README

Temp fork until approach decided

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

Type Detail Source

Additional Types found from the Java based - SSL-API

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
	TTYP string // track type
	TSNG string // song title
	TART string // artist Title
	TGEN string // genre
	TLEN string // length
	TBIT string // bit rate
	TSMP string // sampling rate
	TALB string // album title
	TCOM string // comment
	TCMP string // composer
	TADD string // local time added to database
	TKEY string // key
	TLBL string // ??
	TBPM string // bpm
	TGRP string // group?
	TTYR string // year
	TSIZ string // size of track
	UDSC string // desc?
	TRMX string // remix tag
	TCOR string // group?
	PVID string // group?

	// INT1
	BMIS bool // missing
	BCRT bool // corrupt
	BHRT bool // ?
	BPLY bool // ?
	BLOP bool // ?
	BITU bool // ?
	BOVC bool // ?
	BIRO bool // ?
	BWLB bool // ?
	BWLL bool // ?
	BUNS bool // ?
	BBGL bool // ?
	BKRK bool // ?

	// INT4
	UADD int // timeadded
	UTKN int // ??
	UTME int // ??
	UTPC int // playcount
	UFSB int // ??

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

MediaEntity defines Tracks/Songs entities in a Database or Crate aka Otrk

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