summaryrefslogtreecommitdiff
path: root/get.pl
diff options
context:
space:
mode:
Diffstat (limited to 'get.pl')
-rwxr-xr-xget.pl29
1 files changed, 17 insertions, 12 deletions
diff --git a/get.pl b/get.pl
index 0ef39db..4b94c22 100755
--- a/get.pl
+++ b/get.pl
@@ -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;