Skip to content

fix: Bitrate display in Media Info#556

Merged
PartyDonut merged 4 commits intoDonutWare:developfrom
matt-hb:fix-bitrate
Nov 7, 2025
Merged

fix: Bitrate display in Media Info#556
PartyDonut merged 4 commits intoDonutWare:developfrom
matt-hb:fix-bitrate

Conversation

@matt-hb
Copy link
Copy Markdown
Contributor

@matt-hb matt-hb commented Nov 1, 2025

Pull Request Description

Tiny fix for the bitrate info in the Movie/Episode Info window, and also I have formatted both audio and video to be what I would expect, (for high bitrate video, over 10 Mbps it is xx.x Mbps, under that it is the value in kbps, and for any audio, the bitrate in kbps), open to opinions, might even be something the user could set for themselves via a toggle.

Issue Being Fixed

The Jellyfin API returns the video and audio bitrate in bps, but previously they were displayed as though they are kbps values.
(+ formatting)

Screenshots / Recordings

High bitrate ex:
image

Lower bitrate ex:
image

Checklist

  • If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
  • Check that any changes are related to the issue at hand.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Extract the repeated bitrate formatting logic into a reusable helper method to reduce duplication and improve readability.
  • Define the 10_000_000 threshold as a named constant (e.g., HIGH_BITRATE_THRESHOLD) to make the switch point self-documenting and easier to tweak.
  • Add a null check or fallback for bitRate before using ! to avoid potential runtime errors if the value is missing.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Extract the repeated bitrate formatting logic into a reusable helper method to reduce duplication and improve readability.
- Define the 10_000_000 threshold as a named constant (e.g., `HIGH_BITRATE_THRESHOLD`) to make the switch point self-documenting and easier to tweak.
- Add a null check or fallback for `bitRate` before using `!` to avoid potential runtime errors if the value is missing.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Nov 1, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the InformationModel to correctly convert the API’s bitRate values (in bps) into human-readable kbps or Mbps formats and applies consistent rounding rules for both video and audio streams.

File-Level Changes

Change Details Files
Conditional formatting of video bitrate
  • Convert bps to kbps for bit rates ≤10 000 000
  • Convert bps to Mbps with one decimal for bit rates >10 000 000
  • Replace the previous hardcoded "kbps" interpolation with threshold-based logic
lib/models/information_model.dart
Consistent audio bitrate conversion
  • Divide bps by 1000 and round to display audio bitrate in kbps
  • Remove incorrect raw bps display
lib/models/information_model.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Collaborator

@PartyDonut PartyDonut left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to fix this. I do have a simple cleanup suggestion. Let me know if it's unclear.

"Interlaced": e.isInterlaced,
"FrameRate": e.realFrameRate,
"Bitrate": "${e.bitRate} kbps",
"Bitrate": e.bitRate! <= 10000000
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The bang operator is something best avoided.

While the logic itself is perfectly fine. It would be better to separate this into it's own extension function. That way we can also keep it null safe.

Take a look at the "size_formatting.dart" file for where and how to implement a very similar extension function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call, thanks for the heads up.

@matt-hb matt-hb requested a review from PartyDonut November 1, 2025 19:10
}

String? get videoBitrateFormat {
const int VIDEO_HIGH_BITRATE_CUTOFF = 10000000;
Copy link
Copy Markdown
Collaborator

@PartyDonut PartyDonut Nov 1, 2025

Choose a reason for hiding this comment

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

Seems like the AI suggested the naming convention of this, not sure why. But in dart for local constants its normal to use camelCase.

As I'm already nitpicking should the Kb variable in this case not also be lowercase 'kb' same as the returned string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

haha, the AI suggestion + my background made me go against the linter suggesting camelCase for consts, I'll change that over.
Very good nitpicking eye on the 'kb' name as well, just made both Mb and kb the same on muscle memory 👍

Copy link
Copy Markdown
Collaborator

@PartyDonut PartyDonut left a comment

Choose a reason for hiding this comment

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

Very small nitpick on my end, everything else looks good. Thanks for the quick fixes.

@PartyDonut PartyDonut changed the title Fix bitrate display in Media Info fix: Bitrate display in Media Info Nov 7, 2025
@PartyDonut PartyDonut added the bug Something isn't working label Nov 7, 2025
@PartyDonut PartyDonut merged commit 2594a84 into DonutWare:develop Nov 7, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this to Done in Fladder Nov 7, 2025
@matt-hb matt-hb deleted the fix-bitrate branch February 7, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants