-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from sul-dlss/check-media
Check media and log attributes
- Loading branch information
Showing
4 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
__pycache__/ | ||
whisper_models | ||
*.log | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
boto3 | ||
ffprobe3 | ||
openai-whisper | ||
python-dotenv | ||
pytest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from speech_to_text import inspect_media, SpeechToTextException | ||
|
||
import pytest | ||
|
||
|
||
def test_duration(): | ||
result = inspect_media("tests/data/en.wav") | ||
assert result["duration"] == 3.220000 | ||
|
||
|
||
def test_format(): | ||
result = inspect_media("tests/data/en.wav") | ||
assert result["format"] == "wav" | ||
|
||
|
||
def test_size(): | ||
result = inspect_media("tests/data/en.wav") | ||
assert result["size"] == 618318 | ||
|
||
|
||
def test_invalid_media(): | ||
with pytest.raises(SpeechToTextException): | ||
inspect_media("README.md") |