From 127f414e9c702a8d531a9e110d835bc8ab85535c Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 26 Nov 2024 18:52:23 +0000 Subject: [PATCH] improve phrasing in indexer messages (#120) --- copyparty/up2k.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index d314862f..61e7688d 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -95,9 +95,10 @@ HINT_HISTPATH = "you could try moving the database to another location (preferab class Dbw(object): - def __init__(self, c: "sqlite3.Cursor", n: int, t: float) -> None: + def __init__(self, c: "sqlite3.Cursor", n: int, nf: int, t: float) -> None: self.c = c self.n = n + self.nf = nf self.t = t @@ -1267,7 +1268,7 @@ class Up2k(object): assert reg and self.pp # !rm cur, db_path = reg - db = Dbw(cur, 0, time.time()) + db = Dbw(cur, 0, 0, time.time()) self.pp.n = next(db.c.execute("select count(w) from up"))[0] excl = [ @@ -1319,7 +1320,7 @@ class Up2k(object): self.hub.log_stacks() if db.n: - self.log("commit {} new files".format(db.n)) + self.log("commit %d new files; %d updates" % (db.nf, db.n)) if self.args.no_dhash: if db.c.execute("select d from dh").fetchone(): @@ -1621,12 +1622,13 @@ class Up2k(object): # skip upload hooks by not providing vflags self.db_add(db.c, {}, rd, fn, lmod, sz, "", "", wark, wark, "", "", ip, at) db.n += 1 + db.nf += 1 tfa += 1 td = time.time() - db.t if db.n >= 4096 or td >= 60: - self.log("commit {} new files".format(db.n)) + self.log("commit %d new files; %d updates" % (db.nf, db.n)) db.c.connection.commit() - db.n = 0 + db.n = db.nf = 0 db.t = time.time() if not self.args.no_dhash: