Video editing with Python
Remove audio_loop afx (#1451)
Tom Burrows727cbca9c765
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex da6f3d01..ba00923a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- `moviepy.video.fx.all` and `moviepy.audio.fx.all`. Use the fx method directly from the clip instance or import the fx function from `moviepy.video.fx` and `moviepy.audio.fx`. [\#1105](https://github.com/Zulko/moviepy/pull/1105)### Removed <!-- for now removed features -->+- `audio.fx.audio_loop` removed. Use `video.fx.loop` instead for all types of clip [\#1451](https://github.com/Zulko/moviepy/pull/1451)### Fixed <!-- for any bug fixes -->- Fixed BitmapClip with fps != 1 not returning the correct frames or crashing [\#1333](https://github.com/Zulko/moviepy/pull/1333)diff --git a/docs/ref/audiofx.rst b/docs/ref/audiofx.rstindex 3f6abebb..52bed443 100644--- a/docs/ref/audiofx.rst+++ b/docs/ref/audiofx.rst@@ -41,7 +41,6 @@ the module ``audio.fx`` is loaded as ``afx`` and you can use ``afx.multiply_voluaudio_fadeinaudio_fadeout- audio_loopaudio_normalizemultiply_stereo_volumemultiply_volumediff --git a/docs/ref/audiofx/moviepy.audio.fx.all.audio_loop.rst b/docs/ref/audiofx/moviepy.audio.fx.all.audio_loop.rstdeleted file mode 100644index 04afbdd1..00000000--- a/docs/ref/audiofx/moviepy.audio.fx.all.audio_loop.rst+++ /dev/null@@ -1,6 +0,0 @@-moviepy.audio.fx.all.audio_loop-===============================--.. currentmodule:: moviepy.audio.fx.all--.. autofunction:: audio_loop\ No newline at end of filediff --git a/moviepy/__init__.py b/moviepy/__init__.pyindex dfbde644..f9612e14 100644--- a/moviepy/__init__.py+++ b/moviepy/__init__.py@@ -49,7 +49,7 @@ from moviepy.tools import convert_to_seconds# Transforms the effects into Clip methods so that# they can be called with clip.resize(width=500) instead of# clip.fx(vfx.resize, width=500)-audio_fxs = inspect.getmembers(afx, inspect.isfunction)+audio_fxs = inspect.getmembers(afx, inspect.isfunction) + [("loop", vfx.loop)]video_fxs = (inspect.getmembers(vfx, inspect.isfunction)+ inspect.getmembers(transfx, inspect.isfunction)diff --git a/moviepy/audio/fx/__init__.py b/moviepy/audio/fx/__init__.pyindex 5f95b2a6..c52f9eb8 100644--- a/moviepy/audio/fx/__init__.py+++ b/moviepy/audio/fx/__init__.py@@ -2,7 +2,6 @@from .audio_fadein import audio_fadeinfrom .audio_fadeout import audio_fadeout-from .audio_loop import audio_loopfrom .audio_normalize import audio_normalizefrom .multiply_stereo_volume import multiply_stereo_volumefrom .multiply_volume import multiply_volumediff --git a/moviepy/audio/fx/all/__init__.py b/moviepy/audio/fx/all/__init__.pyindex c36d6e87..3731a5f4 100644--- a/moviepy/audio/fx/all/__init__.py+++ b/moviepy/audio/fx/all/__init__.py@@ -1,7 +1,7 @@"""moviepy.audio.fx.all is deprecated.-Use the fx method directly from the clip instance (e.g. ``clip.audio_loop(...)``)+Use the fx method directly from the clip instance (e.g. ``clip.audio_normalize(...)``)or import the function from moviepy.audio.fx instead."""import warningsdiff --git a/moviepy/audio/fx/audio_loop.py b/moviepy/audio/fx/audio_loop.pydeleted file mode 100644index 375c95a1..00000000--- a/moviepy/audio/fx/audio_loop.py+++ /dev/null@@ -1,26 +0,0 @@-from ..AudioClip import concatenate_audioclips-from moviepy.decorators import audio_video_fx---@audio_video_fx-def audio_loop(clip, n_loops=None, duration=None):- """Loops over an audio clip.-- Returns an audio clip that plays the given clip either- `n_loops` times, or during `duration` seconds.-- Examples- ========-- >>> from moviepy import *- >>> videoclip = VideoFileClip('myvideo.mp4')- >>> music = AudioFileClip('music.ogg')- >>> audio = afx.audio_loop( music, duration=videoclip.duration)- >>> videoclip.with_audio(audio)-- """- if duration is not None:- n_loops = int(duration / clip.duration) + 1- return concatenate_audioclips(n_loops * [clip]).with_duration(duration)-- return concatenate_audioclips(n_loops * [clip])diff --git a/tests/test_fx.py b/tests/test_fx.pyindex b1073d57..d20f3df7 100644--- a/tests/test_fx.py+++ b/tests/test_fx.py@@ -290,6 +290,13 @@ def test_loop():clip3 = loop(clip, n=3) # loop 3 timesclip3.write_videofile(os.path.join(TMP_DIR, "loop3.webm"))+ clip = AudioClip(+ lambda t: np.sin(440 * 2 * np.pi * t) * (t % 1) + 0.5, duration=2.5, fps=44100+ )+ clip1 = clip.loop(2)+ # TODO fix AudioClip.__eq__()+ # assert concatenate_audioclips([clip, clip]) == clip1+close_all_clips(objects=locals())@@ -572,4 +579,5 @@ def test_multiply_stereo_volume():if __name__ == "__main__":- pytest.main()+ # pytest.main()+ test_loop()