fix(scripts): offset butler tasks to reduce ci random failures (#1320)

* fix(scripts): offset butler tasks to reduce ci random failures

* Apply suggestions from code review

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

---------

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
ReenigneArcher 2024-02-04 13:50:31 -05:00 committed by GitHub
parent 768aa58c90
commit 097b989fab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ python plex-bootraptest.py --no-docker --server-name name_of_server --account He
"""
import argparse
from datetime import datetime
import os
import shutil
import socket
@ -506,6 +507,24 @@ if __name__ == "__main__": # noqa: C901
server.settings.get("GenerateBIFBehavior").set("never")
server.settings.get("GenerateChapterThumbBehavior").set("never")
server.settings.get("LoudnessAnalysisBehavior").set("never")
# disable butler tasks
current_hour = datetime.now().hour
start_hour = (current_hour + 12) % 24
end_hour = (current_hour + 15) % 24
server.settings.get("ButlerStartHour").set(start_hour)
server.settings.get("ButlerEndHour").set(end_hour)
# find all butler settings
for setting in server.settings.all():
if setting.id.lower().startswith("butler") and isinstance(setting.value, bool):
try:
setting.set(False)
print("Disabled setting '{}'".format(setting))
except NotFound:
print("Setting '{}' not found".format(setting))
# save settings
server.settings.save()
sections = []