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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user