Coder Social home page Coder Social logo

seratojs's Introduction

seratojs

Manage Serato Crates Programatically in NodeJS.

Installing

npm install seratojs

Usage

const seratojs = require("seratojs");

// List all crates defined by user.
const crates = seratojs.listCratesSync();
console.log(crates);

// List all song filepaths in a given crate.
const crate = crates[0];
const songs = crate.getSongPathsSync();
console.log(songs);

// Create a crate
const newCrate = new seratojs.Crate("ProgramaticallyCreatedCrate");
newCrate.addSong("Users/bcollazo/Music/song.mp3");
newCrate.addSong("C:\\Users\\bcollazo\\Music\\second_song.mp3");
newCrate.saveSync();

Asynchronous (await-async / promise-based) API:

const seratojs = require("seratojs");

(async function () {
  const crates = await seratojs.listCrates();
  const songs = await crates[0].getSongPaths();
  const newCrate = new seratojs.Crate("ProgramaticallyCreatedCrate");
  newCrate.addSong("Users/bcollazo/Music/song.mp3");
  await newCrate.save();
})();

Adding songs from different drives will replicate Serato's behavior of saving the crate in all drives participating in the crate.

const crate = new seratojs.Crate("MyCrate");
crate.addSong("D:\\Music\\song1.mp3");
crate.addSong("C:\\Users\\bcollazo\\Music\\song2.mp3");
crate.saveSync(); // will save in D:\\_Serato_ and C:\\Users\\bcollazo\\Music\\_Serato_

Notes

SeratoJS tries to sanitize crate name before creation. This is to allow crates named 'Some / Name' to be created without giving trouble. It will be created as 'Some - Name' instead.

Migrating from 1.x to 2.x

  • Change crate.getSongPaths() to crate.getSongPathsSync() or await crate.getSongPaths().
  • Change newCrate.save() to newCrate.saveSync() or await newCrate.save().

seratojs's People

Contributors

bcollazo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.