From 845d954fdca9d55f4cef699711a2a73809cd0d69 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 4 May 2023 16:28:07 -0700 Subject: Implemented support for pulling active status from Holodex to local files --- main.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'main.py') diff --git a/main.py b/main.py index 6fa05df..ee2f8b6 100644 --- a/main.py +++ b/main.py @@ -128,6 +128,25 @@ def main(mode=0): # Generating individual pages generate_individual_stats(server, data) +def generate_channel_files(): + """ + Generates the channels.txt and exclude_channels.txt files based on Holodex listings + """ + if not UPDATE_LOCAL_RECORDS: + return + print("Running Channel Files Update") + hldex = HolodexAPI(fs.get_api_key("holodex_api_key"), member_count = ORG_MEMBER_COUNT, + organization = HOLODEX_ORG) + hldex.get_data_all_channels() + if not os.path.exists("data"): + os.mkdir("data") + with open("data/channels.txt", "w", encoding="utf-8") as file: + file.write("\n".join(hldex.get_active_channels())) + with open("data/exclude_channels.txt", "w", encoding="utf-8") as file: + file.write("\n".join(hldex.get_exclude_channels())) + print("Success! Channel Files Updated!") + + if __name__ == "__main__": MODE = 1 if len(sys.argv) > 1: -- cgit v1.2.3