Mbonea commited on
Commit
033d10d
1 Parent(s): 3746a16

added unsilence

Browse files
Files changed (3) hide show
  1. App/Worker.py +10 -0
  2. Dockerfile +2 -0
  3. requirements.txt +1 -0
App/Worker.py CHANGED
@@ -62,6 +62,15 @@ def copy_remotion_app(src: str, dest: str):
62
  # create_symlink(source_dir, target_dir=dest, symlink_name="node_module")
63
 
64
 
 
 
 
 
 
 
 
 
 
65
  @celery.task
66
  def install_dependencies(directory: str):
67
  os.chdir(directory)
@@ -109,6 +118,7 @@ def celery_task(video_task: EditorRequest):
109
  create_json_file.si(video_task.assets, assets_dir),
110
  download_assets.si(video_task.links, temp_dir) if video_task.links else None,
111
  render_video.si(temp_dir, output_dir),
 
112
  cleanup_temp_directory.si(temp_dir, output_dir),
113
  ).apply_async(
114
  # link_error=handle_error
 
62
  # create_symlink(source_dir, target_dir=dest, symlink_name="node_module")
63
 
64
 
65
+ @celery.task
66
+ def unsilence(directory: str):
67
+ output_dir = os.path.join(directory, "out/video.mp4")
68
+ shortered_dir = os.path.join(directory, "out/temp.mp4")
69
+ os.system(f"unsilence {output_dir} {shortered_dir} -y")
70
+ os.remove(output_dir)
71
+ os.rename(shortered_dir, output_dir)
72
+
73
+
74
  @celery.task
75
  def install_dependencies(directory: str):
76
  os.chdir(directory)
 
118
  create_json_file.si(video_task.assets, assets_dir),
119
  download_assets.si(video_task.links, temp_dir) if video_task.links else None,
120
  render_video.si(temp_dir, output_dir),
121
+ unsilence.si(temp_dir),
122
  cleanup_temp_directory.si(temp_dir, output_dir),
123
  ).apply_async(
124
  # link_error=handle_error
Dockerfile CHANGED
@@ -60,6 +60,8 @@ RUN node -v
60
  COPY requirements.txt .
61
  RUN pip install --no-cache-dir -r requirements.txt
62
 
 
 
63
 
64
 
65
 
 
60
  COPY requirements.txt .
61
  RUN pip install --no-cache-dir -r requirements.txt
62
 
63
+ #install unsilence
64
+ RUN pipx install unsilence
65
 
66
 
67
 
requirements.txt CHANGED
@@ -14,3 +14,4 @@ celery
14
  telethon
15
  git+https://github.com/redis/redis-py.git
16
  asgiref
 
 
14
  telethon
15
  git+https://github.com/redis/redis-py.git
16
  asgiref
17
+ pipx