Spaces:
Paused
Paused
adding new audio file types
Browse files
app.py
CHANGED
|
@@ -4,9 +4,12 @@ import subprocess
|
|
| 4 |
|
| 5 |
def fetch(url, name, ext):
|
| 6 |
opts = {
|
| 7 |
-
"mp3": "-f \"ba\" -x --audio-format mp3",
|
| 8 |
-
"mp4": "-f \"bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\"",
|
|
|
|
|
|
|
| 9 |
}[ext]
|
|
|
|
| 10 |
filename = f"{name}.{ext}"
|
| 11 |
|
| 12 |
try:
|
|
@@ -22,7 +25,7 @@ interface = gr.Interface(
|
|
| 22 |
inputs=[
|
| 23 |
gr.Textbox(label="Link Address", placeholder="Enter the URL here ..."),
|
| 24 |
gr.Textbox(label="File Name", placeholder="Example: file_name"),
|
| 25 |
-
gr.Dropdown(["mp3", "mp4"], value="
|
| 26 |
],
|
| 27 |
outputs=gr.File(label="Download!"),
|
| 28 |
description="Download from X, Youtube, Reddit, etc..",
|
|
|
|
| 4 |
|
| 5 |
def fetch(url, name, ext):
|
| 6 |
opts = {
|
| 7 |
+
"mp3": "-f \"ba\" -x --audio-format mp3", # MP3 format
|
| 8 |
+
"mp4": "-f \"bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\"", # MP4 format for video + audio
|
| 9 |
+
"flac": "-f \"ba\" -x --audio-format flac", # FLAC format for lossless audio
|
| 10 |
+
"aac": "-f \"ba\" -x --audio-format aac" # AAC format for lossy high-quality audio
|
| 11 |
}[ext]
|
| 12 |
+
|
| 13 |
filename = f"{name}.{ext}"
|
| 14 |
|
| 15 |
try:
|
|
|
|
| 25 |
inputs=[
|
| 26 |
gr.Textbox(label="Link Address", placeholder="Enter the URL here ..."),
|
| 27 |
gr.Textbox(label="File Name", placeholder="Example: file_name"),
|
| 28 |
+
gr.Dropdown(["mp3", "mp4", "flac", "aac"], value="mp3", label="File Type")
|
| 29 |
],
|
| 30 |
outputs=gr.File(label="Download!"),
|
| 31 |
description="Download from X, Youtube, Reddit, etc..",
|