mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
change affiliate links for publio
This commit is contained in:
parent
2db0287724
commit
1c6a40d4b4
@ -1,13 +1,14 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
store_version = 7 # Needed for dynamic plugin loading
|
store_version = 8 # Needed for dynamic plugin loading
|
||||||
|
|
||||||
__license__ = 'GPL 3'
|
__license__ = 'GPL 3'
|
||||||
__copyright__ = '2012-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
__copyright__ = '2012-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
|
from base64 import b64encode
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
|
|
||||||
from lxml import html
|
from lxml import html
|
||||||
@ -25,13 +26,19 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
|||||||
class PublioStore(BasicStoreConfig, StorePlugin):
|
class PublioStore(BasicStoreConfig, StorePlugin):
|
||||||
|
|
||||||
def open(self, parent=None, detail_item=None, external=False):
|
def open(self, parent=None, detail_item=None, external=False):
|
||||||
google_analytics = '?utm_source=tdcalibre&utm_medium=calibre'
|
aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/29/58/'
|
||||||
url = 'http://www.publio.pl/' + google_analytics
|
url = 'http://www.publio.pl/'
|
||||||
|
|
||||||
|
aff_url = aff_root + str(b64encode(url))
|
||||||
|
|
||||||
|
detail_url = None
|
||||||
|
if detail_item:
|
||||||
|
detail_url = aff_root + str(b64encode(detail_item))
|
||||||
|
|
||||||
if external or self.config.get('open_external', False):
|
if external or self.config.get('open_external', False):
|
||||||
open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
|
open_url(QUrl(url_slash_cleaner(detail_url if detail_url else aff_url)))
|
||||||
else:
|
else:
|
||||||
d = WebStoreDialog(self.gui, url, parent, detail_item if detail_item else url)
|
d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url)
|
||||||
d.setWindowTitle(self.name)
|
d.setWindowTitle(self.name)
|
||||||
d.set_tags(self.config.get('tags', ''))
|
d.set_tags(self.config.get('tags', ''))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user