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
b4f95cce
Commit
b4f95cce
authored
Oct 10, 2020
by
Ghighi Eftimie
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
e1d5c2c5
e16c0cae
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
89 additions
and
5 deletions
+89
-5
db.py
cps/db.py
+1
-3
jinjia.py
cps/jinjia.py
+12
-0
opds.py
cps/opds.py
+1
-1
style.css
cps/static/css/style.css
+6
-0
author.html
cps/templates/author.html
+16
-0
discover.html
cps/templates/discover.html
+8
-0
index.html
cps/templates/index.html
+16
-0
search.html
cps/templates/search.html
+9
-0
shelf.html
cps/templates/shelf.html
+8
-0
shelfdown.html
cps/templates/shelfdown.html
+8
-1
web.py
cps/web.py
+4
-0
No files found.
cps/db.py
View file @
b4f95cce
...
@@ -687,9 +687,7 @@ class CalibreDB():
...
@@ -687,9 +687,7 @@ class CalibreDB():
limit_all
=
result_count
limit_all
=
result_count
ub
.
store_ids
(
result
)
ub
.
store_ids
(
result
)
return
result
[
offset
:
limit_all
],
result_count
,
pagination
return
result
[
offset
:
limit_all
],
result_count
,
pagination
,
# Creates for all stored languages a translated speaking name in the array for the UI
# Creates for all stored languages a translated speaking name in the array for the UI
def
speaking_language
(
self
,
languages
=
None
):
def
speaking_language
(
self
,
languages
=
None
):
...
...
cps/jinjia.py
View file @
b4f95cce
...
@@ -110,9 +110,21 @@ def timestamptodate(date, fmt=None):
...
@@ -110,9 +110,21 @@ def timestamptodate(date, fmt=None):
def
yesno
(
value
,
yes
,
no
):
def
yesno
(
value
,
yes
,
no
):
return
yes
if
value
else
no
return
yes
if
value
else
no
@
jinjia
.
app_template_filter
(
'formatfloat'
)
@
jinjia
.
app_template_filter
(
'formatfloat'
)
def
formatfloat
(
value
,
decimals
=
1
):
def
formatfloat
(
value
,
decimals
=
1
):
formatedstring
=
'
%
d'
%
value
formatedstring
=
'
%
d'
%
value
if
(
value
%
1
)
!=
0
:
if
(
value
%
1
)
!=
0
:
formatedstring
=
(
'
%
s.
%
d'
%
(
formatedstring
,
(
value
%
1
)
*
10
**
decimals
))
.
rstrip
(
'0'
)
formatedstring
=
(
'
%
s.
%
d'
%
(
formatedstring
,
(
value
%
1
)
*
10
**
decimals
))
.
rstrip
(
'0'
)
return
formatedstring
return
formatedstring
@
jinjia
.
app_template_filter
(
'formatseriesindex'
)
def
formatseriesindex_filter
(
series_index
):
if
series_index
:
if
int
(
series_index
)
-
series_index
==
0
:
return
int
(
series_index
)
else
:
return
series_index
return
0
cps/opds.py
View file @
b4f95cce
...
@@ -408,7 +408,7 @@ def get_metadata_calibre_companion(uuid, library):
...
@@ -408,7 +408,7 @@ def get_metadata_calibre_companion(uuid, library):
def
feed_search
(
term
):
def
feed_search
(
term
):
if
term
:
if
term
:
entries
,
__
=
calibre_db
.
get_search_results
(
term
)
entries
,
__
,
___
=
calibre_db
.
get_search_results
(
term
)
entriescount
=
len
(
entries
)
if
len
(
entries
)
>
0
else
1
entriescount
=
len
(
entries
)
if
len
(
entries
)
>
0
else
1
pagination
=
Pagination
(
1
,
entriescount
,
entriescount
)
pagination
=
Pagination
(
1
,
entriescount
,
entriescount
)
return
render_xml_template
(
'feed.xml'
,
searchterm
=
term
,
entries
=
entries
,
pagination
=
pagination
)
return
render_xml_template
(
'feed.xml'
,
searchterm
=
term
,
entries
=
entries
,
pagination
=
pagination
)
...
...
cps/static/css/style.css
View file @
b4f95cce
...
@@ -143,6 +143,12 @@ a, .danger,.book-remove, .editable-empty, .editable-empty:hover { color: #45b29d
...
@@ -143,6 +143,12 @@ a, .danger,.book-remove, .editable-empty, .editable-empty:hover { color: #45b29d
color
:
#444
;
color
:
#444
;
}
}
.container-fluid
.book
.meta
.series
{
font-weight
:
400
;
font-size
:
12px
;
color
:
#444
;
}
.container-fluid
.book
.meta
.author
{
.container-fluid
.book
.meta
.author
{
font-size
:
12px
;
font-size
:
12px
;
color
:
#999
;
color
:
#999
;
...
...
cps/templates/author.html
View file @
b4f95cce
...
@@ -70,6 +70,14 @@
...
@@ -70,6 +70,14 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
{% if entry.ratings.__len__() > 0 %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...
@@ -114,6 +122,14 @@
...
@@ -114,6 +122,14 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.average_rating)|float|round|int(2)) %}
{% for number in range((entry.average_rating)|float|round|int(2)) %}
<span
class=
"glyphicon glyphicon-star good"
></span>
<span
class=
"glyphicon glyphicon-star good"
></span>
...
...
cps/templates/discover.html
View file @
b4f95cce
...
@@ -34,6 +34,14 @@
...
@@ -34,6 +34,14 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
{% if entry.ratings.__len__() > 0 %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...
...
cps/templates/index.html
View file @
b4f95cce
...
@@ -33,6 +33,14 @@
...
@@ -33,6 +33,14 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
{% if entry.ratings.__len__() > 0 %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...
@@ -101,6 +109,14 @@
...
@@ -101,6 +109,14 @@
{% endif %}
{% endif %}
{%endfor%}
{%endfor%}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
{% if entry.ratings.__len__() > 0 %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...
...
cps/templates/search.html
View file @
b4f95cce
...
@@ -72,6 +72,15 @@
...
@@ -72,6 +72,15 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
{% if entry.ratings.__len__() > 0 %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...
...
cps/templates/shelf.html
View file @
b4f95cce
...
@@ -43,6 +43,14 @@
...
@@ -43,6 +43,14 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
{% if entry.ratings.__len__() > 0 %}
<div
class=
"rating"
>
<div
class=
"rating"
>
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...
...
cps/templates/shelfdown.html
View file @
b4f95cce
...
@@ -43,7 +43,14 @@
...
@@ -43,7 +43,14 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</p>
</p>
{% if entry.series.__len__() > 0 %}
<p
class=
"series"
>
<a
href=
"{{url_for('web.books_list', data='series', sort_param='new', book_id=entry.series[0].id )}}"
>
{{entry.series[0].name}}
</a>
({{entry.series_index}})
</p>
{% endif %}
</div>
</div>
<div
class=
"btn-group"
role=
"group"
aria-label=
"Download, send to Kindle, reading"
>
<div
class=
"btn-group"
role=
"group"
aria-label=
"Download, send to Kindle, reading"
>
...
...
cps/web.py
View file @
b4f95cce
...
@@ -624,6 +624,10 @@ def render_books_list(data, sort, book_id, page):
...
@@ -624,6 +624,10 @@ def render_books_list(data, sort, book_id, page):
order
=
[
db
.
Books
.
timestamp
.
desc
()]
order
=
[
db
.
Books
.
timestamp
.
desc
()]
if
sort
==
'old'
:
if
sort
==
'old'
:
order
=
[
db
.
Books
.
timestamp
]
order
=
[
db
.
Books
.
timestamp
]
if
sort
==
'authaz'
:
order
=
[
db
.
Books
.
author_sort
.
asc
()]
if
sort
==
'authza'
:
order
=
[
db
.
Books
.
author_sort
.
desc
()]
if
data
==
"rated"
:
if
data
==
"rated"
:
if
current_user
.
check_visibility
(
constants
.
SIDEBAR_BEST_RATED
):
if
current_user
.
check_visibility
(
constants
.
SIDEBAR_BEST_RATED
):
...
...
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