[niepce] fwk: Don't panic if the movie thumbnailing fail



commit 68d2625a6fd87b0a8b9b9eea23560af21727f986
Author: Hubert Figuière <hub figuiere net>
Date:   Sat Oct 15 17:53:13 2022 -0400

    fwk: Don't panic if the movie thumbnailing fail
    
    - This was happening if totem-movie-thumbnailer isn't found

 crates/npc-fwk/src/toolkit/movieutils.rs | 11 +++++++----
 src/Makefile.am                          |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/crates/npc-fwk/src/toolkit/movieutils.rs b/crates/npc-fwk/src/toolkit/movieutils.rs
index 385f5b44..304a029c 100644
--- a/crates/npc-fwk/src/toolkit/movieutils.rs
+++ b/crates/npc-fwk/src/toolkit/movieutils.rs
@@ -1,7 +1,7 @@
 /*
  * niepce - npc-fwk/toolkit/movieutils.rs
  *
- * Copyright (C) 2020 Hubert Figuière
+ * Copyright (C) 2020-2022 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,12 +26,15 @@ where
     S: AsRef<Path> + std::fmt::Debug,
     D: AsRef<Path>,
 {
-    let status = Command::new("totem-video-thumbnailer")
+    Command::new("totem-video-thumbnailer")
         .arg("-s")
         .arg(format!("{}", cmp::max(w, h)))
         .arg(source.as_ref().as_os_str())
         .arg(dest.as_ref().as_os_str())
         .status()
-        .unwrap_or_else(|_| panic!("Failed to thumbnail {:?}", source));
-    status.success()
+        .map(|s| s.success())
+        .unwrap_or_else(|e| {
+            err_out!("Failed to thumbnail {:?}: {:?}", source, e);
+            false
+        })
 }
diff --git a/src/Makefile.am b/src/Makefile.am
index 57407842..32259138 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,6 +42,7 @@ RUST_SOURCES = \
        @top_srcdir@/crates/npc-fwk/src/toolkit/configuration.rs \
        @top_srcdir@/crates/npc-fwk/src/toolkit/gdk_utils.rs \
        @top_srcdir@/crates/npc-fwk/src/toolkit/mimetype.rs \
+       @top_srcdir@/crates/npc-fwk/src/toolkit/movieutils.rs \
        @top_srcdir@/crates/npc-fwk/src/toolkit/thumbnail.rs \
        @top_srcdir@/crates/npc-fwk/src/toolkit/widgets.rs \
        @top_srcdir@/crates/npc-fwk/src/toolkit/widgets/rating_label.rs \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]