mirror of
https://github.com/davesarmoury/GLaDOS.git
synced 2025-09-26 22:31:26 +08:00
Downloads audio files from wiki
This commit is contained in:
commit
f833bb99ce
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.wav
|
14
README.md
Normal file
14
README.md
Normal file
@ -0,0 +1,14 @@
|
||||
GLaDOS RIVA
|
||||
===========
|
||||
|
||||
This package will download audio for training data, then train a riva TTS network
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
./download_audio.py
|
38
download_audio.py
Executable file
38
download_audio.py
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
from tqdm import tqdm
|
||||
import shutil
|
||||
import os
|
||||
|
||||
blocklist = ["potato", "_ding_"]
|
||||
|
||||
audio_dir = 'audio'
|
||||
if os.path.exists(audio_dir):
|
||||
print("Deleting previously downloaded audio")
|
||||
shutil.rmtree(audio_dir)
|
||||
|
||||
os.mkdir(audio_dir)
|
||||
|
||||
r = requests.get("https://theportalwiki.com/wiki/GLaDOS_voice_lines")
|
||||
|
||||
split_text = r.text.split()
|
||||
urls = []
|
||||
|
||||
for chunk in split_text:
|
||||
if "https:" in chunk and ".wav" in chunk:
|
||||
url = chunk.replace('"', '').replace("href=", '')
|
||||
if url not in urls:
|
||||
for s in blocklist:
|
||||
if s in url:
|
||||
break
|
||||
else:
|
||||
urls.append(url)
|
||||
|
||||
print("Found " + str(len(urls)) + " urls")
|
||||
|
||||
for url in tqdm(urls):
|
||||
filename = url[url.rindex("/")+1:]
|
||||
|
||||
response = requests.get(url)
|
||||
open(os.path.join(audio_dir, filename), "wb").write(response.content)
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
requests
|
||||
tqdm
|
Loading…
Reference in New Issue
Block a user