Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

refactor(providers): organize tv provider into dedicated module directory

Samir Hossains5ab3c75b2094
diff --git a/docs/architecture.md b/docs/architecture.md
index 8b57100..c68a821 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -26,7 +26,8 @@ src/
fourkhdhub/ 4KHDHub provider (client, hubcloud resolver, parser)
bdix/circleftp/ BDIX CircleFTP provider
bdix/dhakaflix/ BDIX DhakaFlix provider
- m3u.rs M3U playlist parser (URL and local file)
+ addons/ Community HTTP addons provider
+ tv/ Live TV / IPTV provider (M3U parser and models)
service.rs MovieBoxService headless engine (search, details, streams, captions)
updater.rs GitHub release update check
tui/
diff --git a/docs/modules.md b/docs/modules.md
index c043d72..e499cc8 100644
--- a/docs/modules.md
+++ b/docs/modules.md
@@ -51,8 +51,8 @@ src/
bdix/
circleftp/ BDIX CircleFTP provider (client + parser).
dhakaflix/ BDIX DhakaFlix provider (client + parser).
- addons/ Community HTTP addons provider (client, aggregator, adapter).
- m3u.rs M3U playlist parser (http(s) URL or local file).
+ addons/ Community HTTP addons provider (client, aggregator, adapter, models).
+ tv/ Live TV / IPTV provider (models + M3U parser).
service.rs MovieBoxService: unified multi-provider headless client &
engine (suggest, search, details, homepage, resolutions,
diff --git a/docs/providers.md b/docs/providers.md
index b81710c..74d4cd3 100644
--- a/docs/providers.md
+++ b/docs/providers.md
@@ -70,7 +70,7 @@ which `app/playback.rs::launch_player` feeds to the external player.
## M3U playlists (TV mode)
-`providers/m3u.rs` parses an M3U playlist from an `https://` URL or a local file path.
+`providers/tv` parses an M3U playlist from an `https://` URL or a local file path.
Each channel yields `{ id, name, logo, group, stream_url }`; TV mode groups channels by
`group-title` and dedupes by `stream_url`. See [tv-mode.md](tv-mode.md).
diff --git a/docs/tv-mode.md b/docs/tv-mode.md
index b310c3c..b31547d 100644
--- a/docs/tv-mode.md
+++ b/docs/tv-mode.md
@@ -24,7 +24,7 @@ file path, and the app parses, groups, dedupes, and lets you search and play the
## Parsing and search
-`providers/m3u.rs` parses each source (http(s) or local file), extracting channel id,
+`src/providers/tv/` parses each source (http(s) or local file), extracting channel id,
name, logo, `group-title`, and stream URL. Channels are **deduped by stream URL**
across all playlists. The search box filters by name or group; the status bar reports
how many channels were imported and which playlists failed.
diff --git a/src/providers/mod.rs b/src/providers/mod.rs
index 1eb0262..12ddfa7 100644
--- a/src/providers/mod.rs
+++ b/src/providers/mod.rs
@@ -1,9 +1,11 @@
pub mod addons;
pub mod bdix;
pub mod fourkhdhub;
-pub mod m3u;
pub mod models;
pub mod moviebox;
+pub mod tv;
+
+pub use tv as m3u;
use models::Release;
diff --git a/src/providers/tv/mod.rs b/src/providers/tv/mod.rs
new file mode 100644
index 0000000..347b4ae
--- /dev/null
+++ b/src/providers/tv/mod.rs
@@ -0,0 +1,5 @@
+pub mod models;
+pub mod parser;
+
+pub use models::Channel;
+pub use parser::M3UParser;
diff --git a/src/providers/tv/models.rs b/src/providers/tv/models.rs
new file mode 100644
index 0000000..5951dbf
--- /dev/null
+++ b/src/providers/tv/models.rs
@@ -0,0 +1,10 @@
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Channel {
+ pub id: String,
+ pub name: String,
+ pub logo: String,
+ pub group: String,
+ pub stream_url: String,
+}
diff --git a/src/providers/m3u.rs b/src/providers/tv/parser.rs
similarity index 96%
rename from src/providers/m3u.rs
rename to src/providers/tv/parser.rs
index f576fbb..b42071a 100644
--- a/src/providers/m3u.rs
+++ b/src/providers/tv/parser.rs
@@ -1,16 +1,7 @@
-use serde::{Deserialize, Serialize};
+use super::models::Channel;
use std::path::PathBuf;
use std::time::SystemTime;
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct Channel {
- pub id: String,
- pub name: String,
- pub logo: String,
- pub group: String,
- pub stream_url: String,
-}
-
pub struct M3UParser {
cache_dir: PathBuf,
client: reqwest::Client,
diff --git a/src/tui/action.rs b/src/tui/action.rs
index 15fe2fb..183fb9e 100644
--- a/src/tui/action.rs
+++ b/src/tui/action.rs
@@ -17,7 +17,7 @@ pub enum Action {
SwitchToStreamingMode,
SwitchProvider(crate::providers::models::ProviderKind),
ShowTvConfig,
- TvChannelsLoaded(Vec<crate::providers::m3u::Channel>, usize),
+ TvChannelsLoaded(Vec<crate::providers::tv::Channel>, usize),
TvPlaylistAdd(String),
TvPlaylistRemove(usize),
TvReloadPlaylists,
diff --git a/src/tui/app/mod.rs b/src/tui/app/mod.rs
index eabf427..7880d0a 100644
--- a/src/tui/app/mod.rs
+++ b/src/tui/app/mod.rs
@@ -192,7 +192,7 @@ impl App {
let playlists = self.state.tv_playlists.clone();
let sender = self.action_sender.clone();
tokio::spawn(async move {
- let parser = crate::providers::m3u::M3UParser::new();
+ let parser = crate::providers::tv::M3UParser::new();
let mut all_channels = Vec::new();
let mut failed = 0usize;
for source in &playlists {
diff --git a/src/tui/state.rs b/src/tui/state.rs
index 82c19ef..99f4cf0 100644
--- a/src/tui/state.rs
+++ b/src/tui/state.rs
@@ -161,7 +161,7 @@ pub struct AppState {
pub is_tv_mode: bool,
pub tv_enabled: bool,
pub tv_config_popup: bool,
- pub tv_channels: Vec<crate::providers::m3u::Channel>,
+ pub tv_channels: Vec<crate::providers::tv::Channel>,
pub tv_playlists: Vec<String>,
pub tv_manager_selected: usize,
pub tv_input_active: bool,