mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-16 10:22:07 +08:00
811fd5086f
version: dragonpilot v2023.02.08 release for EON/C2
date: 2023-02-08T05:01:31
dp-dev(priv2) beta2 commit: f770882b7f
44 lines
1001 B
Python
44 lines
1001 B
Python
import os
|
|
from pathlib import Path
|
|
from system.hardware import PC
|
|
from common.params import Params
|
|
|
|
if os.environ.get('LOG_ROOT', False):
|
|
ROOT = os.environ['LOG_ROOT']
|
|
elif PC:
|
|
ROOT = os.path.join(str(Path.home()), ".comma", "media", "0", "realdata")
|
|
else:
|
|
ROOT = '/data/media/0/fakedata/'
|
|
#ROOT = '/data/media/0/realdata/'
|
|
|
|
|
|
CAMERA_FPS = 20
|
|
SEGMENT_LENGTH = 60
|
|
|
|
STATS_DIR_FILE_LIMIT = 10000
|
|
STATS_SOCKET = "ipc:///tmp/stats"
|
|
if PC:
|
|
STATS_DIR = os.path.join(str(Path.home()), ".comma", "stats")
|
|
else:
|
|
STATS_DIR = "/data/stats/"
|
|
STATS_FLUSH_TIME_S = 60
|
|
|
|
def get_available_percent(default=None):
|
|
try:
|
|
statvfs = os.statvfs(ROOT)
|
|
available_percent = 100.0 * statvfs.f_bavail / statvfs.f_blocks
|
|
except OSError:
|
|
available_percent = default
|
|
|
|
return available_percent
|
|
|
|
|
|
def get_available_bytes(default=None):
|
|
try:
|
|
statvfs = os.statvfs(ROOT)
|
|
available_bytes = statvfs.f_bavail * statvfs.f_frsize
|
|
except OSError:
|
|
available_bytes = default
|
|
|
|
return available_bytes
|