seydx / camera.ui

NVR like user Interface for RTSP capable cameras
https://github.com/seydx/camera.ui
MIT License
676 stars 108 forks source link

Use full disk - recycle. (never delete) #213

Open captainerd opened 2 years ago

captainerd commented 2 years ago

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.

mkz212 commented 2 months ago

🎉 A new version of camera.ui

A new version of camera.ui is currently under active development. An initial alpha/beta release and previews are coming soon. Stay tuned for exciting updates: https://github.com/seydx/camera.ui/issues/448 .

This version will no longer be developed / fixed. The new version contains many novelties and fixes (most important is for HKSV recording).