Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
ee85492c
Commit
ee85492c
authored
Oct 30, 2018
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #662
parent
5fc742c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
helper.py
cps/helper.py
+11
-6
web.py
cps/web.py
+1
-1
No files found.
cps/helper.py
View file @
ee85492c
...
@@ -178,13 +178,18 @@ def get_valid_filename(value, replace_whitespace=True):
...
@@ -178,13 +178,18 @@ def get_valid_filename(value, replace_whitespace=True):
def
get_sorted_author
(
value
):
def
get_sorted_author
(
value
):
try
:
try
:
if
','
not
in
value
:
regexes
=
[
"^(JR|SR)
\
.?$"
,
"^I{1,3}
\
.?$"
,
"^IV
\
.?$"
]
regexes
=
[
"^(JR|SR)
\
.?$"
,
"^I{1,3}
\
.?$"
,
"^IV
\
.?$"
]
combined
=
"("
+
")|("
.
join
(
regexes
)
+
")"
combined
=
"("
+
")|("
.
join
(
regexes
)
+
")"
value
=
value
.
split
(
" "
)
value
=
value
.
split
(
" "
)
if
re
.
match
(
combined
,
value
[
-
1
]
.
upper
()):
if
re
.
match
(
combined
,
value
[
-
1
]
.
upper
()):
value2
=
value
[
-
2
]
+
", "
+
" "
.
join
(
value
[:
-
2
])
+
" "
+
value
[
-
1
]
value2
=
value
[
-
2
]
+
", "
+
" "
.
join
(
value
[:
-
2
])
+
" "
+
value
[
-
1
]
elif
len
(
value
)
==
1
:
value2
=
value
[
0
]
else
:
else
:
value2
=
value
[
-
1
]
+
", "
+
" "
.
join
(
value
[:
-
1
])
value2
=
value
[
-
1
]
+
", "
+
" "
.
join
(
value
[:
-
1
])
else
:
value2
=
value
except
Exception
:
except
Exception
:
web
.
app
.
logger
.
error
(
"Sorting author "
+
str
(
value
)
+
"failed"
)
web
.
app
.
logger
.
error
(
"Sorting author "
+
str
(
value
)
+
"failed"
)
value2
=
value
value2
=
value
...
...
cps/web.py
View file @
ee85492c
...
@@ -588,7 +588,7 @@ def modify_database_object(input_elements, db_book_object, db_object, db_session
...
@@ -588,7 +588,7 @@ def modify_database_object(input_elements, db_book_object, db_object, db_session
# if no element is found add it
# if no element is found add it
# if new_element is None:
# if new_element is None:
if
db_type
==
'author'
:
if
db_type
==
'author'
:
new_element
=
db_object
(
add_element
,
add_element
.
replace
(
'|'
,
','
),
""
)
new_element
=
db_object
(
add_element
,
helper
.
get_sorted_author
(
add_element
.
replace
(
'|'
,
','
)
),
""
)
elif
db_type
==
'series'
:
elif
db_type
==
'series'
:
new_element
=
db_object
(
add_element
,
add_element
)
new_element
=
db_object
(
add_element
,
add_element
)
elif
db_type
==
'custom'
:
elif
db_type
==
'custom'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment