Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: allan716 <525223688@qq.com>
- Loading branch information
1 parent
476935d
commit 2fb5543
Showing
10 changed files
with
237 additions
and
28 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
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
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
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,42 @@ | ||
package sub_timeline_fixer | ||
|
||
import ( | ||
"fmt" | ||
"github.com/allanpk716/ChineseSubFinder/internal/pkg" | ||
"github.com/allanpk716/ChineseSubFinder/internal/pkg/vad" | ||
"time" | ||
) | ||
|
||
type SubUnit struct { | ||
StartTime time.Time | ||
EndTime time.Time | ||
vadList []vad.VADInfo | ||
} | ||
|
||
func NewSubUnit() *SubUnit { | ||
return &SubUnit{ | ||
vadList: make([]vad.VADInfo, 0), | ||
} | ||
} | ||
|
||
func (s *SubUnit) Add(oneSubStartTime, oneSubEndTime time.Time) { | ||
|
||
if s.GetStartTimeNumber() == 0 { | ||
s.StartTime = oneSubStartTime | ||
} | ||
s.EndTime = oneSubEndTime | ||
// | ||
} | ||
|
||
func (s SubUnit) GetStartTimeNumber() float64 { | ||
return pkg.Time2Number(s.StartTime) | ||
} | ||
|
||
func (s SubUnit) GetEndTimeNumber() float64 { | ||
return pkg.Time2Number(s.EndTime) | ||
} | ||
|
||
func (s SubUnit) GetFFMPEGCutRange() (string, string) { | ||
return fmt.Sprintf("%d:%d:%d", s.StartTime.Hour(), s.StartTime.Minute(), s.StartTime.Second()), | ||
fmt.Sprintf("%f", s.GetEndTimeNumber()-s.GetStartTimeNumber()) | ||
} |
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
Oops, something went wrong.