From b2baaf41914a76205e9844d85af685753e80ad40 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Mon, 4 Oct 2021 19:35:55 +0000 Subject: [PATCH] Do not render icos accidentally Removed unused imports --- imgin/__init__.py | 2 +- imgin/get.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/imgin/__init__.py b/imgin/__init__.py index 011b4f6..a067648 100644 --- a/imgin/__init__.py +++ b/imgin/__init__.py @@ -13,7 +13,7 @@ from bottle import static_file from bottle import SimpleTemplate from .get import get -from .config import IMAGE_CACHE, SINGLE_IMAGE_DELETE_AFTER_SECS, ALBUM_DELETE_AFTER_SECS, template_dir +from .config import IMAGE_CACHE, template_dir def get_timestamp_of_file(file): diff --git a/imgin/get.py b/imgin/get.py index 03631f2..d7de595 100644 --- a/imgin/get.py +++ b/imgin/get.py @@ -1,5 +1,4 @@ import sys -from shutil import rmtree from os import remove from threading import Thread @@ -7,7 +6,7 @@ import requests import bs4 from gevent import sleep -from .config import SINGLE_IMAGE_DELETE_AFTER_SECS, ALBUM_DELETE_AFTER_SECS +from .config import SINGLE_IMAGE_DELETE_AFTER_SECS def delete_file(path): sleep(SINGLE_IMAGE_DELETE_AFTER_SECS) @@ -52,6 +51,8 @@ def get(url: str, write_dir: str, delete=True): except KeyError: error("Could not obtain url for detected image") continue + if found_url.endswith('ico.jpg'): + continue print(f"Downloading image {count}: {found_url}") print("Writing image", f"{write_dir}{found_url[-11:]}")