Compare commits

...

3 Commits

Author SHA1 Message Date
Andrew Senetar 1f1dfa88dc
Update version & changelog for 4.3.1 release 2022-07-07 22:06:06 -05:00
Andrew Senetar 916c5204cf
Update translations from transifex 2022-07-07 21:57:59 -05:00
Andrew Senetar 71af825b37
Move try/except of cache db to get() and put()
- Move the try/except of cache db calls to the calls themselves.
- Add some additional information to logging statements on cache db
  exception to improve troubleshooting.
2022-07-07 21:52:22 -05:00
4 changed files with 51 additions and 45 deletions

View File

@ -1,2 +1,2 @@
__version__ = "4.3.1-dev"
__version__ = "4.3.1"
__appname__ = "dupeGuru"

View File

@ -144,13 +144,17 @@ class FilesDB:
stat = path.stat()
size = stat.st_size
mtime_ns = stat.st_mtime_ns
try:
with self.lock:
self.cur.execute(
self.select_query.format(key=key), {"path": str(path), "size": size, "mtime_ns": mtime_ns}
)
result = self.cur.fetchone()
with self.lock:
self.cur.execute(self.select_query.format(key=key), {"path": str(path), "size": size, "mtime_ns": mtime_ns})
result = self.cur.fetchone()
if result:
return result[0]
if result:
return result[0]
except Exception as ex:
logging.warning(f"Couldn't get {key} for {path} w/{size}, {mtime_ns}: {ex}")
return None
@ -158,12 +162,14 @@ class FilesDB:
stat = path.stat()
size = stat.st_size
mtime_ns = stat.st_mtime_ns
with self.lock:
self.cur.execute(
self.insert_query.format(key=key),
{"path": str(path), "size": size, "mtime_ns": mtime_ns, "value": value},
)
try:
with self.lock:
self.cur.execute(
self.insert_query.format(key=key),
{"path": str(path), "size": size, "mtime_ns": mtime_ns, "value": value},
)
except Exception as ex:
logging.warning(f"Couldn't put {key} for {path} w/{size}, {mtime_ns}: {ex}")
def commit(self) -> None:
with self.lock:
@ -265,34 +271,25 @@ class File:
self.size = nonone(stats.st_size, 0)
self.mtime = nonone(stats.st_mtime, 0)
elif field == "digest_partial":
try:
self.digest_partial = filesdb.get(self.path, "digest_partial")
if self.digest_partial is None:
self.digest_partial = self._calc_digest_partial()
filesdb.put(self.path, "digest_partial", self.digest_partial)
except Exception as e:
logging.warning("Couldn't get digest_partial for %s: %s", self.path, e)
self.digest_partial = filesdb.get(self.path, "digest_partial")
if self.digest_partial is None:
self.digest_partial = self._calc_digest_partial()
filesdb.put(self.path, "digest_partial", self.digest_partial)
elif field == "digest":
try:
self.digest = filesdb.get(self.path, "digest")
if self.digest is None:
self.digest = self._calc_digest()
filesdb.put(self.path, "digest", self.digest)
except Exception as e:
logging.warning("Couldn't get digest for %s: %s", self.path, e)
self.digest = filesdb.get(self.path, "digest")
if self.digest is None:
self.digest = self._calc_digest()
filesdb.put(self.path, "digest", self.digest)
elif field == "digest_samples":
size = self.size
# Might as well hash such small files entirely.
if size <= MIN_FILE_SIZE:
setattr(self, field, self.digest)
return
try:
self.digest_samples = filesdb.get(self.path, "digest_samples")
if self.digest_samples is None:
self.digest_samples = self._calc_digest_samples()
filesdb.put(self.path, "digest_samples", self.digest_samples)
except Exception as e:
logging.warning(f"Couldn't get digest_samples for {self.path}: {e}")
self.digest_samples = filesdb.get(self.path, "digest_samples")
if self.digest_samples is None:
self.digest_samples = self._calc_digest_samples()
filesdb.put(self.path, "digest_samples", self.digest_samples)
def _read_all_info(self, attrnames=None):
"""Cache all possible info.

View File

@ -1,3 +1,8 @@
=== 4.3.1 (2022-07-08)
* Fix issue where cache db exceptions could prevent files being hashed (#1015)
* Add extra guard for non-zero length files without digests to prevent false duplicates
* Update Italian translations
=== 4.3.0 (2022-07-01)
* Redirect stdout from custom command to the log files (#1008)
* Update translations

View File

@ -2,15 +2,16 @@
# Andrew Senetar <arsenetar@gmail.com>, 2022
# Emanuele, 2022
# Fuan <jcfrt@posteo.net>, 2022
# Giovanni, 2022
#
msgid ""
msgstr ""
"Last-Translator: Fuan <jcfrt@posteo.net>, 2022\n"
"Last-Translator: Giovanni, 2022\n"
"Language-Team: Italian (https://www.transifex.com/voltaicideas/teams/116153/it/)\n"
"Language: it\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: utf-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
#: qt/app.py:81
msgid "Quit"
@ -979,37 +980,40 @@ msgstr "Ignora file più grandi di"
#: qt\app.py:135 qt\app.py:293
msgid "Clear Cache"
msgstr ""
msgstr "Svuota cache"
#: qt\app.py:294
msgid ""
"Do you really want to clear the cache? This will remove all cached file "
"hashes and picture analysis."
msgstr ""
"Vuoi davvero svuotare la cache? Ciò rimuoverà tutti gli hash dei file "
"memorizzati nella cache e le analisi delle immagini."
#: qt\app.py:299
msgid "Cache cleared."
msgstr ""
msgstr "Cache svuotata"
#: qt\preferences_dialog.py:173
msgid "Use dark style"
msgstr ""
msgstr "Usa stile scuro"
#: qt\preferences_dialog.py:241
msgid "Profile scan operation"
msgstr ""
msgstr "Profila l'operazione di scansione"
#: qt\preferences_dialog.py:242
msgid "Profile the scan operation and save logs for optimization."
msgstr ""
"Profila l'operazione di scansione e salva i registri per l'ottimizzazione."
#: qt\preferences_dialog.py:246
msgid "Logs located in: <a href=\"{}\">{}</a>"
msgstr ""
msgstr "I log si trovano in: <a href=\"{}\">{}</a>"
#: qt\preferences_dialog.py:291
msgid "Debug"
msgstr ""
msgstr "Debug"
#: qt\about_box.py:31
msgid "About {}"
@ -1021,7 +1025,7 @@ msgstr "Versione {}"
#: qt\about_box.py:49 qt\about_box.py:75
msgid "Checking for updates..."
msgstr ""
msgstr "Controllo degli aggiornamenti..."
#: qt\about_box.py:54
msgid "Licensed under GPLv3"
@ -1029,11 +1033,11 @@ msgstr "Distribuito sotto licenza GPLv3"
#: qt\about_box.py:68
msgid "No update available."
msgstr ""
msgstr "Nessun aggiornamento disponibile."
#: qt\about_box.py:71
msgid "New version {} available, download <a href=\"{}\">here</a>."
msgstr ""
msgstr "È disponibile la nuova versione {}, scaricabile <a href=\"{}\">qui</a>."
#: qt\error_report_dialog.py:50
msgid "Error Report"