2010-01-07, 19:30
sorry.
Quote:Update library on startup
Checks for new media files on XBMC startup. For automatic removal of deleted media files you need the <cleanonupdate> advancedsetting.
althekiller Wrote:Watching inodes is a non-trivial task. It's not portable across platforms and there are implications when the file system is network based, which a majority of users have. Simply stat()ing the directories in an event loop can be expensive too. Again, especially for network sources.
The best solution I've thought of is to have an event client that runs on the system where your media actually resides. It does all of the dir watching, and sends XBMC a request to scan the newly added directory, translating paths if necessary. So say you have a new dir /media/movies/NewMovie where /media/movies is shared on SERVER over SMB as Movies. When the file transfer to this directory completes (also non-trivial to detect) the EC fires of an execute builtin request for XBMC to scan smb://SERVER/Movies/NewMovie. Problems of course arise here when you have multiple movies being transfered to the watch dir so you may get a scan request while one is in progress. Currently there's no queuing in the scanner, so (I think) the first scan will be cancelled. There's also the fact that the event server is UDP based, so your client has no idea whether the request was actually received. You could alleviate this by using the HTTP-API and caching the failed scan requests client-side.
robweber Wrote:Here is a link to the TRAC where I posted a patch for what I've come up with so far. My patch allows you to:
a) enable auto update and define a number of hours 1 - 23.
b) starts a countdown that will update the database the set number hours, and then restart the countdown until disabled
One little problem is that if you restart XBMC the process will not restart itself. This should be a simple enough matter and can be inserted into the startup sequence wherever the check for updating the database on startup is. If this feature looks like something people are actually interested in I'll take the time to do that as well.
http://trac.xbmc.org/ticket/8431
One side note - I do agree that a 'watchdog' feature that would monitor the source and update is the most ideal, but that cross platform this is unlikely. I think the ability to update the library automatically without a restart of the whole system is very close to perfection for most people.
CrashX Wrote:Another way to do using built in xbmc idle timers .. http://trac.xbmc.org/ticket/5969 ..
Idle Do Action
-> Shutdown ( Executes the default shutdown action )
-> Update Library ( already feature request for updating on interval )
-> idle.py
Lost Idle Do Action
-> wakeup.py