Linux [solved] howto update library from command line
#1
Thumbs Up 
How could I trigger an update of the XBMC libraries from the command line?

I wrote a small script [0] to rip an audio disc on insertion (using udev) and store the flac's in $HOME/Music/Artist - Album/ for the user I run XBMC-standalone with. This works fine so far.
Now, after the ripping is done, I would like to update the audio library automagically.

I found http://forum.xbmc.org/showthread.php?tid=81474 but apparently something changed since then:

Code:
# curl --verbose --user xbmc:xbmc --data-binary "{ \"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.ScanForContent\", \"id\": \"xbmc\" }" -H content-type: application/json;" http://localhost:8080/jsonrpc
* About to connect() to localhost port 8080 (#0)
*   Trying 127.0.0.1... connected
* Server auth using Basic with user 'htpc'
> POST /jsonrpc HTTP/1.1
> Authorization: Basic aHRwYzpodHBj
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8080
> Accept: */*
> content-type: application/json;
> Content-Length: 75
>
* upload completely sent off: 75out of 75 bytes
< HTTP/1.1 200 OK
< Content-Length: 83
< Content-Type: application/json
< Date: Wed, 24 Oct 2012 15:52:49 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
{"error":{"code":-32601,"message":"Method not found."},"id":"xbmc","jsonrpc":"2.0"}

I guess I just need to change this json request a little bit, but I don't know how. Does anyone care to share his/her knowledge?


[0 - https://github.com/ZyanKLee/autoripper]
Reply
#2
perhaps this can help

http://forum.xbmc.org/showthread.php?tid...pid1221403
Reply
#3
Thanks, had just a quick look and this looks very promising Wink
will integrate it later.
Reply
#4
it works 10+

no problem Smile
Reply
#5
you could try this

curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://127.0.0.1:8080/jsonrpc
Reply
#6
fwiw, here are some commands I use on Windows as part of my automation script

Update Music Library
Code:
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Scan\", \"id\": \"mybash\"}" -H "content-type:application/json" http://username:password@kodi-ip-address:8080/jsonrpc > NUL 2>&1

Update Video Library
Code:
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\", \"id\": \"mybash\"}" -H "content-type:application/json" http://username:password@kodi-ip-address:8080/jsonrpc > NUL 2>&1

Clean Music Library
Code:
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Clean\", \"id\": \"mybash\"}" -H "content-type:application/json" http://username:password@kodi-ip-address:8080/jsonrpc > NUL 2>&1

Clean Video Library
Code:
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Clean\", \"id\": \"mybash\"}" -H "content-type:application/json" http://username:password@kodi-ip-address:8080/jsonrpc > NUL 2>&1

Run Trakt Addon sync
Code:
curl -i -X POST -d {\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"Addons.ExecuteAddon\",\"params\":{\"addonid\":\"script.trakt\"}} -H "content-type:application/json" http://username:password@kodi-ip-address:8080/jsonrpc > NUL 2>&1

Check if Kodi is running remotely
Code:
curl -s kodi-ip-address:8080 >NUL && echo Connected. && goto DoStuff || echo Fail. && goto DoNotDoStuff
4x R-Pi4b LibreELEC v10 | Aeon Nox: SiLVO | Flirc cases
Storage Synology DS411 | 4 x WD RED 6TB
Software MariaDB 10.4.19 | Filebot | Ember Media Manager
wiki (wiki) | First time user (wiki) | Debug_Log (wiki) | mysql (wiki) | artwork (wiki)
Reply

Logout Mark Read Team Forum Stats Members Help
[solved] howto update library from command line0