@task(time_limit=time_limits['hard'], soft_time_limit=time_limits['soft'])
def resize_video(src, pk, user_pk=None, **kw):
 instance = Preview.objects.get(pk=pk)
 user = (UserProfile.objects.get(pk=user_pk) if user_pk else None)
 try:
  copy_stored_file(src, src, src_storage=private_storage, dst_storage=local_storage)
  result = _resize_video(src, instance, **kw)
 except Exception as err:
  log.error(('Error on processing video: %s' % err))
  _resize_error(src, instance, user)
  raise
 if (not result):
  log.error('Error on processing video, _resize_video not True.')
  _resize_error(src, instance, user)
 log.info('Video resize complete.')
 instance.addon.update(modified=datetime.datetime.now())

@ task ( time_limit = time_limits [ 'hard' ] , soft_time_limit = time_limits [ 'soft' ] ) def resize_video ( src , pk , user_pk = None , ** kw ) : instance = Preview . objects . get ( pk = pk ) user = ( UserProfile . objects . get ( pk = user_pk ) if user_pk else None ) try : copy_stored_file ( src , src , src_storage = private_storage , dst_storage = local_storage ) result = _resize_video ( src , instance , ** kw ) except Exception as err : log . error ( ( 'Error on processing video: %s' % err ) ) _resize_error ( src , instance , user ) raise if ( not result ) : log . error ( 'Error on processing video, _resize_video not True.' ) _resize_error ( src , instance , user ) log . info ( 'Video resize complete.' ) instance . addon . update ( modified = datetime . datetime . now ( ) )
try and resize a video and cope if it fails .