JasonLovesDoggo / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
23 stars 13 forks source link

When saving Text to MP3 #17

Closed Snwrk closed 2 years ago

Snwrk commented 2 years ago

Traceback (most recent call last): File "C:\Users\BLANK\Downloads\VidMaker\video_creation\voices.py", line 38, in save_text_to_mp3 length += MP3(f"assets/temp/mp3/{idx}.mp3").info.length File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\mutagen_file.py", line 48, in init self.load(*args, kwargs) File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\mutagen_util.py", line 156, in wrapper return func(self, h, *args, *kwargs) File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\mutagen\id3_file.py", line 421, in load self.info = self._Info(fileobj, offset) File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\mutagen_util.py", line 185, in wrapper return func(args, kwargs) File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\mutagen\mp3__init.py", line 402, in init__ raise HeaderNotFoundError("can't sync to MPEG frame") mutagen.mp3.HeaderNotFoundError: can't sync to MPEG frame

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\sox\core.py", line 147, in soxi shell_output = subprocess.check_output( File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 420, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['sox', '--i', '-D', 'assets/temp/mp3/7.mp3']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\BLANK\Downloads\VidMaker\main.py", line 39, in main() File "C:\Users\BLANK\Downloads\VidMaker\main.py", line 30, in main length, number_of_comments = save_text_to_mp3(reddit_object) File "C:\Users\BLANK\Downloads\VidMaker\video_creation\voices.py", line 40, in save_text_to_mp3 length = sox.file_info.duration(f"assets/temp/mp3/{idx}.mp3") File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\sox\file_info.py", line 122, in duration output = soxi(input_filepath, 'D') File "C:\Users\BLANK\AppData\Local\Programs\Python\Python39\lib\site-packages\sox\core.py", line 153, in soxi raise SoxiError("SoXI failed with exit code {}".format(cpe.returncode)) sox.core.SoxiError: SoXI failed with exit code 1

Snwrk commented 2 years ago

Well it's fixed but now it seems some posts crash when trying to convert text to mp3.

JasonLovesDoggo commented 2 years ago

It's a problem with SoX, not my code so I cannot fix it. I can try using some try blocks though.