From 26476347d389040d597df3ded5e947dcf818f95e Mon Sep 17 00:00:00 2001 From: LecygneNoir Date: Wed, 11 Nov 2020 10:40:05 +0100 Subject: [PATCH] =?UTF-8?q?Renable=20Peertube=20upload=20after=20tests=20?= =?UTF-8?q?=F0=9F=98=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prismedia/pt_upload.py | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/prismedia/pt_upload.py b/prismedia/pt_upload.py index 3bae1b7..0268506 100644 --- a/prismedia/pt_upload.py +++ b/prismedia/pt_upload.py @@ -299,30 +299,30 @@ def upload_video(oauth, secret, options): headers = { 'Content-Type': multipart_data.content_type } - # response = oauth.post(url + "/api/v1/videos/upload", - # data=multipart_data, - # headers=headers) - # if response is not None: - # if response.status_code == 200: - # jresponse = response.json() - # jresponse = jresponse['video'] - # uuid = jresponse['uuid'] - # video_id = str(jresponse['id']) - # logger.info('Peertube: Video was successfully uploaded.') - # template = 'Peertube: Watch it at %s/videos/watch/%s.' - # logger.info(template % (url, uuid)) - # template_stdout = '%s/videos/watch/%s' - # if options.get('--url-only'): - # logger_stdout.info(template_stdout % (url, uuid)) - # elif options.get('--batch'): - # logger_stdout.info("Peertube: " + template_stdout % (url, uuid)) - # # Upload is successful we may set playlist - # if options.get('--playlist'): - # set_playlist(oauth, url, video_id, playlist_id) - # else: - # logger.critical(('Peertube: The upload failed with an unexpected response: ' - # '%s') % response) - # exit(1) + response = oauth.post(url + "/api/v1/videos/upload", + data=multipart_data, + headers=headers) + if response is not None: + if response.status_code == 200: + jresponse = response.json() + jresponse = jresponse['video'] + uuid = jresponse['uuid'] + video_id = str(jresponse['id']) + logger.info('Peertube: Video was successfully uploaded.') + template = 'Peertube: Watch it at %s/videos/watch/%s.' + logger.info(template % (url, uuid)) + template_stdout = '%s/videos/watch/%s' + if options.get('--url-only'): + logger_stdout.info(template_stdout % (url, uuid)) + elif options.get('--batch'): + logger_stdout.info("Peertube: " + template_stdout % (url, uuid)) + # Upload is successful we may set playlist + if options.get('--playlist'): + set_playlist(oauth, url, video_id, playlist_id) + else: + logger.critical(('Peertube: The upload failed with an unexpected response: ' + '%s') % response) + exit(1) def run(options):