Improve start time of rawtherapee when Dark-frames and Flat-fileds directories are set at default (windows), fixes #4103

This commit is contained in:
heckflosse 2017-10-08 17:27:39 +02:00
parent 2f32afa841
commit d84a3fd40a
2 changed files with 46 additions and 57 deletions

View File

@ -334,6 +334,12 @@ void DFManager::init( Glib::ustring pathname )
dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool) dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool)
{ {
auto ext = getFileExtension(filename);
if (ext.empty() || !options.is_extention_enabled(ext)) {
return nullptr;
}
auto file = Gio::File::create_for_path(filename); auto file = Gio::File::create_for_path(filename);
if (!file) { if (!file) {
@ -346,7 +352,7 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool)
try { try {
auto info = file->query_info (); auto info = file->query_info("standard::name,standard::type,standard::is-hidden");
if (!info && info->get_file_type() == Gio::FILE_TYPE_DIRECTORY) { if (!info && info->get_file_type() == Gio::FILE_TYPE_DIRECTORY) {
return nullptr; return nullptr;
@ -356,17 +362,6 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool)
return nullptr; return nullptr;
} }
Glib::ustring ext;
auto lastdot = info->get_name ().find_last_of ('.');
if (lastdot != Glib::ustring::npos) {
ext = info->get_name ().substr (lastdot + 1);
}
if (!options.is_extention_enabled (ext)) {
return nullptr;
}
RawImage ri(filename); RawImage ri(filename);
int res = ri.loadRaw(false); // Read informations about shot int res = ri.loadRaw(false); // Read informations about shot
@ -378,7 +373,7 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool)
if(!pool) { if(!pool) {
dfInfo n(filename, "", "", 0, 0, 0); dfInfo n(filename, "", "", 0, 0, 0);
iter = dfList.insert(std::pair< std::string, dfInfo>( "", n ) ); iter = dfList.emplace("", n);
return &(iter->second); return &(iter->second);
} }
@ -393,7 +388,7 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool)
if(iter == dfList.end()) { if(iter == dfList.end()) {
dfInfo n(filename, ((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(), idata.getISOSpeed(), idata.getShutterSpeed(), idata.getDateTimeAsTS()); dfInfo n(filename, ((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(), idata.getISOSpeed(), idata.getShutterSpeed(), idata.getDateTimeAsTS());
iter = dfList.insert(std::pair< std::string, dfInfo>( key, n ) ); iter = dfList.emplace(key, n);
} else { } else {
while(iter != dfList.end() && iter->second.key() == key && ABS(iter->second.timestamp - idata.getDateTimeAsTS()) > 60 * 60 * 6) { // 6 hour difference while(iter != dfList.end() && iter->second.key() == key && ABS(iter->second.timestamp - idata.getDateTimeAsTS()) > 60 * 60 * 6) { // 6 hour difference
++iter; ++iter;
@ -403,7 +398,7 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool)
iter->second.pathNames.push_back(filename); iter->second.pathNames.push_back(filename);
} else { } else {
dfInfo n(filename, ((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(), idata.getISOSpeed(), idata.getShutterSpeed(), idata.getDateTimeAsTS()); dfInfo n(filename, ((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(), idata.getISOSpeed(), idata.getShutterSpeed(), idata.getDateTimeAsTS());
iter = dfList.insert(std::pair< std::string, dfInfo>( key, n ) ); iter = dfList.emplace(key, n);
} }
} }

View File

@ -21,6 +21,7 @@
#include "rawimage.h" #include "rawimage.h"
#include "imagedata.h" #include "imagedata.h"
#include "median.h" #include "median.h"
#include "utils.h"
namespace rtengine namespace rtengine
{ {
@ -288,6 +289,12 @@ void FFManager::init( Glib::ustring pathname )
ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool) ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool)
{ {
auto ext = getFileExtension(filename);
if (ext.empty() || !options.is_extention_enabled(ext)) {
return nullptr;
}
auto file = Gio::File::create_for_path(filename); auto file = Gio::File::create_for_path(filename);
if (!file ) { if (!file ) {
@ -300,7 +307,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool)
try { try {
auto info = file->query_info (); auto info = file->query_info("standard::name,standard::type,standard::is-hidden");
if (!info || info->get_file_type() == Gio::FILE_TYPE_DIRECTORY) { if (!info || info->get_file_type() == Gio::FILE_TYPE_DIRECTORY) {
return nullptr; return nullptr;
@ -310,19 +317,6 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool)
return nullptr; return nullptr;
} }
Glib::ustring ext;
auto lastdot = info->get_name ().find_last_of ('.');
if (lastdot != Glib::ustring::npos) {
ext = info->get_name ().substr (lastdot + 1);
}
if (!options.is_extention_enabled (ext)) {
return nullptr;
}
RawImage ri(filename); RawImage ri(filename);
int res = ri.loadRaw(false); // Read informations about shot int res = ri.loadRaw(false); // Read informations about shot
@ -334,7 +328,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool)
if(!pool) { if(!pool) {
ffInfo n(filename, "", "", "", 0, 0, 0); ffInfo n(filename, "", "", "", 0, 0, 0);
iter = ffList.insert(std::pair< std::string, ffInfo>( "", n ) ); iter = ffList.emplace("", n);
return &(iter->second); return &(iter->second);
} }
@ -349,7 +343,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool)
if(iter == ffList.end()) { if(iter == ffList.end()) {
ffInfo n(filename, idata.getMake(), idata.getModel(), idata.getLens(), idata.getFocalLen(), idata.getFNumber(), idata.getDateTimeAsTS()); ffInfo n(filename, idata.getMake(), idata.getModel(), idata.getLens(), idata.getFocalLen(), idata.getFNumber(), idata.getDateTimeAsTS());
iter = ffList.insert(std::pair< std::string, ffInfo>( key, n ) ); iter = ffList.emplace(key, n);
} else { } else {
while(iter != ffList.end() && iter->second.key() == key && ABS(iter->second.timestamp - ri.get_timestamp()) > 60 * 60 * 6) { // 6 hour difference while(iter != ffList.end() && iter->second.key() == key && ABS(iter->second.timestamp - ri.get_timestamp()) > 60 * 60 * 6) { // 6 hour difference
++iter; ++iter;
@ -359,7 +353,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool)
iter->second.pathNames.push_back(filename); iter->second.pathNames.push_back(filename);
} else { } else {
ffInfo n(filename, idata.getMake(), idata.getModel(), idata.getLens(), idata.getFocalLen(), idata.getFNumber(), idata.getDateTimeAsTS()); ffInfo n(filename, idata.getMake(), idata.getModel(), idata.getLens(), idata.getFocalLen(), idata.getFNumber(), idata.getDateTimeAsTS());
iter = ffList.insert(std::pair< std::string, ffInfo>( key, n ) ); iter = ffList.emplace(key, n);
} }
} }