Page 2 of 2

Re: Using CURL to force library refresh

PostPosted: Sat Oct 01, 2011 1:24 am
by J038lack
Here is the fix for the new version,

Xmantium test this for me,

I have added a header to the POST request telling the REST interface it is xml.
the highlighted text is the added info to the script.

headers = { "Content-type": "text/xml" }
connection.request('POST', '/rest/action' , body_content , headers)

or copy + paste the whole script.

  Code:
#!/usr/bin/env python
import httplib
connection = httplib.HTTPConnection('192.168.1.6:23423')
body_content = '<action><name>forceLibraryRefresh</name></action>'
headers = { "Content-type": "text/xml" }
connection.request('POST', '/rest/action' , body_content , headers)
result = connection.getresponse()
if result.status == 200:
    print "Updated Serviio Library",
else :
    print "Update Failed",
print result.status,


hope it helps
J03

Re: Using CURL to force library refresh

PostPosted: Sat Oct 01, 2011 4:56 pm
by Xmantium
Tested this and its working fine again!!

Thanks for getting back to me :D

Sabnzbd and Serviio combined is the perfect media station!

Re: Using CURL to force library refresh

PostPosted: Sun Feb 19, 2012 4:01 pm
by Xmantium
Update: For QNAP users who who use SABnzbd to run the script, Ive also noticed sickbeard takes over the Serviio library refresh script if sickbeard installed. The quick solution is edit sickbeard.sh and remove the following code:
  Code:
config_sabnzbdplus() {
if [ -f $SABconfig ] && [ -f ${QPKG_DIR}/config.ini ]; then
/sbin/setcfg misc script_dir "${QPKG_DIR}/autoProcessTV" -f $SABconfig
/sbin/setcfg misc enable_tv_sorting 0 -f $SABconfig
/sbin/setcfg [tv] script sabToSickBeard.py -f $SABconfig
/sbin/setcfg [tv] dir TV -f $SABconfig
fi
inject_sb_startup_procedure
}

Re: Using CURL to force library refresh

PostPosted: Sun Feb 26, 2012 8:07 am
by J038lack
Xmantium,

What do you mean Sickbeard takes over the Serviio refresh?

Im running Sabnzbd, Sickbeard, and CouchPotato with Serviio and I am having no problems. Sickbeard Allows you to run post-processing Scripts from the app itself. Just manually configure the Config.ini.

extra_scripts = C:\\Python27\\pythonw.exe C:\\NZB\\SickBeard\\forceserviio.pyw (running on a windows box)

And CouchPotato has just added post-processing to the renaming section in its new Version also allowing a force update script.

Also remember I let CouchPotato and Sickbeard do all the renaming and creating of thumbnails and metadata allowing Serviio to just serve the files.

J03

Re: Using CURL to force library refresh

PostPosted: Sun Feb 26, 2012 7:11 pm
by Xmantium
Ah you let sickbeard run the script, i use sab to run the script

I think this must be only for QNAP users
Looking at out sickbeard.sh script, it changes serviiorefresh.py to sabToSickBeard.py everytime my Qnap restarts
I actually let Sabnzbd do all the renaming, i dont like how sickbeard renames the files
I just use sickbeard to send the nzb to sab and let sab do the rest :)

Thanks for this amazing script, works wonders!!

Re: Using CURL to force library refresh

PostPosted: Tue Jan 15, 2013 2:58 pm
by DeanoX
phardwick wrote:Quick tip:

I use this to force a library refresh (I'm running on linux):

curl -X POST "http://localhost:23423/rest/action" -H "Content-Type: text/xml" -d "<action><name>forceLibraryRefresh</name></action>"

I plan on putting this into a daily cron job and disabling the auto library refresh.


Many Thanks :-) My windows batch file that creates a few directory based playlists now updates the library on completion. Perfect !