AWS S3 Utilities
audio_splitter.s3_utils
create_presigned_url(bucket_name, object_name, expiration=3600)
Generate a presigned URL to share an S3 object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket_name |
str
|
Bucket name |
required |
object_name |
str
|
Name of object/file |
required |
expiration |
int
|
Time in seconds for the presigned URL to remain valid. Defaults to 3600. |
3600
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Presigned URL as string. If error, returns |
Source code in src/audio_splitter/s3_utils.py
get_audio_file(bucket, key, audio_extension)
Get corresponding audio file of JSON annotation (key
) from AWS S3, in bucket
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
Audio and JSON bucket name in S3. |
required |
key |
str
|
JSON file key name in S3. |
required |
audio_extension |
str
|
Audio extension. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Pre-signed URL pointing to the audio file of the JSON annotation. |
Source code in src/audio_splitter/s3_utils.py
move_file(bucket, file, source, destination)
Move file
in bucket
from source
to destination
folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
S3 bucket name. |
required |
file |
str
|
Name of file to be moved (without full-path). |
required |
source |
str
|
Source folder in S3 bucket. |
required |
destination |
str
|
Destination folder in S3 bucket. |
required |