Spaces:
Runtime error
Runtime error
user_history 0.3.1
Browse files- modules/user_history.py +4 -8
modules/user_history.py
CHANGED
|
@@ -18,7 +18,7 @@ Useful links:
|
|
| 18 |
Update by Surn (Charles Fettinger)
|
| 19 |
"""
|
| 20 |
|
| 21 |
-
__version__ = "0.3.
|
| 22 |
|
| 23 |
import json
|
| 24 |
import os
|
|
@@ -458,7 +458,7 @@ def _add_metadata(file_location: Path, metadata: Dict[str, Any], support_path: s
|
|
| 458 |
|
| 459 |
if file_type == ".wav":
|
| 460 |
# Open and process .wav file
|
| 461 |
-
with wave.open(file_location, 'rb') as wav_file:
|
| 462 |
# Get the current metadata
|
| 463 |
current_metadata = {key: value for key, value in wav_file.getparams()._asdict().items() if isinstance(value, (int, float))}
|
| 464 |
|
|
@@ -484,12 +484,8 @@ def _add_metadata(file_location: Path, metadata: Dict[str, Any], support_path: s
|
|
| 484 |
elif file_type == ".mp4":
|
| 485 |
# Open and process .mp4 file
|
| 486 |
# Add metadata to the file
|
| 487 |
-
if support_path is not None
|
| 488 |
-
|
| 489 |
-
wave_exists = wav_file_location.exists()
|
| 490 |
-
if not wave_exists:
|
| 491 |
-
wav_file_location = file_location.with_suffix(".wav")
|
| 492 |
-
wave_exists = wav_file_location.exists()
|
| 493 |
if not wave_exists:
|
| 494 |
# Use torchaudio to create the WAV file if it doesn't exist
|
| 495 |
audio, sample_rate = torchaudio.load(str(file_location), normalize=True)
|
|
|
|
| 18 |
Update by Surn (Charles Fettinger)
|
| 19 |
"""
|
| 20 |
|
| 21 |
+
__version__ = "0.3.1"
|
| 22 |
|
| 23 |
import json
|
| 24 |
import os
|
|
|
|
| 458 |
|
| 459 |
if file_type == ".wav":
|
| 460 |
# Open and process .wav file
|
| 461 |
+
with wave.open(str(file_location), 'rb') as wav_file:
|
| 462 |
# Get the current metadata
|
| 463 |
current_metadata = {key: value for key, value in wav_file.getparams()._asdict().items() if isinstance(value, (int, float))}
|
| 464 |
|
|
|
|
| 484 |
elif file_type == ".mp4":
|
| 485 |
# Open and process .mp4 file
|
| 486 |
# Add metadata to the file
|
| 487 |
+
wave_file_location = Path(support_path) if support_path is not None else file_location.with_suffix(".wav")
|
| 488 |
+
wave_exists = wav_file_location.exists()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
if not wave_exists:
|
| 490 |
# Use torchaudio to create the WAV file if it doesn't exist
|
| 491 |
audio, sample_rate = torchaudio.load(str(file_location), normalize=True)
|