Spaces:
Running
on
Zero
Running
on
Zero
fix: remove space at the end of title, change the format of audio to .m4a
Browse files
app.py
CHANGED
@@ -203,7 +203,7 @@ def combine_stems_for_all(input_dir, output_format):
|
|
203 |
if subdir == input_dir:
|
204 |
continue
|
205 |
|
206 |
-
song_name = os.path.basename(subdir)
|
207 |
print(f"Processing {subdir}")
|
208 |
|
209 |
stem_paths = {
|
@@ -225,14 +225,11 @@ def combine_stems_for_all(input_dir, output_format):
|
|
225 |
# Trim silence at the end
|
226 |
trimmed_combined = trim_silence_at_end(combined)
|
227 |
|
228 |
-
output_file = os.path.join(subdir, f"{song_name}")
|
229 |
|
230 |
try:
|
231 |
# Export combined audio
|
232 |
-
|
233 |
-
trimmed_combined.export(output_file, format="ipod", codec="aac")
|
234 |
-
else:
|
235 |
-
trimmed_combined.export(output_file, format=output_format)
|
236 |
print(f"Exported combined stems to {output_file}")
|
237 |
except CouldntEncodeError as e:
|
238 |
print(f"Encoding failed: {e}")
|
|
|
203 |
if subdir == input_dir:
|
204 |
continue
|
205 |
|
206 |
+
song_name = os.path.basename(subdir).strip() # Remove any trailing spaces
|
207 |
print(f"Processing {subdir}")
|
208 |
|
209 |
stem_paths = {
|
|
|
225 |
# Trim silence at the end
|
226 |
trimmed_combined = trim_silence_at_end(combined)
|
227 |
|
228 |
+
output_file = os.path.join(subdir, f"{song_name}.{output_format.lower()}")
|
229 |
|
230 |
try:
|
231 |
# Export combined audio
|
232 |
+
trimmed_combined.export(output_file, format=output_format.lower(), codec="aac")
|
|
|
|
|
|
|
233 |
print(f"Exported combined stems to {output_file}")
|
234 |
except CouldntEncodeError as e:
|
235 |
print(f"Encoding failed: {e}")
|