CORE: Improve media paths and player reliability
Build and Publish / Build and Publish Docker Image (push) Successful in 3m3s

This commit is contained in:
Ultradesu
2026-05-27 18:52:17 +03:00
parent fc6090d6a0
commit c43ee02b00
16 changed files with 639 additions and 185 deletions
+6 -18
View File
@@ -1,5 +1,3 @@
use std::path::{Path, PathBuf};
use crate::scheduler::{Job, JobContext, JobLog};
#[derive(Debug, Clone, Copy)]
@@ -104,11 +102,15 @@ pub async fn run_with_options(
for row in rows {
scanned += 1;
let Some(path) = resolve_media_path(&row.file_path, &ctx.config.agent_storage_dir) else {
let path = crate::media_paths::resolve_media_file_path(
&ctx.config.agent_storage_dir,
&row.file_path,
);
if !path.exists() {
missing += 1;
log.warn(&format!("missing file: {}", row.file_path));
continue;
};
}
let extract_path = path.clone();
let raw_meta = match tokio::task::spawn_blocking(move || {
@@ -218,17 +220,3 @@ fn should_update<T>(current: Option<T>, overwrite: bool) -> bool {
fn should_update_duration(current: Option<f64>, overwrite: bool) -> bool {
overwrite || current.unwrap_or(0.0) <= 0.0
}
fn resolve_media_path(file_path: &str, storage_dir: &str) -> Option<PathBuf> {
let path = Path::new(file_path);
if path.exists() {
return Some(path.to_path_buf());
}
if path.is_relative() && !storage_dir.is_empty() {
let joined = Path::new(storage_dir).join(path);
if joined.exists() {
return Some(joined);
}
}
None
}