creates tmp folder if not exists

This commit is contained in:
msramalho
2022-02-23 16:32:38 +01:00
parent 1d62009c4f
commit 3cafc444fc
5 changed files with 11 additions and 5 deletions

View File

@@ -1 +0,0 @@
from storages import *

View File

@@ -6,6 +6,7 @@ from abc import ABC, abstractmethod
from urllib.parse import urlparse
from storages import Storage
from utils import mkdir_if_not_exists
@dataclass
@@ -48,8 +49,7 @@ class Archiver(ABC):
thumbnails_folder = filename.split('.')[0] + '/'
key_folder = key.split('.')[0] + '/'
if not os.path.exists(thumbnails_folder):
os.mkdir(thumbnails_folder)
mkdir_if_not_exists(thumbnails_folder)
fps = 0.5
if duration is not None:

View File

@@ -8,7 +8,7 @@ from dotenv import load_dotenv
import archivers
from storages import S3Storage, S3Config
from utils import GWorksheet
from utils import GWorksheet, mkdir_if_not_exists
load_dotenv()
@@ -124,6 +124,7 @@ def main():
logger.info(f'Opening document {args.sheet}')
mkdir_if_not_exists('tmp')
process_sheet(args.sheet)

View File

@@ -1,2 +1,3 @@
# we need to explicitly expose the available imports here
from .gworksheet import GWorksheet
from .gworksheet import GWorksheet
from .misc import *

5
utils/misc.py Normal file
View File

@@ -0,0 +1,5 @@
import os
def mkdir_if_not_exists(folder):
if not os.path.exists(folder):
os.mkdir(folder)