Illustration API enhancement
Fixes #937
Codecov Report
:x: Patch coverage is 50.56180% with 44 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 57.92%. Comparing base (abf8d4a) to head (c84e2f4).
:warning: Report is 10 commits behind head on main.
:x: Your patch status has failed because the patch coverage (50.56%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.
Additional details and impacted files
@@ Coverage Diff @@
## main #997 +/- ##
==========================================
- Coverage 58.15% 57.92% -0.24%
==========================================
Files 100 101 +1
Lines 5325 5407 +82
Branches 2179 2219 +40
==========================================
+ Hits 3097 3132 +35
- Misses 778 801 +23
- Partials 1450 1474 +24
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
getIllustrationSizeshas not changed. It's a separate discussion but what's the decision on this? @kelson42 ?
Aren't we going to deprecate the old API?
- I thought we'd get a public method to add/read with just the width, height and scale but we have to use a new type. That's OK.
I will add wrappers. Let me see how to do it best.
- I find
Archive::getIllustrations()confusing. We're only getting Illustration Info, not actual illustrations. Maybe that's in line with the rest of the libzim code base though?
That's a valid point, but I found Archive::getIllustrationInfos() a little too verbose in a typed language. In this context IllustrationInfo's act like handles to illustration data (that should be obtained via Archive::getIllustrationItem()). Suppose that getIllustrations() returns pointers to the illustration objects. Should it be named getIllustrationPtrs() then? That's the logic behind the name for that method that I ended up with.
getIllustrationSizeshas not changed. It's a separate discussion but what's the decision on this? @kelson42 ?Aren't we going to deprecate the old API?
Indeed, it's even in the ticket. Is the deprecation doc and warning to be in a separate PR?
- I find
Archive::getIllustrations()confusing. We're only getting Illustration Info, not actual illustrations. Maybe that's in line with the rest of the libzim code base though?That's a valid point, but I found
Archive::getIllustrationInfos()a little too verbose in a typed language. In this contextIllustrationInfo's act like handles to illustration data (that should be obtained viaArchive::getIllustrationItem()). Suppose thatgetIllustrations()returns pointers to the illustration objects. Should it be namedgetIllustrationPtrs()then? That's the logic behind the name for that method that I ended up with.
You are mistaking Type suffixes (which is a terrible practice) with semantic/meaningful naming. I'm just signaling that from my POV it's confusing to request illustrations and receive a struct of illustration metadata. Nothing serious though and I strongly believe that API coherence is more important than individual precision
@rgaudin I've renamed getIllustrations() to getIllustrationInfos() and deprecated getIllustrationSizes().
- I thought we'd get a public method to add/read with just the width, height and scale but we have to use a new type. That's OK.
I will add wrappers. Let me see how to do it best.
I didn't add any wrappers. Instead I provided an overload of getIllustrationInfos() that allows to obtain a list of illustrations with the specified dimensions.
@kelson42 Please don't merge until I get rid of the fixup commits.
The PR has been rebased.
CI failures on Linux are because since kiwix/kiwix-build#834 was merged dependencies are built on jammy, while libzim CI keeps running on focal. Should be fixed by #1002.
The failures on macOS have nothing to do with these changes. One of the failures is because of the following error:
meson.build:55:17: ERROR: Dependency "xapian-core" not found, tried pkgconfig, framework and cmake
The other three failures say:
meson.build:1:0: ERROR: Unknown compiler(s): [['/Applications/Xcode_16.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang']] The following exception(s) were encountered: Running
/Applications/Xcode_16.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --versiongave "[Errno 2] No such file or directory: '/Applications/Xcode_16.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'"
@veloman-yunkan Thank you! I will merge then.