woolbot commited on
Commit
68707b3
1 Parent(s): 792e427
Files changed (1) hide show
  1. routes/ytApi/getPreview.py +4 -0
routes/ytApi/getPreview.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import ffmpeg
2
  from .get import *
3
  from .. import helpers
@@ -29,6 +30,9 @@ def getPreview(request):
29
  if answer['done-or-not']:
30
  return {"status": "pass", "details": {"code": error_code, "name":f"{urlcode}.{extension}", "result": f"{config['url']}/static/previews/{urlcode}.{extension}"}}
31
 
 
 
 
32
  try:
33
  audio_input = ffmpeg.input(answer['path'])
34
  audio_cut = audio_input.audio.filter('atrim', duration=duration)
 
1
+ import os
2
  import ffmpeg
3
  from .get import *
4
  from .. import helpers
 
30
  if answer['done-or-not']:
31
  return {"status": "pass", "details": {"code": error_code, "name":f"{urlcode}.{extension}", "result": f"{config['url']}/static/previews/{urlcode}.{extension}"}}
32
 
33
+ if os.path.exists(f"{config['previews-path']}/{urlcode}.{extension}"):
34
+ return {"status": "pass", "details": {"code": 0, "name":f"{urlcode}.{extension}", "result": f"{config['url']}/static/previews/{urlcode}.{extension}"}}
35
+
36
  try:
37
  audio_input = ffmpeg.input(answer['path'])
38
  audio_cut = audio_input.audio.filter('atrim', duration=duration)