From 588adb70e4d598fa4dfd95d315cfc06e6923008d Mon Sep 17 00:00:00 2001 From: John Schember Date: Mon, 28 Feb 2011 11:44:13 -0500 Subject: [PATCH] Add Kovids Amazon id. --- src/calibre/gui2/store/amazon_plugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/gui2/store/amazon_plugin.py b/src/calibre/gui2/store/amazon_plugin.py index 49e0b98c77..7086cfba8f 100644 --- a/src/calibre/gui2/store/amazon_plugin.py +++ b/src/calibre/gui2/store/amazon_plugin.py @@ -4,6 +4,7 @@ __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' __docformat__ = 'restructuredtext en' +import random import re import urllib2 from contextlib import closing @@ -107,6 +108,9 @@ class AmazonKindleStore(StorePlugin): ''' from calibre.gui2 import open_url aff_id = {'tag': 'josbl0e-cpb-20'} + # Use Kovid's affiliate id 30% of the time. + if random.randint(1, 10) in (1, 2, 3): + aff_id['tag'] = 'calibrebs-20' store_link = 'http://www.amazon.com/Kindle-eBooks/b/?ie=UTF&node=1286228011&ref_=%(tag)s&ref=%(tag)s&tag=%(tag)s&linkCode=ur2&camp=1789&creative=390957' % aff_id if detail_item: aff_id['asin'] = detail_item