feat: add media-server input foundations (#742)

* feat: add remote media input foundations
* fixed macro variable names
* Added todo comment for source editor sidebar
This commit is contained in:
Juanjo Presa
2026-05-04 20:22:51 +02:00
committed by GitHub
parent ef8350a68c
commit 8a2e379f6d
39 changed files with 3376 additions and 56 deletions
@@ -148,6 +148,13 @@ pub(in crate::api::endpoints) async fn get_playlist_for_custom_provider(
)
.into_response();
}
InputType::Emby | InputType::Jellyfin | InputType::Plex => {
return (
axum::http::StatusCode::BAD_REQUEST,
axum::Json(json!({ "error": "Media-server inputs are not supported on this endpoint yet"})),
)
.into_response();
}
};
if result.is_empty() {
let error_strings: Vec<String> = errors.iter().map(ToString::to_string).collect();
@@ -3343,8 +3343,10 @@ impl InputWorker {
fn task_needs_provider_connection(task: &UpdateTask, input_type: InputType) -> bool {
match task {
UpdateTask::ProbeLive { .. } => true,
// Local library probing is fully local and must not depend on provider capacity.
UpdateTask::ProbeStream { .. } => !matches!(input_type, InputType::Library),
// Local library and media-server probing must not depend on IPTV provider capacity.
UpdateTask::ProbeStream { .. } => {
!(matches!(input_type, InputType::Library) || input_type.is_media_server())
},
// Resolve tasks handle their own probe connection acquisition internally.
// This avoids holding a provider connection for the entire duration of
// info fetch + TMDB resolve + probe, reducing "provider exhausted" errors.
@@ -4257,6 +4259,23 @@ mod tests {
assert!(!InputWorker::task_needs_provider_connection(&task, InputType::Library));
}
#[test]
fn task_needs_provider_connection_skips_media_server_probe_stream() {
let task = UpdateTask::ProbeStream {
probe_scope: Arc::from("input_remote"),
unique_id: "u1".to_string(),
url: "http://example.com/stream.mkv".to_string(),
item_type: PlaylistItemType::Video,
reason: ResolveReason::MissingDetails.into(),
delay: 0,
};
for input_type in [InputType::Emby, InputType::Jellyfin, InputType::Plex] {
assert!(!InputWorker::task_needs_provider_connection(&task, input_type));
}
assert!(InputWorker::task_needs_provider_connection(&task, InputType::M3u));
}
#[test]
fn task_needs_provider_connection_keeps_non_library_probe_stream() {
let task = UpdateTask::ProbeStream {
@@ -1039,6 +1039,7 @@ mod tests {
input_type: InputType::Xtream, // You can use a default value here
max_connections,
priority,
media_server: None,
aliases: None,
headers: HashMap::default(),
options: None,
+1 -1
View File
@@ -53,7 +53,7 @@ impl fmt::Debug for SetupWebUserCredentialDto {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SetupWebUserCredentialDto")
.field("username", &self.username)
.field("password", &"<redacted>")
.field("password", &"***")
.finish()
}
}