GithubHelp home page GithubHelp logo

thinkbrown / netmd-tocmanip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asivery/netmd-tocmanip

0.0 1.0 0.0 31 KB

A library that lets you parse and edit Minidiscs' table of contents with ease

License: GNU General Public License v2.0

TypeScript 100.00%

netmd-tocmanip's Introduction

NetMD Tocmanip

What is it?

NetMD Tocmanip is a library created to parse and edit the ToC (Table of Contents) sections of Sony's Minidiscs. It is not meant to be used as a standalone program. Note that this library can only work on raw bytes - it itself cannot fetch the ToC from a NetMD device. (See netmd-js for that.)

Which TOC sectors are currently supported?

  • Sector 0 - Position and address sector. Stores the positions of tracks on the disc
  • Sector 1 - Half-width title sector. Stores ASCII and katakana titles.
  • Sector 2 - Timestamp sector. Stores tracks' date and time of recording and recorder timestamp.
  • Sector 3 - Full-width title sector. Stores kanji, hiragana, full-width katakana and full-width ascii titles. (Not supported yet.)

How to use it?

The two most basic functions for interacting with netmd-tocmanip are parseTOC() and reconstructTOC().

parseTOC()

Below is an example of how to use parseTOC() to load the table of contents from a minidisc using a supported NetMD device.

// Assuming `netmdInteface` is an instance of netmd-js's NetMDInterface
const factoryInterface = await netmdInterface.factory();
const sector0 = await readUTOCSector(factoryInterface, 0);
const sector1 = await readUTOCSector(factoryInterface, 1);

// As sectors are independent of each other, it's possible to skip a sector when using parseTOC()
const sector2 = null; //await readUTOCSector(factoryInterface, 2);

const toc = parseTOC(sector0, sector1, sector2);

reconstructTOC()

Below is an example of how to use reconstructTOC() to recreate the binary representation of the ToC, and write it back to disc.

// Assuming `netmdInterface` is an instance of netmd-js's NetMDInterface and `toc` is an instance of this library's ToC
const factoryInterface = await netmdInterface.factory();
const sectors = reconstructTOC(toc);
for(let sector = 0; sector<sectors.length; sector++){
    if(sector !== null){
        await writeUTOCSector(factoryInterface, sector, sectors[sector]);
    }
}
// WARNING:
// The `writeUTOCSector` calls don't force a ToC Edit. If the ToC becomes 'dirty' by, f. ex. changing a track's name
// the player will first flush its copy of sector 0 from SRAM back to the TOC caching peripheral, overwriting the data written via NetMD.
// To prevent that from happening, it's necessary to trigger a non-flushing ToC Edit with the help of netmd-exploits.
// (https://github.com/asivery/netmd-exploits)

Contributions

Every contribution is welcome, but please stick to the TOC's specification. This library isn't the place to implement custom features used only by new NetMD software.

Credits

Writing this library would be much harder without the excellent article about the TOC on minidisc.org: https://www.minidisc.org/md_toc.html

netmd-tocmanip's People

Contributors

asivery 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.