-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
22 lines (18 loc) · 849 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import logging
import os
import boto3
from services.subtitle_processing import subtitle_processing
logging.basicConfig(level=logging.INFO)
def create_translated_json(video_path):
s3_client = boto3.client("s3", region_name="ap-northeast-1")
bucket_name = os.environ.get("SUBTITLES_BUCKET_NAME")
try:
s3_client.create_bucket(Bucket=bucket_name,
CreateBucketConfiguration={'LocationConstraint': 'ap-northeast-1'})
logging.info(f"Bucket created successfully with name::{bucket_name}")
except Exception as e:
logging.warning(f"Bucket already exists with name::{bucket_name}")
logging.error(f"Printing Exception::{e}")
subtitle_processing_obj = subtitle_processing()
subtitle_processing_obj.process_video(video_path, bucket_name)
return "Finished Processing"