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[36md2d\033[35m disables all database stuff, overrides -e2*
|
||||||
\033[36mdhash\033[35m disables file hashing on initial scans, also ehash
|
\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[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:
|
\033[0mdatabase, audio tags:
|
||||||
"mte", "mth", "mtp", "mtm" all work the same as -mte, -mth, ...
|
"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("--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("--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-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.add_argument("--srch-time", metavar="SEC", type=int, default=30, help="search deadline")
|
||||||
|
|
||||||
ap2 = ap.add_argument_group('metadata db options')
|
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:
|
if "pk" in vol.flags and "gz" not in vol.flags and "xz" not in vol.flags:
|
||||||
vol.flags["gz"] = False # def.pk
|
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 = {}
|
all_mte = {}
|
||||||
errors = False
|
errors = False
|
||||||
for vol in vfs.all_vols.values():
|
for vol in vfs.all_vols.values():
|
||||||
|
|
|
@ -176,20 +176,21 @@ class Up2k(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _sched_rescan(self):
|
def _sched_rescan(self):
|
||||||
maxage = self.args.re_maxage
|
|
||||||
volage = {}
|
volage = {}
|
||||||
while True:
|
while True:
|
||||||
time.sleep(self.args.re_int)
|
time.sleep(self.args.re_int)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
vpaths = list(sorted(self.asrv.vfs.all_vols.keys()))
|
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
if maxage:
|
for vp, vol in sorted(self.asrv.vfs.all_vols.items()):
|
||||||
for vp in vpaths:
|
maxage = vol.flags.get("scan")
|
||||||
if vp not in volage:
|
if not maxage:
|
||||||
volage[vp] = now
|
continue
|
||||||
|
|
||||||
if now - volage[vp] >= maxage:
|
if vp not in volage:
|
||||||
self.need_rescan[vp] = 1
|
volage[vp] = now
|
||||||
|
|
||||||
|
if now - volage[vp] >= maxage:
|
||||||
|
self.need_rescan[vp] = 1
|
||||||
|
|
||||||
if not self.need_rescan:
|
if not self.need_rescan:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -39,6 +39,7 @@ class Cfg(Namespace):
|
||||||
no_scandir=False,
|
no_scandir=False,
|
||||||
no_sendfile=True,
|
no_sendfile=True,
|
||||||
no_rescan=True,
|
no_rescan=True,
|
||||||
|
re_maxage=0,
|
||||||
ihead=False,
|
ihead=False,
|
||||||
nih=True,
|
nih=True,
|
||||||
mtp=[],
|
mtp=[],
|
||||||
|
|
|
@ -26,6 +26,7 @@ class Cfg(Namespace):
|
||||||
"no_hash": False,
|
"no_hash": False,
|
||||||
"css_browser": None,
|
"css_browser": None,
|
||||||
"no_voldump": True,
|
"no_voldump": True,
|
||||||
|
"re_maxage": 0,
|
||||||
"rproxy": 0,
|
"rproxy": 0,
|
||||||
}
|
}
|
||||||
ex.update(ex2)
|
ex.update(ex2)
|
||||||
|
|
Loading…
Reference in a new issue