Auto tagging folders created by software based NVR?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Auto tagging folders created by software based NVR?

Post by highend »

Can "After painting the files list" run multiple scripts in different locations?
Sure, that's why you should use the "!Main.xys" script to load as many different further script files as necessary

Do these roots

Code: Select all

H:\Axis\Parking\grabs
I:\Axis\Shop\grabs
have the same folder structure underneath them?
E.g.: H:\Axis\Parking\grabs\09102024\<some file name>

Should all files older than a specific creation date be deleted?
One of my scripts helped you out? Please donate via Paypal

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

No, after grabs it just files and no more folders and there are more than the two drives that I mentioned.

H:\Axis\Parking\grabs\<some files name.jpg>
I:\Axis\Shop\grabs\<some files name.jpg>
Should all files older than a specific creation date be deleted?
Yes. I'm hoping I can modify that part myself.

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Auto tagging folders created by software based NVR?

Post by highend »

You can add more root paths if you need to and don't forget to change the $delAfter variable

Save it as e.g. Delete NVR items.xys in this script folder:
cea\Changing locations\After painting the file list

and then modify the !Main.xys to execute it as well:

Code: Select all

    // Tag weekdays in the NVR root folder
    e|load "cea\Changing locations\After painting the file list\NVR tagging.xys";
    
    // Delete item(s) in specific root folders
    e|load "cea\Changing locations\After painting the file list\Delete NVR items.xys";
Delete NVR items.xys:

Code: Select all

    $roots = <<<>>>
H:\Axis\Parking\grabs
I:\Axis\Shop\grabs
    >>>;

    $delAfter = 31; // Day value


    setting "BackgroundFileOps", 0;

    $curPath = get("path");
    if ($delAfter < 1) { end true; }
    foreach($root, $roots, <crlf>, "e") {
        if ($curPath != $root) { continue; }

        $tooOld = quicksearch("ageC: >= $delAfter d /f", $curPath);
        if ($tooOld) { delete 0, 0, $tooOld; }
    }
One of my scripts helped you out? Please donate via Paypal

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

Okay, I just set this up as described and changed it to delete after one day to test for now. Will post back results in a day or so.

Thanks

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

Works perfect! Also, just discovered yesterday that XY's virtual folders allow a better way for me to view all these incoming <jpeg> files with some filter options too and layouts that can remain the same when compared to when you have multiple search templates for different things.

Also, although the NVR has tagging and storage management options, their tagging is proprietary to their system and you then have to view the files within their console which for me is not ideal. Their tagging allow for predetermined tags and tagging things such as motion, vehicle, person, package and so on, but thankfully they at least allow to setup folders on my system where they will then place motion files in a motion folder, vehicle files in a vehicle folder and so on. So I can definitely see XY complimenting a software NVR setup very well.

Question on
$delAfter = 31; // Day value
if I change the day value to 0.5 will that set it to 12 hours?

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Auto tagging folders created by software based NVR?

Post by highend »

No.

Do it like this instead

Code: Select all

    $roots = <<<>>>
H:\Axis\Parking\grabs
I:\Axis\Shop\grabs
    >>>;

    $delAfter = "12 h"; // Set the first part to 0 to disable deletion!


    setting "BackgroundFileOps", 0;

    $curPath  = get("path");
    $delAfter = trim($delAfter);
    $value    = regexmatches($delAfter, "^\d+");
    $type     = regexmatches($delAfter, "[a-z]$");
    if ($value < 1) { end true; }
    foreach($root, $roots, <crlf>, "e") {
        if ($curPath != $root) { continue; }

        $tooOld = quicksearch("ageC: >= $value $type /f", $curPath);
        if ($tooOld) { delete 0, 0, $tooOld; }
    }

Code: Select all

y = years
m = months
w = weeks
d = days
h = hours
One of my scripts helped you out? Please donate via Paypal

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

Okay, thanks!

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

Just want to confirm something. It appears from the way changing locations works(After painting the file list) for the auto deletion is that you have to actually go to each and every real location for deletion to take place and so this would exclude viewing those locations through virtual folders and find files search which show those locations?

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Auto tagging folders created by software based NVR?

Post by highend »

Could be done for virtual folders as well (show all your vi's copied from the adress bar that you're using) but not for search results (too many factors why this wouldn't work)
One of my scripts helped you out? Please donate via Paypal

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

vi:
G:\Axis\Driveway\grabs\*
G:\Axis\Front Door\grabs\*
G:\Axis\Side yard\grabs\*
G:\Axis\Scaffold\grabs\*
G:\Axis\Gas Meter\grabs\*
G:\Axis\Backyard\grabs\*
H:\Axis\Red Door\grabs\*
H:\Axis\Garage\grabs\*
H:\Axis\Parking\grabs\*
H:\Axis\Fire Exit\grabs\*
I:\Axis\Foyer\grabs\*
I:\Axis\Shop\grabs\*

Have not added all yet but this is what I have so far.

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Auto tagging folders created by software based NVR?

Post by highend »

This should work for normal paths and virtual folders (doesn't matter if they are "|" or "<crlf>"-separated...)

Code: Select all

    $roots = <<<>>>
G:\Axis\Driveway\grabs
G:\Axis\Front Door\grabs
G:\Axis\Side yard\grabs
G:\Axis\Scaffold\grabs
G:\Axis\Gas Meter\grabs
G:\Axis\Backyard\grabs
H:\Axis\Red Door\grabs
H:\Axis\Garage\grabs
H:\Axis\Parking\grabs
H:\Axis\Fire Exit\grabs
I:\Axis\Foyer\grabs
I:\Axis\Shop\grabs
    >>>;

    $delAfter = "12 h"; // Set the first part to 0 to disable deletion!


    setting "BackgroundFileOps", 0;

    // Allow deleting in normal paths and virtual folders
    $path  = get("path");
    $value = regexmatches(trim($delAfter), "^\d+");
    $type  = regexmatches(trim($delAfter), "[a-z]$");
    if ($value < 1) { end true; }

    $isVi = (regexmatches($path, "^vi:")) ? true : false;
    foreach($root, $roots, <crlf>, "e") {
        $dstPath = $path;

        // Virtual folder, e.g.: vi:D:\Axis\Parking\grabs\*|T:\Axis\Shop\grabs\*
        if ($isVi) {
            $escaped = regexreplace($root, "([\\^$.+()\[{])", "\$1");
            if (!regexmatches($path, $escaped)) { continue; }
            $dstPath = $root;

        // Standard path, e.g.: D:\Axis\Parking\grabs
        } else {
            if ($path != $root) { continue; }
        }

        $tooOld = quicksearch("ageC: >= $value $type /f", $dstPath);
        if ($tooOld) { delete 0, 0, $tooOld; }
    }
One of my scripts helped you out? Please donate via Paypal

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Auto tagging folders created by software based NVR?

Post by Schuller »

Works perfect! Opened my virtual folder after setting up this script and this is much now better as I'll likely very seldom go to those actually folders.
Thanks again.

Post Reply