mirror of https://gitlab.com/bashrc2/epicyon
Favicon path
parent
2e681f5b58
commit
e1b349c0fc
|
@ -7411,7 +7411,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
baseDir: str, GETstartTime) -> None:
|
baseDir: str, GETstartTime) -> None:
|
||||||
"""Shows a favicon image obtained from the cache
|
"""Shows a favicon image obtained from the cache
|
||||||
"""
|
"""
|
||||||
mediaFilename = baseDir + '/favicons' + path
|
mediaFilename = baseDir + path
|
||||||
if os.path.isfile(mediaFilename):
|
if os.path.isfile(mediaFilename):
|
||||||
if self._etag_exists(mediaFilename):
|
if self._etag_exists(mediaFilename):
|
||||||
# The file has not changed
|
# The file has not changed
|
||||||
|
|
|
@ -147,16 +147,16 @@ def _downloadNewswireFeedFavicon(session, baseDir: str,
|
||||||
link: str, debug: bool) -> bool:
|
link: str, debug: bool) -> bool:
|
||||||
"""Downloads the favicon for the given feed link
|
"""Downloads the favicon for the given feed link
|
||||||
"""
|
"""
|
||||||
url = getNewswireFaviconUrl(link)
|
favUrl = getNewswireFaviconUrl(link)
|
||||||
if '://' not in link:
|
if '://' not in link:
|
||||||
return False
|
return False
|
||||||
timeoutSec = 10
|
timeoutSec = 10
|
||||||
imageData = getImageBinaryFromUrl(session, url, timeoutSec, debug)
|
imageData = getImageBinaryFromUrl(session, favUrl, timeoutSec, debug)
|
||||||
if not imageData:
|
if not imageData:
|
||||||
return False
|
return False
|
||||||
if not os.path.isdir(baseDir + '/favicons'):
|
if not os.path.isdir(baseDir + '/favicons'):
|
||||||
os.mkdir(baseDir + '/favicons')
|
os.mkdir(baseDir + '/favicons')
|
||||||
linkFilename = url.replace('/', '#')
|
linkFilename = favUrl.replace('/', '#')
|
||||||
imageFilename = baseDir + '/favicons/' + linkFilename
|
imageFilename = baseDir + '/favicons/' + linkFilename
|
||||||
if os.path.isfile(imageFilename):
|
if os.path.isfile(imageFilename):
|
||||||
return True
|
return True
|
||||||
|
@ -164,7 +164,7 @@ def _downloadNewswireFeedFavicon(session, baseDir: str,
|
||||||
with open(imageFilename, 'wb+') as fp:
|
with open(imageFilename, 'wb+') as fp:
|
||||||
fp.write(imageData)
|
fp.write(imageData)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: failed writing favicon ' + url)
|
print('EX: failed writing favicon ' + favUrl)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue