mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
B&N affiliate code.
This commit is contained in:
parent
602f7d11ac
commit
1866e1e19a
@ -6,6 +6,7 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
|
||||
@ -24,7 +25,13 @@ class BNStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def open(self, parent=None, detail_item=None, external=False):
|
||||
settings = self.get_settings()
|
||||
url = 'http://www.barnesandnoble.com/ebooks/index.asp'
|
||||
url = 'http://gan.doubleclick.net/gan_click?lid=41000000028437369&pubid=21000000000352219'
|
||||
|
||||
if detail_item:
|
||||
mo = re.search(r'(?<=/)(?P<isbn>\d+)(?=/|$)', detail_item)
|
||||
if mo:
|
||||
isbn = mo.group('isbn')
|
||||
detail_item = 'http://gan.doubleclick.net/gan_click?lid=41000000012871747&pid=' + isbn + '&adurl=' + detail_item + '&pubid=21000000000352219'
|
||||
|
||||
if external or settings.get(self.name + '_open_external', False):
|
||||
open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user