Add new feature to force compatibility tag with Mastodon publication (peertube)

This commit is contained in:
LecygneNoir 2018-03-29 23:02:30 +02:00
parent 768bbb0215
commit ac6db56355
5 changed files with 43 additions and 6 deletions

View file

@ -68,14 +68,17 @@ def upload_video(oauth, secret, options):
if options.get('--tags'):
tags = options.get('--tags').split(',')
for strtags in tags:
for strtag in tags:
# Empty tag crashes Peertube, so skip them
if strtags == "":
if strtag == "":
continue
# Tag more than 30 chars crashes Peertube, so exit and check tags
if len(strtags) >= 30:
if len(strtag) >= 30:
exit("Sorry, Peertube does not support tag with more than 30 characters, please reduce your tag size")
fields.append(("tags", strtags))
# If Mastodon compatibility is enabled, clean tags from special characters
if options.get('--mt'):
strtag = utils.mastodonTag(strtag)
fields.append(("tags", strtag))
if options.get('--category'):
fields.append(("category", str(utils.getCategory(options.get('--category'), 'peertube'))))