Skip to content

fix: STRM files not playing correctly#210

Merged
PartyDonut merged 1 commit intodevelopfrom
bugfix/Fix-strm-files
Feb 1, 2025
Merged

fix: STRM files not playing correctly#210
PartyDonut merged 1 commit intodevelopfrom
bugfix/Fix-strm-files

Conversation

@PartyDonut
Copy link
Copy Markdown
Collaborator

Pull Request Description

.STRM files where using the stream url from jellyfin itself despite already being a file that can be streamed.

Issue Being Fixed

resolves #57

@PartyDonut PartyDonut added the bug Something isn't working label Feb 1, 2025
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 1, 2025

Reviewer's Guide by Sourcery

The pull request modifies how .strm files are handled during playback. Instead of always using the Jellyfin server URL, the code now checks if the media source path is a valid URL. If it is, the code uses the media source path directly, otherwise it falls back to the Jellyfin server URL.

Sequence diagram for STRM file playback URL resolution

sequenceDiagram
    participant Client
    participant PlaybackModel
    participant MediaSource

    Client->>PlaybackModel: Request media playback
    PlaybackModel->>MediaSource: Get media source path
    alt Is valid video URL
        PlaybackModel->>Client: Return direct media source URL
    else Not a valid URL
        PlaybackModel->>Client: Return Jellyfin server stream URL
    end
Loading

Flow diagram for STRM file URL resolution logic

flowchart TD
    A[Start] --> B{Is media source path
a valid URL?}
    B -->|Yes| C[Use direct media source URL]
    B -->|No| D[Use Jellyfin server stream URL]
    C --> E[Return URL for playback]
    D --> E
Loading

File-Level Changes

Change Details Files
Modified the logic for constructing the media URL for playback.
  • Added a check to see if the media source path is a valid URL.
  • If the media source path is a valid URL, use it directly for playback.
  • If the media source path is not a valid URL, use the Jellyfin server URL for playback.
lib/models/playback/playback_model.dart
Added a helper function to validate if a string is a valid URL.
  • Added a new function isValidVideoUrl to check if a string is a valid URL.
  • The function returns the path if it's a valid URL, otherwise it returns null.
lib/models/playback/playback_model.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#57 Fix STRM file playback by using direct file path when available
#57 Prevent using Jellyfin stream URL for files that can be directly streamed
#57 Ensure STRM files play correctly across different platforms

Possibly linked issues


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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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
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 @PartyDonut - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@PartyDonut PartyDonut merged commit 54babae into develop Feb 1, 2025
1 check passed
@PartyDonut PartyDonut deleted the bugfix/Fix-strm-files branch February 1, 2025 13:51
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.

Direct Play STRM not working

1 participant