mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
per-volume rescan interval
This commit is contained in:
parent
190473bd32
commit
8d755d41e0
|
@ -271,6 +271,7 @@ def run_argparse(argv, formatter):
|
|||
\033[36md2d\033[35m disables all database stuff, overrides -e2*
|
||||
\033[36mdhash\033[35m disables file hashing on initial scans, also ehash
|
||||
\033[36mhist=/tmp/cdb\033[35m puts thumbnails and indexes at that location
|
||||
\033[36mscan=60\033[35m scan for new files every 60sec, same as --re-maxage
|
||||
|
||||
\033[0mdatabase, audio tags:
|
||||
"mte", "mth", "mtp", "mtm" all work the same as -mte, -mth, ...
|
||||
|
@ -391,7 +392,7 @@ def run_argparse(argv, formatter):
|
|||
ap2.add_argument("--hist", metavar="PATH", type=u, help="where to store volume data (db, thumbs)")
|
||||
ap2.add_argument("--no-hash", action="store_true", help="disable hashing during e2ds folder scans")
|
||||
ap2.add_argument("--re-int", metavar="SEC", type=int, default=30, help="disk rescan check interval")
|
||||
ap2.add_argument("--re-maxage", metavar="SEC", type=int, default=0, help="disk rescan volume interval (0=off)")
|
||||
ap2.add_argument("--re-maxage", metavar="SEC", type=int, default=0, help="disk rescan volume interval, 0=off, can be set per-volume with the 'scan' cflag")
|
||||
ap2.add_argument("--srch-time", metavar="SEC", type=int, default=30, help="search deadline")
|
||||
|
||||
ap2 = ap.add_argument_group('metadata db options')
|
||||
|
|
|
@ -807,6 +807,11 @@ class AuthSrv(object):
|
|||
if "pk" in vol.flags and "gz" not in vol.flags and "xz" not in vol.flags:
|
||||
vol.flags["gz"] = False # def.pk
|
||||
|
||||
if "scan" in vol.flags:
|
||||
vol.flags["scan"] = int(vol.flags["scan"])
|
||||
elif self.args.re_maxage:
|
||||
vol.flags["scan"] = self.args.re_maxage
|
||||
|
||||
all_mte = {}
|
||||
errors = False
|
||||
for vol in vfs.all_vols.values():
|
||||
|
|
|
@ -176,20 +176,21 @@ class Up2k(object):
|
|||
return None
|
||||
|
||||
def _sched_rescan(self):
|
||||
maxage = self.args.re_maxage
|
||||
volage = {}
|
||||
while True:
|
||||
time.sleep(self.args.re_int)
|
||||
now = time.time()
|
||||
vpaths = list(sorted(self.asrv.vfs.all_vols.keys()))
|
||||
with self.mutex:
|
||||
if maxage:
|
||||
for vp in vpaths:
|
||||
if vp not in volage:
|
||||
volage[vp] = now
|
||||
for vp, vol in sorted(self.asrv.vfs.all_vols.items()):
|
||||
maxage = vol.flags.get("scan")
|
||||
if not maxage:
|
||||
continue
|
||||
|
||||
if now - volage[vp] >= maxage:
|
||||
self.need_rescan[vp] = 1
|
||||
if vp not in volage:
|
||||
volage[vp] = now
|
||||
|
||||
if now - volage[vp] >= maxage:
|
||||
self.need_rescan[vp] = 1
|
||||
|
||||
if not self.need_rescan:
|
||||
continue
|
||||
|
|
|
@ -39,6 +39,7 @@ class Cfg(Namespace):
|
|||
no_scandir=False,
|
||||
no_sendfile=True,
|
||||
no_rescan=True,
|
||||
re_maxage=0,
|
||||
ihead=False,
|
||||
nih=True,
|
||||
mtp=[],
|
||||
|
|
|
@ -26,6 +26,7 @@ class Cfg(Namespace):
|
|||
"no_hash": False,
|
||||
"css_browser": None,
|
||||
"no_voldump": True,
|
||||
"re_maxage": 0,
|
||||
"rproxy": 0,
|
||||
}
|
||||
ex.update(ex2)
|
||||
|
|
Loading…
Reference in a new issue