diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-24 20:12:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-24 20:12:43 +0100 |
| commit | 977b36672892b14de4ecb68e98415c64946e8a93 (patch) | |
| tree | 2e264ce029fdd9d0abe6e9e958111a5ddd2cea45 /src/lib/examine_content_job.cc | |
| parent | baf6bc63df6577d6efdc12ae605aa94754b73882 (diff) | |
Tidy up now we have a x-thread signaller.
Diffstat (limited to 'src/lib/examine_content_job.cc')
| -rw-r--r-- | src/lib/examine_content_job.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index 0187e1776..8fadce2f6 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -21,6 +21,7 @@ * @brief A class to run through content at high speed to find its length. */ +#include <boost/filesystem.hpp> #include "examine_content_job.h" #include "options.h" #include "decoder_factory.h" @@ -98,6 +99,28 @@ ExamineContentJob::run () } + string const tdir = _film->dir ("thumbs"); + vector<int> thumbs; + + for (filesystem::directory_iterator i = filesystem::directory_iterator (tdir); i != filesystem::directory_iterator(); ++i) { + + /* Aah, the sweet smell of progress */ +#if BOOST_FILESYSTEM_VERSION == 3 + string const l = filesystem::path(*i).leaf().generic_string(); +#else + string const l = i->leaf (); +#endif + + size_t const d = l.find (".png"); + size_t const t = l.find (".tmp"); + if (d != string::npos && t == string::npos) { + thumbs.push_back (atoi (l.substr (0, d).c_str())); + } + } + + sort (thumbs.begin(), thumbs.end()); + _film->set_thumbs (thumbs); + ascend (); set_progress (1); set_state (FINISHED_OK); |
