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
79d5bab4
Commit
79d5bab4
authored
Mar 31, 2017
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cosmetics
parent
5044b78b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
29 deletions
+28
-29
gdriveutils.py
cps/gdriveutils.py
+5
-7
get_meta.js
cps/static/js/get_meta.js
+23
-22
No files found.
cps/gdriveutils.py
View file @
79d5bab4
...
@@ -194,7 +194,6 @@ def downloadFile(drive, path, filename, output):
...
@@ -194,7 +194,6 @@ def downloadFile(drive, path, filename, output):
f
.
GetContentFile
(
output
)
f
.
GetContentFile
(
output
)
def
backupCalibreDbAndOptionalDownload
(
drive
,
f
=
None
):
def
backupCalibreDbAndOptionalDownload
(
drive
,
f
=
None
):
pass
if
not
drive
:
if
not
drive
:
drive
=
getDrive
()
drive
=
getDrive
()
if
drive
.
auth
.
access_token_expired
:
if
drive
.
auth
.
access_token_expired
:
...
@@ -354,12 +353,11 @@ def getChangeById (drive, change_id):
...
@@ -354,12 +353,11 @@ def getChangeById (drive, change_id):
drive
=
getDrive
()
drive
=
getDrive
()
if
drive
.
auth
.
access_token_expired
:
if
drive
.
auth
.
access_token_expired
:
drive
.
auth
.
Refresh
()
drive
.
auth
.
Refresh
()
"""Print a single Change resource information.
# Print a single Change resource information.
#
Args:
# Args:
service: Drive API service instance.
# service: Drive API service instance.
change_id: ID of the Change resource to retrieve.
# change_id: ID of the Change resource to retrieve.
"""
try
:
try
:
change
=
drive
.
auth
.
service
.
changes
()
.
get
(
changeId
=
change_id
)
.
execute
()
change
=
drive
.
auth
.
service
.
changes
()
.
get
(
changeId
=
change_id
)
.
execute
()
return
change
return
change
...
...
cps/static/js/get_meta.js
View file @
79d5bab4
...
@@ -65,7 +65,7 @@ $(document).ready(function () {
...
@@ -65,7 +65,7 @@ $(document).ready(function () {
$
(
"#description"
).
val
(
meta
.
summary
);
$
(
"#description"
).
val
(
meta
.
summary
);
$
(
"#bookAuthor"
).
val
(
meta
.
author
.
join
(
" & "
));
$
(
"#bookAuthor"
).
val
(
meta
.
author
.
join
(
" & "
));
$
(
"#book_title"
).
val
(
meta
.
title
);
$
(
"#book_title"
).
val
(
meta
.
title
);
var
tags
=
''
;
tags
=
''
;
for
(
var
i
=
0
;
i
<
meta
.
tags
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
meta
.
tags
.
length
;
i
++
)
{
tags
=
tags
+
meta
.
tags
[
i
].
title
+
','
;
tags
=
tags
+
meta
.
tags
[
i
].
title
+
','
;
}
}
...
@@ -74,7 +74,8 @@ $(document).ready(function () {
...
@@ -74,7 +74,8 @@ $(document).ready(function () {
return
;
return
;
}
}
}
}
do_search
=
function
(
keyword
)
{
function
do_search
(
keyword
)
{
show_flag
=
0
;
show_flag
=
0
;
$
(
"#meta-info"
).
text
(
msg
.
loading
);
$
(
"#meta-info"
).
text
(
msg
.
loading
);
var
keyword
=
$
(
"#keyword"
).
val
();
var
keyword
=
$
(
"#keyword"
).
val
();
...
@@ -84,26 +85,6 @@ $(document).ready(function () {
...
@@ -84,26 +85,6 @@ $(document).ready(function () {
}
}
}
}
db_search_book
=
function
(
title
)
{
var
url
=
douban
+
dbSearch
+
'?q='
+
title
+
'&fields=all&count=10'
;
$
.
ajax
({
url
:
url
,
type
:
"GET"
,
dataType
:
"jsonp"
,
jsonp
:
'callback'
,
success
:
function
(
data
)
{
db_results
=
data
.
books
;
},
error
:
function
()
{
$
(
'#meta-info'
).
html
(
'<p class="text-danger">'
+
msg
.
search_error
+
'!</p>'
);
},
complete
:
function
()
{
dbDone
=
true
;
show_result
();
}
});
}
function
show_result
()
{
function
show_result
()
{
show_flag
++
;
show_flag
++
;
if
(
show_flag
==
1
)
{
if
(
show_flag
==
1
)
{
...
@@ -163,6 +144,26 @@ $(document).ready(function () {
...
@@ -163,6 +144,26 @@ $(document).ready(function () {
}
}
}
}
db_search_book
=
function
(
title
)
{
var
url
=
douban
+
dbSearch
+
'?q='
+
title
+
'&fields=all&count=10'
;
$
.
ajax
({
url
:
url
,
type
:
"GET"
,
dataType
:
"jsonp"
,
jsonp
:
'callback'
,
success
:
function
(
data
)
{
db_results
=
data
.
books
;
},
error
:
function
()
{
$
(
'#meta-info'
).
html
(
'<p class="text-danger">'
+
msg
.
search_error
+
'!</p>'
);
},
complete
:
function
()
{
dbDone
=
true
;
show_result
();
}
});
}
$
(
"#do-search"
).
click
(
function
()
{
$
(
"#do-search"
).
click
(
function
()
{
var
keyword
=
$
(
"#keyword"
).
val
();
var
keyword
=
$
(
"#keyword"
).
val
();
if
(
keyword
)
{
if
(
keyword
)
{
...
...
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