Index: contrib/emvideo/emvideo.module =================================================================== --- contrib/emvideo/emvideo.module (revision 194) +++ contrib/emvideo/emvideo.module (working copy) @@ -273,6 +273,19 @@ $ret = emfield_emfield_field($op, $node, $field, $items, $teaser, $page, 'emvideo'); if ($op == 'presave') { foreach ($items as $delta => $item) { + // Remove empty fields + if (empty($item['embed'])) { + // Remove thumbnail files + if (module_exists('emthumb')) { + // see http://drupal.org/node/393490#comment-1328368 + if (is_array($item) && !empty($item['emthumb']['emthumb']['emthumb']['emthumb']['file'])) { + _emthumb_file_delete($item['emthumb']['emthumb']['emthumb']['emthumb']['file'], $field['field_name']); + } + } + unset($items[$delta]); + continue; + } + $duration = emfield_include_invoke('emvideo', $item['provider'], 'duration', $item); $items[$delta]['duration'] = $duration ? $duration : 0; }