Skip to content

Commit

Permalink
Merge pull request #34 from mediacatch/33-switch-to-s2t-api-v2
Browse files Browse the repository at this point in the history
Switch to s2t api v2
  • Loading branch information
FredHaa authored Dec 22, 2023
2 parents 485131f + 758d1fe commit 5b5a232
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 733 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mediacatch-s2t"
version = '1.1.0'
version = '2.0.0'
description = "Upload a media file and get the transcription link."
readme = "README.md"
authors = [{ name = "MediaCatch", email = "[email protected]" }]
Expand Down
33 changes: 13 additions & 20 deletions src/mediacatch_s2t/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,22 @@
"""

# Version of the mc-s2t-mediacatch_s2t
__version__ = '1.1.0'
__version__ = '2.0.0'

import os

URL: str = os.environ.get('MEDIACATCH_URL', 'https://s2t.mediacatch.io')
SINGLE_UPLOAD_ENDPOINT: str = os.environ.get(
'MEDIACATCH_PRESIGN_ENDPOINT',
'/presigned-post-url')
MULTIPART_UPLOAD_CREATE_ENDPOINT: str = os.environ.get(
'MEDIACATCH_MULTIPART_UPLOAD_CREATE_ENDPOINT',
'/multipart-upload/id')
MULTIPART_UPLOAD_URL_ENDPOINT: str = os.environ.get(
'MEDIACATCH_MULTIPART_UPLOAD_URL_ENDPOINT',
'/multipart-upload/url')
MULTIPART_UPLOAD_COMPLETE_ENDPOINT: str = os.environ.get(
'MEDIACATCH_MULTIPART_UPLOAD_COMPLETE_ENDPOINT',
'/multipart-upload/complete')
UPDATE_STATUS_ENDPOINT: str = os.environ.get(
'MEDIACATCH_UPDATE_STATUS_ENDPOINT',
'/upload-completed')
URL: str = os.environ.get('MEDIACATCH_URL', 'https://s2t.mediacatch.io/api/v2')
UPLOAD_CREATE_ENDPOINT: str = os.environ.get(
'MEDIACATCH_UPLOAD_CREATE_ENDPOINT',
'/upload/')
UPLOAD_URL_ENDPOINT: str = os.environ.get(
'MEDIACATCH_UPLOAD_URL_ENDPOINT',
'/upload/{file_id}/{part_number}')
UPLOAD_COMPLETE_ENDPOINT: str = os.environ.get(
'MEDIACATCH_UPLOAD_COMPLETE_ENDPOINT',
'/upload/{file_id}/complete')
TRANSCRIPT_ENDPOINT: str = os.environ.get(
'MEDIACATCH_TRANSCRIPT_ENDPOINT', '/result')
PROCESSING_TIME_RATIO: float = 0.1
MULTIPART_FILESIZE: int = 1 * 1024 * 1024 * 1024
'MEDIACATCH_TRANSCRIPT_ENDPOINT',
'/result/{file_id}')

ENABLE_AUTOMATIC_UPDATE: bool = True
4 changes: 2 additions & 2 deletions src/mediacatch_s2t/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def main() -> None:
)
parser.add_argument("api_key", type=str, help="MediaCatch API key.")
parser.add_argument("file", type=str, help="A media file.")
parser.add_argument("--language", type=str, default='da', help="The main language in the file.")
parser.add_argument("--quota", type=str, default=None, help="The quota to bill usage to. Defaults to None.")
args = parser.parse_args()

console = Console()
with console.status(
"[bold green]Uploading file to MediaCatch..."):
result = uploader.upload_and_get_transcription(args.file, args.api_key, args.language)
result = uploader.upload_and_get_transcription(args.file, args.api_key, args.quota)
if result['status'] == 'error':
sys.exit(
f"Error occurred:\n{result['message']}. "
Expand Down
Loading

0 comments on commit 5b5a232

Please sign in to comment.