regluit/core/links.py

17 lines
564 B
Python
Raw Normal View History

2017-08-16 19:46:19 +00:00
ID_URLS = {
'goog': u'https://books.google.com/books?id={}',
'olwk': u'https://openlibrary.org{}',
'gdrd': u'https://www.goodreads.com/book/show/{}',
'ltwk': u'https://librarything.com/work/{}',
'oclc': u'https://www.worldcat.org/oclc/{}',
'doi': u'https://doi.org/{}',
'gtbg': u'https://gutenberg.org/ebooks/{}',
'glue': u'https://unglue.it/work/{}',
}
def id_url(id_type, id_value):
url_string = ID_URLS.get(id_type, None)
if url_string and id_value:
return url_string.format(id_value)
else:
return ''