Fix recursive search at the root, cleanup video generation return
This commit is contained in:
12
src/files.rs
12
src/files.rs
@@ -70,7 +70,17 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
|
|||||||
.map(|tagged_files| {
|
.map(|tagged_files| {
|
||||||
tagged_files
|
tagged_files
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|f| f.starts_with(&format!("{}/", search_path).to_string()))
|
.filter(|f| {
|
||||||
|
// When searching at the root, everything matches recursively
|
||||||
|
if search_path.trim() == "" { return true; }
|
||||||
|
|
||||||
|
f.starts_with(
|
||||||
|
&format!(
|
||||||
|
"{}/",
|
||||||
|
search_path.strip_suffix('/').unwrap_or_else(|| search_path)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
})
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
})
|
})
|
||||||
.inspect(|files| debug!("Found {:?} files", files.len()))
|
.inspect(|files| debug!("Found {:?} files", files.len()))
|
||||||
|
|||||||
14
src/video.rs
14
src/video.rs
@@ -156,12 +156,16 @@ impl Handler<ScanDirectoryMessage> for VideoPlaylistManager {
|
|||||||
.await
|
.await
|
||||||
.expect("Failed to send generate playlist message")
|
.expect("Failed to send generate playlist message")
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {
|
||||||
|
debug!(
|
||||||
|
"Successfully generated playlist for file: '{}'",
|
||||||
|
path_as_str
|
||||||
|
);
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Failed to generate playlist for path '{:?}'. {:?}", path, e);
|
warn!("Failed to generate playlist for path '{:?}'. {:?}", path, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// .expect("Failed to generate video playlist");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
@@ -180,7 +184,7 @@ pub struct ScanDirectoryMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Message)]
|
#[derive(Message)]
|
||||||
#[rtype(result = "Result<String>")]
|
#[rtype(result = "Result<()>")]
|
||||||
struct GeneratePlaylistMessage {
|
struct GeneratePlaylistMessage {
|
||||||
video_path: PathBuf,
|
video_path: PathBuf,
|
||||||
playlist_path: String,
|
playlist_path: String,
|
||||||
@@ -203,7 +207,7 @@ impl Actor for PlaylistGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Handler<GeneratePlaylistMessage> for PlaylistGenerator {
|
impl Handler<GeneratePlaylistMessage> for PlaylistGenerator {
|
||||||
type Result = ResponseFuture<Result<String>>;
|
type Result = ResponseFuture<Result<()>>;
|
||||||
|
|
||||||
fn handle(&mut self, msg: GeneratePlaylistMessage, _ctx: &mut Self::Context) -> Self::Result {
|
fn handle(&mut self, msg: GeneratePlaylistMessage, _ctx: &mut Self::Context) -> Self::Result {
|
||||||
let video_file = msg.video_path.to_str().unwrap().to_owned();
|
let video_file = msg.video_path.to_str().unwrap().to_owned();
|
||||||
@@ -266,7 +270,7 @@ impl Handler<GeneratePlaylistMessage> for PlaylistGenerator {
|
|||||||
ffmpeg_result
|
ffmpeg_result
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok("meeee".to_string())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user