diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-14 20:38:13 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-14 20:38:13 +0200 |
| commit | 914ffba685b594c11bbfb8559a44f54042e40d83 (patch) | |
| tree | 777948436d295dce892ffc817a2bddb7f7ec176b /get.pl | |
| parent | 45e252f2fc33992b52dc34251c0ba31970b92ee5 (diff) | |
get pl param printing being nice
Diffstat (limited to 'get.pl')
| -rwxr-xr-x | get.pl | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -2,6 +2,19 @@ $SIG{TERM} = $SIG{INT} = sub { exit 1 }; +sub sanitize ($) { + my $s = lc shift; + $s =~ s/\.[^.]+$//g; + $s =~ s/\W//g; + $s =~ s/\s+/_/g; + if (length($s) == 0) { + print "fn is empty"; + exit(1); + } + $s =~ s/_+/_/g; + return $s; +} + chdir('datasets'); my $fn, $new_fn; @@ -22,19 +35,10 @@ foreach my $s (@ARGV){ } } if ($fn) { - $new_fn = lc $fn; - $new_fn =~ s/\.flac$//g; - $new_fn =~ s/\s+/_/g; - $new_fn =~ s/\W//g; - if (length($new_fn) == 0) { - $new_fn = lc $s; - $new_fn =~ s/\s+/_/g; - $new_fn =~ s/\W//g; - } - $new_fn =~ s/_+/_/g; + $new_fn = sanitize($fn) $new_fn .= '.flac'; system('mv', $fn, $new_fn); - print"got fn, $fn => $new_fn\n"; + print "got fn, $fn => $new_fn\n"; system('/usr/bin/perl', 'dataset.pl', $new_fn); } } @@ -44,8 +48,9 @@ foreach my $s (@ARGV){ system('/usr/bin/wget', 'https://neural:spawn5@asdf.us/neural/' . $s); system('/usr/bin/perl', 'dataset.pl', $s); } + my $tag = sanitize($fn); open(my $fd, ">>../run_slap.sh"); - print $fd "standard $fn"; + print $fd "standard $tag\n"; close $fn; $fn = undef; |
