Cleaned up comments
This commit is contained in:
parent
d6c851b1f2
commit
a98b665c36
@ -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 <yanderefedi@proton.me>
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -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 <yanderefedi@proton.me>
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env sh
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
# Mirai Nikki Bot a video frame posting bot for Pleroma
|
# Mirai Nikki Bot, a video frame posting bot for Pleroma
|
||||||
# Copyright (C) 2022 Anon
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# ISSUES:
|
# ISSUES:
|
||||||
# - https://github.com/mpv-player/mpv/issues/5498
|
# - https://github.com/mpv-player/mpv/issues/5498
|
||||||
# MPV has an issue when outputting to jpg.
|
# MPV has an issue when outputting to jpg.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env sh
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
# Mirai Nikki Bot a video frame posting bot for Pleroma
|
# Mirai Nikki Bot, a video frame posting bot for Pleroma
|
||||||
# Copyright (C) 2022 Anon
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# Requiered args supplied by the bot
|
# Requiered args supplied by the bot
|
||||||
INPUT_PATH="$1"
|
INPUT_PATH="$1"
|
||||||
OUTPUT_PATH="$2"
|
OUTPUT_PATH="$2"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env sh
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
# Mirai Nikki Bot a video frame posting bot for Pleroma
|
# Mirai Nikki Bot, a video frame posting bot for Pleroma
|
||||||
# Copyright (C) 2022 Anon
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# ISSUES:
|
# ISSUES:
|
||||||
# - https://github.com/mpv-player/mpv/issues/5498
|
# - https://github.com/mpv-player/mpv/issues/5498
|
||||||
# MPV has an issue when outputting to jpg.
|
# MPV has an issue when outputting to jpg.
|
||||||
|
4
run.sh
4
run.sh
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
# Yandere Lewd Bot, an image posting bot for Pleroma
|
# Mirai Nikki Bot, an image posting bot for Pleroma
|
||||||
# Copyright (C) 2022 Anon
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/env python3
|
#! /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 <yanderefedi@proton.me>
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
# Mirai Nikki Bot a video frame posting bot for Pleroma
|
# Mirai Nikki Bot, a video frame posting bot for Pleroma
|
||||||
# Copyright (C) 2022 Anon
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env python3
|
#! /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
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -138,8 +138,9 @@ class YandereBot:
|
|||||||
|
|
||||||
# YandereBot.__init__()
|
# YandereBot.__init__()
|
||||||
# @param cfg A dynamically loaded python module
|
# @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)
|
# @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):
|
def __init__(self, cfg, keyfile=None, debug_mode=False, prime_bot=True):
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
self.load_settings(self.cfg)
|
self.load_settings(self.cfg)
|
||||||
@ -217,6 +218,8 @@ class YandereBot:
|
|||||||
for path in path_list:
|
for path in path_list:
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
raise FileNotFoundError("Could not upload: {}".format(path))
|
raise FileNotFoundError("Could not upload: {}".format(path))
|
||||||
|
|
||||||
|
for path in path_list:
|
||||||
if not self.debug_mode:
|
if not self.debug_mode:
|
||||||
media = self.mastodon_api.media_post(path, description=os.path.basename(path))
|
media = self.mastodon_api.media_post(path, description=os.path.basename(path))
|
||||||
media_dict = {
|
media_dict = {
|
||||||
@ -237,6 +240,7 @@ class YandereBot:
|
|||||||
for media_dict in media_list:
|
for media_dict in media_list:
|
||||||
path = media_dict["path"]
|
path = media_dict["path"]
|
||||||
media = media_dict["media"]
|
media = media_dict["media"]
|
||||||
|
|
||||||
if path is None or media is None:
|
if path is None or media is None:
|
||||||
continue
|
continue
|
||||||
elif content_type == "text/markdown" and not self.debug_mode:
|
elif content_type == "text/markdown" and not self.debug_mode:
|
||||||
@ -269,11 +273,7 @@ class YandereBot:
|
|||||||
return yandere_frame
|
return yandere_frame
|
||||||
|
|
||||||
# The main post function
|
# The main post function
|
||||||
# This function is responsible for incrementing self.currentSessionCount, as well as posting and blacklisting the
|
# This funciton is responsible for picking a profile, generate a screenshot, and posting it.
|
||||||
# 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 function should return 'None' if a post failed, and the picked item from self.listPictures if it succeeded.
|
# This function should return 'None' if a post failed, and the picked item from self.listPictures if it succeeded.
|
||||||
def post(self):
|
def post(self):
|
||||||
@ -294,14 +294,15 @@ class YandereBot:
|
|||||||
# The post was successful
|
# The post was successful
|
||||||
return picked
|
return picked
|
||||||
|
|
||||||
# Server Errors
|
# Server Errors and other general exceptions
|
||||||
# Assume all exceptions are on the server side (except for FileNotFoundError of course
|
# Assume all exceptions are on the server side (besides FileNotFoundError of course)
|
||||||
# If the connection is timing out it could be for two reasons:
|
# 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:
|
# 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"]
|
# 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
|
# 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).
|
# 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:
|
except (FileNotFoundError, MastodonAPIError, InvalidPost, Exception) as e:
|
||||||
print("Exception:", e)
|
print("Exception:", e)
|
||||||
|
|
||||||
@ -333,7 +334,8 @@ class YandereBot:
|
|||||||
|
|
||||||
# End Conditions:
|
# End Conditions:
|
||||||
# 1. User presses Ctrl+C
|
# 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):
|
def can_post(self):
|
||||||
return (
|
return (
|
||||||
not self.eventSleep.is_set() and
|
not self.eventSleep.is_set() and
|
||||||
|
Reference in New Issue
Block a user