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 /fileutil.py | |
| parent | 0705853d872e0b45a2f3484e68cd82e2679e523b (diff) | |
feat: update exclude channel list with inactive data
Diffstat (limited to 'fileutil.py')
| -rw-r--r-- | fileutil.py | 9 |
1 files changed, 9 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"): """ |
