Skip to content
Snippets Groups Projects
Commit e54b7d85 authored by ale's avatar ale
Browse files

Merge branch 'master' of https://git.autistici.org/djrandom

parents 982e5734 a6439c0b
Branches
No related tags found
No related merge requests found
......@@ -8,6 +8,10 @@ from lxml import etree
from djrandom import utils
# A transparent 1x1 JPEG image, used when no album art is found.
NULL_JPEG = '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00H\x00H\x00\x00\xff\xdb\x00C\x00\x03\x02\x02\x02\x02\x02\x03\x02\x02\x02\x03\x03\x03\x03\x04\x06\x04\x04\x04\x04\x04\x08\x06\x06\x05\x06\t\x08\n\n\t\x08\t\t\n\x0c\x0f\x0c\n\x0b\x0e\x0b\t\t\r\x11\r\x0e\x0f\x10\x10\x11\x10\n\x0c\x12\x13\x12\x10\x13\x0f\x10\x10\x10\xff\xc0\x00\x0b\x08\x00\x01\x00\x01\x01\x01\x11\x00\xff\xc4\x00\x14\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\xff\xc4\x00\x14\x10\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xda\x00\x08\x01\x01\x00\x00?\x00T\xdf\xff\xd9'
class AlbumImageDiskCache(object):
"""Cache album art on disk.
......@@ -38,7 +42,8 @@ class AlbumImageDiskCache(object):
return path
def set_negative_match(self, artist, album):
open(self._path(artist, album), 'w').close()
with open(self._path(artist, album), 'w') as fd:
fd.write(NULL_JPEG)
def download(self, artist, album, url):
"""Download url and convert to JPEG."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment