pascalkrautm / 002---Audio-News-Podcast-Generator

002 - Audio News Podcast Generator, MBA HSD SS21
0 stars 2 forks source link

Bug errors #13

Closed Matadore3 closed 3 years ago

Matadore3 commented 3 years ago

In this issue we should list all errors we had while coding with their solutions

Matadore3 commented 3 years ago

Code:

myText = open(r'podcast.txt', 'w')

Error:

'charmap' codec can't encode character '\u2015' in position 5700: character maps to

Solution:

myText = open(r'podcast.txt', 'w', encoding='utf-8')

This fix must be used by all Windows users, otherwise the program will not run properly.

Matadore3 commented 3 years ago

For both Windows and Mac users, it is important to encode the list from the scrapper into Latin-1 so that a pdf can be created.

The following code is used to encode (applies to Mac and Windows): text_encoded = text.encode('latin-1', 'replace').decode('latin-1')

Matadore3 commented 3 years ago

For both Mac and Windows users, it is important to prepare the output of the scraper as part of the mp3 saving process so that there is a comma after each sentence/entry and not a period. Otherwise the program will save only the first entry for the selected keywords as mp3 format

Code: text = text.replace(".", ", ")

Matadore3 commented 3 years ago

Both Mac and Windows require different keys regarding the language settings in the code. If the program does not find the respective key, the podcast will be played with the default language. Because of this, we have written a loop that contains both the Windows and Mac language keys.

For Example:

                    if platform.system() == "Darwin":
                        engine.setProperty("voice", "com.apple.speech.synthesis.voice.Alex")
                    else:
                        engine.setProperty("voice",
                                           "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\"
                                           "Tokens\\TTS_MS_EN-US_DAVID_11.0")