From 57737c05fbf7c482ba436ca8001e7a4b3097b434 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 24 Sep 2026 01:52:51 +0200 Subject: refactor(node): move the Music handlers out of webrtc_server MusicMixin in transport/webrtc/apps/music.py: tags and cover art, and the audio transcode with the extension list that gates it. Co-Authored-By: Claude Opus 5.5 --- .../src/meshbay_hub/static/music-player.js | 2 +- .../meshbay_node/transport/webrtc/apps/music.py | 207 +++++++++++++++++++++ .../src/meshbay_node/transport/webrtc_server.py | 192 +------------------ .../meshbay-node/tests/test_audio_transcode.py | 5 +- 4 files changed, 213 insertions(+), 193 deletions(-) create mode 100644 packages/meshbay-node/src/meshbay_node/transport/webrtc/apps/music.py (limited to 'packages') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/music-player.js b/packages/meshbay-hub/src/meshbay_hub/static/music-player.js index 5f2e33c..e8124fa 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/music-player.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/music-player.js @@ -37,7 +37,7 @@ const MIME_BY_EXT = { }; // The same two formats as the node's BROWSER_INCOMPATIBLE_AUDIO_EXTS -// (webrtc_server.py), which is the one that decides: the node refuses a +// (transport/webrtc/apps/music.py), which is the one that decides: the node refuses a // transcode request for anything else. This is here so the player does not // ask for one it knows will be refused — not because it enforces the rule. // It used to be the only thing that did, and a member's own message never diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc/apps/music.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc/apps/music.py new file mode 100644 index 0000000..acd4187 --- /dev/null +++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc/apps/music.py @@ -0,0 +1,207 @@ +"""What the node does for the Music app: tags and cover art, and a transcode +for the formats no browser plays.""" + +import logging +from pathlib import Path + +import blake3 +from meshbay_common import MNP_VERSION +from meshbay_common.protocol import MNP + +from meshbay_node.roots import off_disk +from meshbay_node.transport.webrtc.disk import _locate +from meshbay_node.transport.webrtc.media_tools import _transcode_audio_to_aac + +log = logging.getLogger("meshbay_node.transport.webrtc_server") + + +# Extensions no mainstream browser's