seydx / camera.ui

NVR like user Interface for RTSP capable cameras

Home Page:https://github.com/seydx/camera.ui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use full disk - recycle. (never delete)

captainerd opened this issue · comments

Is your feature request related to a problem? Please describe.
no.

Describe the solution you'd like
Using full disk with periodically checks in order to delete the oldest video to make more space than 5gb
(assuming 5gb is a safe-space for OS. updates etc)

Describe alternatives you've considered
Altering a few lines at the cleartimer.js at the line 62 and bellow? i will provide an example.

` if (recRemoveAfter) {
const recordings = Cleartimer.#recordingsDB.chain.get('recordings').cloneDeep().value();

    //will need to check free space later.
    const recPath = Cleartimer.#recordingsDB.chain.get('path').cloneDeep().value();

    //Change the (for loop) array to loop with shorting from lowest unix timestamp first to higher (oldest)  

    for (const recording of recordings.sort(({ timestamp: a }, { timestamp: b }) => a - b)) {


      //Recycle option? considering frontend hides 100days for this. (time == 100)

      if (recRemoveAfter == 100) {
        //update available disk space?
        let diskSpace = await checkDiskSpace(recPath);

        //if we left less than 5gb free space, remove that file if still less than 5gb
        if ((Math.round(diskSpace.free / 1e9) < 5)) {
          Cleartimer.#recordingsTimer.set(recording.id, false);
          await Cleartimer.#clearRecording(recording.id);
        }




      } else {
        let timestampNow = moment();.................................................................`

Additional context
Im not sure how often this is called in order to work smoothly and how these timers actually work , i would like an explenation tho.