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
89927fd7
Commit
89927fd7
authored
Mar 07, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge ComicVine API
parents
18794831
a0535aa3
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
96 additions
and
18 deletions
+96
-18
get_meta.js
cps/static/js/get_meta.js
+76
-1
book_edit.html
cps/templates/book_edit.html
+4
-1
messages.po
cps/translations/cs/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/de/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/es/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/fi/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/fr/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/hu/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/it/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/ja/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/km/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/nl/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/pl/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/ru/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/sv/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/uk/LC_MESSAGES/messages.po
+1
-1
messages.po
cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po
+1
-1
messages.pot
messages.pot
+1
-1
No files found.
cps/static/js/get_meta.js
View file @
89927fd7
...
@@ -15,13 +15,15 @@
...
@@ -15,13 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
/*
/*
* Get Metadata from Douban Books api and Google Books api
* Get Metadata from Douban Books api and Google Books api
and ComicVine
* Google Books api document: https://developers.google.com/books/docs/v1/using
* Google Books api document: https://developers.google.com/books/docs/v1/using
* Douban Books api document: https://developers.douban.com/wiki/?title=book_v2 (Chinese Only)
* Douban Books api document: https://developers.douban.com/wiki/?title=book_v2 (Chinese Only)
* ComicVine api document: https://comicvine.gamespot.com/api/documentation
*/
*/
/* global _, i18nMsg, tinymce */
/* global _, i18nMsg, tinymce */
var
dbResults
=
[];
var
dbResults
=
[];
var
ggResults
=
[];
var
ggResults
=
[];
var
cvResults
=
[];
$
(
function
()
{
$
(
function
()
{
var
msg
=
i18nMsg
;
var
msg
=
i18nMsg
;
...
@@ -33,6 +35,10 @@ $(function () {
...
@@ -33,6 +35,10 @@ $(function () {
var
ggSearch
=
"/books/v1/volumes"
;
var
ggSearch
=
"/books/v1/volumes"
;
var
ggDone
=
false
;
var
ggDone
=
false
;
var
comicvine
=
"https://comicvine.gamespot.com"
;
var
cvSearch
=
"/api/search/"
;
var
cvDone
=
false
;
var
showFlag
=
0
;
var
showFlag
=
0
;
var
templates
=
{
var
templates
=
{
...
@@ -164,6 +170,52 @@ $(function () {
...
@@ -164,6 +170,52 @@ $(function () {
});
});
dbDone
=
false
;
dbDone
=
false
;
}
}
if
(
cvDone
&&
cvResults
.
length
>
0
)
{
cvResults
.
forEach
(
function
(
result
)
{
var
seriesTitle
=
""
;
if
(
result
.
volume
.
name
)
{
seriesTitle
=
result
.
volume
.
name
;
}
var
dateFomers
=
""
;
if
(
result
.
store_date
)
{
dateFomers
=
result
.
store_date
.
split
(
"-"
);
}
else
{
dateFomers
=
result
.
date_added
.
split
(
"-"
);
}
var
publishedYear
=
parseInt
(
dateFomers
[
0
]);
var
publishedMonth
=
parseInt
(
dateFomers
[
1
]);
var
publishedDate
=
new
Date
(
publishedYear
,
publishedMonth
-
1
,
1
);
publishedDate
=
formatDate
(
publishedDate
);
var
book
=
{
id
:
result
.
id
,
title
:
seriesTitle
+
' #'
+
(
'00'
+
result
.
issue_number
).
slice
(
-
3
)
+
' - '
+
result
.
name
,
authors
:
result
.
author
||
[],
description
:
result
.
description
,
publisher
:
""
,
publishedDate
:
publishedDate
||
""
,
tags
:
[
'Comics'
,
seriesTitle
],
rating
:
0
,
series
:
seriesTitle
||
""
,
cover
:
result
.
image
.
original_url
,
url
:
result
.
site_detail_url
,
source
:
{
id
:
"comicvine"
,
description
:
"ComicVine Books"
,
url
:
"https://comicvine.gamespot.com/"
}
};
var
$book
=
$
(
templates
.
bookResult
(
book
));
$book
.
find
(
"img"
).
on
(
"click"
,
function
()
{
populateForm
(
book
);
});
$
(
"#book-list"
).
append
(
$book
);
});
cvDone
=
false
;
}
}
}
function
ggSearchBook
(
title
)
{
function
ggSearchBook
(
title
)
{
...
@@ -207,12 +259,35 @@ $(function () {
...
@@ -207,12 +259,35 @@ $(function () {
});
});
}
}
function
cvSearchBook
(
title
)
{
var
apikey
=
"57558043c53943d5d1e96a9ad425b0eb85532ee6"
;
title
=
encodeURIComponent
(
title
);
$
.
ajax
({
url
:
comicvine
+
cvSearch
+
"?api_key="
+
apikey
+
"&resources=issue&query="
+
title
+
"&sort=name:desc&format=jsonp"
,
type
:
"GET"
,
dataType
:
"jsonp"
,
jsonp
:
"json_callback"
,
success
:
function
success
(
data
)
{
cvResults
=
data
.
results
;
},
error
:
function
error
()
{
$
(
"#meta-info"
).
html
(
"<p class=
\"
text-danger
\"
>"
+
msg
.
search_error
+
"!</p>"
+
$
(
"#meta-info"
)[
0
].
innerHTML
);
},
complete
:
function
complete
()
{
cvDone
=
true
;
showResult
();
$
(
"#show-comics"
).
trigger
(
"change"
);
}
});
}
function
doSearch
(
keyword
)
{
function
doSearch
(
keyword
)
{
showFlag
=
0
;
showFlag
=
0
;
$
(
"#meta-info"
).
text
(
msg
.
loading
);
$
(
"#meta-info"
).
text
(
msg
.
loading
);
if
(
keyword
)
{
if
(
keyword
)
{
dbSearchBook
(
keyword
);
dbSearchBook
(
keyword
);
ggSearchBook
(
keyword
);
ggSearchBook
(
keyword
);
cvSearchBook
(
keyword
);
}
}
}
}
...
...
cps/templates/book_edit.html
View file @
89927fd7
...
@@ -222,6 +222,9 @@
...
@@ -222,6 +222,9 @@
<input
type=
"checkbox"
id=
"show-google"
class=
"pill"
data-control=
"google"
checked
>
<input
type=
"checkbox"
id=
"show-google"
class=
"pill"
data-control=
"google"
checked
>
<label
for=
"show-google"
>
Google
<span
class=
"glyphicon glyphicon-ok"
></span></label>
<label
for=
"show-google"
>
Google
<span
class=
"glyphicon glyphicon-ok"
></span></label>
<input
type=
"checkbox"
id=
"show-comics"
class=
"pill"
data-control=
"comicvine"
checked
>
<label
for=
"show-comics"
>
ComicVine
<span
class=
"glyphicon glyphicon-ok"
></span></label>
</div>
</div>
<div
id=
"meta-info"
>
<div
id=
"meta-info"
>
...
@@ -267,7 +270,7 @@
...
@@ -267,7 +270,7 @@
var
i18nMsg
=
{
var
i18nMsg
=
{
'loading'
:
{{
_
(
'Loading...'
)
|
safe
|
tojson
}},
'loading'
:
{{
_
(
'Loading...'
)
|
safe
|
tojson
}},
'search_error'
:
{{
_
(
'Search error!'
)
|
safe
|
tojson
}},
'search_error'
:
{{
_
(
'Search error!'
)
|
safe
|
tojson
}},
'no_result'
:
{{
_
(
'No Result(s) found! Please try a
on
ther keyword.'
)
|
safe
|
tojson
}},
'no_result'
:
{{
_
(
'No Result(s) found! Please try a
no
ther keyword.'
)
|
safe
|
tojson
}},
'author'
:
{{
_
(
'Author'
)
|
safe
|
tojson
}},
'author'
:
{{
_
(
'Author'
)
|
safe
|
tojson
}},
'publisher'
:
{{
_
(
'Publisher'
)
|
safe
|
tojson
}},
'publisher'
:
{{
_
(
'Publisher'
)
|
safe
|
tojson
}},
'description'
:
{{
_
(
'Description'
)
|
safe
|
tojson
}},
'description'
:
{{
_
(
'Description'
)
|
safe
|
tojson
}},
...
...
cps/translations/cs/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
msgstr "Chyba vyhledávání!"
msgstr "Chyba vyhledávání!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Nebyly nalezeny žádné výsledky! Zadejte jiné klíčové slovo."
msgstr "Nebyly nalezeny žádné výsledky! Zadejte jiné klíčové slovo."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/de/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
msgstr "Fehler bei der Suche!"
msgstr "Fehler bei der Suche!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Keine Ergebnisse gefunden! Bitte ein anderes Schlüsselwort benutzen."
msgstr "Keine Ergebnisse gefunden! Bitte ein anderes Schlüsselwort benutzen."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/es/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1326,7 +1326,7 @@ msgid "Search error!"
...
@@ -1326,7 +1326,7 @@ msgid "Search error!"
msgstr "¡Error en la búsqueda!"
msgstr "¡Error en la búsqueda!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "¡No se encontraron resultados! Por favor intenta con otra palabra clave."
msgstr "¡No se encontraron resultados! Por favor intenta con otra palabra clave."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/fi/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
msgstr "Hakuvirhe!"
msgstr "Hakuvirhe!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Ei osumia! Kokeile jotain tosita hakusanaa."
msgstr "Ei osumia! Kokeile jotain tosita hakusanaa."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/fr/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1337,7 +1337,7 @@ msgid "Search error!"
...
@@ -1337,7 +1337,7 @@ msgid "Search error!"
msgstr "Rechercher les erreur!"
msgstr "Rechercher les erreur!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Aucun résultat. Veuillez essayer avec un nouveau mot clé."
msgstr "Aucun résultat. Veuillez essayer avec un nouveau mot clé."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/hu/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
msgstr "Keresési hiba!"
msgstr "Keresési hiba!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Nincs találat! Próbálj másik kulcsszót."
msgstr "Nincs találat! Próbálj másik kulcsszót."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/it/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
msgstr "Errore di ricerca!"
msgstr "Errore di ricerca!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Nessun risultato! Prova con un altro criterio di ricerca."
msgstr "Nessun risultato! Prova con un altro criterio di ricerca."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/ja/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
msgstr "検索エラー"
msgstr "検索エラー"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "検索結果が見つかりません。別のキーワードで検索してみてください。"
msgstr "検索結果が見つかりません。別のキーワードで検索してみてください。"
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/km/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1325,7 +1325,7 @@ msgid "Search error!"
...
@@ -1325,7 +1325,7 @@ msgid "Search error!"
msgstr "ការស្វែងរកមានកំហុស!"
msgstr "ការស្វែងរកមានកំហុស!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr ""
msgstr ""
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/nl/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1325,7 +1325,7 @@ msgid "Search error!"
...
@@ -1325,7 +1325,7 @@ msgid "Search error!"
msgstr "Zoekfout!"
msgstr "Zoekfout!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Geen resultaten gevonden! Gebruik een ander trefwoord."
msgstr "Geen resultaten gevonden! Gebruik een ander trefwoord."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/pl/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1337,7 +1337,7 @@ msgid "Search error!"
...
@@ -1337,7 +1337,7 @@ msgid "Search error!"
msgstr "Błąd wyszukiwania!"
msgstr "Błąd wyszukiwania!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Nie znaleziono! Spróbuj użyć innego kluczowego słowa."
msgstr "Nie znaleziono! Spróbuj użyć innego kluczowego słowa."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/ru/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1325,7 +1325,7 @@ msgid "Search error!"
...
@@ -1325,7 +1325,7 @@ msgid "Search error!"
msgstr "Ошибка поиска!"
msgstr "Ошибка поиска!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Результат(ы) не найдены! Попробуйте другое ключевое слово."
msgstr "Результат(ы) не найдены! Попробуйте другое ключевое слово."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/sv/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
msgstr "Sökningsfel!"
msgstr "Sökningsfel!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "Inga resultat hittades! Försök med ett annat sökord."
msgstr "Inga resultat hittades! Försök med ett annat sökord."
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/uk/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
msgstr "Помилка пошуку!"
msgstr "Помилка пошуку!"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr ""
msgstr ""
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po
View file @
89927fd7
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
...
@@ -1324,7 +1324,7 @@ msgid "Search error!"
msgstr "搜索错误"
msgstr "搜索错误"
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr "找不到结果。请尝试另一个关键字"
msgstr "找不到结果。请尝试另一个关键字"
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
messages.pot
View file @
89927fd7
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
...
@@ -1323,7 +1323,7 @@ msgid "Search error!"
msgstr ""
msgstr ""
#: cps/templates/book_edit.html:270
#: cps/templates/book_edit.html:270
msgid "No Result(s) found! Please try a
on
ther keyword."
msgid "No Result(s) found! Please try a
no
ther keyword."
msgstr ""
msgstr ""
#: cps/templates/config_edit.html:12
#: cps/templates/config_edit.html:12
...
...
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