diff --git a/auto_archive.py b/auto_archive.py index e4d2020..d06e4e9 100644 --- a/auto_archive.py +++ b/auto_archive.py @@ -149,6 +149,8 @@ def main(): description='Automatically archive social media videos from a Google Sheets document') parser.add_argument('--sheet', action='store', dest='sheet', help='the name of the google sheets document', required=True) parser.add_argument('--header', action='store', dest='header', default=1, type=int, help='1-based index for the header row') + parser.add_argument('--private', action='store_true', help='Store content without public access permission') + for k, v in GWorksheet.COLUMN_NAMES.items(): parser.add_argument(f'--col-{k}', action='store', dest=k, default=v, help=f'the name of the column to fill with {k} (defaults={v})') diff --git a/storages/s3_storage.py b/storages/s3_storage.py index 5d8bf18..53bb151 100644 --- a/storages/s3_storage.py +++ b/storages/s3_storage.py @@ -11,6 +11,7 @@ class S3Config: key: str secret: str folder: str = "" + private: bool = False class S3Storage(Storage): @@ -45,5 +46,9 @@ class S3Storage(Storage): return False def uploadf(self, file, key, **kwargs): - extra_args = kwargs.get("extra_args", {'ACL': 'public-read'}) + if self.private: + extra_args = kwargs.get("extra_args", {}) + else: + extra_args = kwargs.get("extra_args", {'ACL': 'public-read'}) + self.s3.upload_fileobj(file, Bucket=self.bucket, Key=self._get_path(key), ExtraArgs=extra_args)