mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add uri->url identifiers mapping
This commit is contained in:
parent
f79a70c50a
commit
6dc8803ac5
@ -13,6 +13,7 @@ from Queue import Queue, Empty
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
from urlparse import urlparse
|
||||||
|
|
||||||
from calibre.customize.ui import metadata_plugins, all_metadata_plugins
|
from calibre.customize.ui import metadata_plugins, all_metadata_plugins
|
||||||
from calibre.ebooks.metadata.sources.base import create_log, msprefs
|
from calibre.ebooks.metadata.sources.base import create_log, msprefs
|
||||||
@ -458,6 +459,14 @@ def urls_from_identifiers(identifiers): # {{{
|
|||||||
if oclc:
|
if oclc:
|
||||||
ans.append(('OCLC', 'oclc', oclc,
|
ans.append(('OCLC', 'oclc', oclc,
|
||||||
'http://www.worldcat.org/oclc/'+oclc))
|
'http://www.worldcat.org/oclc/'+oclc))
|
||||||
|
url = identifiers.get('uri', None)
|
||||||
|
if url is None:
|
||||||
|
url = identifiers.get('url', None)
|
||||||
|
if url and url.startswith('http'):
|
||||||
|
url = url[:8].replace('|', ':') + url[8:].replace('|', ',')
|
||||||
|
parts = urlparse(url)
|
||||||
|
name = parts.netloc
|
||||||
|
ans.append((name, 'url', url, url))
|
||||||
return ans
|
return ans
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user