diff --git a/.gitignore b/.gitignore index fb24077..17e2ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,4 @@ venv.bak/ .idea/ .pytest_cache/ .coveragerc +*.mp4 diff --git a/displayarray/__init__.py b/displayarray/__init__.py index fd8215c..b9aec02 100644 --- a/displayarray/__init__.py +++ b/displayarray/__init__.py @@ -4,7 +4,7 @@ display is a function that displays these in their own windows. """ -__version__ = "1.1.0" +__version__ = "1.1.1" from .window.subscriber_windows import display, breakpoint_display, read_updates from .frame.frame_publishing import publish_updates_zero_mq, publish_updates_ros diff --git a/examples/videos/__init__.py b/examples/videos/__init__.py index b44dbdb..006f19a 100644 --- a/examples/videos/__init__.py +++ b/examples/videos/__init__.py @@ -1,6 +1,34 @@ # Fractal test is from: https://www.youtube.com/watch?v=WgXQ59rg0GM -import os +from pathlib import Path -test_video = os.path.join(os.path.dirname(__file__), "fractal test.mp4") -test_video_2 = os.path.join(os.path.dirname(__file__), "fractal test 2.mp4") +test_video = str(Path.joinpath(Path(__file__).parent, "fractal test.mp4")) +test_video_2 = str(Path.joinpath(Path(__file__).parent, "fractal test 2.mp4")) +test_video_3 = str(Path.joinpath(Path(__file__).parent, "fractal test 3.mp4")) + +urls = { + "test_video": "https://www.youtube.com/watch?v=LpWhaBVIrZw", + "test_video_2": "https://www.youtube.com/watch?v=GASynpGr-c8", + "test_video_3": "https://www.youtube.com/watch?v=u_P83LcI8Oc" +} + + +def populate_videos(fps=60, res="720p", ext="mp4"): + from pytube import YouTube # Note: pip install pytube3, not pytube + from pathlib import Path + for n, v in globals().items(): + if 'test_video' in n: + print(f"Checking if '{n}' is downloaded.") + if Path(v).exists(): + print("Video already downloaded.") + else: + the_path = Path(v) + print("Downloading...") + YouTube(urls[n]) \ + .streams \ + .filter(fps=fps, res=res, file_extension=ext)[0] \ + .download(output_path=the_path.parent, filename=the_path.stem) + + +if __name__ == "__main__": + populate_videos() diff --git a/examples/videos/fractal test 2.mp4 b/examples/videos/fractal test 2.mp4 deleted file mode 100644 index 006ed14..0000000 Binary files a/examples/videos/fractal test 2.mp4 and /dev/null differ diff --git a/examples/videos/fractal test.mp4 b/examples/videos/fractal test.mp4 deleted file mode 100644 index 2aa086d..0000000 Binary files a/examples/videos/fractal test.mp4 and /dev/null differ diff --git a/pyproject.toml b/pyproject.toml index 230f961..0dfb68f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'displayarray' -version = '1.1.0' +version = '1.1.1' description = 'Tool for displaying numpy arrays.' authors = ['SimLeek '] license = 'MIT'