Skip to main content

Social Platform (social-platform.js)

Lets listeners submit their own audio (songs, mashups, ads, jingles, sweepers, sfx, voice notes, talk show clips, programs) which the engine validates, masters to broadcast level, and — if approved — injects on air as a ranked overlay ahead of the rolling library.

Submission lifecycle

submit → validate (type + duration window) → R128 master → deriveMeta (tags)
→ dedupe (registry dupKey) → approved | rejected → ranked → scheduler overlay
  1. SubmitPOST /api/social/posts (JSON with sourceUrl or base64) or POST /api/social/upload/:type (raw audio body).
  2. Validate — duration must fall inside the type's window.
  3. Master — reuses the pipeline normalizeR128 (EBU R128, −14 LUFS).
  4. TagderiveMeta builds the metadata / registry entry.
  5. Dedupe — a registry dupKey prevents double-submitting the same clip.
  6. Rank — votes + recency + type RANK weights decide the order.
  7. InjectattachScheduler(sched) rebuilds the scheduler's socialDeck; updateM3U prepends each category's ranked overlay to its snapshot. A POST /api/social/sync pushes the updated rotation to the remote.

Types (map to existing categories)

TypeCategoryDuration windowLabel
songarabic_hits90–600sSong
mashupmashups60–600sMashup
jinglesjingles2–30sJingle
sweeperssweepers2–45sStation ID / Sweeper
sfxsfx0.5–15sSound Effect
adsads6–60sAdvertisement
voicesweepers3–120sVoice Note / Dedication
talktalkshow120–5400sTalk Show Episode
programprograms120–10800sProgram / Show

Storage

PathWhat
E:\radionew\media\social\<type>\SOC_<id>_*.mp3Approved audio assets
E:\radionew\social\posts.jsonPost store (registry)
E:\radionew\logs\social_platform.logActivity log
E:\radionew\logs\media\play_history.jsonlPlay counts (auto-matched by SOC_ filenames)

API

Mounted by server.js via socialPlatform.mountRoutes(app, { express, radio }):

  • GET /api/social/posts[?status=&type=&sort=], GET /api/social/posts/:id
  • POST /api/social/posts (JSON), POST /api/social/upload/:type (raw audio)
  • POST /api/social/posts/:id/vote {delta:±1}, .../react {kind}
  • POST /api/social/posts/:id/approve|reject|process (admin gate via env SOCIAL_ADMIN_KEY, empty = open)
  • POST /api/social/sync, GET /api/social/status, GET /api/social/next

Studio UI

public/social.html (http://10.40.3.174:5000/social.html): submit (file or URL), vote/react, approve/reject/re-process, force rotation sync, live rank board.

Scheduler integration

  • smart-scheduler.js exposes socialDeck (setSocialDeck(cat, posts), clearSocialDeck(), init {}).
  • updateM3U prepends each category's ranked overlay to its snapshot (empty overlay = zero behaviour change).
  • Rebuilt at boot and inside resyncSchedulerAfterRefresh.

See also