更新日志#
此项目的所有重要更改都将记录在此文件中。
格式基于 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),本项目遵循[语义化版本控制](https://semver.org/spec/v2.0.0.html)。
[Unreleased]#
[1.0.0] - 2026-05-12#
Summary#
First stable release. The library graduates from beta with the breaking changes accumulated during the 1.0.0b* series finalized. Downstream code that worked against 1.0.0b4 should require no further changes.
首个正式版本。库从测试版毕业,1.0.0b* 系列累积的破坏性变更在此版本定稿。已适配 1.0.0b4 的下游代码无需进一步修改。
Fixed#
Initialization failures in
DfttTimecodeno longer leave behind a half-built object that silently behaves like a "value-0 timecode at 24 fps". The five class-level state defaults (__fps,__nominal_fps,__drop_frame,__strict,__precise_time) that masked missing instance attributes have been removed; any access to state on a partial instance now raisesAttributeErrorDfttTimecode初始化失败时不再遗留一个表现为「24fps 下零值时码」的半构造对象。原本掩盖未赋值实例属性的五个类级别默认值(__fps、__nominal_fps、__drop_frame、__strict、__precise_time)已被移除;对半构造实例的状态访问现在会抛出AttributeError
Removed#
Breaking: Remove
configure_logging()andget_logger()from the public API (dftt_timecode.configure_logging,dftt_timecode.get_logger)破坏性变更: 从公开 API 中移除
configure_logging()和get_logger()Breaking: Remove the
dftt_timecode.logging_configmodule. Logging is now configured directly inside core modules using a standardNullHandler, following the recommended library logging convention. Downstream code should configure logging via the standardloggingmodule破坏性变更: 移除
dftt_timecode.logging_config模块。日志现在在核心模块内部直接配置,并按照库日志最佳实践添加NullHandler。下游代码应使用标准logging模块自行配置日志Breaking: Remove the
DfttTimecode(existing_tc)passthrough constructor introduced in 0.0.10. Passing an existingDfttTimecodeto the constructor now raisesDFTTTimecodeTypeErrorlike any other unsupported input type. The previous behavior returned the same instance unchanged (DfttTimecode(tc) is tc), which created an aliasing footgun when the result was subsequently passed to mutators likeset_fps(). Callers that want to reuse an instance should pass it directly; callers that want an independent copy should construct from a primitive representation such asprecise_timestamp,framecount, or a string form破坏性变更: 移除 0.0.10 引入的
DfttTimecode(existing_tc)透传构造行为。现在向构造器传入已有的DfttTimecode会和其它不支持的输入类型一样抛出DFTTTimecodeTypeError。原行为返回的是同一个实例(DfttTimecode(tc) is tc),后续若调用set_fps()等就地修改方法会出现别名陷阱。需要复用实例的调用方请直接使用原对象;需要独立副本的调用方请改用precise_timestamp、framecount或字符串等基本表示重新构造Breaking (latent): Remove five class-level state attributes on
DfttTimecode(__fps,__nominal_fps,__drop_frame,__strict,__precise_time). These were never part of the documented API but were observable viavars(DfttTimecode)/ class-attribute inspection. See the corresponding Fixed entry above for the user-visible behavior change破坏性变更(隐性): 移除
DfttTimecode上的五个类级别状态属性(__fps、__nominal_fps、__drop_frame、__strict、__precise_time)。它们从未作为文档化 API 公开,但可通过vars(DfttTimecode)等方式观测到。用户可见的行为变化见上方 Fixed 条目
Changed#
Breaking:
DfttTimecode.timecode_output()no longer silently falls back to SMPTE when a conversion method raises an unexpected exception. Only the defensiveAttributeErrorguard remains; other errors now propagate to the caller破坏性变更:
DfttTimecode.timecode_output()在转换方法抛出意外异常时,不再静默回退到 SMPTE 格式。仅保留对AttributeError的防御性回退,其它异常会正常抛给调用方Breaking: Narrow the exception wrapping in
DfttTimeRange.offset(),DfttTimeRange.extend(), andDfttTimeRange.__contains__(). Previously a broadexcept Exceptionre-raised everything asDFTTTimeRangeMethodError/DFTTTimeRangeTypeError; now onlyDFTTErrorraised during internalDfttTimecodeconstruction is wrapped, and other exception types propagate unchanged破坏性变更: 收窄
DfttTimeRange.offset()、DfttTimeRange.extend()和DfttTimeRange.__contains__()中的异常包装范围。之前用宽泛的except Exception将所有异常重新包装;现在只包装内部构造DfttTimecode时抛出的DFTTError,其它类型异常按原类型透传All
DFTTErrorsubclasses raised acrossDfttTimecodeandDfttTimeRangenow carry descriptive messages (raise DFTTTimecodeOperatorError("...")). Previously many sites raised the bare exception class with no message and emitted a separatelogger.error(...)line, sostr(exc)/exc.argswere empty所有在
DfttTimecode和DfttTimeRange中抛出的DFTTError子类现在都附带描述性消息。之前多处只raise异常类本身(无消息)并额外打一条logger.error(...)日志,导致str(exc)/exc.args为空Stop logging an
ERRORrecord immediately before raising aDFTTError. The exception itself is now the single source of truth; callers using log capture for error visibility will see fewer records在抛出
DFTTError前不再额外记录一条ERROR日志。异常本身作为唯一的错误信息来源;依赖日志捕获错误信息的调用方将看到更少的日志记录Breaking: The base
DfttTimecode.__init__overload now raisesDFTTTimecodeTypeErrorfor unsupported input types (previously raised bareTypeError). Callers usingtry / except DFTTError:will now catch this case alongside other library errors破坏性变更:
DfttTimecode.__init__的 dispatch 兜底分支在收到不支持的输入类型时改为抛出DFTTTimecodeTypeError(原为裸TypeError)。使用try / except DFTTError:的调用方现在会一并捕获到该情况
[1.0.0b3]#
Fixed#
Fix Python 3.14 compatibility issue in
move_frame()method whereFraction()constructor with two arguments failed due to stricter type requirements修复 Python 3.14 兼容性问题,
move_frame()方法中Fraction()构造函数因更严格的类型要求而失败Fix precision loss issues in timecode initialization methods (
__init_smpte(),__init_frame()) by usingFraction()division instead of float division修复时码初始化方法中的精度损失问题,使用
Fraction()除法替代浮点数除法Fix FCPX format output to correctly handle integer timestamps, avoiding large numerator values when the result is a whole number
修复 FCPX 格式输出,正确处理整数时间戳,避免结果为整数时出现大分子值
Added#
Add
move_frame()andmove_time()methods to DfttTimecode class for moving timecode by specified frames or time duration为 DfttTimecode 类添加
move_frame()和move_time()方法,用于按指定帧数或时间段移动时码Add comprehensive unit tests (32 tests) for
move_frame()andmove_time()methods为
move_frame()和move_time()方法添加全面的单元测试(32 个测试)Frame movement tests: forward/backward movement, zero movement, large movements (86400 frames)
帧移动测试:正向/反向移动、零移动、大规模移动(86400 帧)
Time movement tests: float/int/Fraction input support, various time movements
时间移动测试:浮点数/整数/分数输入支持、各种时间移动
Strict mode tests: 24-hour cycling behavior verification
严格模式测试:24 小时循环行为验证
Different frame rates: 24, 30, 60, 119.88 fps
不同帧率:24、30、60、119.88 fps
Drop-frame timecode support tests
丢帧时码支持测试
Method chaining and input validation tests
方法链和输入验证测试
Equivalence test between
move_frame()andmove_time()move_frame()和move_time()的等价性测试
Changed#
Improved internal timestamp precision across the entire codebase by consistently using
Fraction()arithmetic通过始终使用
Fraction()算术运算,提高整个代码库的内部时间戳精度
[1.0.0b2]#
Fixed#
Fix bug for fcpx output format 修复 fcpx 输出格式的错误
[1.0.0b1]#
Summary#
First beta release! The library has reached feature completeness and API stability for its core functionality. All major features are implemented, tested, and documented. This beta release is ready for production testing and feedback.
Added#
Comprehensive internationalization (i18n) support with Chinese translations
完整的国际化支持,包含中文翻译
Language switcher in documentation
文档语言切换器
Enhanced documentation with auto-generated changelog integration
增强文档,自动集成 CHANGELOG.md
Changed#
API is now considered stable for 1.0.0 release
API 现在被视为稳定版本,准备发布 1.0.0
Updated development status from Pre-Alpha to Beta
开发状态从预览版更新为测试版
Core Features (Stable)#
Multiple timecode format support: SMPTE (DF/NDF), SRT, FFMPEG, FCPX, DLP, frame count, timestamps
多种时码格式支持
High frame rate support (0.01-999.99 fps)
高帧率支持
High-precision calculations using Fraction for lossless accuracy
使用 Fraction 进行高精度计算
Full arithmetic operators (+, -, *, /) and comparison operators (==, !=, <, >, <=, >=)
完整的算术和比较运算符
DfttTimeRange class for time interval operations
时间范围操作类
Comprehensive test coverage with pytest
完整的测试覆盖
Sphinx-based documentation with API reference
基于 Sphinx 的文档和 API 参考
Automated CI/CD for documentation and PyPI publishing
自动化 CI/CD 用于文档和 PyPI 发布
[0.0.15a2] - Pre-Alpha#
Fixed#
Fix several error string missing user input logging during format
修复遗漏的错误信息格式化 #26
[0.0.15a1] - Pre-Alpha#
Added#
Add
DfttTimecodeInitializationErrorexception class增加
DfttTimecodeInitializationErrorAdd GitHub Action to automatically upload releases to PyPI
使用 GitHub Action 自动打包上传 PyPI
Changed#
Modify drop frame logic to adapt to more frame rates
修改丢帧逻辑适应更多帧率
Refactor timecode type detection logic
重构时码类型检测逻辑
Refactor error handling during timecode initialization
重构时码对象初始化时的错误处理
Modify error messages to enhance readability
修改报错信息,增强可读性
Deprecated#
Completely remove
InstanceMethodDispatch完全移除
InstanceMethodDispatch
Fixed#
Fix millisecond overflow issue when converting certain timecodes from SMPTE to SRT #19
修复特定时码在SMPTE转SRT时毫秒会溢出的问题
[0.0.14]#
Fixed#
Fix v0.0.13 import failure caused by missing dftt_timecode.core while packing
修复v0.0.13打包后不包含core,导致库无法使用的问题
[0.0.13]#
Added#
Add
get_audio_sample_countmethod for correctly outputting the count of audio samples at TC timestamps #9添加
get_audio_sample_count方法用于正确输出TC时间戳下的音频采样数
Changed#
Use f-string for string format output
使用
f-string处理字符串格式输出Refactor timecode output function to reduce code duplication
重构时间码输出函数,减少代码重复
Deprecated#
Use
functools.singledispatchmethodinstead ofdispatch.InstanceMethodDispatch使用
functools.singledispatchmethod代替dispatch.InstanceMethodDispatch
[0.0.12]#
Fixed#
Fix DLP pattern error causing DLP ticks in range [50-99] and [150-199] to not be matched. This bug caused errors when using strings like
'00:00:27:183'to initialize a DLP timecode object修复DLP正则表达式错误导致范围在50-99、150-199的DLP tick不能被匹配的问题
[0.0.11]#
Added#
Add
__str__method to return timecode value for DfttTimecode object添加
__str__方法,返回DfttTimecode对象的时间码值Add unit tests for DfttTimecode using pytest
添加DfttTimecode单元测试(使用pytest)
Changed#
Add 23.98/23.976 FPS to drop frame detection conditions
对丢帧的检测条件添加有关23.98/23.976的判定
+and-operators perform an OR operation on the strict property of two DfttTimecode objects being added/subtracted+-运算符对相加的两个DfttTimecode对象的strict属性进行或运算Comparison operators (
==,>,>=, etc.) now validate that both DfttTimecode objects have the same frame rate before comparison, throwing an exception if frame rates differ比较运算符在对两个DfttTimecode对象进行比较时会先判定帧率,若帧率不同则抛出异常
print(self)now outputs a formatted timecode stringprint(self)将会输出基于类型的时间码字符串
Fixed#
Fix issue in
timecode_output(self, dest_type, output_part)whereoutput_part = 3would incorrectly return minute data修复
timecode_output中output_part = 3时错误返回分钟数据的问题
[0.0.10]#
Added#
Add support for using a DfttTimecode object to initialize a new DfttTimecode object
使用DfttTimecode对象初始化新DfttTimecode对象
Add
float()andint()class methods for DfttTimecode class添加DfttTimecode类的float和int方法
Add
precise_timestampattribute for DfttTimecode class添加DfttTimecode类的precise_timestamp属性
Changed#
DfttTimecode operators now raise errors when encountering undefined circumstances or illegal operations
DfttTimecode运算符在未定义/非法操作时将会报错
Update comparison rules for DfttTimecode operators
修改DfttTimecode运算符的大小比较规则
When creating a timecode object using SMPTE NDF format string, if
drop_frameis forced toTrue, the resulting object will be SMPTE DF format timecode使用SMPTE NDF格式字符串新建时码类对象时,若强制drop_frame为True,则新建得到的对象为SMPTE DF格式时码
[0.0.9]#
Initial public release.