Usage example
As videos are large, often the videos are hosted on a remote machine that is different to the one you will manipulate metadata, and commit to git on.
So, these examples will have commands being executed on 2 machines, the “uploader machine” (e.g. apu for DebConf) and “your machine”. But you can, of course, do this all on a single machine.
The once-off setup below applies to the uploader machine.
Once-off setup
YouTube authentication: credential creation
You can skip this if someone gives you a client_secrets.json
.
Create a Google APIs project. https://console.developers.google.com/apis/
Enable the YouTube Data v3 API in the “Library”.
Create a “Desktop” OAuth 2.0 client ID in the “Credentials”.
Download the Client ID JSON, and save it as
client_secrets.json
.
Virtualenv creation
This uploader requires a few Python libraries (see
requirements.txt
).
You can either install them from Debian, or create a virtualenv to
contain them.
Create a new Python virtualenv:
python3 -m venv ve ve/bin/python -m ensurepip -U ve/bin/python -m pip install wheel
Install the required packages in the virtualenv:
ve/bin/python -m pip install -r requirements.txt
Activate the virtualenv before using these tools, every time:
. ve/bin/activate
Import videos from a conference
Upload the videos to the meetings-archive.
Describe them in archive-meta.
Run
merge-meta
:tools/merge-meta.py ../archive-meta/metadata/
A new metadata file should be created with your new playlist. Check the contents, edit archive-meta if necessary, and repeat until satisfied with the data.
Check and update the
defaults
, applied to every upload.Optional: Create a playlist in YouTube, and record this in the
defaults
.Copy this YouTube metadata file to the uploader machine with the meetings-archive available locally.
Run the upload script, on the uploader machine, in the base directory for the conference videos, recording uploaded video IDs to a log.
The first time you do this, you’ll have to authorize it.
cd /srv/video/video.debian.net/2019/example/ ~/youtube/tools/upload_youtube.py --wait \ ~/youtube/metadata/2019/example.yml ~/upload.log
Copy
upload.log
back to your machine.Merge the video IDs from it into the metadata file:
tools/merge-uploads.py metadata/2019/example.yml upload.log
The
--wait
will cause the uploader to wait and retry, until the entire playlist is uploaded, even if YouTube rate-limits are reached.If you aren’t using
--wait
, or have another failure, and need to continue a partial upload:Ensure the uploaded video IDs have been merged into the metadata (from the above steps).
Update the metadata on the uploader machine.
Run the upload script again. It will upload videos without
video_id
attributes.