cmd/streamdata: peek at subsequent assets for parts

Some streams disconnect half-way. This collects all parts.

Signed-off-by: Yonah <contrib@gensokyo.uk>
This commit is contained in:
2026-03-21 00:26:50 +09:00
parent 74e06ec1ef
commit 71ff3de617

View File

@@ -13,6 +13,7 @@ import (
"os/signal"
"path"
"slices"
"strconv"
"strings"
"syscall"
"time"
@@ -247,12 +248,24 @@ func main() {
})
unique := errors.New("entry already mirrored")
for _, ident := range idents {
for i, ident := range idents {
if err = channel.Edit(ident, func(v *streamdata.VOD) (err error) {
if v.Mirror != "" {
return unique
}
var parts []*streamdata.VOD
for _, next := range idents[i+1:] {
var part *streamdata.VOD
if part, err = channel.Load(next); err != nil {
return
}
if part.Title != v.Title {
break
}
parts = append(parts, part)
}
pathname := path.Join(
flagBase,
"upload"+streamdata.ChannelVODSuffix,
@@ -275,6 +288,22 @@ func main() {
isattyStd()
br := bufio.NewReader(os.Stdin)
if len(parts) > 0 {
fmt.Println("assets with identical title:")
for j := range parts {
fmt.Println(idents[i+1+j])
}
if !require(promptBool(br, "Proceed? ", true)) {
for j, part := range parts {
fmt.Println(idents[i+1+j])
printVOD(part)
}
return errors.New(
strconv.Itoa(len(parts)) + " trailing parts",
)
}
}
retry:
fmt.Println(ident)
printVOD(v)