Skip to content

[service.libraryautoupdate] 1.2.6 - #2891

Merged
romanvm merged 1 commit into
xbmc:matrixfrom
robweber:libraryautoupdate_matrix
Sep 12, 2026
Merged

romanvm merged 1 commit into
xbmc:matrixfrom
robweber:libraryautoupdate_matrix

Conversation

@robweber

@robweber robweber commented Sep 2, 2026

Copy link
Copy Markdown

Description

Changed

  • cron expression error checking now sets a default value in addition to throwing an error
  • added constructor with expected parameters to CronSchedule class

Fixed

  • fixed issue with Run on Idle crashing during manual run
  • also catch KeyError during cron expression checking
  • wrong default in settings.xml file for Clean Library function, resulted in looping behavior fixes

Checklist:

  • My code follows the add-on rules and piracy stance of this project.
  • I have read the CONTRIBUTING document
  • Each add-on submission should be a single commit with using the following style: [script.foo.bar] 1.0.0

Additional information :

  • Submitting your add-on to this specific branch makes it available to any Kodi version equal or higher than the branch name with the applicable Kodi dependencies limits.
  • add-on development wiki page.
  • Kodi pydocs provide information about the Python API
  • PEP8 codingstyle which is considered best practise but not mandatory.
  • This add-on repository has automated code guideline check which could help you improve your coding. You can find the results of these check at Codacy. You can create your own account as well to continuously monitor your python coding before submitting to repo.
  • Development questions can be asked in the add-on development section on the Kodi forum.

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

This release updates schedule construction and cron validation, fixes manual-run idle handling and the cleaning default, and refreshes Swedish translations and add-on metadata. The constructor and validation refactors leave three reachable service failures:

  • Custom-path schedule creation still uses the removed no-argument constructor.
  • Post-scan cleaning can reference an uninitialized command for an excluded library.
  • Cleaning and custom-path cron expressions bypass the new validation while calcNextRun no longer provides fallback handling.

Confidence Score: 2/5

This PR is not safe to merge until custom-path construction, post-scan cleaning selection, and cron fallback handling are corrected.

The changed scheduling code has three reachable exception paths that can abort custom-path setup, post-scan callbacks, or service initialization.

Files Needing Attention: service.libraryautoupdate/resources/lib/cronclasses.py, service.libraryautoupdate/resources/lib/service.py

Important Files Changed

Filename Overview
service.libraryautoupdate/resources/lib/cronclasses.py Adds a required CronSchedule constructor but leaves the live custom-path factory using parameterless construction.
service.libraryautoupdate/resources/lib/service.py Refactors schedule creation and cron validation but introduces an uninitialized cleaning command and removes fallback handling from unvalidated expression paths.
service.libraryautoupdate/resources/settings.xml Corrects the cleaning-library default to numeric option 0 and changes category identifiers without an identified defect.
service.libraryautoupdate/addon.xml Bumps the release version and updates release notes and Swedish metadata.
service.libraryautoupdate/resources/language/resource.language.sv_se/strings.po Refreshes Swedish translations and catalog metadata without affecting runtime logic.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Kodi service initialization] --> B[Create standard schedules]
  B --> C[Load custom-path schedules]
  C -->|CronSchedule without arguments| D[TypeError]
  B --> E[Calculate next run]
  E -->|Unvalidated clean/custom expression| F[Uncaught croniter error]
  G[Library scan finishes] --> H[databaseUpdated]
  H -->|Completed library excluded from cleaning| I[clean_command uninitialized]
  I --> J[UnboundLocalError]
Loading

Reviews (1): Last reviewed commit: "[service.libraryautoupdate] 1.2.6" | Re-trigger Greptile

next_run = 0
on_delay = False # used to defer processing until after player finishes

def __init__(self, name, command, expression=""):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Custom schedules use obsolete constructor

When custom video or music paths are configured, _createSchedule still invokes CronSchedule() without arguments even though this constructor now requires name and command, causing a TypeError that prevents custom-path schedules from being created.

aJob.command = {'method': 'AudioLibrary.Clean', 'params': {'showdialogs': showDialogs}}
clean_command = {'method': 'AudioLibrary.Clean', 'params': {'showdialogs': showDialogs}}

aJob = CronSchedule(utils.getString(30048), clean_command)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Cleaning command remains uninitialized

When cleaning after each update is limited to one library and a scan of the excluded library finishes, neither branch initializes clean_command, but the code uses it unconditionally, causing UnboundLocalError and aborting the post-scan callback instead of skipping that library.

Comment on lines +225 to +227
cron = croniter(cronExp, startTime)

try:
# create croniter for this expression
cron = croniter(cronExp, startTime)
nextRun = cron.get_next(float)
except ValueError:
# error in syntax
xbmcgui.Dialog().ok(utils.getString(30000), utils.getString(30016) % cronExp)
utils.log('Cron syntax error %s' % cronExp, xbmc.LOGDEBUG)
return cron.get_next(float)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unvalidated schedules lose fallback

When a saved cleaning or custom-path cron expression is malformed, it reaches calcNextRun without passing through checkTimer; removing the previous ValueError fallback lets croniter terminate schedule creation or timer recalculation and can stop the auto-update service.

@romanvm romanvm added the Approved Approved and is ready to merge label Sep 12, 2026
@romanvm
romanvm merged commit 498d976 into xbmc:matrix Sep 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Approved and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants