A couple weeks ago I started looking into why my mediatomb server wasn't picking up new media from inotify. My library, which is stored on a NAS and made available to my mediatomb machine via NFS, was being frequently updated with new files but mediatomb would not find these files unless I did a complete restart of the mediatomb process or I manually added them via the web UI. It turns out that an NFS server does not propagate inotify events to connected clients, and that library changes made on a machine other than the one running mediatomb would not be reflected in the mt database.
I suspect that there are other users on this mailing list with setups similar to mine who have had a hard time keeping their mt database up to date with their library. I've put together a program that listens for inotify events on a fileserver and converts them into HTTP requests that the mediatomb daemon can understand. The program and some notes on its usage are available at the address below:
Thanks for the great program.
Sounds interesting, thanks for posting.
Just as a word of warning: the UI API is not really stable and may change unexpectedly (in fact, 0.11 and upcoming 0.12 are already slightly different).
Is there a copy of the Proxy somewhere? I setup my new homebox and mount my partitions into an xen VM, where Mediatomb is running.
If there is no copy of it, what is the URL to send an the new filename to MT? I still have some Perlscripts with inotfy here, should not be that hard to change it.
Found the script on archive.org
Remove all instances of ".EventsCodes" from the script and script won't have any errors. The mediatomb API has been changed so that needs to be fixed. I haven't yet found the URL that adds files. If someone knows something, please let me know.
Great, no i have to inspect the API. Should´nt be a big problem, just use an proxy and capture the traffic, you should see the POST-Uri. The alternative is, use Wireshark to capture and reverse-engineere it. I will give it a shot when i´m back home.
I'm not sure what to look for. Am I supposed to pass the entire directory to the Mediatomb API URL, or just the new file(s)?
Because in the web interface, you add entire directories and it picks up the new files from there so I don't know how to make it add just the newly added fles.
This isn´t that hard. Just watch an directory via inotify, and if an supportet File was added (on_file_close, so its done with saving), just pass the new file incl. his path to Mediatomb and it adds it to you PC-Directory.
I add a new file under:
my monitoring programm with inotify waits util it gets closed, and send it to mediatomb, like:
just to get you an picture of it. I could send of course the whole directory, but think about 12 TB of Musik, Videos and Pictures it should reindex every 5 min. or i send the /media/movies folder him, i has atm around 3 TB movies. Damn HD-Camcorder :)
Ah, cool. That sounds simple enough. I'll give that a try tonight.
I get a 404 error on /fileadd. There doesn't seem to be any api for adding individual files. My HTTP debugger just shows a bunch of GET requests like this:
I also had a look at a wireshark capture file and I don't see any of the files that were added. So the web interface is just passing the directories over to mediatomb.
I've made some progress. I managed to modify the script to make it add files and I'm looking at getting it to remove deleted files. It doesn't seem to trigger my custom import script though. I'll post an updated version soon.
Okay, this is what I've cooked up so far - http://pastebin.com/RNuc0xeJ
It can add and delete files using the new API
It can resolve rar files to the rar content filename (enable with -rar option)
My custom import script isn't getting triggered when it adds new files. I'm not sure why. But I can see the files in "PC Directory"
Log in to post a comment.