Task Application for ZM

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
jlnavio
Posts: 27
Joined: Fri Oct 27, 2006 10:50 am
Location: Spain

Task Application for ZM

Post by jlnavio »

Hello, everybody (before all, sorry for my english)

when I started to use ZM I surprised a lot. It is a great solution for surveillance. However, as I used it, I was needing more features. For example, I wanted to delete all JPGS which had been created in that day and only save MPEG files. Also I wanted to compress LOG files to a TAR.GZ file and move it to other folder, etc.

Those tasks I did them by CRONTAB in my localhost. Then, I thougth to include these features into ZM.

And, here are:

- I've created 5 PHP files. These ones let me create TASKS in contab form for www-data user.

My application adds a button to main console "Tasks":

MAIN_WINDOW
Image

When you click on it, these window appears:

TASK_WINDOW
Image

Here you can select five actions types. Each action can be executed at periodic times such as CRONTAB format. Besides, in some cases you can select file extensions or file ages.
These actions are:

- DELETE FILES ==> you can delete files with extension "jpg", "mpeg", "log", "avi", "3gp", "jpeg", etc; with differents ages or periodic times.

Image

- CHANGE STATE ==> you can change run mode of ZM: start, stop, personal modes (day, night,..)

Image

- COMPRESS LOGS ==> to create a "tar.gz" file with ZM_PATH_LOGS. You can select destiny folder for this file.

Image

- COMPRESS FILES ==> you can also compress other files of your ZM system and store them into other folder

Image


When you does click on "Save", it shows a new window (like Filters in ZM):

Image


In these moment, the application creates a folder into ZM_WEB_PATH: "tasks". Inside it, the application wil create folder which named "cron.task_name" where it is a script. It will do the appropiate actions for execute the task. Besides, a new line will be created into "crontab" file for "www-data" user. You can see it with: crontab -u www-data -l

Other important thing is LANGUAGE:

All scripts are in spanish. However I've added new labels to "zm_lang_en_gb.php" for english support. You must add these lines to your "zm_lang_en_gb.php":

/////// TASKS application ///////
$zmSlangAge = 'Age';
$zmSlangAllHours = 'All';
$zmSlangAllMoment = 'All';
$zmSlangCompressFiles = 'Compress Files';
$zmSlangCompressLogs = 'Compress Logs';
$zmSlangConfirmDeleteTask = 'Are you sure to remove selected task? (Associated LOG file will be also delete)';
$zmSlangDays = 'days';
$zmSlangDeleteFiles = 'Delete Files';
$zmSlangDest = 'Destiny';
$zmSlangErrorValidName = 'Error, Introduced Name is not a valid value';
$zmSlangEvery = 'Every';
$zmSlangExactly = 'Exactly';
$zmSlangExample = 'Ex';
$zmSlangExtension = 'Extension';
$zmSlangHours = 'Hours';
$zmSlangIntroduceData = 'Introduce data for field';
$zmSlangLessThan = 'Less than';
$zmSlangList = 'List';
$zmSlangMinute = 'Minute';
$zmSlangMinutes = 'Minutes';
$zmSlangMonth = 'Mes';
$zmSlangMonthday = 'Month Day';
$zmSlangMoreThan = 'More than';
$zmSlangNewTask = 'New Task';
$zmSlangRange = 'Range';
$zmSlangRepeatEvery = 'Repeat every';
$zmSlangSimple = 'Simple';
$zmSlangTask = 'Task';
$zmSlangTasks = 'Tasks';
$zmSlangWeekday = 'Week Day';
$zmSlangYesterday = 'Yesterday';
/////////////////////////////////

Nothing more. I hope this application was useful for "ZM community".

Please, "zoneminder administrator". How I can upload my "php" files??
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

if you email them to me or phil ill put them up
jpwilson<.NO-SPAM.>@jpwilson.eu
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
adahary
Posts: 14
Joined: Fri Jun 29, 2007 2:15 pm

Post by adahary »

Could you please update when the 'Tasks' addon will be ready for installation in ZM?

Regards
Post Reply