From 1975704954fc6b3a1c1813f16db35da33a339180 Mon Sep 17 00:00:00 2001 From: LecygneNoir Date: Fri, 16 Mar 2018 10:58:49 +0100 Subject: [PATCH] Displaying video URL after upload --- lib/pt_upload.py | 7 ++++++- lib/yt_upload.py | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/pt_upload.py b/lib/pt_upload.py index 669be5d..898e083 100644 --- a/lib/pt_upload.py +++ b/lib/pt_upload.py @@ -110,7 +110,12 @@ def upload_video(oauth, secret, options): headers=headers) if response is not None: if response.status_code == 200: - print('Peertube : Video was successfully uploaded.') + uuid = response.json() + uuid = uuid['video'] + uuid = uuid['uuid'] + template = ('Peertube : Video was successfully uploaded.\n' + 'Watch it at %s/videos/watch/%s.') + print(template % (url, uuid)) else: exit(('Peertube : The upload failed with an unexpected response: ' '%s') % response) diff --git a/lib/yt_upload.py b/lib/yt_upload.py index 23234a7..a456f6c 100644 --- a/lib/yt_upload.py +++ b/lib/yt_upload.py @@ -125,8 +125,9 @@ def resumable_upload(request): status, response = request.next_chunk() if response is not None: if 'id' in response: - template = ('Youtube : Video id "%s" was successfully ' - 'uploaded.') + template = ('Youtube : Video was successfully ' + 'uploaded.\n' + 'Watch it at https://youtu.be/%s (post-encoding could get some time)') print(template % response['id']) else: template = ('Youtube : The upload failed with an '