Skip to content

Video editing with Python

reagular path manipulations, ie, os.path.join doens't work with zipped packages/libs

Rad Cirskis6a395cca1ab4
diff --git a/moviepy/audio/fx/all/__init__.py b/moviepy/audio/fx/all/__init__.py
index 4c96acfd..c5691763 100644
--- a/moviepy/audio/fx/all/__init__.py
+++ b/moviepy/audio/fx/all/__init__.py
@@ -5,15 +5,11 @@ import moviepy.audio.fx.all as afx
audio_clip = afx.volume_x(some_clip, .5)
"""
-import os
+import pkgutil
+import moviepy.audio.fx as fx
-directory = os.path.dirname(
- os.path.dirname(
- os.path.realpath(__file__)))
-
-files = os.listdir(directory)
-fx_list = [f for f in files if ( f.endswith('.py') and not f.startswith('_'))]
-__all__ = [c[:-3] for c in fx_list]
+__all__ = [name for _, name, _ in pkgutil.iter_modules(
+ fx.__path__) if name != "all"]
for name in __all__:
- exec("from ..%s import %s"%(name,name))
\ No newline at end of file
+ exec("from ..%s import %s" % (name, name))
\ No newline at end of file
diff --git a/moviepy/video/fx/all/__init__.py b/moviepy/video/fx/all/__init__.py
index b2062989..a74fb9c8 100644
--- a/moviepy/video/fx/all/__init__.py
+++ b/moviepy/video/fx/all/__init__.py
@@ -7,10 +7,10 @@ clip = vfx.mirror_x(some_clip)
"""
import pkgutil
-import os
+import moviepy.video.fx as fx
__all__ = [name for _, name, _ in pkgutil.iter_modules(
- [os.path.join(__path__[0], "..")]) if name != "all"]
+ fx.__path__) if name != "all"]
-for _name in __all__:
- exec("from ..%s import %s"%(_name,_name))
\ No newline at end of file
+for name in __all__:
+ exec("from ..%s import %s" % (name, name))
\ No newline at end of file