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/'
status = {}
failed = False
def __init__(self, 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')
if 'poppler' in apt_packages:
print('You need to install pdftocairo (part of poppler-utils)')
input("After installing those packages, press Enter to continue...")
sys.exit(1)
input("After installing those packages, run install again")
self.failed = True
return
target = self.target
target = os.path.normpath(os.path.join(os.path.abspath(target)))
if not os.path.exists(target):
@ -161,4 +163,5 @@ if __name__ == '__main__':
install = Install(target)
install.join()
if not install.failed:
subprocess.call([os.path.join(target, 'ctl'), 'open'])

View file

@ -11,7 +11,7 @@ from sqlalchemy import func
from oxtornado import actions
from utils import cleanup_id
from websocket import trigger_event
import metaremote as meta
import meta
from . import models
from . import query
from .person import get_sort_name
@ -265,6 +265,9 @@ def getMetadata(data):
response = meta.lookup(key, value)
if include_edits:
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:
response['primaryid'] = [key, value]
return response

View file

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

View file

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

View file

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