Skip to content

Commit

Permalink
Merge branch 'python3-dev'
Browse files Browse the repository at this point in the history
FIX:(mylar3#1463) Truncated image retrieval check - if failure, will retrieve alternate image quality
FIX:(mylar3#1469) incorrect logger reference causing traceback on SAB snatches that are completed quickly
FIX:(mylar3#1471) pillow check so it's case-insensitive (went from Pillow to pillow)
FIX: Move gzip header to fix tempermental ddl (@scooterpsu)
FIX: requirements -> bump versions for cheroot (>8.2.1) and pillow (>10.1 due to python3.12 not working on less than this verison)
  • Loading branch information
evilhero committed Jan 16, 2024
2 parents f9bd3ba + 2c8aa15 commit efff50d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion mylar/getcomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ def downloadit(self, id, link, mainlink, resume=None, issueid=None, remote_files
myDB = db.DBConnection()
filename = None
self.cookie_receipt()
self.headers['Accept-encoding'] = 'gzip'
#self.headers['Accept-encoding'] = 'gzip'
try:
with requests.Session() as s:
if resume is not None:
Expand Down Expand Up @@ -956,6 +956,7 @@ def downloadit(self, id, link, mainlink, resume=None, issueid=None, remote_files
stream=True,
timeout=(30,10)
)
t.headers['Accept-encoding'] = 'gzip'
filename = os.path.basename(
urllib.parse.unquote(t.url)
) # .decode('utf-8'))
Expand Down
9 changes: 9 additions & 0 deletions mylar/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from urllib.parse import urljoin
from io import StringIO
from apscheduler.triggers.interval import IntervalTrigger
from PIL import Image

import mylar
from . import logger
Expand Down Expand Up @@ -4167,6 +4168,14 @@ def getImage(comicid, url, issueid=None, thumbnail_path=None, apicall=False):
statinfo = os.stat(coverfile)
coversize = statinfo.st_size

#quick test for image integrity
try:
im = Image.open(coverfile)
except OSError as e:
logger.warn('Truncated image retrieved - trying alternate image file.')
return {'coversize': coversize,
'status': 'retry'}

return {'coversize': coversize,
'status': 'success'}

Expand Down
4 changes: 3 additions & 1 deletion mylar/req_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def check_the_pip(self):
for rq in self.req_list:
version_match = False
for pl in self.pip_list:
if re.sub('[\-\_]', '', rq['module']).strip() == re.sub('[\-\_]', '', pl['module']).strip():
if re.sub('[\-\_]', '', rq['module'].lower()).strip() == re.sub('[\-\_]', '', pl['module'].lower()).strip():
if parse_version(pl['version']) == parse_version(rq['version']):
version_match = 'OK'
elif parse_version(pl['version']) < parse_version(rq['version']):
Expand Down Expand Up @@ -145,6 +145,8 @@ def check_the_pip(self):
targ = '<'
elif x['arg'] == '<=':
targ = '>'
else:
targ = '='
pip_message = "%s installed %s %s required" % (x['pip_version'], targ, x['req_version'])
else:
pip_message = "%s %s" % (x['req_version'], x['pip_version'])
Expand Down
2 changes: 1 addition & 1 deletion mylar/sabnzbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def processor(self):
queueinfo = queueresponse['queue']['slots'][0]
logger.info('monitoring ... detected download - %s [%s]' % (queueinfo['filename'], queueinfo['status']))
except Exception as e:
logger.warning('unable to locate item within sabnzbd active queue - it could be finished already?')
logger.warn('Unable to locate item within sabnzbd active queue - it could be finished already?')
queueinfo = queueresponse['queue']
try:
logger.fdebug('SABnzbd Queued item status : %s' % queueinfo['status'])
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
APScheduler>=3.6.3
beautifulsoup4>=4.8.2
cfscrape>=2.0.8
cheroot==8.2.1
cheroot>=8.2.1
CherryPy>=18.5.0
configparser>=4.0.2
feedparser>=5.2.1
Mako>=1.1.0
natsort>=3.5.2
Pillow>=8
Pillow>=10.1
portend>=2.6
pystun>=0.1.0
pytz>=2019.3
Expand Down

0 comments on commit efff50d

Please sign in to comment.