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"
|
"os/signal"
|
||||||
"path"
|
"path"
|
||||||
"slices"
|
"slices"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@@ -247,12 +248,24 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
unique := errors.New("entry already mirrored")
|
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 err = channel.Edit(ident, func(v *streamdata.VOD) (err error) {
|
||||||
if v.Mirror != "" {
|
if v.Mirror != "" {
|
||||||
return unique
|
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(
|
pathname := path.Join(
|
||||||
flagBase,
|
flagBase,
|
||||||
"upload"+streamdata.ChannelVODSuffix,
|
"upload"+streamdata.ChannelVODSuffix,
|
||||||
@@ -275,6 +288,22 @@ func main() {
|
|||||||
isattyStd()
|
isattyStd()
|
||||||
br := bufio.NewReader(os.Stdin)
|
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:
|
retry:
|
||||||
fmt.Println(ident)
|
fmt.Println(ident)
|
||||||
printVOD(v)
|
printVOD(v)
|
||||||
|
|||||||
Reference in New Issue
Block a user