Skip to content

Parse xtream m3u urls into separate credentials#195

Merged
kristofferR merged 2 commits into
kristofferR:mainfrom
benjiewheeler:main
Jun 11, 2026
Merged

Parse xtream m3u urls into separate credentials#195
kristofferR merged 2 commits into
kristofferR:mainfrom
benjiewheeler:main

Conversation

@benjiewheeler

@benjiewheeler benjiewheeler commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Parse Xtream M3U-style URLs entered into the server field and auto-fill Xtream server, username, and password fields when credentials are present in the query string

Changes

  • Added parseXtreamM3ULink(link: string) helper.
    • Attempts to parse the input as a URL
    • If username and password query params exist, sets:
      • xtreamServer to the URL origin (protocol + host)
      • xtreamUsername and xtreamPassword to the extracted values
    • Fallback to setting xtreamServer to the raw input when parsing fails or credentials are not present.

Reason

Many Xtream providers give credentials as M3U URLs. Parsing these automatically saves time from manually copying username/password and reduces friction when testing multiple streams

Example

Input:
http://hostname:8080/get.php?username=foo&password=bar&type=m3u_plus
Result:

Summary by CodeRabbit

  • New Features
    • Xtream input now auto-extracts server, username, and password when a full link is pasted.
  • Bug Fixes
    • Scan/channel results now surface a “last error” value so error messages are more accurate.
  • Chores
    • Updated how bundled media tools are downloaded to use a simpler releases URL.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Xtream M3U parsing to auto-fill server/username/password, extends ChannelResult with optional last_error_reason and updates its initialization and accessor, and switches the BtbN ffmpeg download URL to the releases/download/latest endpoint.

Changes

Xtream M3U Credential Extraction

Layer / File(s) Summary
Xtream M3U credential parsing and form integration
src/components/OpenSourceDialog.tsx
Introduces parseXtreamM3ULink that parses Xtream input as a URL, extracts username and password query params, and updates xtreamServer, xtreamUsername, and xtreamPassword; integrates parser into the Xtream Server input onChange handler.

ChannelResult error field and accessors

Layer / File(s) Summary
ChannelResult type and error accessor
src/lib/types.ts, src/lib/channelResults.ts
Adds `last_error_reason?: string

FFmpeg download script tweak

Layer / File(s) Summary
BtbN download URL update
scripts/download-ffmpeg.sh
Replaces dynamic BtbN tag resolution with a direct https://github.com/BtbN/FFmpeg-Builds/releases/download/latest base URL when constructing download links for ffmpeg/ffprobe artifacts.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant OpenSourceDialog
  participant parseXtreamM3ULink
  User->>OpenSourceDialog: paste/modify Xtream Server input
  OpenSourceDialog->>parseXtreamM3ULink: call parseXtreamM3ULink(input)
  parseXtreamM3ULink-->>OpenSourceDialog: set xtreamServer / xtreamUsername / xtreamPassword (or raw server)
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit nibbles query strings with care,
Finding usernames hidden there,
It hops and fills the form so neat,
Errors logged, downloads made complete,
Hooray—small fixes, tidy and fair 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Parse xtream m3u urls into separate credentials' accurately summarizes the main change: adding logic to parse Xtream M3U-style URLs and extract credentials into separate fields.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@kristofferR

Copy link
Copy Markdown
Owner

Awesome, thanks, nice improvement!

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/download-ffmpeg.sh`:
- Around line 128-129: The hardcoded archive name in the download script
(variable archive) doesn't match the actual asset names served by the
BtbN/FFmpeg-Builds /releases/download/latest endpoint; replace the static
"ffmpeg-master-latest-${platform}-gpl" with logic that queries the GitHub
releases API for the latest release assets and selects the correct asset whose
name matches the pattern "ffmpeg-.*-${platform}-gpl" (use curl to fetch
https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest, parse the
.assets[].name with jq or similar, grep for the platform-specific gpl asset, and
assign that result to archive) so the script downloads the real existing file
instead of a non-existent hardcoded name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 38a87c92-500a-49e4-be83-a54d1a8a9ccf

📥 Commits

Reviewing files that changed from the base of the PR and between a2eb238 and 285cd6a.

📒 Files selected for processing (3)
  • scripts/download-ffmpeg.sh
  • src/lib/channelResults.ts
  • src/lib/types.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Define agent interfaces and implementations in TypeScript for agent systems
Use clear naming conventions for agent classes and methods
Document agent behavior and responsibilities in comments or docstrings
Implement error handling in agent methods

Files:

  • src/lib/types.ts
  • src/lib/channelResults.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code should use strict mode and enforce no unused locals/params

Files:

  • src/lib/types.ts
  • src/lib/channelResults.ts
src/lib/types.ts

📄 CodeRabbit inference engine (AGENTS.md)

Define and maintain data types in lib/types.ts that mirror Rust models

Files:

  • src/lib/types.ts
src/lib/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Tauri IPC commands for frontend-backend communication instead of direct HTTP calls

Files:

  • src/lib/types.ts
  • src/lib/channelResults.ts
🔇 Additional comments (3)
src/lib/channelResults.ts (2)

26-26: LGTM!


45-48: LGTM!

src/lib/types.ts (1)

66-66: Confirm Rust ↔ TS model alignment for last_error_reason

src-tauri/src/models/channel.rs adds #[serde(..., alias = "last_error_reason")] pub error_reason: Option<String>, so the serialized field name last_error_reason matches the TypeScript last_error_reason?: string | null (optional + nullable) in src/lib/types.ts.

Comment on lines +128 to 129
local base="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest"
local archive="ffmpeg-master-latest-${platform}-gpl"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify BtbN latest endpoint and archive naming

echo "=== Testing latest endpoint redirect ==="
curl -sI "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest" | grep -i location

echo -e "\n=== Fetching actual latest release assets ==="
gh api /repos/BtbN/FFmpeg-Builds/releases/latest --jq '.assets[].name' | grep -E '(linux64|win64)'

echo -e "\n=== Testing if specific archive exists ==="
curl -I "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz" 2>&1 | head -1

Repository: kristofferR/IPTVChecker

Length of output: 1523


Fix archive naming for /releases/download/latest in scripts/download-ffmpeg.sh

The /latest endpoint assets in BtbN/FFmpeg-Builds are named like ffmpeg-N-<id>-linux64-gpl.tar.xz / ffmpeg-N-<id>-win64-gpl.zip, and I don’t see any assets matching ffmpeg-master-latest-${platform}-gpl*. This hardcoded archive name at lines 128–129 is likely requesting a non-existent file (which would explain CI failures); pinning can be addressed separately.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/download-ffmpeg.sh` around lines 128 - 129, The hardcoded archive
name in the download script (variable archive) doesn't match the actual asset
names served by the BtbN/FFmpeg-Builds /releases/download/latest endpoint;
replace the static "ffmpeg-master-latest-${platform}-gpl" with logic that
queries the GitHub releases API for the latest release assets and selects the
correct asset whose name matches the pattern "ffmpeg-.*-${platform}-gpl" (use
curl to fetch https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest,
parse the .assets[].name with jq or similar, grep for the platform-specific gpl
asset, and assign that result to archive) so the script downloads the real
existing file instead of a non-existent hardcoded name.

@kristofferR kristofferR merged commit ae2118e into kristofferR:main Jun 11, 2026
8 checks passed
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.

2 participants