Skip to content

Commit 460dd1f

Browse files
committed
Ignore extension case
1 parent 8f556db commit 460dd1f

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

lib/rvc/train.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,28 @@
2929
from .models import (MultiPeriodDiscriminator, SynthesizerTrnMs256NSFSid,
3030
SynthesizerTrnMs256NSFSidNono)
3131

32-
audio_exts = [
33-
".wav",
34-
".flac",
35-
".ogg",
36-
".mp3",
37-
".m4a",
38-
".wma",
39-
".aiff",
40-
]
41-
42-
43-
def glob_dataset(glob_str: str, speaker_id: int, multiple_speakers: bool = False, recursive: bool = True):
32+
33+
def is_audio_file(file: str):
34+
if "." not in file:
35+
return False
36+
ext = os.path.splitext(file)[1]
37+
return ext.lower() in [
38+
".wav",
39+
".flac",
40+
".ogg",
41+
".mp3",
42+
".m4a",
43+
".wma",
44+
".aiff",
45+
]
46+
47+
48+
def glob_dataset(
49+
glob_str: str,
50+
speaker_id: int,
51+
multiple_speakers: bool = False,
52+
recursive: bool = True,
53+
):
4454
globs = glob_str.split(",")
4555
datasets_speakers = []
4656
for glob_str in globs:
@@ -63,7 +73,7 @@ def glob_dataset(glob_str: str, speaker_id: int, multiple_speakers: bool = False
6373
for file in glob.iglob(
6474
os.path.join(dir[0], "*"), recursive=recursive
6575
)
66-
if os.path.splitext(file)[1] in audio_exts
76+
if is_audio_file(file)
6777
]
6878
continue
6979

@@ -73,7 +83,7 @@ def glob_dataset(glob_str: str, speaker_id: int, multiple_speakers: bool = False
7383
[
7484
(file, speaker_id)
7585
for file in glob.iglob(glob_str, recursive=recursive)
76-
if os.path.splitext(file)[1] in audio_exts
86+
if is_audio_file(file)
7787
]
7888
)
7989

0 commit comments

Comments
 (0)