Page 1 of 1

post-update hooks

PostPosted: Thu Jan 26, 2012 9:44 am
by Elwell
Hi,

At the moment I grep the logfile to see what's been added (to stick on a web page of 'most recent additions'

I'd like for a script to be called automatically if the LibraryUpdatesChecker finds something new -- is this possible?

(FYI I have the following trivial script:

  Code:
#!/bin/sh
SERVIIO_LOG=/home/andrew/serviio/log/serviio.log
grep ' Added file ' $SERVIIO_LOG | sed -e 's/,.*Thread\]//'  -e 's/ to Library$//'


which produces something like

2012-01-26 09:01:51 Added file 'Vampire_Diaries_S02E22.avi' (title: As I Lay Dying)
2012-01-26 10:04:22 Added file 'Doctor_Who_S04E06.avi' (title: The Doctor's Daughter)

.. which although not pretty is good enough :-)

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 12:12 pm
by Cerberus

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 12:26 pm
by will
Although there is an API that allows you to check to see if new files have been added in the last update, you still have to go and parse the log anyway to find out the actual files. (Yes it exposes the last file, but you would probably miss a few if lots of files were added at once).

I have a near identical command setup as an alias so I can type 'sn' and get a list of all the new files.

I guess the OP (myself and others) would like is something serviio driven, e.g. an optional bin/post-update.sh script that is called by serviio when ever it finds new files, rather than user driven where you keep querying serviio.

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 12:35 pm
by moltra
will wrote:Although there is an API that allows you to check to see if new files have been added in the last update, you still have to go and parse the log anyway to find out the actual files. (Yes it exposes the last file, but you would probably miss a few if lots of files were added at once).

I have a near identical command setup as an alias so I can type 'sn' and get a list of all the new files.

I guess the OP (myself and others) would like is something serviio driven, e.g. an optional bin/post-update.sh script that is called by serviio when ever it finds new files, rather than user driven where you keep querying serviio.



Can you add something like this to the android app?

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 1:12 pm
by will
moltra wrote:Can you add something like this to the android app?


What part of it?

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 1:36 pm
by moltra
Seeing what has been files have been added / changed or maybe even a link to the serviio.log file.

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 1:44 pm
by will
moltra wrote:Seeing what has been files have been added / changed or maybe even a link to the serviio.log file.


Four options order by my likelihood of doing them

1) Show the last added file on the status view, thats easy and I don't know why I didn't in the first place. I'll add that to the next release.

2) Wait for ZIP to allow 'browsing' the repository over the REST API so that I can show the 'Last added' category in the app. My prefered method.

3) When connected over wifi perform a UPnP browse through the app as if it was a renderer and show the files available in the 'Last added' category. This should work but I don't know how much time it would take and I don't have time at the moment.

4) Do something with the serviio.log file - this requires either zip expose it, or that the user expose it. I guess something along the lines of how the restful webui works might work. Or a standalone server, ie the user tells the app that they have apache running with SERVERIP/serviio/serviio.log available for access.

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 1:47 pm
by moltra
The order you are looking at them looks good to me. I know I will add a movie and then watch the log for it to be added. I would love to be able to check via your app.

Re: post-update hooks

PostPosted: Thu Jan 26, 2012 1:52 pm
by will
I'm moving this to the android app thread to keep this just related to serviio post-update hooks.

@moltra I've added an extra idea, let me know if this is something you would want.

Re: post-update hooks

PostPosted: Fri Jan 27, 2012 1:14 pm
by Elwell
will wrote:I guess the OP (myself and others) would like is something serviio driven, e.g. an optional bin/post-update.sh script that is called by serviio when ever it finds new files, rather than user driven where you keep querying serviio.



Spot on!

I can then hook it into the general messaging plaform for IRC/Jabber/MQTT etc