I had a similar task so i decided to make a simple addon for this. It is based on code that was linked above (https://discourse.osmc.tv/t/refresh-picture-library/4867/13), but also it can use Kodi VFS paths (like SMB or NFS), it restarts slideshow from last shown image (if possible), it can be configured to automatically launch on Kodi start or can be launched manually, and sub-folders are also supported (recursive slideshow). Download here: https://github.com/antonsoroko/service.autoslideshow/releases