How to automatically update library?

My library is on my NAS, via SMB. I’ve always got the Kodi on, so “Scan library on startup” doesn’t work.

I’ve tried both Watchdog and Auto Updater

Watchdog just doesn’t work. Verified the settings, looks good, just doesn’t do anything. Does this require NFS instead of Samba?

Auto Updater is not what I want. It’s polling the NAS all day, keeping it out of sleep. Plus, when the NAS is temporarily unavailable it just removes my entire library!

I just want to have some smart mechanism. E.g. on my Linux box that has mounted the NAS shares via NFS, and I’ve got MiniDLNA running, any update is picked up automatically.

Hi,

Please clarify is MiniDLNA is the video source?

If so, Minidlna can be set to update its self, its done by a setting minidlna.conf.

http://manpages.ubuntu.com/manpages/zesty/man5/minidlna.conf.5.html

notify_interval - the default is 895 seconds.

I used to set my to 180.

Anyway should be auto updating after 15 min, is this not the case?

Thanks Tom.

Sorry for the confusion, no I’m not using MiniDLNA. I was using MiniDLNA when I was still using my Sony BR as media player. But I meant it as an example that it was updating automatically, so how do I achieve the same in Kodi/OSMC?

Hi,

Scan library on startup - Should work, samba or nfs shouldn’t make any difference.

Is a manual scan working?

Have you updated to yesterdays release?

Also debugging logs may help, details can be found here

Thanks Tom.

You can schedule a cron job that calls the kodi-send command with the builtin function to update the library regulary.

https://help.ubuntu.com/community/CronHowto
http://kodi.wiki/view/List_of_built-in_functions

Edit: You could even put that into a script that checks for availability of the nas before doing anything.

Thanks all!
Manual scan is working fine.
On startup works as well, but the kodi is never turned off so not useful.

I would like to stay away from scheduled jobs as that’s not smart.
I’m using nzbget to download, maybe I can implement a post download event that calls the kodi api? Has that been done before?

I still don’t understand why Watchdog isn’t working as that seems exactly what I need.

There is a Kodi addon called Auto Library Update. Its great. In the Kodi Repository. Give that a try. I use it on all my KODI boxes. By default it is set to scan every 4 hours.

Thanks but unfortunately that’s not working for me and not what I want. I want it to be instantly updated when something is downloaded. Tbh just polling every x hours is a waste…

You say you are using nzbget to download your new content. Then why don’t you just do as @mcobit suggested and add a kodi-send to start the scan to the nzbget script?

This is not a OSMC problem, so maybe you should take it to the Kodi forums, or ask the author of the nzbget script for help.

Yep I will do it at nzbget level, will try this script first: GitHub - natemccurdy/nzbget-update_kodi: NZBGet script to update Kodi libraries

Hi,

I’m trying to achieve something similar but I usualy turn off my Vero 4K from power so I would like to make the nas update the library.
The lib is hosted with mysql in the nas.

To identify new files I was thinking of using something like:

inotifywait -r -m -e moved_to -e create -e move_self /path1 /path2 |
while read line ;
do
filename=$(echo “$line” | sed -r ‘s//\s*(CREATE|MOVED_TO)\s*///g’)
if [[ (“$filename” == *“avi”) || (“$filename” == *“mkv”) || (“$filename” == *“mp4”) ]]
then
doStuff
fi
done

I still need to make the “doStuff” part… Do I need to install kodi in nas for it to update the lib itself?

Yep you would need that. You can not magically update the database with some SQL statements

So am I understanding you right that you are turning off the Vero 4K, and want your MySQL library hosted on a NAS? That’s not going to happen unless you can somehow install Kodi on it.

Why do you turn off the 4K? It uses far less power than your NAS uses (and it’s designed to be always on)

Ok, maybe i’ll try to install kodi in the nas. My nas is a sbc with low power consuption, sata and gigabit ethernet.

I turn my vero off just because it’s plugged to a central power socket used for all my media devices, receiver, tv… The nas is already hosting the lib database for my other kodi devices, so i’ll not change that.

My main purpose of making the nas the update device is for performance concerns in the vero. I want it to be focus on ui and playback as must as possible…

So you are just simply ‘Pulling the Plug’ on the Vero? That’s a really bad idea that at some point may cause filesystem corruption.

I use a simple shell script on my Linux Mint laptop to trigger a library scan on my Vero 4K. And I can’t tell at all when it’s running the scan. The Vero 4K is more than capable of running a scan and playing media or rendering the UI at the same time.

Ok. I understand that it’s not a good policy to constantly pull the plug :slight_smile:

I’ll consider the option to keep the vero on and make the nas trigger the update in vero when media files are managed on certain paths

That’s your best bet. To help get you started, here’s a simple shell script to trigger an update:

#!/bin/bash

echo  "Start update"
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": { "showdialogs": false }, "id": "scan"}' -H 'content-type: application/json;' http://osmc:osmc@vero4k.local:8080/jsonrpc
echo -e "\nStarted update"
1 Like

Thanks

So what happens when there is a power cut? The probability of a power failure for an always on device is 100%. if there is any real likely-hood of this causing corruption, then the vero CANNOT be considered to be an always on device - no one is going to put a UPS in their lounge to protect it.

Even here in SW London we get two or three power outages a year. They only last for a few minutes, but that’s neither here nor there.

It’s a numbers game. Each power-pull has an n% chance of corrupting something on the box, where n is a number greater than zero and less than 100.