11from __future__ import (unicode_literals , division , absolute_import , print_function )
22
33from calibre .customize import StoreBase
4+ from calibre .devices .usbms .driver import debug_print
45from calibre .gui2 import open_url
56from calibre .gui2 .store import StorePlugin
67from calibre .gui2 .store .search_result import SearchResult
@@ -25,8 +26,8 @@ def genesis(self):
2526 '''
2627 Initialize the Libgen Client
2728 '''
29+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:genesis' )
2830
29- print ('LibgenStore:genesis: Initializing self.libgen' )
3031 self .libgen = LibgenFictionClient ()
3132
3233 def search (self , query , max_results = 10 , timeout = 60 ):
@@ -35,15 +36,19 @@ def search(self, query, max_results=10, timeout=60):
3536 downloads, it should not provide these as `s.downloads`.
3637 '''
3738
38- print ('LibgenStore:search: query = ' , query )
39+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:search:query =' ,
40+ query )
3941
4042 libgen_results = self .libgen .search (query )
4143
4244 for result in libgen_results .results [:min (max_results , len (libgen_results .results ))]:
43- print ('LibgenStore:search: result.title = ' , result .title )
45+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:search:'
46+ 'result.title =' ,
47+ result .title )
4448
4549 for mirror in result .mirrors [0 :1 ]: # Calibre only shows 1 anyway
46- print ('LibgenStore:search: result.mirror.url = ' , mirror .url )
50+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:search:'
51+ 'result.mirror.url =' , mirror .url )
4752
4853 s = SearchResult ()
4954
@@ -58,7 +63,8 @@ def search(self, query, max_results=10, timeout=60):
5863 s .formats = mirror .format
5964 s .plugin_author = PLUGIN_AUTHORS
6065
61- print ('LibgenStore:search: s = ' , s , sep = '\n ' )
66+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:search:s =' ,
67+ s )
6268
6369 yield s
6470
@@ -67,15 +73,17 @@ def open(self, parent=None, detail_item=None, external=False):
6773 Open the specified item in the external, or Calibre's browser
6874 '''
6975
70- print ('LibgenStore:open: locals() = ' , locals ())
76+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:open:locals() =' ,
77+ locals ())
7178
7279 detail_url = (
7380 self .libgen .get_detail_url (detail_item )
7481 if detail_item
7582 else self .libgen .base_url
7683 )
7784
78- print ('LibgenStore:open: detail_url = ' , detail_url )
85+ debug_print ('Libgen Fiction::__init__.py:LibgenStore:open:detail_url =' ,
86+ detail_url )
7987
8088 if external or self .config .get ('open_external' , False ):
8189 open_url (QUrl (detail_url ))
0 commit comments