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

fix #345 compile readme #388

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
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
383 changes: 383 additions & 0 deletions README.ipynb

Large diffs are not rendered by default.

32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Note: This requires Graphviz to be installed on your system.

Here's how to quickly start using `typed-ffmpeg`:




```python
import ffmpeg

Expand All @@ -80,37 +83,56 @@ f = (
.hflip()
.output(filename='output.mp4')
)
f.run()
f
```

![](https://raw.githubusercontent.com/livingbio/typed-ffmpeg/main/docs/media/quick-usage.png)




![svg](https://raw.githubusercontent.com/livingbio/typed-ffmpeg/main/docs/media/README_files/README_1_0.svg)




For a more complex example:



```python
import ffmpeg.filters
import ffmpeg

# Complex filter graph example
in_file = ffmpeg.input("input.mp4")
overlay_file = ffmpeg.input("overlay.png")

f = (
ffmpeg
ffmpeg.filters
.concat(
in_file.trim(start_frame=10, end_frame=20),
in_file.trim(start_frame=30, end_frame=40),
)
.video(0)
.overlay(overlay_file.hflip())
.drawbox(x="50", y="50", width="120", height="120", color="red", thickness="5")
.output(filename="out.mp4")
)
f.run()
f
```

![](https://raw.githubusercontent.com/livingbio/typed-ffmpeg/main/docs/media/quick-usage-complex.png)




![svg](https://raw.githubusercontent.com/livingbio/typed-ffmpeg/main/docs/media/README_files/README_3_0.svg)




See the [Usage](https://livingbio.github.io/typed-ffmpeg/usage/typed/) section in our documentation for more examples and detailed guides.


---

## Acknowledgements
Expand Down
Binary file added docs/media/README_files/README_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions docs/media/README_files/README_1_0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/README_files/README_3_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions docs/media/README_files/README_3_0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions scripts/compile-readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import shutil

import typer


def post_process(markdown_file: str, original_folder: str, new_folder: str) -> None:
rel_path = "https://raw.githubusercontent.com/livingbio/typed-ffmpeg/main/" + new_folder

# Move the folder
if os.path.exists(original_folder):
for filepath in os.listdir(original_folder):
# Move the file, replace if it already exists
old_path = os.path.join(original_folder, filepath)
new_path = os.path.join(new_folder, filepath)
if os.path.exists(new_path):
os.remove(new_path)

shutil.move(old_path, new_path)
print(f"Moved {filepath} to {new_folder}")

# Update paths in the Markdown file
with open(markdown_file, "r") as file:
content = file.read()

content = content.replace(original_folder, rel_path)

with open(markdown_file, "w") as file:
file.write(content)

print("Image paths updated and folder moved.")


def main() -> None:
os.remove("README.md")
os.system("jupyter nbconvert --to markdown README.ipynb")
assert os.path.exists("README.md")

post_process("README.md", "README_files", "docs/media/README_files")


if __name__ == "__main__":
typer.run(main)