Spaces:
Runtime error
Runtime error
da
Browse files- app.py +1 -1
- routes/ytApi/getPreview.py +10 -5
app.py
CHANGED
|
@@ -84,7 +84,7 @@ def getBMPreview(): return osuApi.getPreview(request)
|
|
| 84 |
def getBMFull(): return osuApi.getFull(request)
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
-
VERSION = '1.0
|
| 88 |
|
| 89 |
config = configFile()
|
| 90 |
with open(config['config-path'], "w") as outfile:
|
|
|
|
| 84 |
def getBMFull(): return osuApi.getFull(request)
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
+
VERSION = '1.0 build75'
|
| 88 |
|
| 89 |
config = configFile()
|
| 90 |
with open(config['config-path'], "w") as outfile:
|
routes/ytApi/getPreview.py
CHANGED
|
@@ -20,16 +20,21 @@ def getPreview(request):
|
|
| 20 |
if duration > 60: duration = 60
|
| 21 |
except: duration = 30
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
config = helpers.configFile()
|
| 24 |
if answer['done-or-not']:
|
| 25 |
-
return {"status": "pass", "details": {"code": error_code, "name":f"{urlcode}.
|
| 26 |
|
| 27 |
try:
|
| 28 |
audio_input = ffmpeg.input(answer['path'])
|
| 29 |
audio_cut = audio_input.audio.filter('atrim', duration=duration)
|
| 30 |
-
audio_output = ffmpeg.output(audio_cut, f"{config['previews-path']}/{urlcode}.
|
| 31 |
ffmpeg.run(audio_output)
|
| 32 |
-
helpers.deleteAudio(f"temp/{urlcode}.
|
| 33 |
-
except Exception as e: return {"status": "error", "details": {"error_code": 102, "error_details": str(e), "result": f"{config['url']}/static/temp/{urlcode}.
|
| 34 |
-
return {"status": "pass", "details": {"code": error_code, "name":f"{urlcode}.
|
| 35 |
|
|
|
|
| 20 |
if duration > 60: duration = 60
|
| 21 |
except: duration = 30
|
| 22 |
|
| 23 |
+
try:
|
| 24 |
+
if request.method == 'POST': extension = request.form['extension']
|
| 25 |
+
else: extension = request.args['extension']
|
| 26 |
+
except: extension = "ogg"
|
| 27 |
+
|
| 28 |
config = helpers.configFile()
|
| 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)
|
| 35 |
+
audio_output = ffmpeg.output(audio_cut, f"{config['previews-path']}/{urlcode}.{extension}", audio_bitrate=bitrate)
|
| 36 |
ffmpeg.run(audio_output)
|
| 37 |
+
helpers.deleteAudio(f"temp/{urlcode}.{extension}")
|
| 38 |
+
except Exception as e: return {"status": "error", "details": {"error_code": 102, "error_details": str(e), "result": f"{config['url']}/static/temp/{urlcode}.{extension}"}}
|
| 39 |
+
return {"status": "pass", "details": {"code": error_code, "name":f"{urlcode}.{extension}", "result": f"{config['url']}/static/previews/{urlcode}.{extension}"}}
|
| 40 |
|