goodtune / vitriolic

This project unifies the various sub-projects Touch Technology has created over the years that were intended to be reusable in isolation, but in practice never stood alone for long.
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Manage the video thumbnail for matches on YouTube #58

Open goodtune opened 1 year ago

goodtune commented 1 year ago

Example for https://youtu.be/MpSsc171CBQ

from tournamentcontrol.competition.models import Season
from googleapiclient.http import MediaFileUpload

# https://www.internationaltouch.org/events/atlantic-youth-touch-cup/2023/videos/
season = Season.objects.get(pk=48)
request = season.youtube.thumbnails().set(
    videoId="MpSsc171CBQ",
    # https://www.internationaltouch.org/media/events/AYTC/2023/AYTC%20Live%20Stream%20Card.jpg
    media_body=MediaFileUpload("AYTC Live Stream Card.jpg"),
)
request.execute()

I'd like to store the image in the database and implement an alternative class similar in behaviour to MediaFileUpload that knows where to source the data from.

When I set the image on the season, it should propagate to all matches already on YouTube.

When I set the image on the match, it should not be overwritten by the season image.

goodtune commented 1 year ago

Refer to the implementation of MediaFileUpload here - https://github.com/googleapis/google-api-python-client/blob/main/googleapiclient/http.py