diff --git a/default/cfg.py b/default/cfg.py index f38a89d..c97b84d 100644 --- a/default/cfg.py +++ b/default/cfg.py @@ -1,4 +1,6 @@ -# Mirai Nikki Bot a video frame posting bot for Pleroma +#! /usr/bin/env python3 + +# Mirai Nikki Bot, a video frame posting bot for Pleroma # Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify diff --git a/default/cfg_netoge.py b/default/cfg_netoge.py index f82e6e9..d51643e 100644 --- a/default/cfg_netoge.py +++ b/default/cfg_netoge.py @@ -1,4 +1,6 @@ -# Mirai Nikki Bot a video frame posting bot for Pleroma +#! /usr/bin/env python3 + +# Mirai Nikki Bot, a video frame posting bot for Pleroma # Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify diff --git a/render/render_mirai_nikki_script.sh b/render/render_mirai_nikki_script.sh index 69203f6..b0df658 100755 --- a/render/render_mirai_nikki_script.sh +++ b/render/render_mirai_nikki_script.sh @@ -1,7 +1,7 @@ #! /usr/bin/env sh -# Mirai Nikki Bot a video frame posting bot for Pleroma -# Copyright (C) 2022 Anon +# Mirai Nikki Bot, a video frame posting bot for Pleroma +# Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + # ISSUES: # - https://github.com/mpv-player/mpv/issues/5498 # MPV has an issue when outputting to jpg. diff --git a/render/render_netoge_ffmpeg.sh b/render/render_netoge_ffmpeg.sh index 2d970ef..8cab3c4 100755 --- a/render/render_netoge_ffmpeg.sh +++ b/render/render_netoge_ffmpeg.sh @@ -1,7 +1,7 @@ #! /usr/bin/env sh -# Mirai Nikki Bot a video frame posting bot for Pleroma -# Copyright (C) 2022 Anon +# Mirai Nikki Bot, a video frame posting bot for Pleroma +# Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + # Requiered args supplied by the bot INPUT_PATH="$1" OUTPUT_PATH="$2" diff --git a/render/render_netoge_script.sh b/render/render_netoge_script.sh index d643839..f305f8d 100755 --- a/render/render_netoge_script.sh +++ b/render/render_netoge_script.sh @@ -1,7 +1,7 @@ #! /usr/bin/env sh -# Mirai Nikki Bot a video frame posting bot for Pleroma -# Copyright (C) 2022 Anon +# Mirai Nikki Bot, a video frame posting bot for Pleroma +# Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + # ISSUES: # - https://github.com/mpv-player/mpv/issues/5498 # MPV has an issue when outputting to jpg. diff --git a/run.sh b/run.sh index e82a142..d71d868 100755 --- a/run.sh +++ b/run.sh @@ -1,7 +1,7 @@ #! /usr/bin/env bash -# Yandere Lewd Bot, an image posting bot for Pleroma -# Copyright (C) 2022 Anon +# Mirai Nikki Bot, an image posting bot for Pleroma +# Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/encryption.py b/src/encryption.py index a9b07c0..acb3a75 100755 --- a/src/encryption.py +++ b/src/encryption.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 -# Yandere Lewd Bot, an image posting bot for Pleroma +# Mirai Nikki Bot, a video frame posting bot for Pleroma # Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify diff --git a/src/main.py b/src/main.py index cd71690..7d97ed0 100755 --- a/src/main.py +++ b/src/main.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 -# Mirai Nikki Bot a video frame posting bot for Pleroma -# Copyright (C) 2022 Anon +# Mirai Nikki Bot, a video frame posting bot for Pleroma +# Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/yandere_bot.py b/src/yandere_bot.py index 37a0a1c..d301966 100644 --- a/src/yandere_bot.py +++ b/src/yandere_bot.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 -# Yandere Lewd Bot, an image posting bot for Pleroma -# Copyright (C) 2022 Anon +# Mirai Nikki Bot, a video frame posting bot for Pleroma +# Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -138,8 +138,9 @@ class YandereBot: # YandereBot.__init__() # @param cfg A dynamically loaded python module + # @param keyfile Keyfile to decrypt settings_post # @param debug_mode Should the bot run in debug mode (do not sign in or post to Pleroma) - # prime_bot Should the bot immediately prime itself (configure picture list and login, but don't post) + # @prime_bot Should the bot immediately prime itself (configure picture list and login, but don't post) def __init__(self, cfg, keyfile=None, debug_mode=False, prime_bot=True): self.cfg = cfg self.load_settings(self.cfg) @@ -217,6 +218,8 @@ class YandereBot: for path in path_list: if not os.path.isfile(path): raise FileNotFoundError("Could not upload: {}".format(path)) + + for path in path_list: if not self.debug_mode: media = self.mastodon_api.media_post(path, description=os.path.basename(path)) media_dict = { @@ -237,6 +240,7 @@ class YandereBot: for media_dict in media_list: path = media_dict["path"] media = media_dict["media"] + if path is None or media is None: continue elif content_type == "text/markdown" and not self.debug_mode: @@ -269,11 +273,7 @@ class YandereBot: return yandere_frame # The main post function - # This function is responsible for incrementing self.currentSessionCount, as well as posting and blacklisting the - # picked item. - # - # It is also responsible for removing the picked item from self.listPictures, which can be accomplished by simply - # popping it at index 0. This should handle any error that might occur while posting. + # This funciton is responsible for picking a profile, generate a screenshot, and posting it. # # This function should return 'None' if a post failed, and the picked item from self.listPictures if it succeeded. def post(self): @@ -294,14 +294,15 @@ class YandereBot: # The post was successful return picked - # Server Errors - # Assume all exceptions are on the server side (except for FileNotFoundError of course + # Server Errors and other general exceptions + # Assume all exceptions are on the server side (besides FileNotFoundError of course) # If the connection is timing out it could be for two reasons: # 1. The error was caused by the user attempting to upload a large file over a slow connection: # a. FIX: Reduce settings_behavior["max_size"] # 2. The server is down. Check to verify in a web browser (this is the default assumption since the # mastodon.py API will not specify why the connection timed out). - # The default assumption is #2 + # 3. Failed to generate screenshot + # 4. Other general exceptions except (FileNotFoundError, MastodonAPIError, InvalidPost, Exception) as e: print("Exception:", e) @@ -333,7 +334,8 @@ class YandereBot: # End Conditions: # 1. User presses Ctrl+C - # 2. settings_behavior["uploads_per_post"] is less than one for some reason + # 2. settings_behavior["uploads_per_post"] is less than uploads_per_post + # 3. Consecutive failed uploads is less than max_errors def can_post(self): return ( not self.eventSleep.is_set() and