| 334 | # Rename previews |
| 335 | my ($dimensions, $current_preview); |
| 336 | my $old_name = $show->{'local_path'}; |
| 337 | while (defined($current_preview = <$old_name*.png>)) { |
| 338 | $current_preview =~ /$show->{'local_path'}(\..*)?\.png/; |
| 339 | $dimensions = $1 || ''; |
| 340 | $ret = rename $current_preview, "$video_dir/$name$dimensions.png"; |
| 341 | # If the rename fails, try to delete the preview from the |
| 342 | # cache (it will automatically be re-created with the |
| 343 | # proper name, when necessary) |
| 344 | if (!$ret) { |
| 345 | unlink $current_preview or |
| 346 | vprint("Unable to rename preview image: $current_preview."); |
| 347 | } |
| 348 | } |