robweber / xbmclibraryautoupdate

Kodi Addon to update your video/music libraries on a schedule
MIT License
30 stars 22 forks source link

option to supress errors #42

Closed chris400 closed 5 years ago

chris400 commented 5 years ago

All of my resources are on my NAS. When maintaining the NAS (e.g. applying updates, rebooting), the library update of kodi throws an error, which does not disappear automatically. So all future auto updates fail. Please provide an option to suppress (such) warnings.

robweber commented 5 years ago

Do you have an example of the dialog you're seeing? This addon doesn't show any dialogs by default other than in the notification area when scans are scheduled. I'm guessing what you're seeing is actually part of the Kodi scanner. You may want to check out this setting and see if that fixes your issue: https://kodi.wiki/view/Advancedsettings.xml#videoscanner

chris400 commented 5 years ago

Thx for the fast reply!

I will use the setting in the advancedsetting.xml. But this will suppress the warning even when manually scanning. Any chance you can temporary set these? Like a parameter or something when starting the scan.

robweber commented 5 years ago

I see what you mean. You can modify the advancedsettings value while Kodi is running, but unfortunately it will only reload values on startup so changes don't have any effect until after a restart of the application.

I guess thinking about this from another angle there is a different way this could be fixed (I think). Right now there is a quick "network check" that happens before the Kodi Scan function is called. This was implemented a long time ago as others complained of a similar issue where Kodi would lose the network connection and that would cause issues. What if I made this setting configurable so that in order for the network check to pass it had to receive a "ping" from a specific address configurable by you? I'm thinking you could put in the IP of your NAS and if that IP is non responsive the scan will just never get started.

Thoughts?

robweber commented 5 years ago

Just as an update to this I'm not sure it will work the way I envision. The current method uses urlopen to just check if a website is available. Doing a ping request requires root (or Admin on windows) permissions for the user account running Kodi since that is ICMP traffic. Not sure that will be the case on a lot of machines so doing a straight ping might be out.

The last thing I could offer is a modification of some code that used to exist. In the past Kodi didn't do a sources check when cleaning the library. This was rectified like 4 years ago, but before that this addon contained some code to check if a source existed before trying to do the clean. What I could do is re-introduce this code but instead as a setting to check sources before starting the Scan process. If a source is not available, don't start the scan. This would fail gracefully until the next update check as well.

Here is where I tore the old code out: https://github.com/robweber/xbmclibraryautoupdate/commit/9e84851b81dbf867879ed771a745b99aefda9cfd#diff-a534c3c8963e6e7695f1d2cd016b98c7

chris400 commented 5 years ago

Checking the source would be better, because that would be on a higher level of OSI. 🤓

Update: currently my ressources are on two different servers, so pinging just one of them wouldn't be enough.

robweber commented 5 years ago

If you want to test out this idea here is the branch I've started, so far seems to work OK in the tests I've done. If the scan is a full scan it tests every source. If it's just a single source to scan it only tests that source. If the source check fails the scan function just doesn't get called.

https://github.com/robweber/xbmclibraryautoupdate/tree/check_sources

chris400 commented 5 years ago

I would be happy to test it, but I am kodiless for (hopefully only) a few days. My OSMC Vero 4k+ has a faulty NIC ☹️

robweber commented 5 years ago

I've cleaned this up enough that it can be merged in. Where you able to test it yet? Seems to work for me but want to make sure it fits your use case before calling it done.

chris400 commented 5 years ago

Today Sam confirmed the faultiness of my device. I will receive a replacement "in a couple of days". I will test your changes asap.

robweber commented 5 years ago

Just checking back in on this. Where you ever able to test out that branch with the check sources fixes?

chris400 commented 5 years ago

Hi Rob,

I am having difficulties with my NAS, QNAP's support is letting me down ☹️. Maybe I can setup a different test environment.

As there is no SLA / no supervisor in here, we can leave the ticket open, ok?

robweber commented 5 years ago

That's fine. I'm like 99% sure this is going to do the trick. I'd like to do a pull request so I think I'll do a bit more testing on my end and then just merge it in. We can keep this open and revisit if you have issues down the road.