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
e5bc1ae0
Commit
e5bc1ae0
authored
Feb 25, 2019
by
Virgil Grigoras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new database field for storing max_authors
parent
17b73339
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
ub.py
cps/ub.py
+8
-0
web.py
cps/web.py
+6
-2
No files found.
cps/ub.py
View file @
e5bc1ae0
...
...
@@ -315,6 +315,7 @@ class Settings(Base):
config_calibre_web_title
=
Column
(
String
,
default
=
u'Calibre-Web'
)
config_books_per_page
=
Column
(
Integer
,
default
=
60
)
config_random_books
=
Column
(
Integer
,
default
=
4
)
config_authors_max
=
Column
(
Integer
,
default
=
5
)
config_read_column
=
Column
(
Integer
,
default
=
0
)
config_title_regex
=
Column
(
String
,
default
=
u'^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)
\
s+'
)
config_log_level
=
Column
(
SmallInteger
,
default
=
logging
.
INFO
)
...
...
@@ -380,6 +381,7 @@ class Config:
self
.
config_calibre_web_title
=
data
.
config_calibre_web_title
self
.
config_books_per_page
=
data
.
config_books_per_page
self
.
config_random_books
=
data
.
config_random_books
self
.
config_authors_max
=
data
.
config_authors_max
self
.
config_title_regex
=
data
.
config_title_regex
self
.
config_read_column
=
data
.
config_read_column
self
.
config_log_level
=
data
.
config_log_level
...
...
@@ -601,6 +603,12 @@ def migrate_Database():
conn
=
engine
.
connect
()
conn
.
execute
(
"ALTER TABLE Settings ADD column `config_default_role` SmallInteger DEFAULT 0"
)
session
.
commit
()
try
:
session
.
query
(
exists
()
.
where
(
Settings
.
config_authors_max
))
.
scalar
()
except
exc
.
OperationalError
:
# Database is not compatible, some rows are missing
conn
=
engine
.
connect
()
conn
.
execute
(
"ALTER TABLE Settings ADD column `config_authors_max` INTEGER DEFAULT 5"
)
session
.
commit
()
try
:
session
.
query
(
exists
()
.
where
(
BookShelf
.
order
))
.
scalar
()
except
exc
.
OperationalError
:
# Database is not compatible, some rows are missing
...
...
cps/web.py
View file @
e5bc1ae0
...
...
@@ -1207,7 +1207,7 @@ def get_updater_status():
def
index
(
page
):
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
timestamp
.
desc
()])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Recently Added Books"
),
page
=
"root"
)
title
=
_
(
u"Recently Added Books"
),
page
=
"root"
,
config_authors_max
=
config
.
config_authors_max
)
@
app
.
route
(
'/books/newest'
,
defaults
=
{
'page'
:
1
})
...
...
@@ -1351,7 +1351,8 @@ def author(book_id, page):
app
.
logger
.
error
(
'Goodreads website is down/inaccessible'
)
return
render_title_template
(
'author.html'
,
entries
=
entries
,
pagination
=
pagination
,
title
=
name
,
author
=
author_info
,
other_books
=
other_books
,
page
=
"author"
)
title
=
name
,
author
=
author_info
,
other_books
=
other_books
,
page
=
"author"
,
config_authors_max
=
config
.
config_authors_max
)
@
app
.
route
(
"/publisher"
)
...
...
@@ -2817,6 +2818,9 @@ def view_configuration():
content
.
config_random_books
=
int
(
to_save
[
"config_random_books"
])
if
"config_books_per_page"
in
to_save
:
content
.
config_books_per_page
=
int
(
to_save
[
"config_books_per_page"
])
# maximum authors to show before we display a 'show more' link
if
"config_authors_max"
in
to_save
:
content
.
config_authors_max
=
int
(
to_save
[
"config_authors_max"
])
# Mature Content configuration
if
"config_mature_content_tags"
in
to_save
:
content
.
config_mature_content_tags
=
to_save
[
"config_mature_content_tags"
]
.
strip
()
...
...
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