File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 33 import subprocess
44elif platform .system () == 'Windows' :
55 import psutil
6+ import tempfile
67import sys
78import os
89import random
1819from mutagen .flac import FLAC
1920from mutagen .oggvorbis import OggVorbis
2021from mutagen .wavpack import WavPack
22+ from mutagen .wave import WAVE
2123import wave
2224from mutagen .easyid3 import EasyID3
2325import glob
@@ -937,7 +939,7 @@ def get_metadata(self, file_path):
937939 elif ext == '.ogg' :
938940 audio = OggVorbis (file_path )
939941 elif ext == '.wav' :
940- audio = WavPack (file_path ) # ou utiliser une autre bibliothèque appropriée pour les fichiers WAV
942+ audio = WAVE (file_path )
941943 else :
942944 return None # Format non supporté ou inconnu
943945
@@ -1169,7 +1171,7 @@ def play_track(self, index):
11691171 format_map = {'.flac' : 'flac' , '.mp3' : 'mp3' , '.ogg' : 'ogg' }
11701172 audio_format = format_map .get (ext , 'mp3' ) # Par défaut à 'mp3' si le format n'est pas trouvé
11711173 audio = AudioSegment .from_file (self .filePath , format = audio_format )
1172- temp_file = 'temp .wav' # Nom de fichier temporaire
1174+ temp_file = tempfile . NamedTemporaryFile ( delete = True , suffix = ' .wav') # Nom de fichier temporaire
11731175 audio .export (temp_file , format = 'wav' )
11741176 self .filePath = temp_file
11751177
You can’t perform that action at this time.
0 commit comments