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

@ -3,6 +3,7 @@
from ConfigParser import RawConfigParser, NoOptionError, NoSectionError
from os.path import dirname, splitext, basename, isfile
import unicodedata
### CATEGORIES ###
YOUTUBE_CATEGORY = {
@ -154,3 +155,21 @@ def parseNFO(options):
except NoSectionError:
exit("Given NFO file miss section [video], please check syntax of your NFO.")
return options
def upcaseFirstLetter(s):
return s[0].upper() + s[1:]
def mastodonTag(tag):
tags = tag.split(' ')
mtag = ''
for s in tags:
if s == '':
continue
strtag = unicodedata.normalize('NFKD', unicode (s, 'utf-8')).encode('ASCII', 'ignore')
strtag = ''.join(e for e in strtag if e.isalnum())
strtag = upcaseFirstLetter(strtag)
mtag = mtag + strtag
return mtag