Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 477684 | Differences between
and this patch

Collapse All | Expand All

(-)lazylibrarian/__init__.py (-3 / +3 lines)
Lines 258-266 Link Here
258
        logger.lazylibrarian_log.initLogger(loglevel=LOGLEVEL)
258
        logger.lazylibrarian_log.initLogger(loglevel=LOGLEVEL)
259
259
260
        # Clearing cache
260
        # Clearing cache
261
        if os.path.exists(".ProviderCache"):
261
        if os.path.exists("/var/lazylibrarian/cache/.ProviderCache"):
262
            for f in os.listdir(".ProviderCache"):
262
            for f in os.listdir("/var/lazylibrarian/cache/.ProviderCache"):
263
                os.unlink("%s/%s" % (".ProviderCache", f))
263
                os.unlink("%s/%s" % ("/var/lazylibrarian/cache/.ProviderCache", f))
264
        # Clearing throttling timeouts
264
        # Clearing throttling timeouts
265
        t = SimpleCache.ThrottlingProcessor()
265
        t = SimpleCache.ThrottlingProcessor()
266
        t.lastRequestTime.clear()
266
        t.lastRequestTime.clear()
(-)lazylibrarian/gr.py (-6 / +6 lines)
Lines 22-28 Link Here
22
22
23
        # Cache our request
23
        # Cache our request
24
        request = urllib2.Request(URL)
24
        request = urllib2.Request(URL)
25
        opener = urllib2.build_opener(SimpleCache.CacheHandler(".AuthorCache"), SimpleCache.ThrottlingProcessor(5))
25
        opener = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.AuthorCache"), SimpleCache.ThrottlingProcessor(5))
26
        resp = opener.open(request)
26
        resp = opener.open(request)
27
27
28
        try:
28
        try:
Lines 53-59 Link Here
53
53
54
        # Cache our request
54
        # Cache our request
55
        request = urllib2.Request(URL)
55
        request = urllib2.Request(URL)
56
        opener = urllib2.build_opener(SimpleCache.CacheHandler(".AuthorCache"), SimpleCache.ThrottlingProcessor(5))
56
        opener = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.AuthorCache"), SimpleCache.ThrottlingProcessor(5))
57
        resp = opener.open(request)
57
        resp = opener.open(request)
58
58
59
        try:
59
        try:
Lines 87-93 Link Here
87
        try:
87
        try:
88
            # Cache our request
88
            # Cache our request
89
            request = urllib2.Request(URL)
89
            request = urllib2.Request(URL)
90
            opener = urllib2.build_opener(SimpleCache.CacheHandler(".AuthorCache"), SimpleCache.ThrottlingProcessor(5))
90
            opener = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.AuthorCache"), SimpleCache.ThrottlingProcessor(5))
91
            resp = opener.open(request)
91
            resp = opener.open(request)
92
            sourcexml = ElementTree.parse(resp)
92
            sourcexml = ElementTree.parse(resp)
93
        except Exception, e:
93
        except Exception, e:
Lines 141-147 Link Here
141
							try:
141
							try:
142
							    # Cache our request
142
							    # Cache our request
143
							    request = urllib2.Request(BOOK_URL)
143
							    request = urllib2.Request(BOOK_URL)
144
							    opener = urllib2.build_opener(SimpleCache.CacheHandler(".AuthorCache"), SimpleCache.ThrottlingProcessor(5))
144
							    opener = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.AuthorCache"), SimpleCache.ThrottlingProcessor(5))
145
							    resp = opener.open(request)
145
							    resp = opener.open(request)
146
							except Exception, e:
146
							except Exception, e:
147
							    logger.error("Error finding results: ", e)
147
							    logger.error("Error finding results: ", e)
Lines 205-211 Link Here
205
				try:
205
				try:
206
				    # Cache our request
206
				    # Cache our request
207
				    request1 = urllib2.Request(URL)
207
				    request1 = urllib2.Request(URL)
208
				    opener1 = urllib2.build_opener(SimpleCache.CacheHandler(".AuthorCache"), SimpleCache.ThrottlingProcessor(5))
208
				    opener1 = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.AuthorCache"), SimpleCache.ThrottlingProcessor(5))
209
				    resp1 = opener1.open(request1)
209
				    resp1 = opener1.open(request1)
210
				except Exception, e:
210
				except Exception, e:
211
				    logger.error("Error finding results: " + str(e))				
211
				    logger.error("Error finding results: " + str(e))				
Lines 234-240 Link Here
234
            try:
234
            try:
235
                # Cache our request
235
                # Cache our request
236
                request = urllib2.Request(set_url)
236
                request = urllib2.Request(set_url)
237
                opener = urllib2.build_opener(SimpleCache.CacheHandler(".AuthorCache"), SimpleCache.ThrottlingProcessor(5))
237
                opener = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.AuthorCache"), SimpleCache.ThrottlingProcessor(5))
238
                resp = opener.open(request)
238
                resp = opener.open(request)
239
                sourcexml = ElementTree.parse(resp)
239
                sourcexml = ElementTree.parse(resp)
240
            except Exception, e:
240
            except Exception, e:
(-)lazylibrarian/providers.py (-1 / +1 lines)
Lines 42-48 Link Here
42
    try :
42
    try :
43
        request = urllib2.Request(URL)
43
        request = urllib2.Request(URL)
44
        request.add_header('User-Agent', 'lazylibrary/0.0 +https://github.com/herman-rogers/LazyLibrarian-1')
44
        request.add_header('User-Agent', 'lazylibrary/0.0 +https://github.com/herman-rogers/LazyLibrarian-1')
45
        opener = urllib2.build_opener(SimpleCache.CacheHandler(".ProviderCache"), SimpleCache.ThrottlingProcessor(5))
45
        opener = urllib2.build_opener(SimpleCache.CacheHandler("/var/lazylibrarian/cache/.ProviderCache"), SimpleCache.ThrottlingProcessor(5))
46
        resp = opener.open(request)
46
        resp = opener.open(request)
47
47
48
        try:
48
        try:
(-)lazylibrarian/searchnzb.py (-3 / +3 lines)
Lines 23-31 Link Here
23
        searchbooks = myDB.select('SELECT BookID, AuthorName, Bookname from books WHERE Status="Wanted"')
23
        searchbooks = myDB.select('SELECT BookID, AuthorName, Bookname from books WHERE Status="Wanted"')
24
24
25
        # Clear cache
25
        # Clear cache
26
        if os.path.exists(".ProviderCache"):
26
        if os.path.exists("/var/lazylibrarian/cache/.ProviderCache"):
27
            for f in os.listdir(".ProviderCache"):
27
            for f in os.listdir("/var/lazylibrarian/cache/.ProviderCache"):
28
                os.unlink("%s/%s" % (".ProviderCache", f))
28
                os.unlink("%s/%s" % ("/var/lazylibrarian/cache/.ProviderCache", f))
29
29
30
        # Clearing throttling timeouts
30
        # Clearing throttling timeouts
31
        t = SimpleCache.ThrottlingProcessor()
31
        t = SimpleCache.ThrottlingProcessor()

Return to bug 477684