aboutsummaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-05-04 16:28:07 -0700
committerPinapelz <donaldshan1@outlook.com>2023-05-04 16:28:07 -0700
commit845d954fdca9d55f4cef699711a2a73809cd0d69 (patch)
treed80965cb57d120b90e6427abe16872448f70efbc /main.py
parent5cabfb535913f45e031013e9e7b98e65cacf4dcd (diff)
Implemented support for pulling active status from Holodex to local files
Diffstat (limited to 'main.py')
-rw-r--r--main.py19
1 files changed, 19 insertions, 0 deletions
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:
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage