title unify spostato in support e aggiunto a tmdb

This commit is contained in:
Alhaziel01
2021-02-19 16:37:41 +01:00
parent bf147f7cdf
commit 7dde92eb43
3 changed files with 31 additions and 26 deletions
+24
View File
@@ -796,6 +796,30 @@ def menu(func):
return wrapper
def title_unify(title):
import unicodedata
u_title = ''
if type(title) == str: title = u'' + title
for c in unicodedata.normalize('NFD', title):
cat = unicodedata.category(c)
if cat != 'Mn':
if cat == 'Pd':
c_new = '-'
elif cat in ['Ll', 'Lu'] or c == ':':
c_new = c
else:
c_new = ' '
u_title += c_new
if (u_title.count(':') + u_title.count('-')) == 1:
# subtitle, split but only if there's one, it might be part of title
spl = u_title.replace(':', '-').split('-')
u_title = spl[0] if len(spl[0]) > 5 else spl[1]
return u_title.strip()
def typo(string, typography=''):
kod_color = '0xFF65B3DA' #'0xFF0081C2'