[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
Re: xPLRioNet Scanner Changes - Comments Please
Hi Tony,
I have used the FileSystemWatcher class in an application that
re-organizes files. The app keeps an eye on specific directories and
moves new files to other locations dependig on configuration settings.
E.g. move files ending in .jpg to pictures, .mpg to video etc. I can
drag hundreds of files into the directory and then it starts moving
the files one by one.
The trick is:
- catch the filesystemwatcher event
- initial check: is this a file to act upon
- save relevant information in an object (hashtable-like probably)
- start a new thread if it wasn't already started that reads
information from the above object and does what is has to do (in my
case move the file; in your case update a db?) in a loop, removing
entries as they are finished.
- the new thread ends when there are no more entries
Things to look out for:
- you will be adding/reading/deleting data from the hashtable (or
alike) from different threads so you need to lock where appropriate;
- start only 1 new thread.
The application is pretty solid. If you think it might be useful I
can send it to you off list. It's c#.
Regards,
Tom
On Mon, 3 Jan 2005 12:34:25 -0000, Tony Tofts <tony@xxxxxxx> wrote:
> Hi all,
>
> Would like to get some feedback on the following suggestions for
changes to
> the scanner system please...
>
> Have implemented John's suggestion of watchers for the file structures
used
> for music/movies/pictures
>
> This currently detects if a file/folder has been
deleted/created/renamed and
> raises an event where an action can be performed (nothing happens
yet!)
>
> However there are issues, e.g. if something is renamed you can't tell
what
> it was previously called - so you don't know what has changed.
>
> Also, the coding required to action individual changes will be both
complex
> and in some cases not possible or unreliable. Also, if you were to
copy in a
> load of new files (or move a load of files) the processing would be
> overpowering.
>
> So my suggestion is as follows:
>
> Modify existing scanner to allow music/movies/pictures to be scanned
as
> seperate processes and add them to the web interface
>
> Add items to the scanner.xml to allow you to activate automatic
rescanning
> against none/one/any of music/pictures/movies after the watchers have
> detected a change?
>
> Basically the watchers will flag a change has occurred, wait 30
seconds for
> no further change to occur and automatically schedule a scan in the
> appropriate area if enabled?
>
> Shoutcast rescanning will simply be handled by a button on the web to
reload
> shoutcasts.xml
>
> Thoughts/comments please?
>
> Thanks
> Tony
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> xPL Links: http://www.xplproject.org.uk http://www.xplhal.com
> http://www.xpl.myby.co.uk
> To Post a Message: ukha_xpl@xxxxxxx
> To Subscribe: ukha_xpl-subscribe@xxxxxxx
> To Unsubscribe: ukha_xpl-unsubscribe@xxxxxxx
>
>
> ________________________________
> Yahoo! Groups Links
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/ukha_xpl/
>
> To unsubscribe from this group, send an email to:
> ukha_xpl-unsubscribe@xxxxxxx
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
xPL Links: http://www.xplproject.org.uk http://www.xplhal.com http://www.xpl.myby.co.uk
To Post a Message: ukha_xpl@xxxxxxx
To Subscribe: ukha_xpl-subscribe@xxxxxxx
To Unsubscribe: ukha_xpl-unsubscribe@xxxxxxx
xPL Main Index |
xPL Thread Index |
xPL Home |
Archives Home
|