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, ___
# `-.,.-.,.-.-.,.-.--' ' `
- 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')
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))
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)
# 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
from mediagoblin.media_types import get_media_manager
+_log = logging.getLogger(__name__)
THUMB_SIZE = 180, 180
MEDIUM_SIZE = 640, 640
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()