diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-06-23 15:55:54 -0700 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-06-23 15:55:54 -0700 |
| commit | 404458d6804c54024d63cccf16d316cff754b888 (patch) | |
| tree | 35ae6e47668fb835f77dd526e840b3d4821adabf | |
| parent | 0705853d872e0b45a2f3484e68cd82e2679e523b (diff) | |
feat: update exclude channel list with inactive data
| -rw-r--r-- | fileutil.py | 9 | ||||
| -rw-r--r-- | nijitrack.py | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/fileutil.py b/fileutil.py index b8f6015..4068030 100644 --- a/fileutil.py +++ b/fileutil.py @@ -20,6 +20,15 @@ def get_excluded_channels(): excluded_channels = _read_file(os.path.join("data", "exclude_channel.txt")) return excluded_channels +def update_excluded_channels(channel_ids: list): + # add to exclude_channel.txt if not already there + excluded_channels = get_excluded_channels() + for channel_id in channel_ids: + if channel_id not in excluded_channels: + excluded_channels.append(channel_id) + with open(os.path.join("data", "exclude_channel.txt"), "w", encoding="utf-8") as file: + for channel_id in excluded_channels: + file.write(channel_id + "\n") def save_local_channels(data: list, path: str = "data"): """ diff --git a/nijitrack.py b/nijitrack.py index 159c19f..8ed5967 100644 --- a/nijitrack.py +++ b/nijitrack.py @@ -106,5 +106,6 @@ if __name__ == "__main__": server = SQLHandler(CONFIG["SQL"]["host"], CONFIG["SQL"]["user"], CONFIG["SQL"]["password"], CONFIG["SQL"]["database"]) initialize_database(server) channel_data, inactive_channels = holodex_generation(server) # channel_data = youtube_generation(server) + fs.update_excluded_channels(inactive_channels) generate_individual_pages(server, channel_data) builder.build_ranking_page(server, CONFIG, get_excluded_channel_ids(inactive_channels, fs.get_excluded_channels())) |
