robweber / xbmclibraryautoupdate

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

Refactor Manual Runs #75

Closed robweber closed 1 year ago

robweber commented 1 year ago

This is an attempt to fix issues seen when the addon is run manually that result in multiple loops of the updater or issues with library cleaning.

The existing main branch treats manual runs as a special case by tricking the scheduler into running outside the normal scheduled time. This works but leaves some ancillary classes - namely the Monitor operating when really this should only exist when the updater is run as a Service.

In testing it was observed that multiple versions of the Monitor, created through a manual run, created issues with scans being kicked off in a repeated loop. The creation of the Monitor class, which triggers on scan complete actions, is now moved from the Updater class creation to inside of the runProgram method. runProgram should only be called when the service is created at Kodi startup. Manual runs of the scanner now call the evalSchedules function directly.