This commit is contained in:
j 2016-01-07 15:42:48 +05:30
parent c33f580edf
commit 0e71dcd9a8
5 changed files with 53 additions and 41 deletions

View file

@ -19,6 +19,7 @@ class Install(Thread):
base_url = 'http://downloads.openmedialibrary.com/' base_url = 'http://downloads.openmedialibrary.com/'
status = {} status = {}
failed = False
def __init__(self, target): def __init__(self, target):
self.target = target self.target = target
@ -72,8 +73,9 @@ class Install(Thread):
print('You need to install Pillow, lxml and pyOpenSSL\ni.e. sudo pip3 install pillow lxml pyOpenSSL') print('You need to install Pillow, lxml and pyOpenSSL\ni.e. sudo pip3 install pillow lxml pyOpenSSL')
if 'poppler' in apt_packages: if 'poppler' in apt_packages:
print('You need to install pdftocairo (part of poppler-utils)') print('You need to install pdftocairo (part of poppler-utils)')
input("After installing those packages, press Enter to continue...") input("After installing those packages, run install again")
sys.exit(1) self.failed = True
return
target = self.target target = self.target
target = os.path.normpath(os.path.join(os.path.abspath(target))) target = os.path.normpath(os.path.join(os.path.abspath(target)))
if not os.path.exists(target): if not os.path.exists(target):
@ -161,4 +163,5 @@ if __name__ == '__main__':
install = Install(target) install = Install(target)
install.join() install.join()
if not install.failed:
subprocess.call([os.path.join(target, 'ctl'), 'open']) subprocess.call([os.path.join(target, 'ctl'), 'open'])

View file

@ -11,7 +11,7 @@ from sqlalchemy import func
from oxtornado import actions from oxtornado import actions
from utils import cleanup_id from utils import cleanup_id
from websocket import trigger_event from websocket import trigger_event
import metaremote as meta import meta
from . import models from . import models
from . import query from . import query
from .person import get_sort_name from .person import get_sort_name
@ -265,6 +265,9 @@ def getMetadata(data):
response = meta.lookup(key, value) response = meta.lookup(key, value)
if include_edits: if include_edits:
response.update(models.Metadata.load(key, value)) response.update(models.Metadata.load(key, value))
for key in [k['id'] for k in settings.config['itemKeys'] if isinstance(k['type'], list)]:
if key in response and not isinstance(response[key], list):
response[key] = [response[key]]
if response: if response:
response['primaryid'] = [key, value] response['primaryid'] = [key, value]
return response return response

View file

@ -23,7 +23,8 @@ from utils import remove_empty_folders
from websocket import trigger_event from websocket import trigger_event
import db import db
import media import media
import metaremote as meta #import metaremote as meta
import meta
import settings import settings
import state import state
import utils import utils

View file

@ -51,6 +51,9 @@ def lookup_provider(arg):
def lookup(key, value): def lookup(key, value):
if not isvalid_id(key, value): if not isvalid_id(key, value):
return {} return {}
if key == 'isbn':
data = google.info(key, value)
else:
data = {key: [value]} data = {key: [value]}
ids = set([(key, value)]) ids = set([(key, value)])
provider_data = {} provider_data = {}

View file

@ -45,7 +45,7 @@ def info(key, value):
store.delete(url) store.delete(url)
raise IOError(url, r) raise IOError(url, r)
if not 'items' in r: if not 'items' in r:
print('unkown %s: %s [%s]' % (key, value, r)) print('unknown %s: %s [%s]' % (key, value, r))
return {} return {}
_data = r['items'][0]['volumeInfo'] _data = r['items'][0]['volumeInfo']
data = {} data = {}
@ -81,7 +81,9 @@ def info(key, value):
data['isbn'].append(k['identifier']) data['isbn'].append(k['identifier'])
else: else:
print('unknown identifier', k) print('unknown identifier', k)
if 'publisher' in data and isinstance(data['publisher'], str):
data['publisher'] = [data['publisher']]
if 'language' in _data: if 'language' in _data:
data['language'] = get_language(_data['language']) data['language'] = [get_language(_data['language'])]
return data return data