mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2025-06-29 22:31:10 +02:00
Side identifiers cannot begin with le/la/les/l'/the
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import json
|
||||
import re
|
||||
import urllib.request
|
||||
import unicodedata
|
||||
|
||||
@ -109,9 +110,15 @@ class MediaAdminForm(ModelForm):
|
||||
author_name = self.cleaned_data['authors'][0].name
|
||||
if ',' not in author_name and ' ' in author_name:
|
||||
author_name = author_name.split(' ')[-1]
|
||||
title_normalized = self.cleaned_data['title'].upper()
|
||||
title_normalized = re.sub(r'^LE ', '', title_normalized)
|
||||
title_normalized = re.sub(r'^LA ', '', title_normalized)
|
||||
title_normalized = re.sub(r'^LES ', '', title_normalized)
|
||||
title_normalized = re.sub(r'^L\'', '', title_normalized)
|
||||
title_normalized = re.sub(r'^THE ', '', title_normalized)
|
||||
side_identifier = "{:.3} {:.3}".format(
|
||||
author_name,
|
||||
self.cleaned_data['title'], )
|
||||
title_normalized.replace(' ', ''), )
|
||||
|
||||
if self.cleaned_data['subtitle']:
|
||||
start = self.cleaned_data['subtitle'].split(' ')[0] \
|
||||
|
Reference in New Issue
Block a user