#!/usr/bin/env perl
use strict;
use warnings;
use autodie;

use utf8;
use Encode;
use PerlIO::encoding; ## for open(my $FO, '>:encoding(utf-8)', 'file');
use open qw/:std :utf8/;

use Math::Round;
use feature ':5.20';
use feature 'signatures'; no warnings qw(experimental::signatures);
use warnings FATAL => qw{ uninitialized };

=pod

=head1 Title

  fixfilenames.pl ---

=cut

while (glob("C*.mp4")) {
  my $e= $_;
  s/C[hH] ([0-9])\-/ch0$1-/;
  s/C[hH] (1[0-9])\-/ch$1-/;
  s/[ \_]+/_/g;
  s/\_\-\_/_/g;
  s/[\(\)]//g;
  $_ = lc($_);
  s/_(bb4bec9a|d5e6697d|3cbbaed2|f9b4ae40|d1b4b808)//g;
  s/_default\./\./;
  s/implied_cost_of_capital/icc/;
  s/_the_/_/g;
  s/meaning_og_yield/meaning_of_yield/;
  print "$_ \t\t\t\t $e\n";
  ($e eq $_) and next;
  rename($e, $_) or die "cannot rename $e\n";
}
