def determine_quality(template_params, params):
    """Determine the quality parameter for all videos."""
    if params.get('video'):
        if params['video'].get('dmcInfo'):
            if params['video']['dmcInfo']['quality']['videos'][0]['id'
                ] == template_params['video_quality'] and params['video'][
                'dmcInfo']['quality']['audios'][0]['id'] == template_params[
                'audio_quality']:
                template_params['quality'] = 'auto'
            else:
                template_params['quality'] = 'low'
        elif params['video'].get('smileInfo'):
            template_params['quality'] = params['video']['smileInfo'][
                'currentQualityId']
    if params.get('videoDetail'):
        template_params['quality'] = 'auto'
