Use Kovid's affiliate id 30% of the time

This commit is contained in:
Alex Stanev 2011-07-22 17:42:03 +03:00
parent 029e238228
commit f45c317a69

View File

@ -6,6 +6,7 @@ __license__ = 'GPL 3'
__copyright__ = '2011, Alex Stanev <alex@stanev.org>' __copyright__ = '2011, Alex Stanev <alex@stanev.org>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import random
import urllib2 import urllib2
from contextlib import closing from contextlib import closing
@ -23,10 +24,12 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
class eKnigiStore(BasicStoreConfig, StorePlugin): class eKnigiStore(BasicStoreConfig, StorePlugin):
def open(self, parent=None, detail_item=None, external=False): def open(self, parent=None, detail_item=None, external=False):
#url = 'http://e-knigi.net/?amigosid=22' # Use Kovid's affiliate id 30% of the time
#aff_suffix = '&amigosid=22' if random.randint(1, 10) in (1, 2, 3):
url = 'http://e-knigi.net' aff_suffix = '&amigosid=23'
aff_suffix = '' else:
aff_suffix = '&amigosid=22'
url = 'http://e-knigi.net/?' + aff_suffix[1:]
if external or self.config.get('open_external', False): if external or self.config.get('open_external', False):
if detail_item: if detail_item: