diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-05-04 16:28:07 -0700 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-05-04 16:28:07 -0700 |
| commit | 845d954fdca9d55f4cef699711a2a73809cd0d69 (patch) | |
| tree | d80965cb57d120b90e6427abe16872448f70efbc | |
| parent | 5cabfb535913f45e031013e9e7b98e65cacf4dcd (diff) | |
Implemented support for pulling active status from Holodex to local files
| -rw-r--r-- | config.py | 1 | ||||
| -rw-r--r-- | main.py | 19 |
2 files changed, 20 insertions, 0 deletions
@@ -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 @@ -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: |
