Merge remote-tracking branch 'upstream/release-0.9.0' into event_view

This commit is contained in:
Bernt Christian Egeland 2021-08-23 18:14:51 +02:00
commit 9ead6480ce
5 changed files with 23 additions and 10 deletions

View File

@ -244,6 +244,8 @@ class RecordingCleanup(threading.Thread):
def expire_files(self): def expire_files(self):
logger.debug("Start expire files (legacy).") logger.debug("Start expire files (legacy).")
shortest_retention = self.config.record.retain_days
default_expire = ( default_expire = (
datetime.datetime.now().timestamp() datetime.datetime.now().timestamp()
- SECONDS_IN_DAY * self.config.record.retain_days - SECONDS_IN_DAY * self.config.record.retain_days
@ -254,8 +256,19 @@ class RecordingCleanup(threading.Thread):
datetime.datetime.now().timestamp() datetime.datetime.now().timestamp()
- SECONDS_IN_DAY * camera.record.retain_days - SECONDS_IN_DAY * camera.record.retain_days
) )
if camera.record.retain_days < shortest_retention:
shortest_retention = camera.record.retain_days
for p in Path("/media/frigate/recordings").rglob("*.mp4"): logger.debug(f"Shortest retention: {shortest_retention}")
process = sp.run(
["find", RECORD_DIR, "-type", "f", "-mtime", f"+{shortest_retention}"],
capture_output=True,
text=True,
)
files_to_check = process.stdout.splitlines()
for f in files_to_check:
p = Path(f)
# Ignore files that have a record in the recordings DB # Ignore files that have a record in the recordings DB
if Recordings.select().where(Recordings.path == str(p)).count(): if Recordings.select().where(Recordings.path == str(p)).count():
continue continue
@ -265,8 +278,8 @@ class RecordingCleanup(threading.Thread):
logger.debug("End expire files (legacy).") logger.debug("End expire files (legacy).")
def run(self): def run(self):
# Expire recordings every minute, clean directories every 5 minutes. # Expire recordings every minute, clean directories every hour.
for counter in itertools.cycle(range(5)): for counter in itertools.cycle(range(60)):
if self.stop_event.wait(60): if self.stop_event.wait(60):
logger.info(f"Exiting recording cleanup...") logger.info(f"Exiting recording cleanup...")
break break

View File

@ -23,7 +23,7 @@ export default function App() {
) : ( ) : (
<div className="flex flex-row min-h-screen w-full bg-white dark:bg-gray-900 text-gray-900 dark:text-white"> <div className="flex flex-row min-h-screen w-full bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
<Sidebar /> <Sidebar />
<div className="w-full flex-auto p-2 mt-24 px-4 min-w-0"> <div className="w-full flex-auto p-2 mt-16 px-4 min-w-0">
<Router> <Router>
<AsyncRoute path="/cameras/:camera/editor" getComponent={Routes.getCameraMap} /> <AsyncRoute path="/cameras/:camera/editor" getComponent={Routes.getCameraMap} />
<AsyncRoute path="/cameras/:camera" getComponent={Routes.getCamera} /> <AsyncRoute path="/cameras/:camera" getComponent={Routes.getCamera} />

View File

@ -63,7 +63,7 @@ export default function AppBar() {
<MenuSeparator /> <MenuSeparator />
<MenuItem icon={FrigateRestartIcon} label="Restart Frigate" onSelect={handleRestart} /> <MenuItem icon={FrigateRestartIcon} label="Restart Frigate" onSelect={handleRestart} />
</Menu> </Menu>
) : null}, ) : null}
{showDialog ? ( {showDialog ? (
<Dialog <Dialog
onDismiss={handleDismissRestartDialog} onDismiss={handleDismissRestartDialog}
@ -74,7 +74,7 @@ export default function AppBar() {
{ text: 'Cancel', onClick: handleDismissRestartDialog }, { text: 'Cancel', onClick: handleDismissRestartDialog },
]} ]}
/> />
) : null}, ) : null}
{showDialogWait ? ( {showDialogWait ? (
<Dialog <Dialog
title="Restart in progress" title="Restart in progress"

View File

@ -37,13 +37,13 @@ export default function AppBar({ title: Title, overflowRef, onOverflowClick }) {
return ( return (
<div <div
className={`w-full border-b border-gray-200 dark:border-gray-700 flex items-center align-middle p-4 space-x-2 fixed left-0 right-0 z-10 bg-white dark:bg-gray-900 transform transition-all duration-200 ${ className={`w-full border-b border-gray-200 dark:border-gray-700 flex items-center align-middle p-2 fixed left-0 right-0 z-10 bg-white dark:bg-gray-900 transform transition-all duration-200 ${
!show ? '-translate-y-full' : 'translate-y-0' !show ? '-translate-y-full' : 'translate-y-0'
} ${!atZero ? 'shadow-sm' : ''}`} } ${!atZero ? 'shadow-sm' : ''}`}
data-testid="appbar" data-testid="appbar"
> >
<div className="lg:hidden"> <div className="lg:hidden">
<Button color="black" className="rounded-full w-12 h-12" onClick={handleShowDrawer} type="text"> <Button color="black" className="rounded-full w-10 h-10" onClick={handleShowDrawer} type="text">
<MenuIcon className="w-10 h-10" /> <MenuIcon className="w-10 h-10" />
</Button> </Button>
</div> </div>
@ -54,7 +54,7 @@ export default function AppBar({ title: Title, overflowRef, onOverflowClick }) {
<Button <Button
aria-label="More options" aria-label="More options"
color="black" color="black"
className="rounded-full w-12 h-12" className="rounded-full w-9 h-9"
onClick={onOverflowClick} onClick={onOverflowClick}
type="text" type="text"
> >

View File

@ -22,7 +22,7 @@ export default function NavigationDrawer({ children, header }) {
onClick={handleDismiss} onClick={handleDismiss}
> >
{header ? ( {header ? (
<div className="flex-shrink-0 p-5 flex flex-row items-center justify-between border-b border-gray-200 dark:border-gray-700"> <div className="flex-shrink-0 p-2 flex flex-row items-center justify-between border-b border-gray-200 dark:border-gray-700">
{header} {header}
</div> </div>
) : null} ) : null}