Skip to content

Commit

Permalink
✨ feat: Add support for converting SRT to BCC
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoskys committed Jan 18, 2024
1 parent d20f10c commit 095b972
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ pip install -U subtitle_utils
## Usage

```python
import subtitle_utils

method = subtitle_utils.SeeAvailableMethods()
print(method)


def get_convert(pre: str = "ass", aft: str = "srt", input_str: str = None) -> str:
_result_group = subtitle_utils.FormatConverter(pre=pre, aft=aft, strs=input_str)
_result_group: subtitle_utils.Returner
if not _result_group.status:
print(_result_group.dict())
return ""
result: str
result = _result_group.data
print(f"{_result_group.pre}->{print(_result_group.aft)}")
print(_result_group.msg)
return result
from subtitle_utils import get_method, show_available, srt2bcc

print("Available methods:")
print(show_available())

with open("test.srt", 'r') as file_io:
test_result = get_method(method="srt2bcc")(content=file_io)
print(test_result)

_result = srt2bcc(content="1\n00:00:00,000 --> 00:00:01,000\nHello World")
print(_result)
```
9 changes: 9 additions & 0 deletions feature_test/direct.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# @Time : 2024/1/19 上午12:01
# @Author : sudoskys
# @File : direct.py
# @Software: PyCharm
from subtitle_utils import srt2bcc

_result = srt2bcc(content="1\n00:00:00,000 --> 00:00:01,000\nHello World")
print(_result)

0 comments on commit 095b972

Please sign in to comment.