Conversation
| // - UploadStatusRejected | ||
| // - UploadStatusDeleted | ||
| func CheckUploadStatus(ctx context.Context, videoID string) (string, error) { | ||
| // Force using the default account (AusOcean's account). |
There was a problem hiding this comment.
We're not using the AusOcean main channel right?
There was a problem hiding this comment.
Currently yes. It would probably good to have a dedicated channel for this.
There was a problem hiding this comment.
Keep in mind that the upload function above this is where the upload being forced to use the ausocean channel
There was a problem hiding this comment.
I'm going to deal with this in another PR
youtube/upload.go
Outdated
| } | ||
|
|
||
| // Upload Status constants. | ||
| const UploadStatusUploaded = "uploaded" |
There was a problem hiding this comment.
put into const block i.e.
const (
...
)
| "google.golang.org/api/youtube/v3" | ||
| ) | ||
|
|
||
| var ErrUnknownStatus = errors.New("unknown video status") |
There was a problem hiding this comment.
If we're not doing anything particularly special in response to any one of the "bad" upload statuses, then maybe we just need a type that implements the error interface and just wrap the upload status ?
There was a problem hiding this comment.
I think that the decision of what to do with the status is up to the caller, and the little bit of extra detail doesn't hurt
There was a problem hiding this comment.
The error type can expose a method that returns the underlying status though if the caller needs it.
There was a problem hiding this comment.
Is it just the Failed and Rejected statuses that you would consider "bad" statuses? I would assume that the Deleted status is probably only used if the user has called for a deletion, and the caller would probably want to check for that?
| case "processed": | ||
| return UploadStatusProcessed, nil | ||
| case "failed": | ||
| return UploadStatusFailed, nil |
There was a problem hiding this comment.
Should these "bad" statuses have us return an error ?
There was a problem hiding this comment.
I don't think so, as the caller will be dealing with the status. The function is designed to return the status, and is doing so without encountering an error. We could consider wrapping this function with something like
func HasUploadFailed(videoID string) bool
But I think that returning an error here would not match the name of the current function.
Saxon1
left a comment
There was a problem hiding this comment.
Seems OK but maybe we should think about what we do in the case of the weird statuses.
This change returns the video object when uploading a video. This video contains an ID which can then be used to check the status of the upload
7cfa186 to
f3e8505
Compare
This change returns the video object when uploading a video. This video contains an ID which can then be used to check the status of the upload.