Author Topic: Extending Watcher Plugin  (Read 9128 times)

0 Members and 1 Guest are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Extending Watcher Plugin
« Reply #15 on: June 07, 2015, 10:59:51 AM »
OK, I've updated the plugin and replaced the installer on the main download page.
http://voxcommando.com/home/downloads/

The version of VC and the installer remains 2.1.4.8

It should now handle your old watcher settings properly and will even convert the old watcher settings (if you have any) to the new format.
« Last Edit: June 07, 2015, 11:32:24 AM by nime5ter »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Extending Watcher Plugin
« Reply #16 on: June 23, 2015, 08:55:06 PM »
I am wondering if the Watcher plug-in can be extended a bit more ...
I was trying to use to monitor a log file changes ... however it turn out, it monitors only the creation of new files ... but won't generate an event if a file is updated ...
this feature would allow VC to tap into many programs that support logging, and know what is going on ....

here is some python solution for the problem http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html, but it is kind of doubling the functions (wasting resources), having watcher and this python runing at the same time
When Voice command gets tough, use hand gestures

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Extending Watcher Plugin
« Reply #17 on: June 23, 2015, 10:01:58 PM »
I am wondering if the Watcher plug-in can be extended a bit more ...
I was trying to use to monitor a log file changes ... however it turn out, it monitors only the creation of new files ... but won't generate an event if a file is updated ...
this feature would allow VC to tap into many programs that support logging, and know what is going on ....

here is some python solution for the problem http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html, but it is kind of doubling the functions (wasting resources), having watcher and this python runing at the same time


I requested the same in a post above:

Watcher.Created (as it does now)
Watcher.Updated (used to see when a change is made to a file in that folder)
Watcher.Completed (or something similar when the file is fully transferred like a video being recorded or transferred across the network)
Watcher.Deleted (when a file or video is deleted from the folder, I could do this one with my script if I have Watcher.Completed to trigger the script)


I wanted the events above for a couple of different ideas that I had, the only one I was able to make a work around for was checking a media file to see if it was done,  I made a group of commands that will test a video file every 10 secs and then if its done will run another script that I use to move and rename the media, its a bit complicated because of all the file paths but it works.

having the "update" event would be nice for watching files of other programs and use the event to trigger backups


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Extending Watcher Plugin
« Reply #18 on: June 24, 2015, 05:52:14 PM »
OK, OK I will dooooo eeeeeeet!  :biglaugh

I was a bit reluctant to add all these because each event must be processed by VC and I don't want constant events interfering with the normal operation of the program and its ability to listen to voice commands etc.

I will have to make it optional.  Just use it with caution.

I think I will have this option only for event type watchers, and not for action watchers.  Does that make sense to you?

Do we need just one option for "extra events" or should we have an option for each type (updated/completed/deleted)?

Bear in mind that each type of event may have its own anomalies  in terms of when a file is ready / locked because it is still being written etc.  You may have to adapt your macros with ++ and pauses to account for this if you intend to access the files that are generating events.
« Last Edit: June 24, 2015, 06:46:25 PM by jitterjames »

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Extending Watcher Plugin
« Reply #19 on: June 24, 2015, 06:32:08 PM »
SWEET,  ::bow 

I think making each event type optional would be best, and doing it similar to how you have it now in the watcher plugin, so we could pick witch event(s) we want triggered with that watcher,

watching log file have it trigger "updated"
watching media folder "completed" and "deleted"

with the group I'm working on I have it check the media file every 10 seconds and that seems to work well but I also have it wait to test files while other parts of the group are being used, once I get the group to be more user friendly I'll upload it, right now there are to many different actions that have file paths so I'm setting it up to have it use the payloads off of the watcher event payloads

Quote
I think I will have this option only for event type watchers, and not for action watchers.  Does that make sense to you?

Yes that makes sense,


 ::bow :hugs

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Extending Watcher Plugin
« Reply #20 on: June 25, 2015, 04:42:43 PM »
Sweeeeeeeeeeettttttt.  :hugs
When Voice command gets tough, use hand gestures

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Extending Watcher Plugin
« Reply #21 on: February 03, 2016, 02:33:19 PM »
I am working with watcher plugin to monitor HouseLinc (InstOn Controlling software) to provide VC with events notifications, i.e. pressing a switch on the wall ...
however I noticed that watcher plugin and file.read can not read the log file (I get error the file is open in another process) while HouseLinc is runnin, because HouseLinc keep the file open.

can this behaviour modified? i.e. Notpad++ do not have an issue reading the same file and sense changes while houseLinc is running
When Voice command gets tough, use hand gestures

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Extending Watcher Plugin
« Reply #22 on: February 03, 2016, 03:00:20 PM »
I am working with watcher plugin to monitor HouseLinc (InstOn Controlling software) to provide VC with events notifications, i.e. pressing a switch on the wall ...
however I noticed that watcher plugin and file.read can not read the log file (I get error the file is open in another process) while HouseLinc is runnin, because HouseLinc keep the file open.

can this behaviour modified? i.e. Notpad++ do not have an issue reading the same file and sense changes while houseLinc is running

with the File.Read I had a similar issue with the Kodi.log when Trying to read it to get a list of Pandora Stations from the log file,

what I did was simply use File.Copy to copy the log file to my VC Folder and then used File.Read from there.


Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Extending Watcher Plugin
« Reply #23 on: February 03, 2016, 03:16:50 PM »
what I did was simply use File.Copy to copy the log file to my VC Folder and then used File.Read from there.

I found this solution too ... however it is half what I need... the most important thing is watcher plugin, trigger the event ... I am just guessing here, I think both use the same access mode
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Extending Watcher Plugin
« Reply #24 on: February 03, 2016, 04:06:50 PM »
I don't think it is possible to detect when a file has changed if the program changing it keeps the file open, certainly not with the FileSystem Watcher object provided by .Net 4. Otherwise it would be generating thousands of events (one for every byte that was written to the file).

Before you ask, notepad++ is not detecting a file change. Only when notepad is refocused does it check to see if a file has changed. It's not the same thing. More like polling.

As for reading a file that is open, I think I can fix this but only with programs that have opened the file in a polite way.
« Last Edit: February 03, 2016, 05:07:28 PM by jitterjames »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Extending Watcher Plugin
« Reply #25 on: February 04, 2016, 12:32:00 AM »
I don't think it is possible to detect when a file has changed if the program changing it keeps the file open, certainly not with the FileSystem Watcher object provided by .Net 4. Otherwise it would be generating thousands of events (one for every byte that was written to the file).

Before you ask, notepad++ is not detecting a file change. Only when notepad is refocused does it check to see if a file has changed. It's not the same thing. More like polling.

As for reading a file that is open, I think I can fix this but only with programs that have opened the file in a polite way.

thanks for clarifying james ...
and for fixing the file read will be a good step forward if it is not too much coding ... as always unparalleled response and support
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Extending Watcher Plugin
« Reply #26 on: February 21, 2016, 07:22:30 PM »
however I noticed that watcher plugin and file.read can not read the log file (I get error the file is open in another process) while HouseLinc is runnin, because HouseLinc keep the file open.

2.2.1.6 should allow you to read an open file.

http://voxcommando.com/mediawiki/index.php?title=ChangeLog#Core_Program_14

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Extending Watcher Plugin
« Reply #27 on: February 21, 2016, 09:23:17 PM »
:clap :clap :clap ... best support ever always
When Voice command gets tough, use hand gestures