-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4071 from quadproduction/221-wizz_burn-ins-on-pub…
…lished-videos-should-show-the-kitsu-user Get kitsu login to fill username burnin
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
openpype/modules/kitsu/plugins/publish/collect_kitsu_username.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- 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): | ||
kitsu_login = os.environ.get('KITSU_LOGIN') | ||
|
||
if not kitsu_login: | ||
return | ||
|
||
kitsu_username = kitsu_login.split("@")[0].replace('.', ' ') | ||
new_username = re.sub('[^a-zA-Z]', ' ', kitsu_username).title() | ||
|
||
for instance in context: | ||
# Don't override customData if it already exists | ||
if 'customData' not in instance.data: | ||
instance.data['customData'] = {} | ||
|
||
instance.data['customData']["kitsuUsername"] = new_username |