Skip to content

Update for netmd-js 4.x and Web MiniDisc Pro - #6

Open
jaeming wants to merge 1 commit into
asivery:masterfrom
jaeming:feat/netmd-js-4x
Open

jaeming wants to merge 1 commit into
asivery:masterfrom
jaeming:feat/netmd-js-4x

Conversation

@jaeming

@jaeming jaeming commented Jul 3, 2026

Copy link
Copy Markdown

Why

Web MiniDisc Pro (the client at web.minidisc.wiki, and as far as I know the only client) now uses netmd-js 4.x and a codec-based format model. This server targets the older 3.x API, so against a current netmd-js it breaks — EKBOpenSource is no longer exported, MDSession resolves the EKB internally, and the track/format names changed. The net effect is that a fresh setup can't record with the current client.

This brings the server up to date. (Complements the client-side fix in asivery/webminidisc#99.)

Changes

  • MDSession — drop the EKBOpenSource argument. In 4.x init() derives the EKB from the device's vendor/product IDs, so it's just new MDSession(device).
  • Track converters — report SP as SPS (stereo) / SPM (mono) and MDLP as AT3 + bitrate, matching what the current client sends and renders.
  • /upload — accept the SPS/SPM codec names the current client sends (both → PCM wireformat), and record SPM with DiscFormat.spMono.
  • normalizeGroups — a blank disc comes back from netmd-js with an empty groups array; synthesize the "ungrouped" bucket the client expects, and make the group/track converters null-safe.
  • package.json — depend on the published netmd-js@^4.4.1 instead of a local working tree. (Easy to revert to file: if you'd rather keep the working-tree workflow.)

Testing

Ran live against a Sony MZ-N505: /prepareUpload completes the EKB session handshake, disc listing / group rewrite work, and SP + LP2 uploads complete.

Notes

The current Web MiniDisc Pro client uses netmd-js 4.x, which this server had
not been updated for. Against a 4.x netmd-js the old code fails: EKBOpenSource
is no longer exported and MDSession resolves the EKB internally.

- MDSession: drop the EKBOpenSource argument; init() derives the EKB from the
  device's vendor/product IDs. new MDSession(device).
- Track converters: report SP as SPS (stereo) / SPM (mono) and MDLP as AT3 with
  a bitrate, matching what the current client sends and displays.
- /upload: accept the SPS/SPM codec names the current client sends (both map to
  the PCM wireformat) and record SPM with the mono disc format.
- normalizeGroups: a blank disc returns an empty groups array from netmd-js;
  synthesize the ungrouped bucket the client expects, and make the group/track
  converters null-safe.
- package.json: depend on the published netmd-js ^4.4.1.

Tested live against a Sony MZ-N505 (SP and LP2 uploads, disc listing, group
rewrite). Happy to keep the file:../netmd-js dependency style if preferred.
@jaeming

jaeming commented Jul 3, 2026

Copy link
Copy Markdown
Author

Verification note — ran this branch's exact code against real hardware before opening:

  • Installed the published netmd-js@4.4.1 (fresh npm install, not a local working tree) on a Raspberry Pi (Node 22) with a Sony MZ-N505 attached.
  • Confirmed the named imports resolve under Node ESM against 4.4.1 (MDSession, DiscFormat, etc. all defined; DiscFormat.spMono = 4, Wireformat.pcm = 0).
  • End-to-end against the deck:
    • /deviceNameSony MZ-N505
    • /listContent → the updated converters emit the current codec model on real tracks ({codec:"AT3",bitrate:132} for MDLP, {codec:"SPS",bitrate:292} for SP)
    • /prepareUploadnew MDSession(device) + init() completes the EKB handshake
    • /finalizeUpload → clean close
  • SP and LP2 uploads through the current Web MiniDisc Pro client complete end-to-end (via the companion client fix Fix stalled SP/mono upload over Remote NetMD webminidisc#99).

Note: kept separate from the version-independent /rewriteGroups + upload-lock fixes in #5; the two touch the /upload handler in different spots, so a trivial rebase may be needed depending on merge order. Happy to adjust anything (e.g. keep file:../netmd-js instead of pinning ^4.4.1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant