Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -3,14 +3,17 @@ import subprocess
|
|
3 |
import os
|
4 |
import re
|
5 |
import datetime
|
|
|
6 |
|
7 |
# Função para baixar o clipe da Twitch
|
8 |
def download_twitch_clip(url, auth_token):
|
9 |
-
#
|
10 |
-
|
11 |
-
output_pattern = f"{timestamp}_{{id}}_{{channel_login}}_{{title_slug}}.{{format}}"
|
12 |
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
if auth_token.strip():
|
16 |
command.extend(["-a", auth_token])
|
@@ -18,9 +21,8 @@ def download_twitch_clip(url, auth_token):
|
|
18 |
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
19 |
stdout, stderr = process.communicate()
|
20 |
|
21 |
-
# O nome do arquivo é determinado pelo
|
22 |
-
|
23 |
-
return file_name
|
24 |
|
25 |
# Interface Gradio
|
26 |
def gradio_interface(url, auth_token=""):
|
|
|
3 |
import os
|
4 |
import re
|
5 |
import datetime
|
6 |
+
import uuid
|
7 |
|
8 |
# Função para baixar o clipe da Twitch
|
9 |
def download_twitch_clip(url, auth_token):
|
10 |
+
# Gerar um UUID
|
11 |
+
unique_id = uuid.uuid4()
|
|
|
12 |
|
13 |
+
# Criar um nome de arquivo único com o UUID
|
14 |
+
output_filename = f"{unique_id}.mkv"
|
15 |
+
|
16 |
+
command = ["twitch-dl", "download", url, "-q", "source", "-o", output_filename]
|
17 |
|
18 |
if auth_token.strip():
|
19 |
command.extend(["-a", auth_token])
|
|
|
21 |
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
22 |
stdout, stderr = process.communicate()
|
23 |
|
24 |
+
# O nome do arquivo é determinado pelo UUID
|
25 |
+
return output_filename
|
|
|
26 |
|
27 |
# Interface Gradio
|
28 |
def gradio_interface(url, auth_token=""):
|