Skip to content

[script.litebox] v1.0.4 - #2866

Open
yorah wants to merge 1 commit into
xbmc:matrixfrom
yorah:script.litebox
Open

[script.litebox] v1.0.4#2866
yorah wants to merge 1 commit into
xbmc:matrixfrom
yorah:script.litebox

Conversation

@yorah

@yorah yorah commented Jul 29, 2026

Copy link
Copy Markdown

Description

Bugfix update: script.litebox is broken on Pillow 10+, which means it is broken on any reasonably current Python environment.

I'm submitting this as a third party. The add-on's declared <source> (https://github.com/BADMS/script.litebox) has had no commits since 2021-07-07, and its unreleased 1.0.3 still contains both bugs. Happy to adjust or withdraw if you'd rather this went through the original authors.

This affects users on current Kodi. The build in this branch is what the official repo serves to Omega users today. I downloaded https://mirrors.kodi.tv/addons/omega/script.litebox/script.litebox-1.0.0.zip and compared it to matrix:

d6f9fa8df07a5402e691b7cd2bf897aa  resources/lib/utils.py
b6050a4b11a13c0458f71766fe201867  resources/lib/imageoperations.py
22f801c41000753c262ef197ec925ff6  addon.xml

Byte-identical, hence submitting here rather than to a newer branch.

Bug 1: Image.ANTIALIAS (removed in Pillow 10.0)

Deprecated in Pillow 9.1, removed in Pillow 10.0 (July 2023). Two resize() calls in resources/lib/utils.py still used it, so every image operation raised:

module 'PIL.Image' has no attribute 'ANTIALIAS'

Replaced with Image.LANCZOS. ANTIALIAS was always an alias for it, and LANCZOS has existed since Pillow 2.7, so this stays compatible with old Pillow rather than requiring Image.Resampling (9.1+).

Bug 2: image.gaussian_blur() core signature

MyGaussianBlur called the C core directly as image.gaussian_blur(self.radius). Newer Pillow requires a 2-item (xradius, yradius) sequence, raising:

argument 1 must be 2-item sequence, not int

Rather than hardcode either signature, MyGaussianBlur now inherits ImageFilter.GaussianBlur, so Pillow itself makes the core call and adapts to whatever version is installed. The radius default of 10 is preserved. One behavioural note: GaussianBlur is a MultibandFilter, so the blur is applied to all bands at once instead of per-band. The result is identical for a Gaussian blur.

Verification

Exercised both patched paths (MyGaussianBlur(radius=30) and resize(..., LANCZOS)) against real Pillow releases:

Pillow original patched
8.4.0 (py3.9) OK OK
9.5.0 (py3.11) OK OK
10.0.0 blur fails OK
10.4.0 blur fails OK
11.3.0 argument 1 must be 2-item sequence, not int OK

So the fix repairs Pillow 10+ without regressing the Pillow 8/9 versions current when this branch was cut.

Also confirmed on a live install (CoreELEC 21.3, Kodi 21, Python 3.13, Pillow 11.0.0), where the unpatched add-on logged 1985 ANTIALIAS failures in a single session and never produced an output image. Note that script.module.pil there is a stub containing only addon.xml and icon.png, so from PIL import Image resolves to the OS Pillow. The version is set by the distro, entirely outside the add-on system.

kodi-addon-checker --branch=matrix --PR script.litebox reports 0 problems. The 3 warnings are pre-existing (<forum> URL redirect/403, default.py entry-point length) and untouched by this change.

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] v1.0.0

@kodiai

kodiai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Kodiai Add-on Review

Summary

Reviewed 1 changed addon on matrix using 3 scoped patches.

Findings

No addon-rule violations were found in the reviewed diff.

Verdict

No addon-rule violations found. Final approval remains with a human reviewer.

@yorah
yorah force-pushed the script.litebox branch 2 times, most recently from d6b80b2 to 0824f60 Compare July 29, 2026 22:24
@pkscout

pkscout commented Aug 2, 2026

Copy link
Copy Markdown
Member

I approved the review and am checking with the team to see about merging a third-party update.

@pkscout

pkscout commented Aug 2, 2026

Copy link
Copy Markdown
Member

@BADMS are you OK with this third party merge, or would you rather have them submit the update to you directly and then do an addon update?

@pkscout

pkscout commented Aug 9, 2026

Copy link
Copy Markdown
Member

@yorah We can consider this addon abandoned at this point. If you want to take over maintenance, we ask that you fork the original repo BADMS had and then update the addon.xml to add you as a provider (you can put your info first and leave the others there) as well as the source and contact email.

@yorah yorah changed the title [script.litebox] v1.0.1 [script.litebox] v1.0.4 Aug 24, 2026
Brings the add-on up to date with the upstream repository, fixes the
colour conversion helpers, and adds a Pillow 10+ compatibility fix.

