Skip to content

Commit

Permalink
Squashed 3 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
DonFlymoor committed Sep 24, 2020
1 parent c87f1d6 commit de15cdd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
5 changes: 4 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ version
1.2.4
- And more bugs
1.2.5
- Added ssml input with readable usage
- Added ssml input with readable usage
1.2.6
- Better readability for scripts
- Sqaushed 3 bugs
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
EMAIL = '[email protected]'
AUTHOR = 'Don Flymoor'
REQUIRES_PYTHON = '>=3.6.0'
VERSION = '1.2.5'
VERSION = '1.2.6'

# What packages are required for this module to be executed?
REQUIRED = [
Expand Down
2 changes: 1 addition & 1 deletion voxtalkz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from .voxtalkz import *

__version__ = '1.2.5'
__version__ = '1.2.6'
34 changes: 21 additions & 13 deletions voxtalkz/voxtalkz.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import json
import os
import base64
import errno

File = 'null'

Expand Down Expand Up @@ -274,23 +275,30 @@ def ListToSound(self, Lists):
if "@" in List[1]:
effects=(List[1].split('@'))[1]
List[1]=(List[1].split('@'))[0]
List[1] = List[1].replace('*', '')
# Check to see if it's a sound effect
if List[0] == 'SOUND':
if self.debug:
print('Makeing %s...'%List[1])
while True:
try:
try:
audio_segment = AudioSegment.from_mp3(self.homedir+'/.voxTalkz/soundEffects/'+List[1]+'.mp3')
except:
audio_segment = AudioSegment.from_wav(self.homedir+'/.voxTalkz/soundEffects/'+List[1]+'.wav')
finally:
audio_segment = AudioSegment.from_ogg(self.homedir+'/.voxTalkz/soundEffects/'+List[1]+'.ogg')
fileName = List[1]
filePath = self.homedir+'\\.voxTalkz\\soundEffects\\'+ fileName
if os.path.exists(filePath+'.mp3'):
audio_segment = AudioSegment.from_mp3(filePath+'.mp3')
elif os.path.exists(filePath+'.wav'):
audio_segment = AudioSegment.from_wav(filePath+'.wav')
elif os.path.exists(filePath+'.ogg'):
audio_segment = AudioSegment.from_ogg(filePath+'.ogg')
else:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), filePath)

if self.debug:
print("Done!\n")
break
except:
contd = input('\n !!! Could not open %s'%(self.homedir+'/.voxTalkz/soundEffects/'+List[1]+'.mp3 (or .wav, or ogg) !!! Type continue to skip the sound effect, retry to retry after you\'ve fixed the problem, or exit to quit.'))
except Exception as e:
print(e)
contd = input('Type continue to skip the sound effect, retry to retry after you\'ve fixed the problem, or exit to quit.')
if contd == 'continue':
break
elif contd == 'retry':
Expand Down Expand Up @@ -349,7 +357,6 @@ def ListToSound(self, Lists):
text_type = "text"

data = {
"speakingRate":1,
"input": {text_type: text},
"voice": {"name": self.Actors[List[0]][0], "languageCode": self.Actors[List[0]][1]},
"audioConfig": {"audioEncoding": "MP3"}
Expand All @@ -371,6 +378,7 @@ def ListToSound(self, Lists):
except Exception as Error:
print('Error while using wavenet voice!')
print(Error)
print(content)

if self.debug:
print('Done!\n')
Expand Down Expand Up @@ -473,7 +481,7 @@ def to_ssml(self, text):
</speak>
There are many other ssml notaions, all of which are supported, but will have to be manually entered
'''
text = '<speak> ' + text + '</speak>'
text = '<speak> ' + text + ' </speak>'
replace_dict = {' __' : ' <emphasis level="strong"> ',
'__ ' : ' </emphasis> ',
' _' : ' <emphasis level="moderate"> ',
Expand All @@ -489,7 +497,7 @@ def to_ssml(self, text):
'..' : '<break time="100ms"/>'}

for string in replace_dict:
text.replace(string, replace_dict[string])
text = text.replace(string, replace_dict[string])

return text
def save(self):
Expand Down Expand Up @@ -526,8 +534,8 @@ def say(*args, **kwargs):
print('Usage: --cloud [text-to-speach API key]')
args.remove("--cloud")

elif len(args) != 3:
print("Expecting two arguments! Usage: voxtalkz [input file, output file] ")
# elif len(args) != 3:
# print("Expecting two arguments! Usage: voxtalkz [input file, output file] ")

else:
print(args)
Expand Down

0 comments on commit de15cdd

Please sign in to comment.