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
aa2d3d2b
Commit
aa2d3d2b
authored
Jul 07, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update python search Metadata
parent
d5e9cdc5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
379 deletions
+40
-379
__init__.py
cps/__init__.py
+0
-2
comicvine.py
cps/metadata_provider/comicvine.py
+1
-0
google.py
cps/metadata_provider/google.py
+2
-0
search_metadata.py
cps/search_metadata.py
+6
-13
get_meta.js
cps/static/js/get_meta.js
+30
-359
book_edit.html
cps/templates/book_edit.html
+1
-5
No files found.
cps/__init__.py
View file @
aa2d3d2b
...
@@ -127,7 +127,6 @@ def create_app():
...
@@ -127,7 +127,6 @@ def create_app():
def
get_locale
():
def
get_locale
():
# if a user is logged in, use the locale from the user settings
# if a user is logged in, use the locale from the user settings
user
=
getattr
(
g
,
'user'
,
None
)
user
=
getattr
(
g
,
'user'
,
None
)
# user = None
if
user
is
not
None
and
hasattr
(
user
,
"locale"
):
if
user
is
not
None
and
hasattr
(
user
,
"locale"
):
if
user
.
name
!=
'Guest'
:
# if the account is the guest account bypass the config lang settings
if
user
.
name
!=
'Guest'
:
# if the account is the guest account bypass the config lang settings
return
user
.
locale
return
user
.
locale
...
@@ -148,7 +147,6 @@ def get_timezone():
...
@@ -148,7 +147,6 @@ def get_timezone():
user
=
getattr
(
g
,
'user'
,
None
)
user
=
getattr
(
g
,
'user'
,
None
)
return
user
.
timezone
if
user
else
None
return
user
.
timezone
if
user
else
None
from
.
import
search_metadata
from
.updater
import
Updater
from
.updater
import
Updater
updater_thread
=
Updater
()
updater_thread
=
Updater
()
...
...
cps/metadata_provider/comicvine.py
View file @
aa2d3d2b
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ComicVine api document: https://comicvine.gamespot.com/api/documentation
import
requests
import
requests
from
cps.services.Metadata
import
Metadata
from
cps.services.Metadata
import
Metadata
...
...
cps/metadata_provider/google.py
View file @
aa2d3d2b
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Google Books api document: https://developers.google.com/books/docs/v1/using
import
requests
import
requests
from
cps.services.Metadata
import
Metadata
from
cps.services.Metadata
import
Metadata
...
...
cps/search_metadata.py
View file @
aa2d3d2b
...
@@ -17,17 +17,17 @@
...
@@ -17,17 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
division
,
print_function
,
unicode_literals
from
__future__
import
division
,
print_function
,
unicode_literals
from
cps.services.Metadata
import
Metadata
import
os
import
os
import
json
import
json
import
importlib
import
sys
import
inspect
from
flask
import
Blueprint
,
request
,
Response
from
flask
import
Blueprint
,
request
,
Response
from
flask_login
import
login_required
from
flask_login
import
login_required
from
.
import
constants
,
logger
from
.
import
constants
,
logger
from
os.path
import
basename
,
isfile
from
cps.services.Metadata
import
Metadata
import
importlib
import
sys
,
inspect
meta
=
Blueprint
(
'metadata'
,
__name__
)
meta
=
Blueprint
(
'metadata'
,
__name__
)
...
@@ -37,8 +37,8 @@ new_list = list()
...
@@ -37,8 +37,8 @@ new_list = list()
meta_dir
=
os
.
path
.
join
(
constants
.
BASE_DIR
,
"cps"
,
"metadata_provider"
)
meta_dir
=
os
.
path
.
join
(
constants
.
BASE_DIR
,
"cps"
,
"metadata_provider"
)
modules
=
os
.
listdir
(
os
.
path
.
join
(
constants
.
BASE_DIR
,
"cps"
,
"metadata_provider"
))
#glob.glob(join(dirname(__file__), "*.py"))
modules
=
os
.
listdir
(
os
.
path
.
join
(
constants
.
BASE_DIR
,
"cps"
,
"metadata_provider"
))
#glob.glob(join(dirname(__file__), "*.py"))
for
f
in
modules
:
for
f
in
modules
:
if
isfile
(
os
.
path
.
join
(
meta_dir
,
f
))
and
not
f
.
endswith
(
'__init__.py'
):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
meta_dir
,
f
))
and
not
f
.
endswith
(
'__init__.py'
):
a
=
basename
(
f
)[:
-
3
]
a
=
os
.
path
.
basename
(
f
)[:
-
3
]
try
:
try
:
importlib
.
import_module
(
"cps.metadata_provider."
+
a
)
importlib
.
import_module
(
"cps.metadata_provider."
+
a
)
new_list
.
append
(
a
)
new_list
.
append
(
a
)
...
@@ -55,8 +55,6 @@ def list_classes(provider_list):
...
@@ -55,8 +55,6 @@ def list_classes(provider_list):
return
classes
return
classes
cl
=
list_classes
(
new_list
)
cl
=
list_classes
(
new_list
)
#for c in cl:
# print(c.search("Walking"))
@
meta
.
route
(
"/metadata/provider"
)
@
meta
.
route
(
"/metadata/provider"
)
@
login_required
@
login_required
...
@@ -72,8 +70,3 @@ def metadata_search():
...
@@ -72,8 +70,3 @@ def metadata_search():
for
c
in
cl
:
for
c
in
cl
:
data
.
extend
(
c
.
search
(
query
))
data
.
extend
(
c
.
search
(
query
))
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
@
meta
.
route
(
"/metadata/replace/<id>"
)
@
login_required
def
metadata_replace
(
id
):
return
""
cps/static/js/get_meta.js
View file @
aa2d3d2b
This diff is collapsed.
Click to expand it.
cps/templates/book_edit.html
View file @
aa2d3d2b
...
@@ -242,9 +242,6 @@
...
@@ -242,9 +242,6 @@
</div>
</div>
<div
class=
"modal-body"
>
<div
class=
"modal-body"
>
<div
class=
"text-center padded-bottom"
>
<div
class=
"text-center padded-bottom"
>
<input
type=
"checkbox"
id=
"show-douban"
class=
"pill"
data-control=
"douban"
checked
>
<label
for=
"show-douban"
>
Douban
<span
class=
"glyphicon glyphicon-ok"
></span></label>
<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>
...
@@ -253,13 +250,12 @@
...
@@ -253,13 +250,12 @@
<input
type=
"checkbox"
id=
"show-googlescholar"
class=
"pill"
data-control=
"googlescholar"
checked
>
<input
type=
"checkbox"
id=
"show-googlescholar"
class=
"pill"
data-control=
"googlescholar"
checked
>
<label
for=
"show-googlescholar"
>
Google Scholar
<span
class=
"glyphicon glyphicon-ok"
></span></label>
<label
for=
"show-googlescholar"
>
Google Scholar
<span
class=
"glyphicon glyphicon-ok"
></span></label>
</div>
</div>
<div
id=
"meta-info"
>
<div
id=
"meta-info"
>
{{_("Loading...")}}
{{_("Loading...")}}
</div>
</div>
<
ul
id=
"book-list"
class=
"media-list"
></ul
>
<
!--ul id="book-list" class="media-list"></ul--
>
</div>
</div>
<div
class=
"modal-footer"
>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
{{_('Close')}}
</button>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
{{_('Close')}}
</button>
...
...
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