Revert "Upgrade to go 1.19 and update dependencies (#3069)" (#3085)

This reverts commit bba7c23957.
This commit is contained in:
WithoutPants
2022-11-07 12:33:15 +11:00
committed by GitHub
parent bba7c23957
commit 2609095c7a
939 changed files with 43785 additions and 101302 deletions

View File

@@ -6,7 +6,6 @@ install:
- go get -t ./...
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go install github.com/mattn/goveralls
matrix:
allow_failures:
- go: tip

View File

@@ -7,7 +7,7 @@ This is a Golang library to manipulate subtitles.
It allows you to manipulate `srt`, `stl`, `ttml`, `ssa/ass`, `webvtt` and `teletext` files for now.
Available operations are `parsing`, `writing`, `applying linear correction`, `syncing`, `fragmenting`, `unfragmenting`, `merging` and `optimizing`.
Available operations are `parsing`, `writing`, `syncing`, `fragmenting`, `unfragmenting`, `merging` and `optimizing`.
# Installation
@@ -43,9 +43,6 @@ s1.Optimize()
// Unfragment the subtitles
s1.Unfragment()
// Apply linear correction
s1.ApplyLinearCorrection(1*time.Second, 2*time.Second, 5*time.Second, 7*time.Second)
// Write subtitles
s1.Write("/path/to/example.srt")
var buf = &bytes.Buffer{}
@@ -60,10 +57,6 @@ If **astisub** has been installed properly you can:
astisub convert -i example.srt -o example.ttml
- apply linear correction to any type of subtitle:
astisub apply-linear-correction -i example.srt -a1 1s -d1 2s -a2 5s -d2 7s -o example.out.srt
- fragment any type of subtitle:
astisub fragment -i example.srt -f 2s -o example.out.srt
@@ -93,7 +86,6 @@ If **astisub** has been installed properly you can:
- [x] merging
- [x] ordering
- [x] optimizing
- [x] linear correction
- [x] .srt
- [x] .ttml
- [x] .vtt

View File

@@ -640,19 +640,6 @@ func (s *Subtitles) Unfragment() {
}
}
// ApplyLinearCorrection applies linear correction
func (s *Subtitles) ApplyLinearCorrection(actual1, desired1, actual2, desired2 time.Duration) {
// Get parameters
a := float64(desired2-desired1) / float64(actual2-actual1)
b := time.Duration(float64(desired1) - a*float64(actual1))
// Loop through items
for idx := range s.Items {
s.Items[idx].EndAt = time.Duration(a*float64(s.Items[idx].EndAt)) + b
s.Items[idx].StartAt = time.Duration(a*float64(s.Items[idx].StartAt)) + b
}
}
// Write writes subtitles to a file
func (s Subtitles) Write(dst string) (err error) {
// Create the file