Skip to content

fix(media): name a stream after its folder when its playlist name is generic - #627

Merged
linroid merged 2 commits into
mainfrom
fix/media-generic-names
Oct 23, 2026
Merged

linroid merged 2 commits into
mainfrom
fix/media-generic-names

Conversation

@linroid

@linroid linroid commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Found while downloading public HLS/DASH streams: outputs were named after the playlist file, which for most streams says nothing.

Stream Before After
…/img_bipbop_adv_example_fmp4/master.m3u8 (Apple) master.mp4 img_bipbop_adv_example_fmp4.mp4
…/shaka-demo-assets/angel-one/dash.mpd dash.mp4 angel-one.mp4
…/tears-of-steel/tears-of-steel.ism/.m3u8 (Unified Streaming) media.ts tears-of-steel.ts
…/x36xhzz/x36xhzz.m3u8 (Mux), …/bbb_30fps.mpd (Akamai) unchanged unchanged

What changes

MediaDownloadHelper.resolve names the output with the new mediaName(url): the playlist's name, percent-decoded, unless it is empty or generic (master, index, playlist, manifest, main, media, stream, prog_index, chunklist, dash, hls, video, audio, output, …). In that case it uses the nearest of the two folders above it that names something: not generic, containing a letter, at most 64 characters, and without =, ~ or ,, so a signed path's token (exp=…~hmac=…) or a numeric ID never becomes a file name. A Smooth Streaming .ism/.isml suffix is dropped. Otherwise the old name stays (index, master, media). Files the user names are unaffected.

Verification

  • ketch from this branch saves Apple's stream as img_bipbop_adv_example_fmp4.mp4, angel-one as angel-one.mp4 and Unified Streaming's as tears-of-steel.ts.
  • New MediaDownloadHelperTest.mediaName_genericPlaylists_takeTheirFoldersName covers those URLs, Mux, a percent-encoded folder, numeric and token folders, and an empty name. The existing HLS/DASH naming tests (index.ts, master.mp4 with no folder) are unchanged.
  • ./gradlew :library:core:jvmTest --tests '*MediaDownloadHelperTest*' :library:hls:jvmTest :library:dash:jvmTest passes.

…generic

HLS and DASH downloads took the playlist's name: Apple's example saved as
master.mp4, Shaka's angel-one as dash.mp4, and Unified Streaming's
.../tears-of-steel.ism/.m3u8 as media.ts. When the playlist's name only
says it is a playlist (master, index, playlist, manifest, dash, ...) or is
empty, the stream is now named after the nearest of the two folders above
it that names something, without a Smooth Streaming .ism: never a signed
path's token or a number. Names are percent-decoded too.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T16:37:56.283550Z e448d74 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e448d74697

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 199 files  ±0   2 227 suites  ±0   59m 50s ⏱️ + 3m 2s
15 335 tests +4  15 067 ✅ +4  268 💤 ±0  0 ❌ ±0 
18 692 runs  +4  18 424 ✅ +4  268 💤 ±0  0 ❌ ±0 

Results for commit afd8958. ± Comparison against base commit e6d2fe1.

@linroid
linroid merged commit d26a1e6 into main Oct 23, 2026
14 checks passed
@linroid
linroid deleted the fix/media-generic-names branch October 23, 2026 17:30
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