The Kodi repo has been on 1.0.0 while BADMS released 1.0.1, 1.0.2 and
1.0.3 to their own repository without submitting them here, so this
change carries those over as well:

  1.0.1 - use colorsys for the hls and hsv conversions, change check_mod
          to floor the modifier at the current channel value, point the
          forum link at the add-on's own thread
  1.0.2 - lower the daemon poll interval to 0.1s
  1.0.3 - revert the daemon poll interval back to 0.2s
  1.0.4 - the fixes below

1.0.2 and 1.0.3 cancel out, so no daemon change reaches this diff.

Pillow
------
Image.ANTIALIAS was removed in Pillow 10.0, so resizing raised
AttributeError on any current install. It is replaced with
Image.LANCZOS, which it was an alias for.

MyGaussianBlur called the PIL core gaussian_blur directly; that
signature changed and now raises "TypeError: argument 1 must be 2-item
tuple, not int". It now inherits ImageFilter.GaussianBlur so Pillow
supplies the call itself.

Colour conversion
-----------------
The bundled rgb_to_hsv is colorsys' implementation with true division
replaced by floor division, so every intermediate collapses to 0.0 or
1.0 and it returns hue 0.0 for essentially any input. The hsv mode has
therefore never produced a correct colour. 1.0.1 switched to colorsys,
which this carries over.

fhsv was worse: a misplaced parenthesis meant check_mod was called with
one argument instead of two, so every fhsv request raised TypeError.
That is also fixed by the 1.0.1 rewrite.

ONE_THIRD, ONE_SIXTH and TWO_THIRD were defined as round(1/3, 1) and
friends, so hls_to_rgb ran with 0.3, 0.2 and 0.7 in place of the real
thirds and sixths. That skews every hue it produces - asking for hue
0.20 returned a colour at hue 0.14 - and makes the first branch of _v()
return up to 1.14, pushing a channel past 255. RGB_to_hex did not clamp,
so those overflows surfaced as nine character strings such as FF124ff00,
which is not a valid AARRGGBB colour. This uses the true constants and
clamps in RGB_to_hex; across a 6x6x6 colour cube and 22 modifier strings
that takes malformed output from 270 cases to none.

fhls and fhsv accept the '-' form again; the 1.0.1 rewrite converted the
argument to float in the caller, which crashed on '-' before check_mod
ever saw it. Numeric modifiers still floor at the channel's current
value as 1.0.1 intended, except on hue, which is forced. Hue is
circular, so max() on it silently discards the request roughly half the
time - asking for yellow-green on a magenta colour returned the magenta.

Skinners should be aware that hls, hsv and fhls output shifts as a
result of the above; bump is unchanged.

Maintenance
-----------
The add-on is unmaintained upstream and I am taking it over, so
addon.xml now lists me as a provider and points source and contact email
at https://github.com/yorah/script.litebox.
@yorah

yorah commented Aug 24, 2026

Copy link
Copy Markdown
Author

@pkscout Done. Forked to https://github.com/yorah/script.litebox and updated addon.xml: I'm first in provider-name with the originals kept, and source and email point at me.

Version is 1.0.4 rather than 1.0.1. This repo has been on 1.0.0, but BADMS put out 1.0.1, 1.0.2 and 1.0.3 in their own repo and never submitted them here. Reusing 1.0.1 would mean two different code states under the same number, so I pulled their changes in and bumped past them. 1.0.2 and 1.0.3 only move the daemon poll interval from 0.2 to 0.1 and back, so nothing from them shows up in the diff.

The diff is bigger than before because the colour helpers in 1.0.0 are broken:

  • fhsv always raises TypeError. A paren is misplaced, so check_mod gets one argument instead of two.
  • hsv always returns hue 0. The bundled rgb_to_hsv is colorsys with / replaced by //.
  • ONE_THIRD and friends are round(1/3, 1), so hls_to_rgb runs with 0.3, 0.2 and 0.7. Hues come out skewed and channels can go past 255. RGB_to_hex doesn't clamp, so those turn into nine character strings like FF124ff00.

BADMS fixed the first two in 1.0.1 by moving to colorsys. The constants and the clamp are mine. Over 5616 test cases 1.0.0 crashes 1296 times and emits 270 bad colour strings. This branch does neither.

Worth knowing for skinners: hls, hsv and fhls produce different colours than 1.0.0 now. bump is unchanged.

One deliberate difference from BADMS. Their 1.0.1 made fhls and fhsv numbers mean max(requested, current) instead of "set to this". That works for lightness and saturation, but hue is a wheel, so max() just drops the request about half the time. I kept the floor for lightness and saturation and force hue. I also restored the - form, which 1.0.1 broke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants