app: find a clip in the folder it was recorded to

History lists a timeline from the default recordings folder, where
the daemon writes them, but review looked for its clip only there as
well. A recording made into the folder chosen in settings therefore
appeared in history with no video. The app now searches the
configured folder first and the default one after it, and uses the
path stored with the timeline when the recorder wrote one, so a clip
stays playable after the setting moves and an older timeline still
plays.

Settings are read back after a save because the daemon resolves the
chosen folder to an absolute path. The two Open folder buttons open
the configured folder instead of the default one.
This commit is contained in:
vhaudiquet committed 2026-11-23 18:24:22 +01:00
1 parent 86fc7cea2f
commit 9e4349fe42
5 files changed
+167 -34

No files matched your search

+2 -1
View File
@@ -457,7 +457,8 @@ fn delete_confirmed(app: &mut App) {
let Some(summary) = app.games.iter().find(|g| g.recording_id == id).cloned() else {
return;
};
if let Err(e) = history::delete(&id, summary.video_file.as_deref()) {
let video = summary.video_path(&app.video_roots());
if let Err(e) = history::delete(&id, video.as_deref()) {
app.notify_error(e);
return;
}
+12 -4
View File
@@ -1,5 +1,6 @@
//! Game review: the recorded clip, a scrubber with event markers, highlights and export.
use std::path::PathBuf;
use std::sync::mpsc::{Receiver, TryRecvError, channel};
use rune::tok::{radius, space, type_};
@@ -15,6 +16,8 @@ use crate::ui::{self, Paint, body, heading};
pub struct Review {
/// The opened recording, once its file has been read.
pub game: Option<Timeline>,
/// The folders the clip may be in, as the settings named them when the row opened.
pub video_roots: Vec<PathBuf>,
/// Set while that file is on its way to the screen.
pub loading: bool,
pub player: Option<Player>,
@@ -348,6 +351,7 @@ impl Default for Review {
fn default() -> Self {
Self {
game: None,
video_roots: Vec::new(),
loading: false,
player: None,
sounds: Vec::new(),
@@ -396,7 +400,8 @@ pub fn open(app: &mut App, recording_id: &str) {
/// Fill the review screen with a timeline that has been read, and load its clip.
pub fn show(app: &mut App, game: Timeline) {
let path = game.video_path();
let roots = app.video_roots();
let path = game.video_path(&roots);
let highlights = highlight::compute(
&game,
game.summoner().as_deref(),
@@ -405,6 +410,7 @@ pub fn show(app: &mut App, game: Timeline) {
app.review.highlights = highlights;
app.review.duration = game.duration_secs.max(0) as f64;
let video_file = game.video_file.clone();
app.review.video_roots = roots;
app.review.game = Some(game);
let Some(path) = path else {
@@ -459,7 +465,7 @@ fn follow_sound(app: &mut App) {
.review
.game
.as_ref()
.and_then(history::Timeline::video_path)
.and_then(|game| game.video_path(&app.review.video_roots))
else {
return;
};
@@ -912,7 +918,7 @@ fn channels(app: &App, p: Paint) -> Option<El> {
fn clip_row(app: &App, p: Paint, clip: Clip) -> El {
let video = app
.reviewed()
.and_then(|game| game.video_path())
.and_then(|game| game.video_path(&app.review.video_roots))
.map(|path| path.display().to_string());
let name = app
.reviewed()
@@ -1203,7 +1209,9 @@ fn highlights(app: &App, p: Paint, game: &Timeline) -> El {
for (index, clip) in app.review.highlights.iter().enumerate() {
let start = clip.start;
let end = clip.end;
let video = game.video_path().map(|path| path.display().to_string());
let video = game
.video_path(&app.review.video_roots)
.map(|path| path.display().to_string());
let name = format!("{}-highlight-{}", game.recording_id, index);
let kind_ink = match clip.kind {
highlight::Kind::Death => p.danger,
+4 -4
View File
@@ -397,8 +397,8 @@ fn quick(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content:
"open-recordings",
"Open folder",
false,
|_app: &mut App| {
crate::daemon::open_folder(&crate::daemon::recordings_dir());
|app: &mut App| {
crate::daemon::open_folder(&app.output_dir());
},
)),
vec![ui::setting_row(
@@ -479,8 +479,8 @@ fn recording(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, cont
"open-output",
"Open folder",
false,
|_app: &mut App| {
crate::daemon::open_folder(&crate::daemon::recordings_dir());
|app: &mut App| {
crate::daemon::open_folder(&app.output_dir());
},
)),
vec![