summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-common/src/meshbay_common/protocol.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-24 14:33:38 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-24 14:33:38 +0200
commit317f09328ed8bf20148b707470c9b0fe82e59575 (patch)
treeba8daf5dcf050d44b7b0e766babbfda8fadac59f /packages/meshbay-common/src/meshbay_common/protocol.py
parentb6e2dcea65124673da047f9b3c92bc5e25980d63 (diff)
parent0b0da86f1f9d6f0b1a27b5e1e1658c42de9f356a (diff)
downloadmeshbay-317f09328ed8bf20148b707470c9b0fe82e59575.tar.gz
Merge branch 'docs/mediacenter-videos-app': Videos group app
Poster grid / flat list browsing, TMDB metadata enrichment, thumbnail generation and caching, season-specific overviews, manual match correction, and the create-group wizard's app-selection step. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LAmyXtc6dAADsH23ydXQpY
Diffstat (limited to 'packages/meshbay-common/src/meshbay_common/protocol.py')
-rw-r--r--packages/meshbay-common/src/meshbay_common/protocol.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/packages/meshbay-common/src/meshbay_common/protocol.py b/packages/meshbay-common/src/meshbay_common/protocol.py
index e1bfb8e..900acc2 100644
--- a/packages/meshbay-common/src/meshbay_common/protocol.py
+++ b/packages/meshbay-common/src/meshbay_common/protocol.py
@@ -90,6 +90,18 @@ class MNP:
APPS_ENABLED_ACK = "apps_enabled_ack"
SET_SCAN_SETTINGS = "set_scan_settings" # operator → node: reconcile/debounce timing
SET_SCAN_SETTINGS_ACK = "set_scan_settings_ack"
+ MEDIA_META_REQ = "media_meta_req" # client → node: TMDB metadata for a path
+ MEDIA_META_RESP = "media_meta_resp" # node → client: TMDB metadata (or none)
+ VIDEO_ROOT = "video_root" # operator → node: which folder is the Videos entry point
+ VIDEO_ROOT_ACK = "video_root_ack"
+ TMDB_CONFIG = "tmdb_config" # operator → node: enable/disable TMDB, set token
+ TMDB_CONFIG_ACK = "tmdb_config_ack" # node → everyone: new TMDB config (never the token)
+ SEASON_META_REQ = "season_meta_req" # client → node: TMDB overview/poster for one season
+ SEASON_META_RESP = "season_meta_resp" # node → client: season-level TMDB fields (or none)
+ TMDB_SEARCH_REQ = "tmdb_search_req" # client → node: candidate TMDB matches for a query
+ TMDB_SEARCH_RESP = "tmdb_search_resp" # node → client: candidate list (id, title, year, poster)
+ TMDB_OVERRIDE = "tmdb_override" # operator → node: replace a show/movie's TMDB match
+ TMDB_OVERRIDE_ACK = "tmdb_override_ack"
# Device linking. A new device files a request bound to a code it displays;
# an already-pinned device of the same account approves it. Neither the hub
# nor the node can produce the countersignature.
@@ -141,6 +153,30 @@ class IndexEntry:
thumb_hash: str | None = None # blake3 of thumbnail
uploader_id: str | None = None # user_id of who uploaded (None = pre-existing on disk)
uploader_pk: str | None = None # Ed25519 public key of uploader (base64 raw 32 bytes)
+ width: int | None = None # pixels, video only
+ height: int | None = None # pixels, video only
+ display_title: str | None = None # parsed or cleaned-filename title, Videos app
+ season: int | None = None # parsed season number, Videos app
+ episode: int | None = None # parsed episode number, Videos app
+
+
+def index_entry_wire(e: IndexEntry) -> dict:
+ """
+ The wire-dict shape used by INDEX_SYNC/INDEX_DELTA hand-built messages
+ (as opposed to GroupIndex.serialize()'s asdict() encoding of the whole
+ index). Centralized so the three call sites that build these
+ (webrtc_server._do_index_sync, daemon._broadcast_index_change's two
+ branches) can't drift from each other as fields are added.
+ """
+ return {
+ "id": e.id, "name": e.name, "path": e.path,
+ "size": e.size, "type": e.type, "added_at": e.added_at,
+ "uploader_id": e.uploader_id,
+ "duration": e.duration, "thumb_hash": e.thumb_hash,
+ "width": e.width, "height": e.height,
+ "display_title": e.display_title,
+ "season": e.season, "episode": e.episode,
+ }
@dataclass
@@ -149,6 +185,12 @@ class IndexDelta:
version: int
additions: list[IndexEntry] = field(default_factory=list)
deletions: list[str] = field(default_factory=list) # list of ids
+ # Same id as before (same file, same content hash), different field
+ # values — e.g. the Videos app's async enrichment filling in duration/
+ # thumb_hash/etc. after the file was already indexed with hash+size only.
+ # A distinct list from `additions`: `GroupIndex.diff()` only ever adds an
+ # id here once it has already appeared unchanged in a prior snapshot.
+ updates: list[IndexEntry] = field(default_factory=list)
# ── Chunk request/response ────────────────────────────────────────────────────