Skip to content

Commit

Permalink
Release v1.14.5
Browse files Browse the repository at this point in the history
Release v1.14.5
  • Loading branch information
CollinHeist authored Oct 26, 2023
2 parents 79ce6b0 + ab2a622 commit 235edcb
Show file tree
Hide file tree
Showing 44 changed files with 1,595 additions and 801 deletions.
15 changes: 8 additions & 7 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ verify_ssl = true
name = "pypi"

[packages]
regex = "==2023.3.23"
regex = "==2023.10.3"
num2words = "==0.5.12"
pyyaml = "==6.0"
requests = "==2.31.0"
titlecase = "==2.4"
tqdm = "==4.65.0"
fonttools = "==4.40.0"
plexapi = "==4.14.0"
tenacity = "==8.2.2"
tinydb = "==4.7.1"
schedule = "==1.2.0"
tqdm = "==4.66.1"
fonttools = "==4.43.0"
plexapi = "==4.15.4"
tenacity = "==8.2.3"
tinydb = "==4.8.0"
schedule = "==1.2.1"
tmdbapis = "==1.2.0"
"ruamel.yaml" = "==0.17.21"
imagesize = "==1.4.1"
pillow = "==10.0.1"

[dev-packages]

Expand Down
563 changes: 333 additions & 230 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ For invocation and configuration details, read [here](https://github.com/CollinH
Below are examples of almost all the types of title card that can be created automatically by TitleCardMaker:

### Built-in Card Types
<img alt="Anime" src="https://user-images.githubusercontent.com/17693271/185820454-4e3dca1c-c0df-4fa0-a7a7-81e070aa9e69.jpg" height="150"/> <img alt="comic book" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/c5f34e46-ec3b-44a9-a563-b9a24db8cd1a" height="150"/> <img alt="Cutout" src="https://user-images.githubusercontent.com/17693271/212500535-e88daff6-ecc0-4cc8-8627-82069114c7e0.jpg" height="150"/> <img alt="Divider" src="https://user-images.githubusercontent.com/17693271/232378485-a9a737dc-9faf-47c2-b639-7df3d3ffb194.jpg" height="150"> <img alt="Fade" src="https://user-images.githubusercontent.com/17693271/214648223-b4f68553-e982-4efa-a16b-9662018b5d40.jpg" height="150"/> <img alt="Frame" src="https://user-images.githubusercontent.com/17693271/202352614-155a176a-fdb0-4476-9f11-6a3a20533a54.jpg" height="150"/> <img alt="Landscape" src="https://user-images.githubusercontent.com/17693271/202352137-b411da21-65ce-4bed-991b-90428c71ec34.jpg" height="150"/> <img alt="Logo" src="https://user-images.githubusercontent.com/17693271/172227163-0ee4990a-b0a8-4dbd-91b3-3f57dfe6e732.jpg" height="150"/> <img alt="Marvel" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/8cd0c2b5-bd48-4c58-9e5b-bf1e0ebf322d" height="150"> <img alt="Olivier" src="https://user-images.githubusercontent.com/17693271/212500009-067f14ff-4f48-4f75-bacd-7311a9aba716.jpg" height="150"/> <img alt="Overline" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/a8de2b70-5d62-4a14-97cd-3ed365054795" height="150"> <img alt="Poster" src="https://user-images.githubusercontent.com/17693271/180627387-f72bb58e-e001-4608-b4be-82a26263c628.jpg" height="150"/> <img alt="Roman" src="https://user-images.githubusercontent.com/17693271/203910966-4dde1466-6c7e-4422-923b-1f9222ad49e9.jpg" height="150"/> <img alt="Standard" src="https://user-images.githubusercontent.com/17693271/212500240-ae946f2c-a5c8-4881-85f2-83ccb45bf46e.jpg" height="150"/> <img alt="Star Wars" src="https://user-images.githubusercontent.com/17693271/170836059-136fa6eb-40ef-4cd7-9aca-8ad8e0537239.jpg" height="150"> <img alt="tinted Frame" src="https://user-images.githubusercontent.com/17693271/233257029-8b17ce2e-01ea-4ae3-bc73-54e152be4d31.jpg" height="150"> <img alt="Tinted Glass" src="https://user-images.githubusercontent.com/17693271/213939482-6018b2be-28c5-42dd-988d-d7b9733fe0e8.jpg" height="150"> <img alt="White Border" height="150" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/14f25d6a-4be7-4078-97c2-7730ed070508"/>
<img alt="Anime" src="https://user-images.githubusercontent.com/17693271/185820454-4e3dca1c-c0df-4fa0-a7a7-81e070aa9e69.jpg" height="150"/> <img alt="Calligraphy" src="https://user-images.githubusercontent.com/17693271/275364823-473521f4-e2e3-4236-a514-49eb186f2872.jpg" height="150"> <img alt="Comic Book" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/c5f34e46-ec3b-44a9-a563-b9a24db8cd1a" height="150"/> <img alt="Cutout" src="https://user-images.githubusercontent.com/17693271/212500535-e88daff6-ecc0-4cc8-8627-82069114c7e0.jpg" height="150"/> <img alt="Divider" src="https://user-images.githubusercontent.com/17693271/232378485-a9a737dc-9faf-47c2-b639-7df3d3ffb194.jpg" height="150"> <img alt="Fade" src="https://user-images.githubusercontent.com/17693271/214648223-b4f68553-e982-4efa-a16b-9662018b5d40.jpg" height="150"/> <img alt="Frame" src="https://user-images.githubusercontent.com/17693271/202352614-155a176a-fdb0-4476-9f11-6a3a20533a54.jpg" height="150"/> <img alt="Landscape" src="https://user-images.githubusercontent.com/17693271/202352137-b411da21-65ce-4bed-991b-90428c71ec34.jpg" height="150"/> <img alt="Logo" src="https://user-images.githubusercontent.com/17693271/172227163-0ee4990a-b0a8-4dbd-91b3-3f57dfe6e732.jpg" height="150"/> <img alt="Marvel" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/8cd0c2b5-bd48-4c58-9e5b-bf1e0ebf322d" height="150"> <img alt="Olivier" src="https://user-images.githubusercontent.com/17693271/212500009-067f14ff-4f48-4f75-bacd-7311a9aba716.jpg" height="150"/> <img alt="Overline" src="https://user-images.githubusercontent.com/17693271/277546845-a8de2b70-5d62-4a14-97cd-3ed365054795.jpg" height="150"> <img alt="Poster" src="https://user-images.githubusercontent.com/17693271/180627387-f72bb58e-e001-4608-b4be-82a26263c628.jpg" height="150"/> <img alt="Roman" src="https://user-images.githubusercontent.com/17693271/203910966-4dde1466-6c7e-4422-923b-1f9222ad49e9.jpg" height="150"/> <img alt="Standard" src="https://user-images.githubusercontent.com/17693271/212500240-ae946f2c-a5c8-4881-85f2-83ccb45bf46e.jpg" height="150"/> <img alt="Star Wars" src="https://user-images.githubusercontent.com/17693271/170836059-136fa6eb-40ef-4cd7-9aca-8ad8e0537239.jpg" height="150"> <img alt="tinted Frame" src="https://user-images.githubusercontent.com/17693271/233257029-8b17ce2e-01ea-4ae3-bc73-54e152be4d31.jpg" height="150"> <img alt="Tinted Glass" src="https://user-images.githubusercontent.com/17693271/213939482-6018b2be-28c5-42dd-988d-d7b9733fe0e8.jpg" height="150"> <img alt="White Border" height="150" src="https://github.com/CollinHeist/TitleCardMaker/assets/17693271/14f25d6a-4be7-4078-97c2-7730ed070508"/>

> The above cards are, in order, the [anime](https://github.com/CollinHeist/TitleCardMaker/wiki/AnimeTitleCard), [comic book](https://github.com/CollinHeist/TitleCardMaker/wiki/ComicBookTitleCard), [cutout](https://github.com/CollinHeist/TitleCardMaker/wiki/CutoutTitleCard), [divider](https://github.com/CollinHeist/TitleCardMaker/wiki/DividerTitleCard), [fade](https://github.com/CollinHeist/TitleCardMaker/wiki/FadeTitleCard), [frame](https://github.com/CollinHeist/TitleCardMaker/wiki/FrameTitleCard), [landscape](https://github.com/CollinHeist/TitleCardMaker/wiki/LandscapeTitleCard), [logo](https://github.com/CollinHeist/TitleCardMaker/wiki/LogoTitleCard), [marvel](https://github.com/CollinHeist/TitleCardMaker/wiki/MarvelTitleCard), [olivier](https://github.com/CollinHeist/TitleCardMaker/wiki/OlivierTitleCard), [overline](https://github.com/CollinHeist/TitleCardMaker/wiki/OverlineTitleCard), [poster](https://github.com/CollinHeist/TitleCardMaker/wiki/PosterTitleCard), [roman](https://github.com/CollinHeist/TitleCardMaker/wiki/RomanNumeralTitleCard), [standard](https://github.com/CollinHeist/TitleCardMaker/wiki/StandardTitleCard), [star wars](https://github.com/CollinHeist/TitleCardMaker/wiki/StarWarsTitleCard), [tinted frame](https://github.com/CollinHeist/TitleCardMaker/wiki/TintedFrameTitleCard), [tinted glass](https://github.com/CollinHeist/TitleCardMaker/wiki/TintedGlassTitleCard), and the [white border](https://github.com/CollinHeist/TitleCardMaker/wiki/WhiteBorderTitleCard) title cards - the [textless](https://github.com/CollinHeist/TitleCardMaker/wiki/TitleCard) card is not shown.
> The above cards are, in order, the [anime](https://github.com/CollinHeist/TitleCardMaker/wiki/AnimeTitleCard), [calligraphy](https://github.com/CollinHeist/TitleCardMaker/wiki/CalligraphyTitleCard), [comic book](https://github.com/CollinHeist/TitleCardMaker/wiki/ComicBookTitleCard), [cutout](https://github.com/CollinHeist/TitleCardMaker/wiki/CutoutTitleCard), [divider](https://github.com/CollinHeist/TitleCardMaker/wiki/DividerTitleCard), [fade](https://github.com/CollinHeist/TitleCardMaker/wiki/FadeTitleCard), [frame](https://github.com/CollinHeist/TitleCardMaker/wiki/FrameTitleCard), [landscape](https://github.com/CollinHeist/TitleCardMaker/wiki/LandscapeTitleCard), [logo](https://github.com/CollinHeist/TitleCardMaker/wiki/LogoTitleCard), [marvel](https://github.com/CollinHeist/TitleCardMaker/wiki/MarvelTitleCard), [olivier](https://github.com/CollinHeist/TitleCardMaker/wiki/OlivierTitleCard), [overline](https://github.com/CollinHeist/TitleCardMaker/wiki/OverlineTitleCard), [poster](https://github.com/CollinHeist/TitleCardMaker/wiki/PosterTitleCard), [roman](https://github.com/CollinHeist/TitleCardMaker/wiki/RomanNumeralTitleCard), [standard](https://github.com/CollinHeist/TitleCardMaker/wiki/StandardTitleCard), [star wars](https://github.com/CollinHeist/TitleCardMaker/wiki/StarWarsTitleCard), [tinted frame](https://github.com/CollinHeist/TitleCardMaker/wiki/TintedFrameTitleCard), [tinted glass](https://github.com/CollinHeist/TitleCardMaker/wiki/TintedGlassTitleCard), and the [white border](https://github.com/CollinHeist/TitleCardMaker/wiki/WhiteBorderTitleCard) title cards - the [textless](https://github.com/CollinHeist/TitleCardMaker/wiki/TitleCard) card is not shown.

<details><summary><h3>User-Created Card Types</h3></summary>

Expand Down
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from re import match
from time import sleep

from modules.Version import Version

try:
from requests import get
import schedule
Expand Down Expand Up @@ -171,12 +173,12 @@ def check_for_update():
# Make API call to get latest version
try:
response = get(REPO_URL, timeout=30)
available_version = Version(response.json().get('name', '').strip())
assert response.ok
except Exception:
log.debug(f'Failed to check for new version')
else:
available_version = response.json().get('name', '').strip()
if available_version != pp.version:
if available_version > pp.version:
log.info(f'New version of TitleCardMaker ({available_version}) '
f'available')
if is_docker:
Expand Down
17 changes: 15 additions & 2 deletions mini_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
help='Omit the gradient from the created Collection/Genre/Season image')

# Argument group for 'manual' title card creation
title_card_group = parser.add_argument_group('Title Cards',
'Manual TitleCardMaker interaction')
title_card_group = parser.add_argument_group(
'Title Cards', 'Manual TitleCardMaker interaction'
)
title_card_group.add_argument(
'--title-card',
type=Path,
Expand Down Expand Up @@ -91,6 +92,12 @@
default='',
metavar=('TITLE_LINE'),
help="The title text for this card")
title_card_group.add_argument(
'--logo',
type=Path,
default=None,
metavar='LOGO_FILE',
help='Logo file to add to the card (if supported)')
title_card_group.add_argument(
'--font-file', '--font',
type=Path,
Expand Down Expand Up @@ -259,6 +266,10 @@
default='100%',
metavar='SCALE%',
help='A font scale (as percentage) for the movie poster')
movie_poster_group.add_argument(
'--movie-drop-shadow',
action='store_true',
help='Whether to add a drop shadow to the text for the movie poster')

# Argument group for genre cards
genre_group = parser.add_argument_group(
Expand Down Expand Up @@ -399,6 +410,7 @@
card = CardClass(
source_file=CleanPath(args.title_card[0]).sanitize(),
card_file=output_file,
logo_file=args.logo,
title_text='\n'.join(args.title),
season_text=('' if not args.season else args.season),
episode_text=args.episode,
Expand Down Expand Up @@ -470,6 +482,7 @@
font_color=args.movie_font_color,
font_size=float(args.movie_font_size[:-1])/100.0,
borderless=args.borderless,
add_drop_shadow=args.movie_drop_shadow,
omit_gradient=args.no_gradient,
).create()

Expand Down
95 changes: 86 additions & 9 deletions modules/BaseCardType.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,89 @@

from titlecase import titlecase

from modules.ImageMaker import ImageMaker
from modules.ImageMaker import ImageMaker, Dimensions


ImageMagickCommands = list[str]


class Coordinate:
"""Class that defines a single Coordinate on an x/y plane."""

__slots__ = ('x', 'y')

def __init__(self, x: float, y: float) -> None:
"""Initialize this Coordinate with the given x/y coordinates."""

self.x = x
self.y = y


def __iadd__(self, other: 'Coordinate') -> 'Coordinate':
"""
Add the given Coordinate to this one. This adds the x/y
positions individually.
Args:
other: The Coordinate to add.
Returns:
This object.
"""

self.x += other.x
self.y += other.y

return self


def __str__(self) -> str:
"""
Represent this Coordinate as a string.
>>> str(Coordinate(1.2, 3.4))
'1,2'
"""

return f'{self.x:.0f},{self.y:.0f}'

@property
def as_svg(self) -> str:
"""SVG representation of this Coordinate."""

return f'{self.x:.1f} {self.y:.1f}'


class Rectangle:
"""Class that defines movable SVG rectangle."""

__slots__ = ('start', 'end')

def __init__(self, start: Coordinate, end: Coordinate) -> None:
"""
Initialize this Rectangle that encompasses the two given start
and end Coordinates. These Coordinates are the opposite corners
of the rectangle.
"""

self.start = start
self.end = end


def __str__(self) -> str:
"""
Represent this Rectangle as a string. This is the joined string
representation of the start and end coordinate.
"""

return f'{str(self.start)},{str(self.end)}'

def draw(self) -> str:
"""Draw this Rectangle."""

return f'-draw "rectangle {str(self)}"'


class BaseCardType(ImageMaker):
"""
This class describes an abstract card type. A BaseCardType is a
Expand Down Expand Up @@ -61,14 +138,14 @@ def TITLE_CHARACTERISTICS(self) -> dict[str, Union[int, bool]]:
keys for max_line_width, max_line_count, and top_heavy. See
`Title` class for details.
"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


@property
@abstractmethod
def ARCHIVE_NAME(self) -> str:
"""How to name archive directories for this type of card"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


@property
Expand All @@ -78,21 +155,21 @@ def TITLE_FONT(self) -> str:
Standard font (full path or ImageMagick recognized font name) to
use for the episode title text.
"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


@property
@abstractmethod
def TITLE_COLOR(self) -> str:
"""Standard color to use for the episode title text"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


@property
@abstractmethod
def USES_SEASON_TITLE(self) -> bool:
"""Whether this class uses season titles for archives"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


"""Slots for standard style attributes"""
Expand Down Expand Up @@ -169,7 +246,7 @@ def is_custom_font(font: 'Font') -> bool: # type: ignore
Returns:
True if a custom font is indicated, False otherwise.
"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


@staticmethod
Expand All @@ -185,7 +262,7 @@ def is_custom_season_titles(
Returns:
True if a custom season title is indicated, False otherwise.
"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError


@property
Expand Down Expand Up @@ -299,4 +376,4 @@ def create(self) -> None:
CardType. All implementations of this method should delete any
intermediate files.
"""
raise NotImplementedError(f'All CardType objects must implement this')
raise NotImplementedError
2 changes: 1 addition & 1 deletion modules/CleanPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def sanitize_name(filename: str) -> str:

replacements = CleanPath.ILLEGAL_FILE_CHARACTERS

return filename.translate(str.maketrans(replacements))
return filename.translate(str.maketrans(replacements))[:254]


@staticmethod
Expand Down
Loading

0 comments on commit 235edcb

Please sign in to comment.