Skip to content

Commit

Permalink
[61] (v1) Add --font-vertical-shift arg to Movie Posters in the mini …
Browse files Browse the repository at this point in the history
…maker
  • Loading branch information
CollinHeist committed Aug 11, 2024
1 parent 652f407 commit e758473
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
14 changes: 11 additions & 3 deletions mini_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@ def genre_card_batch(
@click.option('--font', type=Path, default=MoviePosterMaker.FONT,
help='Custom font for the title text')
@click.option('--font-color', type=str, default=MoviePosterMaker.FONT_COLOR,
help='Font color for the title text(s)')
help='Font color for the title text')
@click.option('--font-size', type=click.FloatRange(min=0.0), default=1.0,
help='Font size scalar for the text')
@click.option('--font-vertical-shift', type=int, default=0,
help='Vertical shift to apply to title text')
@click.option('--drop-shadow', is_flag=True,
help='Whether to add a drop shadow to the text for the movie poster')
@click.option('--borderless', is_flag=True,
Expand All @@ -221,6 +223,7 @@ def create_movie_poster(
font: Path,
font_color: str,
font_size: float,
font_vertical_shift: int,
drop_shadow: bool,
borderless: bool,
omit_gradient: bool,
Expand All @@ -237,6 +240,7 @@ def create_movie_poster(
font_file=font,
font_color=font_color,
font_size=font_size,
font_vertical_shift=font_vertical_shift,
borderless=borderless,
add_drop_shadow=drop_shadow,
omit_gradient=omit_gradient,
Expand Down Expand Up @@ -324,6 +328,8 @@ class Show:
help='Font size scalar for the season text')
@click.option('--font-kerning', type=float, default=1.0,
help='Font kerning scale for the season text')
@click.option('--font-vertical-shift', type=int, default=0,
help='Vertical shift to apply to the season text (in pixels)')
@click.option('--logo-placement',
type=click.Choice(['top', 'middle', 'bottom']), default='bottom',
help='Placement of the logo')
Expand All @@ -337,10 +343,11 @@ def season_poster(
destination: Path,
logo: Optional[Path],
season_text: list[str],
font: Path,
font_file: Path,
font_color: str,
font_size: float,
font_kerning: float,
font_vertical_shift: int,
logo_placement: Literal['top', 'middle', 'bottom'],
text_placement: Literal['top', 'bottom'],
omit_gradient: bool,
Expand All @@ -351,10 +358,11 @@ def season_poster(
destination=destination,
logo=logo,
season_text='\n'.join(season_text),
font=font,
font_color=font_color,
font=font_file,
font_size=font_size,
font_kerning=font_kerning,
font_vertical_shift=font_vertical_shift,
logo_placement=logo_placement,
text_placement=text_placement,
omit_gradient=omit_gradient,
Expand Down
26 changes: 4 additions & 22 deletions modules/MoviePosterMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,12 @@ def __init__(self,
font_file: Path = FONT,
font_color: str = FONT_COLOR,
font_size: float = 1.0,
font_vertical_shift: int = 0,
borderless: bool = False,
add_drop_shadow: bool = False,
omit_gradient: bool = False,
) -> None:
"""
Construct a new instance of a CollectionPosterMaker.
Args:
source: The source image to use for the poster.
output: The output path to write the poster to.
title: String to use on the created poster.
subtitle: String to use for smaller title text.
top_subtitle: String to use for smaller subtitle text that
appears above the title text.
movie_index: Optional (series) index to place behind the
movie title.
logo: Optional path to a logo file to place on top of the
poster.
font_file: Path to the font file of the poster's title.
font_color: Font color of the poster text.
font_size: Scalar for the font size of the poster's title.
add_drop_shadow: Whether to add a drop shadow to the text.
borderless: Whether to omit the white frame border.
omit_gradient: Whether to make the poster with no gradient
overlay.
"""
"""Construct a new instance of this object."""

# Initialize parent object for the ImageMagickInterface
super().__init__()
Expand All @@ -70,6 +50,7 @@ def __init__(self,
self.font_file = font_file
self.font_color = font_color
self.font_size = font_size
self.font_vertical_shift = font_vertical_shift
self.borderless = borderless
self.add_drop_shadow = add_drop_shadow
self.omit_gradient = omit_gradient
Expand Down Expand Up @@ -223,6 +204,7 @@ def title_command(self) -> list[str]:
f'-layers merge',
f'+repage',
]
y_offset += self.font_vertical_shift

# At least one title being added, return entire command
return [
Expand Down
2 changes: 1 addition & 1 deletion modules/ref/version_webui
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0-alpha.11.0-webui60
v2.0-alpha.11.0-webui61

0 comments on commit e758473

Please sign in to comment.