Allow to have a R in front of subtitles
This commit is contained in:
parent
838fcecb56
commit
8fa724e848
|
@ -59,6 +59,7 @@ def generate_side_identifier(title, authors, subtitle=None):
|
||||||
subtitle = re.sub(r'</span>', '', subtitle)
|
subtitle = re.sub(r'</span>', '', subtitle)
|
||||||
subtitle = re.sub(r'<span.*>', '', subtitle)
|
subtitle = re.sub(r'<span.*>', '', subtitle)
|
||||||
start = subtitle.split(' ')[0].replace('.', '')
|
start = subtitle.split(' ')[0].replace('.', '')
|
||||||
|
start = re.sub("^R?", "", start)
|
||||||
|
|
||||||
if start.isnumeric():
|
if start.isnumeric():
|
||||||
side_identifier += " {:0>2}".format(start, )
|
side_identifier += " {:0>2}".format(start, )
|
||||||
|
|
|
@ -12,8 +12,10 @@ class Command(BaseCommand):
|
||||||
default='bd',
|
default='bd',
|
||||||
choices=['bd', 'manga', 'roman'],
|
choices=['bd', 'manga', 'roman'],
|
||||||
help="Type of medium where the sides need to be regenerated.")
|
help="Type of medium where the sides need to be regenerated.")
|
||||||
parser.add_argument('--noninteractivemode', '-n', action="store_true",
|
parser.add_argument('--noninteractivemode', '-ni', action="store_true",
|
||||||
help="Disable the interaction mode and replace existing side identifiers.")
|
help="Disable the interaction mode and replace existing side identifiers.")
|
||||||
|
parser.add_argument('--no-commit', '-nc', action="store_true",
|
||||||
|
help="Only show modifications, don't commit them to database.")
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
@ -47,7 +49,8 @@ class Command(BaseCommand):
|
||||||
self.stdout.write(self.style.WARNING(f"Replace side of {obj} from {current_side_identifier} "
|
self.stdout.write(self.style.WARNING(f"Replace side of {obj} from {current_side_identifier} "
|
||||||
f"to {generated_side_identifier}..."))
|
f"to {generated_side_identifier}..."))
|
||||||
obj.side_identifier = generated_side_identifier
|
obj.side_identifier = generated_side_identifier
|
||||||
obj.save()
|
if not options["no_commit"]:
|
||||||
|
obj.save()
|
||||||
replaced += 1
|
replaced += 1
|
||||||
|
|
||||||
if replaced:
|
if replaced:
|
||||||
|
|
Loading…
Reference in New Issue