Skip to content

Commit

Permalink
add support of wave file
Browse files Browse the repository at this point in the history
  • Loading branch information
Paullux committed Jan 10, 2024
1 parent 1f23427 commit 8d0cc22
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess
elif platform.system() == 'Windows':
import psutil
import tempfile
import sys
import os
import random
Expand All @@ -18,6 +19,7 @@
from mutagen.flac import FLAC
from mutagen.oggvorbis import OggVorbis
from mutagen.wavpack import WavPack
from mutagen.wave import WAVE
import wave
from mutagen.easyid3 import EasyID3
import glob
Expand Down Expand Up @@ -937,7 +939,7 @@ def get_metadata(self, file_path):
elif ext == '.ogg':
audio = OggVorbis(file_path)
elif ext == '.wav':
audio = WavPack(file_path) # ou utiliser une autre bibliothèque appropriée pour les fichiers WAV
audio = WAVE(file_path)
else:
return None # Format non supporté ou inconnu

Expand Down Expand Up @@ -1169,7 +1171,7 @@ def play_track(self, index):
format_map = {'.flac': 'flac', '.mp3': 'mp3', '.ogg': 'ogg'}
audio_format = format_map.get(ext, 'mp3') # Par défaut à 'mp3' si le format n'est pas trouvé
audio = AudioSegment.from_file(self.filePath, format=audio_format)
temp_file = 'temp.wav' # Nom de fichier temporaire
temp_file = tempfile.NamedTemporaryFile(delete=True, suffix='.wav') # Nom de fichier temporaire
audio.export(temp_file, format='wav')
self.filePath = temp_file

Expand Down

0 comments on commit 8d0cc22

Please sign in to comment.