mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
This reverts commit bba7c23957.
This commit is contained in:
1
vendor/github.com/asticode/go-astisub/.travis.yml
generated
vendored
1
vendor/github.com/asticode/go-astisub/.travis.yml
generated
vendored
@@ -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
|
||||
|
||||
10
vendor/github.com/asticode/go-astisub/README.md
generated
vendored
10
vendor/github.com/asticode/go-astisub/README.md
generated
vendored
@@ -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
|
||||
|
||||
13
vendor/github.com/asticode/go-astisub/subtitles.go
generated
vendored
13
vendor/github.com/asticode/go-astisub/subtitles.go
generated
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user