Skip to content

Youtube: Export video status checking#626

Merged
ao-david merged 1 commit intomainfrom
youtube-for-ausoceantv
Sep 24, 2025
Merged

Youtube: Export video status checking#626
ao-david merged 1 commit intomainfrom
youtube-for-ausoceantv

Conversation

@ao-david
Copy link
Member

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.

// - UploadStatusRejected
// - UploadStatusDeleted
func CheckUploadStatus(ctx context.Context, videoID string) (string, error) {
// Force using the default account (AusOcean's account).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the AusOcean main channel right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently yes. It would probably good to have a dedicated channel for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind that the upload function above this is where the upload being forced to use the ausocean channel

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to deal with this in another PR

}

// Upload Status constants.
const UploadStatusUploaded = "uploaded"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put into const block i.e.

const (
...
)

"google.golang.org/api/youtube/v3"
)

var ErrUnknownStatus = errors.New("unknown video status")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

@Saxon1 Saxon1 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error type can expose a method that returns the underlying status though if the caller needs it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these "bad" statuses have us return an error ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@Saxon1 Saxon1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@ao-david ao-david force-pushed the youtube-for-ausoceantv branch from 7cfa186 to f3e8505 Compare September 24, 2025 03:49
@ao-david ao-david merged commit b966926 into main Sep 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants