From e6e616b683bcee62e67ba770b17417881a03453b Mon Sep 17 00:00:00 2001 From: djdembeck Date: Sun, 3 Oct 2021 11:50:25 -0500 Subject: [PATCH] feat(author-update): :sparkles: set author sort name --- Contents/Code/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 89b68dc..6de68ef 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -259,6 +259,16 @@ def compile_metadata(self, helper): # Title. if not helper.metadata.title or helper.force: helper.metadata.title = helper.name + # Sort Title. + if not helper.metadata.title_sort or helper.force: + split_author_surname = re.match( + '^(.+?).([^\s,]+)(,?.(?:[JS]r\.?|III?|IV))?$', + helper.name, + ) + helper.metadata.title_sort = ( + split_author_surname.group(2) + ', ' + + split_author_surname.group(1) + ) # Thumb. if helper.thumb not in helper.metadata.posters or helper.force: helper.metadata.posters[helper.thumb] = Proxy.Media(