diff --git a/CHANGES.md b/CHANGES.md index 7ba8053..281caf6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,10 @@ -### 0.23.19 (2020-05-05 21:40:00 UTC) +### 0.23.20 (2020-05-13 18:35:00 UTC) + +* Fix restart to release and free resources from previous run process +* Change fanart lib to get_url + + +### 0.23.19 (2020-05-05 21:40:00 UTC) * Fix MoreThan provider and add provider option only allow releases that are site trusted * Add Python 3.9 to Travis diff --git a/lib/fanart/core.py b/lib/fanart/core.py index da972e6..24f7274 100644 --- a/lib/fanart/core.py +++ b/lib/fanart/core.py @@ -1,9 +1,9 @@ -import requests import re import lib.fanart as fanart from bs4_parser import BS4Parser from exceptions_helper import ex from .errors import ResponseFanartError +from sg_helpers import get_url class Request(object): @@ -22,12 +22,11 @@ class Request(object): def response(self): try: - response = requests.get(str(self)) - rjson = response.json() + rjson = get_url(str(self), parse_json=True) image_type = self._types or u'showbackground' rhtml = self.scrape_web(image_type) if not isinstance(rjson, dict) and 0 == len(rhtml[image_type]): - raise Exception(response.text) + raise Exception(rjson) if not isinstance(rjson, dict): rjson = {image_type: []} @@ -49,11 +48,11 @@ class Request(object): def scrape_web(self, image_type): try: - data = requests.get(self._web_url % self._tvdb_id) + data = get_url(self._web_url % self._tvdb_id) if not data: return - with BS4Parser(data.text, parse_only=dict(ul={'class': 'artwork %s' % image_type})) as ul_item: + with BS4Parser(data, parse_only=dict(ul={'class': 'artwork %s' % image_type})) as ul_item: li_items = ul_item('li') if li_items: image_urls = {image_type: []} diff --git a/lib/fanart/items.py b/lib/fanart/items.py index 6dec2bc..d94cf5f 100644 --- a/lib/fanart/items.py +++ b/lib/fanart/items.py @@ -1,8 +1,8 @@ import json import os -import requests from .core import Request from .immutable import Immutable +from sg_helpers import get_url class LeafItem(Immutable): @@ -26,7 +26,7 @@ class LeafItem(Immutable): @Immutable.mutablemethod def content(self): if not self._content: - self._content = requests.get(self.url).content + self._content = get_url(self.url) return self._content def __str__(self): diff --git a/sickgear.py b/sickgear.py index 61a6f5b..20e3afe 100755 --- a/sickgear.py +++ b/sickgear.py @@ -709,7 +709,7 @@ class SickGear(object): logger.close() from _23 import Popen with Popen(popen_list, cwd=os.getcwd()): - pass + self.exit(0) # system exit self.exit(0)