add hash number MD5 to mip files

This commit is contained in:
Desmis 2017-02-14 13:16:13 +01:00
parent 7800b51a5d
commit c2f161b280
6 changed files with 39 additions and 5 deletions

View File

@ -1075,7 +1075,7 @@ PREFERENCES_MIP;Mip Profiles
PREFERENCES_MIP_LABEL;Mip profiles:
PREFERENCES_MIP_OPT;Mip files in cache
PREFERENCES_MIP_PREV;Next Input file
PREFERENCES_MIP_TOOLTIP;Next input file allow multiple sessions of the same file, but do not allow path with NON ASCII characters.\nMip files in Cache, allow NON ASCII characters in path, but allow only one session for the same file.
PREFERENCES_MIP_TOOLTIP;Next input file allow multiple sessions of the same file, but do not allow path with NON ASCII characters.\nMip files in Cache, allow NON ASCII characters in path, allow multi session for the same file.
PREFERENCES_MONINTENT;Default rendering intent
PREFERENCES_MONITOR;Monitor
PREFERENCES_MONPROFILE;Default color profile

View File

@ -26,6 +26,9 @@
#include <fstream>
#include <string>
#include <unistd.h>
#include "../rtgui/cachemanager.h"
#include "../rtgui/cacheimagedata.h"
//#include <chrono>
// "ceil" rounding
//#define SKIPS(a,b) ((a) / (b) + ((a) % (b) > 0))
@ -836,12 +839,20 @@ void Crop::update (int todo)
// if (tyty ) {
//Glib::ustring datalab2 = parent->imgsrc->getFileName() + ".mip";
// Glib::ustring pop = options.getUserProfilePath() + "/";
CacheManager* cachemgr; // parent
CacheImageData cfs; // cache entry corresponding to the thumbnai
cfs.md5 = cachemgr->getMD5 (parent->imgsrc->getFileName());
std::string mdfive = cfs.md5;
// printf("md5=%s \n", mdfive.c_str());
Glib::ustring pop = options.cacheBaseDir + "/mip/";
Glib::ustring datalab;
if (options.mip == MI_opt) {
datalab = pop + Glib::path_get_basename (parent->imgsrc->getFileName () + ".mip");
datalab = pop + Glib::path_get_basename (parent->imgsrc->getFileName () + "." + mdfive + ".mip");
}
if (options.mip == MI_prev) {

View File

@ -26,6 +26,9 @@
#include <iostream>
#include <fstream>
#include <string>
#include "../rtgui/cachemanager.h"
#include "../rtgui/cacheimagedata.h"
#include "iccstore.h"
#ifdef _OPENMP
#include <omp.h>
@ -717,6 +720,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
*/
bool isascii = true;
CacheManager* cachemgr; // parent
CacheImageData cfs; // cache entry corresponding to the thumbnai
cfs.md5 = cachemgr->getMD5 (imgsrc->getFileName());
std::string mdfive = cfs.md5;
// printf("md5=%s \n", mdfive.c_str());
Glib::ustring datainterm = imgsrc->getFileName() + ".ii";//extansion ii arbitrary to test if mip file is possible
ofstream finterm (datainterm, ios::out);
@ -744,9 +755,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
Glib::ustring datal;
if (options.mip == MI_opt || !isascii) {
datal = pop + Glib::path_get_basename (imgsrc->getFileName () + ".mip");
datal = pop + Glib::path_get_basename (imgsrc->getFileName () + "." + mdfive + ".mip");
}
if (options.mip == MI_prev && isascii) {//&& isascii

View File

@ -26,6 +26,7 @@
#include "imagesource.h"
#include "procevents.h"
#include "dcrop.h"
#include "LUT.h"
#include "../rtgui/threadutils.h"

View File

@ -32,6 +32,8 @@
#include <iostream>
#include <fstream>
#include <string>
#include "../rtgui/cachemanager.h"
#include "../rtgui/cacheimagedata.h"
#undef THREAD_PRIORITY_NORMAL
@ -946,6 +948,11 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
if (params.locallab.enabled) {
MyTime t1, t2;
t1.set();
CacheManager* cachemgr; // parent
CacheImageData cfs; // cache entry corresponding to the thumbnai
cfs.md5 = cachemgr->getMD5 (imgsrc->getFileName());
std::string mdfive = cfs.md5;
//Glib::ustring datalab = imgsrc->getFileName() + ".mip";
@ -955,7 +962,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
Glib::ustring datalab;
if (options.mip == MI_opt) {
datalab = pop + Glib::path_get_basename (imgsrc->getFileName () + ".mip");
datalab = pop + Glib::path_get_basename (imgsrc->getFileName () + "." + mdfive + ".mip");
}
if (options.mip == MI_prev) {

View File

@ -195,6 +195,7 @@ void CacheManager::renameEntry (const std::string& oldfilename, const std::strin
error |= g_rename (getCacheFileName ("aehistograms", oldfilename, "", oldmd5).c_str (), getCacheFileName ("aehistograms", newfilename, "", newmd5).c_str ());
error |= g_rename (getCacheFileName ("embprofiles", oldfilename, ".icc", oldmd5).c_str (), getCacheFileName ("embprofiles", newfilename, ".icc", newmd5).c_str ());
error |= g_rename (getCacheFileName ("data", oldfilename, ".txt", oldmd5).c_str (), getCacheFileName ("data", newfilename, ".txt", newmd5).c_str ());
error |= g_rename (getCacheFileName ("mip", oldfilename, ".mip", oldmd5).c_str (), getCacheFileName ("mip", newfilename, ".mip", newmd5).c_str ());
if (error != 0 && options.rtSettings.verbose) {
std::cerr << "Failed to rename all files for cache entry '" << oldfilename << "': " << g_strerror (errno) << std::endl;
@ -255,6 +256,8 @@ void CacheManager::clearProfiles () const
MyMutex::MyLock lock (mutex);
deleteDir ("profiles");
deleteDir ("mip");
}
void CacheManager::deleteDir (const Glib::ustring& dirName) const
@ -295,6 +298,8 @@ void CacheManager::deleteFiles (const Glib::ustring& fname, const std::string& m
if (purgeProfile) {
error |= g_remove (getCacheFileName ("profiles", fname, paramFileExtension, md5).c_str ());
error |= g_remove (getCacheFileName ("mip", fname, ".mip", md5).c_str ());
}
if (error != 0 && options.rtSettings.verbose) {