FAQ  •  Register  •  Login

Automatic Serviio database update

<<

mackowiakp

Serviio lover

Posts: 71

Joined: Tue Feb 11, 2014 8:31 pm

Post Sun May 11, 2014 11:25 am

Automatic Serviio database update

All I want to do is automatic Serviio database update after adding/removing file to any directory defined in "Library" as sharing element.
My Serviio is installed on Linux server, so I can use "inotify" mechanisms. It can trigger action when pre-defined parameters will change on desired filesystem.
So my question is. How can I trigger from Serviio command line, execution of update sharing elements database, after infotify will notice any chages?
Just I want to write a small script and after testing I will share my experience with forum members.
<<

DenyAll

DLNA master

Posts: 2257

Joined: Fri Mar 08, 2013 11:16 pm

Location: Adelaide, Australia

Post Sun May 11, 2014 12:16 pm

Re: Automatic Serviio database update

There has been some work on this by other users:

  • lukakama has recently developed a Java based addon for Serviio to support refreshing based on native file system monitoring. He has done some testing and his post refers to some of the limitations with this approach, predominantly for network shares. See viewtopic.php?f=17&t=16649;
  • My WinHelper tool has this feature as well - see viewtopic.php?f=17&t=12136, however it's only for Windows users. I have been using it flawlessly since late last year but I have not got NAS drives to test with. I am also working on further enhancements to this feature (per share updating - allow the user to set how to update a share eg. automatically, timer, forced only or never. This will allow local shares to be automatically updated but network ones still be timer based).
To answer your question - you can trigger a refresh by using the Configuration API (see http://docs.serviio.apiary.io/). Some things to note:

  • The filesystem will often issue multiple notify messages when doing a simple change (eg. a rename);
  • A long file copy will issue multiple notify messages over the duration of the copy;
  • Serviio may not recognise the file as a valid media file until a decent portion of the file is copied.
My approach to handling this was to implement a 60 second timer. Whenever a file system change is detected, I start the timer. If another change occurs the timer restarts. Only after the expiration of the timer (ie. after no file changes in the monitored folders is received for 60 seconds) is the Serviio library refreshed.
DenyAll
Panasonic Viera FX800A | Panasonic Viera CS610A | Sony PS4 | Sony PS3 | Panasonic DMP-BD79 | Yamaha RX-V500D | iPad | Windows 10 | Serviio 1.10.1 Pro
WinHelper | MediaInfo

Beta Tester, Moderator
Please do not PM me for support as any solution cannot be shared with others.
<<

mackowiakp

Serviio lover

Posts: 71

Joined: Tue Feb 11, 2014 8:31 pm

Post Sun May 11, 2014 5:08 pm

Re: Automatic Serviio database update

I think that inotify and inotifywait (used by Twonky on Linux) is the best choice. I will test it..
<<

mackowiakp

Serviio lover

Posts: 71

Joined: Tue Feb 11, 2014 8:31 pm

Post Mon May 12, 2014 7:52 am

Re: Automatic Serviio database update

I think your fears are not entirely justified. I used a lot of times in the Linux scripts inotifywait, and I can wire for Serviio users (on Linux platform) small script for automatic Serviio database update. The key is to use that line:

  Code:
inotifywait -e close_write -e delete -e modify -e move /path_to_watching_directory


So inotifywait will be inform system about changes only if (for example) full copy of log file will be done.

The problem I have is that I am not expert in JSON programming. So, can You help me, what I have to do to trigger database update action?
I try something like this:

  Code:
wget http://127.0.0.1:23423/rest/action/forceLibraryRefresh


But it not work. Can You help me?
<<

norm

Serviio lover

Posts: 72

Joined: Tue Apr 09, 2013 3:18 pm

Post Sat May 17, 2014 6:47 am

Re: Automatic Serviio database update

Hi mackowiakp

I have written a script using inotifywait from the inotify-tools suite and python that I have been running on my Linux/NAS box. The python script posted in my post queries serviio REST api to update the library if the library was not already being updated and if the filename was not the same as last updated. Anyway check it out http://forum.serviio.org/viewtopic.php?f=5&t=2225&start=20#p68508

I hope this helps. Let me know if you have any questions.

Thanks

Norm 8-)
<<

mackowiakp

Serviio lover

Posts: 71

Joined: Tue Feb 11, 2014 8:31 pm

Post Sat May 17, 2014 6:59 am

Re: Automatic Serviio database update

I resolved problem too using inotifywait in "ordinary" shell script. See topic:

viewtopic.php?t=16649&f=17#p90968
<<

norm

Serviio lover

Posts: 72

Joined: Tue Apr 09, 2013 3:18 pm

Post Sat May 17, 2014 3:30 pm

Re: Automatic Serviio database update

Ok great. Glad to hear you got it working. Thanks 8-)

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 53 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.