npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

netmd-tocmanip

v0.1.5

Published

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

Downloads

69

Readme

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