Few fixes
This commit is contained in:
parent
538bbe5a05
commit
99eed82b3d
@ -277,6 +277,7 @@ def load_config(args=None, check_with_data=True):
|
|||||||
LOGGER.info("Creating data directory according to config: %s",
|
LOGGER.info("Creating data directory according to config: %s",
|
||||||
config_data["data_directory"])
|
config_data["data_directory"])
|
||||||
os.makedirs(config_data["data_directory"])
|
os.makedirs(config_data["data_directory"])
|
||||||
|
os.makedirs(os.path.join(config_data["data_directory"], "images"))
|
||||||
|
|
||||||
if config_data["database"] is None:
|
if config_data["database"] is None:
|
||||||
config_data["database"] = "sqlite:///" + os.path.join(
|
config_data["database"] = "sqlite:///" + os.path.join(
|
||||||
|
@ -86,7 +86,14 @@ class ImageCache(MemoryCache):
|
|||||||
"""
|
"""
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def compute_filename(url):
|
def compute_filename(url):
|
||||||
return hashlib.sha1(url.encode("utf-8")).hexdigest()
|
"""
|
||||||
|
Compute filename (hash of the URL) for the cached image.
|
||||||
|
|
||||||
|
:param url: The URL of the image.
|
||||||
|
:return: The filename, with its extension.
|
||||||
|
"""
|
||||||
|
# Always store as JPEG
|
||||||
|
return "%s.jpg" % hashlib.sha1(url.encode("utf-8")).hexdigest()
|
||||||
|
|
||||||
def on_miss(self, url):
|
def on_miss(self, url):
|
||||||
"""
|
"""
|
||||||
|
@ -17,7 +17,10 @@ LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def download_images(flats_list, config):
|
def download_images(flats_list, config):
|
||||||
"""
|
"""
|
||||||
TODO
|
Download images for all flats in the list, to serve them locally.
|
||||||
|
|
||||||
|
:param flats_list: A list of flats dicts.
|
||||||
|
:param config: A config dict.
|
||||||
"""
|
"""
|
||||||
photo_cache = ImageCache(
|
photo_cache = ImageCache(
|
||||||
storage_dir=os.path.join(config["data_directory"], "images")
|
storage_dir=os.path.join(config["data_directory"], "images")
|
||||||
|
Loading…
Reference in New Issue
Block a user