Channel export
This commit is contained in:
parent
906566825f
commit
c36276aee5
2 changed files with 12 additions and 6 deletions
|
@ -368,17 +368,23 @@ class SlackExporter:
|
|||
f.write(data)
|
||||
|
||||
def export_channels(self, channels: List[str]):
|
||||
with open(os.path.join(self.output_dir, "channels.txt"), "w", encoding="utf-8") as f:
|
||||
for channel in channels:
|
||||
f.write(str(channel) + "\n")
|
||||
pass
|
||||
channels_map = {ch.id: ch for ch in self.channels}
|
||||
self.export_channel_list(True)
|
||||
self.export_user_list(True)
|
||||
for channel_id in channels:
|
||||
print(f"Eksport {channels_map.get(channel_id).label}...")
|
||||
self.export_channel_history(channel_id)
|
||||
self.export_channel_history(channel_id, as_json=True)
|
||||
self.export_channel_replies(channel_id)
|
||||
self.export_channel_replies(channel_id, as_json=True)
|
||||
self.export_channel_files(channel_id)
|
||||
|
||||
def export_channel_list(self, as_json: bool = False):
|
||||
"""Eksportuje listę kanałów"""
|
||||
if as_json:
|
||||
data = [vars(ch) for ch in self.channels]
|
||||
else:
|
||||
data = "\n".join(ch.format(self.users) for ch in self.channels)
|
||||
data = "\n".join(ch.label for ch in self.channels)
|
||||
self._save_data(data, "channel_list", as_json)
|
||||
|
||||
def export_user_list(self, as_json: bool = False):
|
||||
|
|
2
tui.py
2
tui.py
|
@ -107,7 +107,7 @@ def run_tui(exporter: SlackExporter):
|
|||
app = SlackTUI(exporter)
|
||||
app.run()
|
||||
if app.get_return_code() == 8080:
|
||||
exporter.export_channels(app.get_selection())
|
||||
exporter.export_channels(list(app.get_selection()))
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue