Catch crash when trying to upload a not available video file (#18)

This happens for example when a Live Stream is scheduled on a
YT-Channel. In this case the download of the video file is not possible
and therefore the attempt to upload leads to a crash.
pull/19/head
Georg Krause 2020-04-23 17:47:27 +02:00 zatwierdzone przez GitHub
rodzic 9395712a05
commit fbc28562a5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 19 dodań i 16 usunięć

Wyświetl plik

@ -166,22 +166,25 @@ def upload_to_pt(dl_dir, channel_conf, queue_item, access_token, thumb_extension
# MultipartEncoder does not support list refer # MultipartEncoder does not support list refer
# https://github.com/requests/toolbelt/issues/190 and # https://github.com/requests/toolbelt/issues/190 and
# https://github.com/requests/toolbelt/issues/205 # https://github.com/requests/toolbelt/issues/205
fields = [ try:
("name", queue_item["title"]), fields = [
("licence", "1"), ("name", queue_item["title"]),
("description", description), ("licence", "1"),
("nsfw", channel_conf["nsfw"]), ("description", description),
("channelId", channel_id), ("nsfw", channel_conf["nsfw"]),
("originallyPublishedAt", queue_item["published"]), ("channelId", channel_id),
("category", channel_conf["pt_channel_category"]), ("originallyPublishedAt", queue_item["published"]),
("language", channel_conf["default_lang"]), ("category", channel_conf["pt_channel_category"]),
("privacy", str(channel_conf["pt_privacy"])), ("language", channel_conf["default_lang"]),
("commentsEnabled", channel_conf["comments_enabled"]), ("privacy", str(channel_conf["pt_privacy"])),
("videofile", get_file(video_file)), ("commentsEnabled", channel_conf["comments_enabled"]),
("thumbnailfile", get_file(thumb_file)), ("videofile", get_file(video_file)),
("previewfile", get_file(thumb_file)), ("thumbnailfile", get_file(thumb_file)),
("waitTranscoding", 'false') ("previewfile", get_file(thumb_file)),
] ("waitTranscoding", 'false')
]
except:
return
if channel_conf["pt_tags"] != "": if channel_conf["pt_tags"] != "":
fields.append(("tags", "[" + channel_conf["pt_tags"] + "]")) fields.append(("tags", "[" + channel_conf["pt_tags"] + "]"))