Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/test ci #1

Open
wants to merge 77 commits into
base: devel
Choose a base branch
from
Open

Dev/test ci #1

wants to merge 77 commits into from

Conversation

QSchulz
Copy link
Owner

@QSchulz QSchulz commented Nov 19, 2024

No description provided.

QSchulz added 30 commits January 5, 2022 19:00
Until now, to change the log-level for a subcommand, the following was
to be executed:

recitale --log-level DEBUG build

This patch moves the parameter to subcommands so that the following can
be executed instead:

recitale build --log-level DEBUG

which feels more natural.

Signed-off-by: Quentin Schulz <[email protected]>
width and height variables are strings when split from the output of
subprocess.check_output. However, in ratio property, width is divided by
height which only works for numbers which isn't the case unless they are
casted to a number before being put in self.size tuple.

Signed-off-by: Quentin Schulz <[email protected]>
BaseVideo.size is only set by ratio property since the reencode()
function which calls ffprobe sets the size attribute only to the
ReencodedVideo and not the BaseVideo.
Thereofre, when BaseVideo.ratio is called, the size attribute does not
exist yet and will raise an AttributeError.

So instead of checking if the size attribute is set, let's check if the
object has the size attribute.

Signed-off-by: Quentin Schulz <[email protected]>
This prepares for getting more info about a video in a later commit in
one go instead of calling ffprobe multiple times.

Signed-off-by: Quentin Schulz <[email protected]>
To prepare for getting more infos from ffprobe and make it easier to
parse, let's just switch to json instead of doing manual parsing of csv.

Signed-off-by: Quentin Schulz <[email protected]>
This allows themes and rendering functions to access the duration of a
video.

This will be useful to display during rendering how much of a video has
already been reencoded.

Signed-off-by: Quentin Schulz <[email protected]>
This allows to display a progress bar displaying the amount of the video
that has already been reencoded making the wait a bit more
user-friendly.

Signed-off-by: Quentin Schulz <[email protected]>
This allows themes and rendering functions to access the duration of an
audio file.

This will be useful to display during rendering how much of an audio
file has already been reencoded.

Signed-off-by: Quentin Schulz <[email protected]>
This allows to display a progress bar displaying the amount of the audio
that has already been reencoded making the wait a bit more
user-friendly.

Signed-off-by: Quentin Schulz <[email protected]>
This adds untested line numbers to the report so it's easier to know
what kind of tests should be written next.

Signed-off-by: Quentin Schulz <[email protected]>
== operator is different from the "is" operator. Since the factories
should return the same object if the same parameters are given, "is"
operator should be used and not the equal operator, which can return two
different objects with the same content.

Signed-off-by: Quentin Schulz <[email protected]>
This adds missing tests for BaseAudio so that 100% code coverage is
reached.

Signed-off-by: Quentin Schulz <[email protected]>
This adds missing unit tests for BaseImage to improve test coverage.

Signed-off-by: Quentin Schulz <[email protected]>
This adds missing unit tests for BaseVideo to improve test coverage.

Signed-off-by: Quentin Schulz <[email protected]>
…ryptodomex

To limit the number of external, non-Python dependencies and subprocess
calls, let's migrate the HTML page encryption from subprocess'ed OpenSSL
encryption to pycryptodomex.

However, the key and IV derivation implementation supported by CryptoJS
(the client side decryption tool) is OpenSSL specific and therefore
needed to be re-implemented in Python.

Signed-off-by: Quentin Schulz <[email protected]>
…g name

There's a variable available to get the branch/tag name that can be used
insteaf of using a regular expression for the GitHub refspec so let's
use it.

Signed-off-by: Quentin Schulz <[email protected]>
This adds a Dockerfile which fetches recitale pip package and make it
available through a Debian-based container image.

Signed-off-by: Quentin Schulz <[email protected]>
…ghcr.io

This builds a container image based on the recitale PYPI package that
was pushed in the pypi-package job, does a small check by building the
example gallery and then pushes it to ghcr.io registry.

Signed-off-by: Quentin Schulz <[email protected]>
pathlib is a Python standard library so no additional package is needed.

Also, it's been reported for prosopopee that MacOS users cannot use the
software because of some path.py function being broken so using pathlib
instead seems like a good idea.

See: Psycojoker/prosopopee#124

Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
Wild guess turned out to be wrong, let's fix the URL with a working one.

Signed-off-by: Quentin Schulz <[email protected]>
For Jpeg, MPO and TIFF formats, dpi is of type IFDRational and is thus
not serializable which crashes the cache saving.

This casts the dpi tuple into a float tuple to make it serializable.

Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
With the with_ extension being built-in since 2.9 and removed in 3.1, in
order to be compatible with 3.1 and later, the min version needs to be
2.9.

Signed-off-by: Quentin Schulz <[email protected]>
From Jinja2 docs:
"""
Changed in version 2.9.

This extension is now built-in and no longer does anything.
"""

https://jinja.palletsprojects.com/en/2.9.x/extensions/#with-statement

This was not an issue until 3.1 version was released, which removed this
extension and thus fails recitale.
c.f. https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0

Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
flake apparently now errors out with this inline comment, so let's move
the comment before the line to make flake happy.

Signed-off-by: Quentin Schulz <[email protected]>
The video is actually slightly bigger and starts vertically a bit
lower than the thumbnail, leaving a few pixels from the thumbnail
above the video.

There's no reason for this so let's fix that by having the video match
the thumbnail.

