From 7f05b923abdd127254961bdbb6a6287cd6460490 Mon Sep 17 00:00:00 2001 From: Daniel Grana Date: Fri, 28 Nov 2008 16:18:03 +0000 Subject: [PATCH] s3 images pipeline: dont include path prefix in key name --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40449 --- scrapy/trunk/scrapy/contrib/pipeline/s3images.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scrapy/trunk/scrapy/contrib/pipeline/s3images.py b/scrapy/trunk/scrapy/contrib/pipeline/s3images.py index e64ddadec..d5ef63614 100644 --- a/scrapy/trunk/scrapy/contrib/pipeline/s3images.py +++ b/scrapy/trunk/scrapy/contrib/pipeline/s3images.py @@ -48,7 +48,7 @@ class S3ImagesPipeline(BaseImagesPipeline): MediaPipeline.__init__(self) def s3request(self, key, method, body=None, headers=None): - url = 'http://%s.s3.amazonaws.com/%s' % (self.bucket_name, key) + url = 'http://%s.s3.amazonaws.com/%s%s' % (self.bucket_name, self.prefix, key) req = Request(url, method=method, body=body, headers=headers) sign_request(req, self.access_key, self.secret_key) return req @@ -71,14 +71,14 @@ class S3ImagesPipeline(BaseImagesPipeline): downloaded to. """ image_guid = hashlib.sha1(url).hexdigest() - return '%s/full/%s.jpg' % (self.prefix, image_guid) + return 'full/%s.jpg' % (image_guid) def s3_thumb_key(self, url, thumb_id): """Return the relative path on the target filesystem for an image to be downloaded to. """ image_guid = hashlib.sha1(url).hexdigest() - return '%s/thumbs/%s/%s.jpg' % (self.prefix, thumb_id, image_guid) + return 'thumbs/%s/%s.jpg' % (thumb_id, image_guid) def media_to_download(self, request, info): """Return if the image should be downloaded by checking if it's already in