mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
get username from kitsu login
This commit is contained in:
parent
8338296935
commit
c0f2de08d9
1 changed files with 27 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import re
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class CollectKitsuUsername(pyblish.api.ContextPlugin):
|
||||
"""Collect Kitsu username from the kitsu login"""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.499
|
||||
label = "Kitsu username"
|
||||
|
||||
def process(self, context):
|
||||
for instance in context:
|
||||
kitsu_login = os.environ['KITSU_LOGIN']
|
||||
|
||||
if kitsu_login:
|
||||
kitsu_username = kitsu_login.split("@")[0]
|
||||
kitsu_username = kitsu_username.split('.')
|
||||
kitsu_username = ' '.join(kitsu_username)
|
||||
|
||||
new_username = re.sub('[^a-zA-Z]', ' ', kitsu_username)
|
||||
|
||||
instance.data['customData'] = {
|
||||
"kitsuUsername": new_username.title()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue