fix glue resolution
parent
489790fa2f
commit
f9d31b0f51
|
@ -334,13 +334,13 @@ def loaded_book_ok(book, work, edition):
|
||||||
|
|
||||||
ID_URLPATTERNS = {
|
ID_URLPATTERNS = {
|
||||||
'goog': re.compile(r'[\./]google\.com/books\?.*id=([a-zA-Z0-9\-_]{12})'),
|
'goog': re.compile(r'[\./]google\.com/books\?.*id=([a-zA-Z0-9\-_]{12})'),
|
||||||
'olwk': re.compile(r'[\./]openlibrary\.org(/works/OL\d{1-8}W)'),
|
'olwk': re.compile(r'[\./]openlibrary\.org(/works/OL\d{1,8}W)'),
|
||||||
'gdrd': re.compile(r'[\./]goodreads\.com/book/show/(\d{1-8})'),
|
'gdrd': re.compile(r'[\./]goodreads\.com/book/show/(\d{1,8})'),
|
||||||
'ltwk': re.compile(r'[\./]librarything\.com/work/(\d{1-8})'),
|
'ltwk': re.compile(r'[\./]librarything\.com/work/(\d{1,8})'),
|
||||||
'oclc': re.compile(r'\.worldcat\.org/.*oclc/(\d{8-12})'),
|
'oclc': re.compile(r'\.worldcat\.org/.*oclc/(\d{8,12})'),
|
||||||
'doi': re.compile(r'[\./]doi\.org/(10\.\d+/\S+)'),
|
'doi': re.compile(r'[\./]doi\.org/(10\.\d+/\S+)'),
|
||||||
'gtbg': re.compile(r'[\./]gutenberg\.org/ebooks/(\d{1-6})'),
|
'gtbg': re.compile(r'[\./]gutenberg\.org/ebooks/(\d{1,6})'),
|
||||||
'glue': re.compile(r'[\./]unglue\.it/work/(\d{1-7})'),
|
'glue': re.compile(r'[\./]unglue\.it/work/(\d{1,7})'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def ids_from_urls(url):
|
def ids_from_urls(url):
|
||||||
|
|
|
@ -99,6 +99,13 @@ def get_edition_for_id(id_type, id_value):
|
||||||
if edition:
|
if edition:
|
||||||
return edition
|
return edition
|
||||||
|
|
||||||
|
if identifiers.has_key('glue'):
|
||||||
|
try:
|
||||||
|
work = models.safe_get_work(identifiers['glue'])
|
||||||
|
return work.preferred_edition
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if identifiers.has_key('http'):
|
if identifiers.has_key('http'):
|
||||||
edition = add_by_webpage(identifiers['http'])
|
edition = add_by_webpage(identifiers['http'])
|
||||||
return edition
|
return edition
|
||||||
|
|
Loading…
Reference in New Issue