[niepce] thumbnails: movies: support space in path. delete temp file.



commit aa43bed5172aa38d670279e981d7087050611365
Author: Hubert Figuière <hub figuiere net>
Date:   Fri Jun 2 23:01:58 2017 -0400

    thumbnails: movies: support space in path. delete temp file.

 src/fwk/toolkit/movieutils.cpp |    8 +++++---
 src/fwk/toolkit/thumbnail.cpp  |    1 +
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/fwk/toolkit/movieutils.cpp b/src/fwk/toolkit/movieutils.cpp
index ff4372f..c2b0a3b 100644
--- a/src/fwk/toolkit/movieutils.cpp
+++ b/src/fwk/toolkit/movieutils.cpp
@@ -30,9 +30,9 @@ namespace fwk {
   // TODO be smarter
 bool thumbnail_movie(const std::string &src, int w, int h, const std::string &dest)
 {
-  std::string command = str(boost::format("totem-video-thumbnailer -s %1% %2% %3%") 
-                           % std::max(w,h) % src % dest);
-  return system(command.c_str()) != -1;
+    std::string command = str(boost::format("totem-video-thumbnailer -s %1% \"%2%\" \"%3%\"")
+                              % std::max(w,h) % src % dest);
+    return system(command.c_str()) != -1;
 }
 
 }
@@ -42,6 +42,8 @@ bool thumbnail_movie(const std::string &src, int w, int h, const std::string &de
   c-file-style:"stroustrup"
   c-file-offsets:((innamespace . 0))
   indent-tabs-mode:nil
+  tab-width:4
+  c-basic-offset:4
   fill-column:80
   End:
 */
diff --git a/src/fwk/toolkit/thumbnail.cpp b/src/fwk/toolkit/thumbnail.cpp
index e208a3a..b6199b3 100644
--- a/src/fwk/toolkit/thumbnail.cpp
+++ b/src/fwk/toolkit/thumbnail.cpp
@@ -58,6 +58,7 @@ Thumbnail Thumbnail::thumbnail_file(const std::string& filename,
             std::string cached = Glib::get_tmp_dir() + "/temp-1234";
             if(fwk::thumbnail_movie(filename, w, h, cached)) {
                 pix = Gdk::Pixbuf::create_from_file(cached, w, h, true);
+                unlink(cached.c_str());
             }
         }
         catch(const Glib::Error & e) {


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