Skip to content

Commit

Permalink
updated VideoCacheGenerator.generate_image_preview()
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Jan 29, 2024
1 parent 89f548d commit b31b14e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/jarklin/cache/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ def generate_previews(self) -> None:
)

def generate_image_preview(self) -> None:
import shutil
first_preview = self.previews_dir.joinpath("1.jpg")
if first_preview.is_file():
shutil.copyfile(first_preview, self.dest.joinpath("preview.jpg"))
# prefer the second as the first could be producer-logo
preview_source = self.previews_dir.joinpath("2.jpg")
if not preview_source.is_file():
preview_source = self.previews_dir.joinpath("1.jpg")
shutil.copyfile(preview_source, self.dest.joinpath("preview.jpg"))

def generate_animated_preview(self) -> None:
images = sorted(self.previews_cache.glob("*.jpg"), key=lambda f: int(f.stem))
Expand Down

0 comments on commit b31b14e

Please sign in to comment.