diff --git a/archivers/base_archiver.py b/archivers/base_archiver.py index dc47273..12cca80 100644 --- a/archivers/base_archiver.py +++ b/archivers/base_archiver.py @@ -1,6 +1,7 @@ import os import ffmpeg import datetime +import shutil from dataclasses import dataclass from abc import ABC, abstractmethod from urllib.parse import urlparse @@ -78,7 +79,6 @@ class Archiver(ABC): self.storage.upload(thumbnail_filename, key) cdn_urls.append(cdn_url) - os.remove(thumbnail_filename) if len(cdn_urls) == 0: return ('None', 'None') @@ -100,6 +100,7 @@ class Archiver(ABC): thumb_index = key_folder + 'index.html' self.storage.upload(index_fname, thumb_index, extra_args={'ACL': 'public-read', 'ContentType': 'text/html'}) + shutil.rmtree(thumbnails_folder) thumb_index_cdn_url = self.storage.get_cdn_url(thumb_index) diff --git a/auto_archive.py b/auto_archive.py index 472efd2..ce82ee1 100644 --- a/auto_archive.py +++ b/auto_archive.py @@ -2,6 +2,7 @@ import os import datetime import argparse import requests +import shutil import gspread from loguru import logger from dotenv import load_dotenv @@ -126,7 +127,7 @@ def main(): mkdir_if_not_exists('tmp') process_sheet(args.sheet) - + shutil.rmtree('tmp') if __name__ == '__main__': main()