[script.litebox] v1.0.4 - #2866
Conversation
Kodiai Add-on ReviewSummaryReviewed 1 changed addon on FindingsNo addon-rule violations were found in the reviewed diff. VerdictNo addon-rule violations found. Final approval remains with a human reviewer. |
d6b80b2 to
0824f60
Compare
|
I approved the review and am checking with the team to see about merging a third-party update. |
|
@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? |
|
@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. |
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.
|
@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:
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: One deliberate difference from BADMS. Their 1.0.1 made |
Description
Bugfix update:
script.liteboxis 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.zipand compared it tomatrix: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 inresources/lib/utils.pystill used it, so every image operation raised:Replaced with
Image.LANCZOS.ANTIALIASwas always an alias for it, andLANCZOShas existed since Pillow 2.7, so this stays compatible with old Pillow rather than requiringImage.Resampling(9.1+).Bug 2:
image.gaussian_blur()core signatureMyGaussianBlurcalled the C core directly asimage.gaussian_blur(self.radius). Newer Pillow requires a 2-item(xradius, yradius)sequence, raising:Rather than hardcode either signature,
MyGaussianBlurnow inheritsImageFilter.GaussianBlur, so Pillow itself makes the core call and adapts to whatever version is installed. Theradiusdefault of 10 is preserved. One behavioural note:GaussianBluris aMultibandFilter, 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)andresize(..., LANCZOS)) against real Pillow releases:argument 1 must be 2-item sequence, not intSo 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
ANTIALIASfailures in a single session and never produced an output image. Note thatscript.module.pilthere is a stub containing onlyaddon.xmlandicon.png, sofrom PIL import Imageresolves to the OS Pillow. The version is set by the distro, entirely outside the add-on system.kodi-addon-checker --branch=matrix --PR script.liteboxreports 0 problems. The 3 warnings are pre-existing (<forum>URL redirect/403,default.pyentry-point length) and untouched by this change.Checklist: