diff options
author | Joar Wandborg <git@wandborg.com> | 2012-02-04 20:51:05 +0100 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-02-04 20:51:05 +0100 |
commit | 64da09e86a755e49832e3c324582c65d352632d4 (patch) | |
tree | e846691fdd6cd79dafe03c9760af3e92148632d8 /mediagoblin | |
parent | 010d28b4f0a39103949692209106a1b47fceeaf2 (diff) | |
download | mediagoblin-64da09e86a755e49832e3c324582c65d352632d4.tar.lz mediagoblin-64da09e86a755e49832e3c324582c65d352632d4.tar.xz mediagoblin-64da09e86a755e49832e3c324582c65d352632d4.zip |
ASCII media support - Fixes
- Added debug logging in
- mediagoblin.processing
- mediagoblin.media_types.ascii.processing
- mediagoblin.media_types.ascii.asciitoimage
Diffstat (limited to 'mediagoblin')
-rw-r--r-- | mediagoblin/media_types/ascii/asciitoimage.py | 11 | ||||
-rw-r--r-- | mediagoblin/media_types/ascii/processing.py | 1 | ||||
-rw-r--r-- | mediagoblin/processing.py | 12 |
3 files changed, 18 insertions, 6 deletions
diff --git a/mediagoblin/media_types/ascii/asciitoimage.py b/mediagoblin/media_types/ascii/asciitoimage.py index 186d8066..e1c4fb44 100644 --- a/mediagoblin/media_types/ascii/asciitoimage.py +++ b/mediagoblin/media_types/ascii/asciitoimage.py @@ -59,15 +59,15 @@ class AsciiToImage(object): if kw.get('font_size'): self._font_size = kw.get('font_size') - _log.info('Setting font to {0}, size {1}'.format( - self._font, - self._font_size)) - self._if = ImageFont.truetype( self._font, self._font_size, encoding='unic') + _log.info('Font set to {0}, size {1}'.format( + self._font, + self._font_size)) + # ,-,-^-'-^'^-^'^-'^-. # ( I am a wall socket )Oo, ___ # `-.,.-.,.-.-.,.-.--' ' ` @@ -92,6 +92,7 @@ class AsciiToImage(object): - Character set detection and decoding, http://pypi.python.org/pypi/chardet ''' + _log.debug('Drawing image') # Convert the input from str to unicode text = text.decode('utf-8') @@ -128,7 +129,7 @@ class AsciiToImage(object): px_pos = self._px_pos(char_pos) _log.debug('Writing character "{0}" at {1} (px pos {2})'.format( - char, + char.encode('ascii', 'replace'), char_pos, px_pos)) diff --git a/mediagoblin/media_types/ascii/processing.py b/mediagoblin/media_types/ascii/processing.py index 96dfce80..837b9830 100644 --- a/mediagoblin/media_types/ascii/processing.py +++ b/mediagoblin/media_types/ascii/processing.py @@ -72,6 +72,7 @@ def process_ascii(entry): thumb.thumbnail(THUMB_SIZE, Image.ANTIALIAS) thumb.save(thumb_file) + _log.debug('Copying local file to public storage') mgg.public_store.copy_local_to_storage( tmp_thumb_filename, thumb_filepath) diff --git a/mediagoblin/processing.py b/mediagoblin/processing.py index 4f1bf61b..9e57380d 100644 --- a/mediagoblin/processing.py +++ b/mediagoblin/processing.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import logging + from celery.task import Task from mediagoblin.db.util import ObjectId @@ -23,6 +25,7 @@ from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ from mediagoblin.media_types import get_media_manager +_log = logging.getLogger(__name__) THUMB_SIZE = 180, 180 MEDIUM_SIZE = 640, 640 @@ -57,12 +60,19 @@ class ProcessMedia(Task): try: #__import__(entry.media_type) manager = get_media_manager(entry.media_type) + _log.debug('Processing {0}'.format(entry)) manager['processor'](entry) except BaseProcessingFail, exc: mark_entry_failed(entry._id, exc) return except ImportError, exc: - mark_entry_failed(entry[u'_id'], exc) + _log.error( + 'Entry {0} failed to process due to an import error: {1}'\ + .format( + entry.title, + exc)) + + mark_entry_failed(entry._id, exc) entry.state = u'processed' entry.save() |