add flag to remove unpublished videos

refactor code
add workaround for SDK bug
add code to remove unpublished videos
fix alt downloader to only produce mp4
add missing height and width
add tags sorting
add a few channel wide tags
This commit is contained in:
Niko Storni 2019-06-04 22:21:40 +02:00
parent 3389a8be93
commit cfe8ff0879
No known key found for this signature in database
GPG key ID: F37FE63398800368
9 changed files with 109 additions and 36 deletions

View file

@ -11,6 +11,7 @@ import (
"strings"
"time"
"github.com/lbryio/lbry.go/extras/api"
"github.com/lbryio/lbry.go/extras/errors"
"github.com/lbryio/lbry.go/extras/null"
@ -167,6 +168,34 @@ const (
VideoStatusFailed = "failed"
)
func (a *APIConfig) DeleteVideos(videos []string) error {
endpoint := a.ApiURL + "/yt/video_status"
videoIDs := strings.Join(videos, ",")
vals := url.Values{
"video_id": {videoIDs},
"auth_token": {a.ApiToken},
}
res, _ := http.PostForm(endpoint, vals)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
response := api.Response{}
err := json.Unmarshal(body, response)
if err != nil {
return errors.Err(err)
}
if response.Error != nil {
return errors.Err(response.Error)
}
str, ok := response.Data.(string)
if !ok {
return errors.Err("%x", response.Data)
}
if str != "ok" {
return errors.Err(str)
}
return nil
}
func (a *APIConfig) MarkVideoStatus(channelID string, videoID string, status string, claimID string, claimName string, failureReason string, size *int64, metadataVersion uint) error {
endpoint := a.ApiURL + "/yt/video_status"