diff --git a/CHANGELOG.md b/CHANGELOG.md index d8113b1..284b16a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - Fix a typo in log (missing space when displaying thumbnail) (see #47) - Add pagination when searching playlist in Peertube as default pagination show only 14 playlists (see #41) + - Add a check to avoid uploading video on Peertube with more than 5 tags (see #48) ## v0.10.1 diff --git a/prismedia/pt_upload.py b/prismedia/pt_upload.py index 8a8c381..3bae1b7 100644 --- a/prismedia/pt_upload.py +++ b/prismedia/pt_upload.py @@ -209,14 +209,21 @@ def upload_video(oauth, secret, options): if options.get('--tags'): tags = options.get('--tags').split(',') + tag_number = 0 for strtag in tags: + tag_number = tag_number + 1 # Empty tag crashes Peertube, so skip them if strtag == "": continue - # Tag more than 30 chars crashes Peertube, so exit and check tags + # Tag more than 30 chars crashes Peertube, so skip tags if len(strtag) >= 30: - logger.error("Peertube: Sorry, Peertube does not support tag with more than 30 characters, please reduce tag: " + strtag) - logger.error("Peertube: Meanwhile, this tag will be skipped") + logger.warning("Peertube: Sorry, Peertube does not support tag with more than 30 characters, please reduce tag: " + strtag) + logger.warning("Peertube: Meanwhile, this tag will be skipped") + continue + # Peertube supports only 5 tags at the moment + if tag_number > 5: + logger.warning("Peertube: Sorry, Peertube support 5 tags max, additional tag will be skipped") + logger.warning("Peertube: Skipping tag " + strtag) continue fields.append(("tags[]", strtag))