Skip to content

fix(plex): stream parts as the original file - #735

Open
maliavko wants to merge 1 commit into
bjarneo:mainfrom
maliavko:fix/plex-flac-download
Open

maliavko wants to merge 1 commit into
bjarneo:mainfrom
maliavko:fix/plex-flac-download

Conversation

@maliavko

@maliavko maliavko commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Split from #699, as asked there.

Problem

Plex answered HTTP 500 for FLAC parts whose audio stream it had analyzed. Its log said "No direct play music profile exists for protocol http, with container flac": for a /library/parts request Plex checks the file against the client's direct-play profile, cliamp sends none, and the generic profile has no FLAC over HTTP.

Fix

StreamURL adds download=1, as Plexamp does. Plex then serves the original file without the profile check.

Verification

  • make check and staticcheck pass. TestStreamURLPlaysAnalyzedFLAC fails without the fix.
  • On 2026-10-27 a failing part on my server answered 500 without download=1 and 206 with it.
  • Today, on Plex Media Server 1.43.5, I could not reproduce the 500: 399 FLAC albums and the same part answered 206 both with and without download=1. The parameter changes nothing for those requests.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Plex streaming links for analyzed FLAC files that could otherwise fail with an HTTP 500 error. Links now request the original file without transcoding.
  • Documentation
    • Updated the Plex streaming documentation to explain the link behavior and its effect on file playback.

Plex answered HTTP 500 for newly added FLAC albums. Its log showed why:
for a /library/parts request it checks the file against the client's
direct-play profile, cliamp sends none, and the generic profile has no
FLAC over HTTP ("No direct play music profile exists for protocol
http, with container flac").

Request parts with download=1, as Plexamp does, so Plex serves the
original file without a profile check.

Verified with make check (gofmt, go vet, go test ./...) and staticcheck.
The new test fails without the fix. On the live server a part answered
500 before and 206 with download=1 (2026-10-27).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

StreamURL now adds download=1 alongside the escaped Plex token. Documentation and tests cover the parameter and the analyzed FLAC request that returns HTTP 500 when it is absent.

Changes: Plex stream URL

Layer / File(s) Summary
Stream URL and regression coverage
external/plex/client.go, external/plex/client_test.go, docs/plex.md
StreamURL adds download=1 while retaining the escaped token. Tests check the URL and an analyzed FLAC request; documentation describes the parameter and Plex’s response when it is absent.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Low

Possibly related PRs

  • bjarneo/cliamp#699: Its Plex provider changes also refer to original-file streaming, which may overlap with the stream URL change.

Suggested reviewers: skeptomai, bjarneo

Merge Risk: Minimal · up to 797e7

This change adds download=1 to Plex stream URLs so that analyzed FLAC files stop returning HTTP 500. The change is small and easy to revert, and its test and docs are updated. The one thing worth confirming is that a real Plex server returns a full 200 response, not a partial 206, to cliamp's plain GET request. That is unverified, not a known defect.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(plex): stream parts as the original file" matches the main change. StreamURL now adds download=1 so Plex serves the original file for /library/parts requests, which the docs and tests i…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(plex): stream parts as the original file" matches the main change. StreamURL now adds download=1 so Plex serves the original file for /library/parts requests, which the docs and tests in this PR cover. The title names the fix and the affected component, so it summarizes the primary change.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 704ce271-1273-4611-a4a8-4fbe17d0d38f
Commits

Reviewing files that changed from the base of the PR and between b1bbc20 and 797e7f0.

Files selected for processing: 3

  • docs/plex.md
  • external/plex/client.go
  • external/plex/client_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
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