aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.py1
-rw-r--r--main.py19
2 files changed, 20 insertions, 0 deletions
diff --git a/config.py b/config.py
index 16599bd..6eb919a 100644
--- a/config.py
+++ b/config.py
@@ -43,5 +43,6 @@ ROOT_STORAGE_PATH = ""
# Skip the options below if you are not using Holodex
HOLODEX_ORG = "Nijisanji"
ORG_MEMBER_COUNT = 300
+UPDATE_LOCAL_RECORDS = True # If true, will update the local records of the channels.txt and exclude_channels.txt files
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