Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.0.11 #7

Merged
merged 10 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
dftt_timecode/__pycache__
test.py
.vscode
__pycache__
.venv
.DS_Store
.env
dftt_timecode.egg-info
.pytest_cache
.DS_Store
31 changes: 31 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,35 @@ First Public Release.

- 使用SMPTE NDF格式字符串新建时码类对象时,若强制drop_frame为True,则新建得到的对象为SMPTE DF格式时码

## V0.0.11
添加 Add:
- `__str__`方法,返回DfttTimecode对象的时间码值

`__str__`method,return timecode value for DfttTimecode object

- DfttTimecode单元测试(使用pytest)

Unit test for DfttTimecode (Using pytest)

修改 Modify:
- 对丢帧的检测条件添加有关23.98/23.976的判定

Add 23.97/23.976FPS to drop frame conditions

- `+` `-`运算符对相加的两个DfttTimecode对象的strict属性进行或运算

`+` `-`operators performs an or operation on the strict property of two DfttTimecode objects that are added together

- 比较运算符,比如`==` `>` `>=`等,在对两个DfttTimecode对象进行比较的时候会先对两个对象的帧率进行判定,若帧率不同抛出异常

Comparison operators, such as `==`, `>`, `>=`, in the comparison of two DfttTimecode objects will first compare the frame rate of the two objects, if the frame rate is different throw an exception

- `print(self)` 将会输出基于类型的时间码字符串

`print(self)` will output a timecode string

修复 BugFix:
- `timecode_output(self, dest_type, output_part)` 中`output_part = 3`时错误返回分钟数据的问题

Addressed a problem when `output_part = 3` in `timecode_output(self, dest_type, output_part)` would return minute value in timecode value

20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,6 @@ assert a.timecode_output('smpte') == '01:00:00:100'

#### 4.2.9 `self.set_type()`

```python
a = DfttTimecode('01:00:00,123', 'auto', fps=24)
a.set_type('smpte', rounding=True)
assert a.type == 'smpte'
a.set_type('srt')
assert a.timecode_output('srt') == '01:00:00,125'
```

该函数会更改DfttTimecode对象的时码类型,并可以选择在更改类型时是否取整。

This function will change the timecode type of a DfttTimecode object, you can choose whether or not to round the timecode value while changing the timecode type.
Expand Down Expand Up @@ -451,13 +443,13 @@ This function will return the timecode value of a DfttTimecode object in the giv

#### 4.3.1 `print(self)`

该运算符会打印DfttTimecode对象相关的基本信息,如下所示。
该运算符会打印DfttTimecode对象相关的时间码值,如下所示。

This operator will print basic information of a DfttTimecode object, as the following codes show.
This operator will print timecode value of a DfttTimecode object, as the following codes show.

```python
a = DfttTimecode('01:00:00,123', 'srt', fps=24, drop_frame=False, strict=True)
print(a) # <DfttTimecode>(Timecode:01:00:00,123, Type:srt, FPS:24.00 NDF, Strict)
print(a) # 01:00:00,123
```

#### 4.3.2 `-self`
Expand All @@ -468,7 +460,7 @@ This operator will yield the negation of the timecode value of a DfttTimecode ob

```python
a = DfttTimecode('01:00:00,123', 'srt', fps=24, drop_frame=False, strict=True)
print(-a) # <DfttTimecode>(Timecode:22:59:59,877, Type:srt, FPS:24.00 NDF, Strict)
print(-a) # 22:59:59,877
```

#### 4.3.3 `+`
Expand Down Expand Up @@ -499,7 +491,7 @@ When performing a subtraction between a DfttTimecode object and an `int`, the `i

The two DfttTimecode objects to perform the subtraction must have the same frame rate.

#### 4.3.5 `\*`
#### 4.3.5 `*`

该运算符可以将一个DfttTimecode对象与一个`int`,`float`或`Fraction`相乘,后者的数学意义是倍数。

Expand All @@ -525,7 +517,7 @@ This operator can perform a comparison between two DfttTimecode objects, or perf

When performing a comparison between two DfttTimecode objects, a comparison of their timestamp will be performed. When performing a comparison between a DfttTimecode object and an `int`, the `int` will be considered as a frame number. When performing a comparison between a DfttTimecode object and a `float` or a `Fraction`, the latter will be considered as a time stamp.

#### 4.3.8 `\!=`
#### 4.3.8 `!=`

该运算符可以比较两个DfttTimecode对象是否相等,或比较DfttTimecode对象和`int`,`float`或`Fraction`是否相等。

Expand Down
297 changes: 196 additions & 101 deletions dftt_timecode/core.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
addopts = -v -s
testpaths = test
Empty file added test/__init__.py
Empty file.
Loading