Signed-off-by: Quentin Schulz <[email protected]>
While the thumbnail is properly rendered, the video was smaller than the
thumbnail, making it a bit funny looking.

Let's have the video fill the thumbnail entirely instead.

Signed-off-by: Quentin Schulz <[email protected]>
QSchulz and others added 30 commits August 31, 2023 18:00
This allows to not provide a 'date' setting for autogenerated
galleries. The 'date' will automatically be retrieved from the oldest
file in the gallery, either from one of its EXIF date tags or from its
mtime.

Suggested-by: crypto512 <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
show_date is supported since commit dc51723 ("[enh] add show_date
setting, to be able to order galleries, without showing the date") but
it wasn't documented, so let's fix this oversight.

Signed-off-by: Quentin Schulz <[email protected]>
ffmpeg_audio encoder settings are supported since commit 2f657c9
("start audio support") so let's document those settings.

Signed-off-by: Quentin Schulz <[email protected]>
It's ffmpeg and not ffmeg so let's fix the typo. While at it, remove a
spurious whitespace.

Signed-off-by: Quentin Schulz <[email protected]>
On systems where neither LC_TIME, LANGUAGE, LC_ALL, LC_CTYPE nor LANG
environment variables are set, babel.default_locale('LC_TIME') will return
an object of NoneType type which will then fail the babel.format_date()
later in the code path.

In order to account for those systems, default to the POSIX locale as is
supposed to be the case on POSIX-compliant systems[1].

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html section 7.2
Reported-by: Sebastien Stormacq <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
Typo in href of the link.

Signed-off-by: Quentin Schulz <[email protected]>
It's 2023, time to use HTTPS now.

Signed-off-by: Quentin Schulz <[email protected]>
This domain is for sale (and has been for a while since it was removed
from README.md three years ago already).

Signed-off-by: Quentin Schulz <[email protected]>
Google pulled the plug on Google+ more than 4 years ago, so we can
remove those share links now.

Signed-off-by: Quentin Schulz <[email protected]>
The second background URL was missing a separator between the gallery
link and the thumbnail filename, let's add it to have a more proper
path.

Signed-off-by: Quentin Schulz <[email protected]>
0.18.0 has removed the safe_load function we use. Let's just force an
older version instead until we fix it (or switch for something else).

Signed-off-by: Quentin Schulz <[email protected]>
The caption is part of a div being 100% of the media to show (be it a
video or a picture), therefore adding a right and left margin makes it
only take the centered 75% of the media instead of the full width.

The 11.5% are actually applied to the parent parent container. It's a
mistake to duplicate it, so let's remove it.

Signed-off-by: Quentin Schulz <[email protected]>
black 24.1a1 suggests changes that other versions do not. black used to
have only pre-releases before 22.1.0 and we had a hard dependency on
black being older than 19.10b0.

Because of how pip installs dependencies[1], providing 19.10b0 as
minimum version asked pip to install the latest version, even if it is a
pre-release, therefore installing 24.1a1.

Considering that black now uses "proper" releases, let's use the first
release version as minimum dependency to avoid the changes suggested in
24.1a1.

[1] https://pip.pypa.io/en/stable/cli/pip_install/#pre-release-versions

Signed-off-by: Quentin Schulz <[email protected]>
Python v3.12 and later raise an exception for this line with the
following message:
"""
AttributeError: 'called_once_with' is not a valid assertion. Use a spec for the mock if 'called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?
"""

A bit of research returned commit 1d4d677d1c90 ("gh-100690: Raise an
AttributeError when the assert_ prefix is forgotten when using Mock
(#100691)") from CPython git history, which in turns points at
python/cpython#100690.

This GitHub issue mentions that called_once_with returns a Mock object
instead of doing a proper assertion. This test is basically a no-op.

Therefore, let's fix the test by doing a proper assertion.

Fixes: 94d64c8 ("test: image: improve code coverage by testing BaseImage")
Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
The caption is part of a div being 100% of the media to show (be it a
video or a picture), therefore adding a right and left margin makes it
only take the centered 75% of the media instead of the full width.

The 11.5% are actually applied to the parent parent container. It's a
mistake to duplicate it, so let's remove it.

Signed-off-by: Quentin Schulz <[email protected]>
In case there's a subgallery with a video as cover, the link is improper
as gallery.link provides the absolute path of the subgallery. Considering
that all paths here are expected to be relative, this ends up being
wrong. Instead, let's use the name of the subgallery instead of its link
so that the path relative to the subgallery as returned by vid and
video.thumbnail can simply be concatenated with the name to provide the
path relative to the current gallery.

Signed-off-by: Quentin Schulz <[email protected]>
TIME_FORMAT is used both for encoding and decoding a date. If a media
file doesn't contain an exif field for the date, it'll be provided one
from the mtime, itself encoded via TIME_FORMAT. However if a media file
does contain an exif field for the date, then it'll be used without
going through the encoding part. Therefore, the decoding should take
into account that the seconds part of the date can be something else
than 00.

This fixes autogen for the oldest file, in a gallery without a predefined
cover, with an exif date field where the seconds part was non-zero.

Fixes: 5e525a5 ("autogen: autofill date gallery setting if missing")
Signed-off-by: Quentin Schulz <[email protected]>
To cover potential regressions, let's make sure that non-zero numbers
for seconds in exif fields are used to test autogen.

This is a follow up for the previous commit fixing a non-zero number of
seconds in exif fields when generating a gallery with no predefined
cover.

Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants