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

Extract file name; re.match only checks the start #1528

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from modules import builder, util
from modules.library import Library
from modules.util import Failed, ImageData
from pathlib import Path
from PIL import Image
from plexapi import utils
from plexapi.audio import Artist, Track, Album
Expand Down Expand Up @@ -1384,7 +1385,8 @@ def find_item_assets(self, item, item_asset_directory=None, asset_directory=None

if is_top_level and self.asset_folders and self.dimensional_asset_rename and (not poster or not background):
for file in util.glob_filter(os.path.join(item_asset_directory, "*.*")):
if file.lower().endswith((".png", ".jpg", ".jpeg", "webp")) and not re.match(r"s\d+e\d+|season\d+", file.lower()):
p_file = Path(file).name
if p_file.lower().endswith((".png", ".jpg", ".jpeg", "webp")) and not re.match(r"s\d+e\d+|season\d+", p_file.lower()):
try:
with Image.open(file) as image:
_w, _h = image.size
Expand Down