Commit aa2d3d2b authored by Ozzie Isaacs's avatar Ozzie Isaacs

Update python search Metadata

parent d5e9cdc5
...@@ -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()
......
...@@ -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
......
...@@ -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
......
...@@ -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 ""
This diff is collapsed.
...@@ -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>
......
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