Skip to content

Commit

Permalink
copying webm files
Browse files Browse the repository at this point in the history
  • Loading branch information
edublancas committed Jan 10, 2025
1 parent 60e2973 commit bf2e1b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 0.0.15dev

* [Feature] Copying `.webm` files when rendering posts

## 0.0.14 (2024-03-25)

* [Feature] Keep existing date if the current file has been rendered already
Expand Down
5 changes: 3 additions & 2 deletions src/jupyblog/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ def add_output_tags(md, outputs):

def copy_all_images(src, target, dir_name):
"""
Copy all .png files in src to target inside a folder with the passed name
Copy all .png, .gif, and .webm files in src to target inside a folder with the passed name
"""
pngs = glob(str(Path(src, "**", "*.png")), recursive=True)
gifs = glob(str(Path(src, "**", "*.gif")), recursive=True)
videos = glob(str(Path(src, "**", "*.webm")), recursive=True)

for img in chain(pngs, gifs):
for img in chain(pngs, gifs, videos):
# target location: {target}/{dir-name}/{original-relative-path}
rel_path = str(Path(img).relative_to(src))
target_file = Path(target, dir_name, rel_path)
Expand Down

0 comments on commit bf2e1b3

Please sign in to comment.