elebumm / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
6.41k stars 1.81k forks source link

Error on making MP3 #888

Closed kloentje2 closed 2 years ago

kloentje2 commented 2 years ago

Describe the bug I can't create a video using RedditVideoMakerBot. I only get an error when the script is making a MP3 file

This is the result

C:\Reddit>python main.py
Using Germany server backend.

██████╗ ███████╗██████╗ ██████╗ ██╗████████╗    ██╗   ██╗██╗██████╗ ███████╗ ██████╗     ███╗   ███╗ █████╗ ██╗  ██╗███████╗██████╗
██╔══██╗██╔════╝██╔══██╗██╔══██╗██║╚══██╔══╝    ██║   ██║██║██╔══██╗██╔════╝██╔═══██╗    ████╗ ████║██╔══██╗██║ ██╔╝██╔════╝██╔══██╗
██████╔╝█████╗  ██║  ██║██║  ██║██║   ██║       ██║   ██║██║██║  ██║█████╗  ██║   ██║    ██╔████╔██║███████║█████╔╝ █████╗  ██████╔╝
██╔══██╗██╔══╝  ██║  ██║██║  ██║██║   ██║       ╚██╗ ██╔╝██║██║  ██║██╔══╝  ██║   ██║    ██║╚██╔╝██║██╔══██║██╔═██╗ ██╔══╝  ██╔══██╗
██║  ██║███████╗██████╔╝██████╔╝██║   ██║        ╚████╔╝ ██║██████╔╝███████╗╚██████╔╝    ██║ ╚═╝ ██║██║  ██║██║  ██╗███████╗██║  ██║
╚═╝  ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═╝   ╚═╝         ╚═══╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝     ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝

  Thanks for using this tool! Feel free to contribute to this project on GitHub! If you have any questions, feel free
     to reach out to me on Twitter or submit a GitHub issue. You can find solutions to many common problems in the
                                                     Documentation

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ You are using V2.2.1 of the bot                                                                                     │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Logging into Reddit.
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Getting subreddit threads...                                                                                        │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Using subreddit: r/100yearsago from environment variable config
Video will be: [July 7, 1922] Noted medium Eva Carriere fails to produce ectoplasm from her vagina (no, really!) during
15 experiments at the Sorbonne. 👍
Thread has 168 upvotes
Thread has a upvote ratio of 98.0%
Thread has 25 comments
Received subreddit threads Successfully.
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Please choose one of the following TTS providers:                                                                   │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────┐ ┌──────────┐ ┌─────────────────┐ ┌────────┐
│ GoogleTranslate │ │ AWSPolly │ │ StreamlabsPolly │ │ TikTok │
└─────────────────┘ └──────────┘ └─────────────────┘ └────────┘

GoogleTranslate
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Saving Text to MP3 files...                                                                                         │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Saving... ----------------------------------------
Traceback (most recent call last):
  File "C:\Reddit\main.py", line 70, in <module>
    main()
  File "C:\Reddit\main.py", line 37, in main
    length, number_of_comments = save_text_to_mp3(reddit_object)
  File "C:\Reddit\video_creation\voices.py", line 49, in save_text_to_mp3
    return text_to_mp3.run()
  File "C:\Reddit\TTS\engine_wrapper.py", line 65, in run
    self.call_tts(f"{idx}", comment["comment_body"])
  File "C:\Reddit\TTS\engine_wrapper.py", line 93, in call_tts
    self.tts_module.run(text=process_text(text), filepath=f"{self.path}/{filename}.mp3")
  File "C:\Reddit\TTS\GTTS.py", line 15, in run
    tts = gTTS(text=text, lang=os.getenv("POSTLANG") or "en", slow=False)
  File "C:\Python310\lib\site-packages\gtts\tts.py", line 134, in __init__
    assert text, "No text to speak"
AssertionError: No text to speak

C:\Reddit>python main.py

My settings: (.env)

STREAMLABS_VOICE="Emma"
REDDIT_USERNAME="******"
ALLOW_NSFW="False"
THEME="LIGHT"
SUBREDDIT="100yearsago"
POSTLANG=""
AWS_VOICE="Emma"
TIMES_TO_RUN=""
REDDIT_CLIENT_ID="******"
OPACITY=1.0
TIKTOK_VOICE="en_us_001"
REDDIT_PASSWORD="******"
REDDIT_CLIENT_SECRET="******"
TTSCHOICE=""
MAX_COMMENT_LENGTH=500
POST_ID=""
REDDIT_2FA="no"

When I use TikTok as TTS I get this error

Saving... ----------------------------------------
Traceback (most recent call last):
  File "C:\Reddit\main.py", line 70, in <module>
    main()
  File "C:\Reddit\main.py", line 37, in main
    length, number_of_comments = save_text_to_mp3(reddit_object)
  File "C:\Reddit\video_creation\voices.py", line 49, in save_text_to_mp3
    return text_to_mp3.run()
  File "C:\Reddit\TTS\engine_wrapper.py", line 67, in run
    self.split_post(comment["comment_body"], idx)
  File "C:\Reddit\TTS\engine_wrapper.py", line 82, in split_post
    self.call_tts(f"{idx}-{idy}.part", text_cut)
  File "C:\Reddit\TTS\engine_wrapper.py", line 94, in call_tts
    self.length += MP3(f"{self.path}/{filename}.mp3").info.length
  File "C:\Python310\lib\site-packages\mutagen\_file.py", line 48, in __init__
    self.load(*args, **kwargs)
  File "C:\Python310\lib\site-packages\mutagen\_util.py", line 156, in wrapper
    return func(self, h, *args, **kwargs)
  File "C:\Python310\lib\site-packages\mutagen\id3\_file.py", line 421, in load
    self.info = self._Info(fileobj, offset)
  File "C:\Python310\lib\site-packages\mutagen\_util.py", line 185, in wrapper
    return func(*args, **kwargs)
  File "C:\Python310\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

It really looks like that the mp3 file isnt created. But I am not sure...

I execute the code as admin, so I am sure that I have the proper access rights

William9923 commented 2 years ago

use latest version