198 lines
6.0 KiB
Python
198 lines
6.0 KiB
Python
# Mirai Nikki Bot a video frame posting bot for Pleroma
|
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
|
#
|
|
# 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
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
from collections import OrderedDict
|
|
|
|
|
|
def setup_episode(profile_name, path, frames, _skip, _nsfw, output_name, message, message_nsfw):
|
|
return {
|
|
"profile_name": profile_name,
|
|
"path": path,
|
|
"frames": frames,
|
|
"skip": _skip,
|
|
"nsfw": _nsfw,
|
|
"output_name": output_name,
|
|
"message": (message,),
|
|
"message_nsfw": (message_nsfw,),
|
|
"render_script": "./render/render_netoge_ffmpeg.sh"
|
|
}
|
|
|
|
|
|
# Client credentials: >>>NEVER GIVE THESE OUT TO ANYONE<<<
|
|
# Use the create_app.py script and follow the prompts to generate your tokens. Once generated, copy & paste them below.
|
|
settings_server = OrderedDict([
|
|
("app_name", "generated from create_app.py"),
|
|
("api_base_url", "generated from create_app.py"),
|
|
("client_id", "generated from create_app.py"),
|
|
("client_secret", "generated from create_app.py"),
|
|
("access_token", "generated from create_app.py")
|
|
])
|
|
|
|
settings_reminder = "08/17/2023 11:59PM"
|
|
|
|
# Encryption settings: When using encryption the bot will ask you for your password before logging into your instance.
|
|
# Use create_app.py and follow the instructions. Select yes when it asks you if you want to encrypt your credentials.
|
|
# Paste the output below and never change the values.
|
|
# If you want to encrypt or re-encrypt settings_server you can use encryption.py (or just regenerate your tokens)
|
|
settings_encrypt = {
|
|
"encrypt": False,
|
|
"salt": "",
|
|
"keyfile": None
|
|
}
|
|
|
|
# Basic settings to configure Yandere Bot's behavior
|
|
settings_behavior = {
|
|
"visibility": "unlisted",
|
|
"feature_set": "pleroma",
|
|
"uploads_per_post": 1,
|
|
"max_errors": 6,
|
|
"retry_seconds": 15,
|
|
"content_type": "text/plain",
|
|
"content_newline": "\n",
|
|
"post_image_link": False,
|
|
"debug": False
|
|
}
|
|
|
|
# Time string formats
|
|
settings_time = {
|
|
"time_format": "%I:%M%p",
|
|
"time_format_seconds": "%I:%M:%S%p",
|
|
"date_format": "%m/%d/%Y",
|
|
"long_date_format": "%m/%d/%Y %I:%M%p",
|
|
"long_date_seconds_format": "%m/%d/%Y %I:%M:%S%p",
|
|
"long_date_week": "%m/%d/%Y %I:%M%p, %A",
|
|
"datetime": "%Y.%m.%d_%I.%M.%S%p"
|
|
}
|
|
|
|
# The final frame (in seconds)
|
|
end_frame = {
|
|
"netoge_ep01": 24*60+42.816,
|
|
"netoge_ep02": 24*60+41.731,
|
|
"netoge_ep03": 24*60+39.771,
|
|
"netoge_ep04": 24*60+39.813,
|
|
"netoge_ep05": 24*60+38.603,
|
|
"netoge_ep06": 24*60+40.23,
|
|
"netoge_ep07": 24*60+40.021,
|
|
"netoge_ep08": 24*60+41.147,
|
|
"netoge_ep09": 24*60+42.899,
|
|
"netoge_ep10": 24*60+39.771,
|
|
"netoge_ep11": 24*60+40.271,
|
|
"netoge_ep12": 24*60+40.146
|
|
}
|
|
|
|
# Tuple of time ranges to skip (in seconds)
|
|
skip = {
|
|
"netoge_ep01": (
|
|
(0, 30.154), # Funimation Shill
|
|
(1367.282, end_frame["netoge_ep01"]) # ED
|
|
),
|
|
"netoge_ep02": (
|
|
(0, 30.154), # Funimation Shill
|
|
(121.037, 210.69), # OP
|
|
(1381.671, end_frame["netoge_ep02"]) # ED
|
|
),
|
|
"netoge_ep03": (
|
|
(0, 30.154), # Funimation Shill
|
|
(84.959, 174.882), # OP
|
|
(1379.794, end_frame["netoge_ep03"]) # ED
|
|
),
|
|
"netoge_ep04": (
|
|
(0, 30.154), # Funimation Shill
|
|
(191.315, 281.239), # OP
|
|
(1379.836, end_frame["netoge_ep04"]) # ED
|
|
),
|
|
"netoge_ep05": (
|
|
(0, 30.154), # Funimation Shill
|
|
(72.989, 162.912), # OP
|
|
(1468.633, end_frame["netoge_ep05"]) # ED
|
|
),
|
|
"netoge_ep06": (
|
|
(0, 30.154), # Funimation Shill
|
|
(162.245, 252.21), # OP
|
|
(1308.181, 1398.188), # ED1
|
|
(1470.26, end_frame["netoge_ep06"]) # ED2
|
|
),
|
|
"netoge_ep07": (
|
|
(0, 30.154), # Funimation Shill
|
|
(124.207, 214.13), # OP
|
|
(1380.086, end_frame["netoge_ep07"]) # ED
|
|
),
|
|
"netoge_ep08": (
|
|
(0, 30.154), # Funimation Shill
|
|
(106.481, 196.487), # OP
|
|
(1471.177, end_frame["netoge_ep08"]) # ED
|
|
),
|
|
"netoge_ep09": (
|
|
(0, 30.154), # Funimation Shill
|
|
(93.801, 183.808), # OP
|
|
(1383.381, end_frame["netoge_ep09"]) # ED
|
|
),
|
|
"netoge_ep10": (
|
|
(0, 30.154), # Funimation Shill
|
|
(144.227, 234.15), # OP
|
|
(1469.843, end_frame["netoge_ep10"]) # ED
|
|
),
|
|
"netoge_ep11": (
|
|
(0, 30.154), # Funimation Shill
|
|
(122.205, 212.128), # OP
|
|
(1380.337, end_frame["netoge_ep11"]) # ED
|
|
),
|
|
"netoge_ep12": (
|
|
(0, 30.154), # Funimation Shill
|
|
(121.245, 211.169) # OP
|
|
)
|
|
}
|
|
|
|
# Tuple of time ranges to mark as sensative (in seconds)
|
|
nsfw = {
|
|
"netoge_ep01": (tuple()),
|
|
"netoge_ep02": (tuple()),
|
|
"netoge_ep03": (tuple()),
|
|
"netoge_ep04": (tuple()),
|
|
"netoge_ep05": (tuple()),
|
|
"netoge_ep06": (tuple()),
|
|
"netoge_ep07": (tuple()),
|
|
"netoge_ep08": (tuple()),
|
|
"netoge_ep09": (tuple()),
|
|
"netoge_ep10": (tuple()),
|
|
"netoge_ep11": (tuple()),
|
|
"netoge_ep12": (tuple()),
|
|
}
|
|
|
|
# Regular episodes
|
|
start_episode = 1
|
|
end_episode = 12
|
|
profile_name = "netoge_ep{}"
|
|
rsc_name = "./rsc/[HorribleSubs] Netoge no Yome wa Onnanoko ja Nai to Omotta - {} [1080p].mkv"
|
|
screenshot_folder = "/tmp/Netoge_EP{}_${{frame}}.jpg"
|
|
msg = "#Netoge #yandere"
|
|
msg_nsfw = "#Netoge #yandere #nsfw"
|
|
|
|
# Use a list comprehension and convert it to a tuple since
|
|
# regular episodes are named in ascending order
|
|
settings_post = tuple((
|
|
setup_episode(
|
|
profile_name .format(i),
|
|
rsc_name .format(i),
|
|
end_frame [profile_name.format(i)],
|
|
skip [profile_name.format(i)],
|
|
nsfw [profile_name.format(i)],
|
|
screenshot_folder .format(i),
|
|
msg .format(i),
|
|
msg_nsfw .format(i)
|
|
) for i in (str(x).zfill(2) for x in range(start_episode, end_episode + 1))
|
|
))
|