ASCII media support - Fixes
- Added debug logging in - mediagoblin.processing - mediagoblin.media_types.ascii.processing - mediagoblin.media_types.ascii.asciitoimage
This commit is contained in:
parent
010d28b4f0
commit
64da09e86a
@ -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))
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user