Commit aa2d3d2b authored by Ozzie Isaacs's avatar Ozzie Isaacs

Update python search Metadata

parent d5e9cdc5
......@@ -127,7 +127,6 @@ def create_app():
def get_locale():
# if a user is logged in, use the locale from the user settings
user = getattr(g, 'user', None)
# user = None
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
return user.locale
......@@ -148,7 +147,6 @@ def get_timezone():
user = getattr(g, 'user', None)
return user.timezone if user else None
from . import search_metadata
from .updater import Updater
updater_thread = Updater()
......
......@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ComicVine api document: https://comicvine.gamespot.com/api/documentation
import requests
from cps.services.Metadata import Metadata
......
......@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# 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
from cps.services.Metadata import Metadata
......
......@@ -17,17 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import division, print_function, unicode_literals
from cps.services.Metadata import Metadata
import os
import json
import importlib
import sys
import inspect
from flask import Blueprint, request, Response
from flask_login import login_required
from . import constants, logger
from os.path import basename, isfile
import importlib
import sys, inspect
from cps.services.Metadata import Metadata
meta = Blueprint('metadata', __name__)
......@@ -37,8 +37,8 @@ new_list = list()
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"))
for f in modules:
if isfile(os.path.join(meta_dir, f)) and not f.endswith('__init__.py'):
a = basename(f)[:-3]
if os.path.isfile(os.path.join(meta_dir, f)) and not f.endswith('__init__.py'):
a = os.path.basename(f)[:-3]
try:
importlib.import_module("cps.metadata_provider." + a)
new_list.append(a)
......@@ -55,8 +55,6 @@ def list_classes(provider_list):
return classes
cl = list_classes(new_list)
#for c in cl:
# print(c.search("Walking"))
@meta.route("/metadata/provider")
@login_required
......@@ -72,8 +70,3 @@ def metadata_search():
for c in cl:
data.extend(c.search(query))
return Response(json.dumps(data), mimetype='application/json')
@meta.route("/metadata/replace/<id>")
@login_required
def metadata_replace(id):
return ""
This diff is collapsed.
......@@ -242,9 +242,6 @@
</div>
<div class="modal-body">
<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>
<label for="show-google">Google <span class="glyphicon glyphicon-ok"></span></label>
......@@ -253,13 +250,12 @@
<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>
</div>
<div id="meta-info">
{{_("Loading...")}}
</div>
<ul id="book-list" class="media-list"></ul>
<!--ul id="book-list" class="media-list"></ul-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{_('Close')}}</button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment