summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xget.pl43
-rwxr-xr-xlatest.pl7
-rwxr-xr-xprocess_fns3
3 files changed, 45 insertions, 8 deletions
diff --git a/get.pl b/get.pl
index 4447ab3..8a0d8f9 100755
--- a/get.pl
+++ b/get.pl
@@ -4,11 +4,44 @@ $SIG{TERM} = $SIG{INT} = sub { exit 1 };
chdir('datasets');
-foreach (@ARGV){
- my $s = $_;
- if ($s !~/\..*$/) { $s .= ".wav"; }
- system('/usr/bin/wget', 'https://neural:spawn5@asdf.us/neural/' . $s);
- system('/usr/bin/perl', 'dataset.pl', $s);
+my $fn, $new_fn;
+foreach my $s (@ARGV){
+ if ($s =~ /^http/) {
+ if ($s =~ /(wav|aiff?|flac|mp3|opus)$/i) {
+ my $fn = `basename $s`;
+ system('/usr/bin/wget', $s);
+ system('/usr/bin/perl', 'dataset.pl', $fn);
+ } else {
+ my $yt = `youtube-dl --extract-audio --audio-format flac -o "%(title)s.%(ext)s" $s`;
+ my @partz = split("\n", $yt);
+ foreach $part (@partz) {
+ if ($part =~ /\[ffmpeg\] Destination\: (.*\.flac)$/) {
+ $fn = $1;
+ }
+ }
+ 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 .= '.flac';
+ system('mv', $fn, $new_fn);
+ print"got fn, $fn => $new_fn\n";
+ system('/usr/bin/perl', 'dataset.pl', $new_fn);
+ }
+ }
+ } else {
+ if ($s !~/\..*$/) { $s .= ".wav"; }
+ system('/usr/bin/wget', 'https://neural:spawn5@asdf.us/neural/' . $s);
+ system('/usr/bin/perl', 'dataset.pl', $s);
+ }
+ $fn = undef;
}
END {
diff --git a/latest.pl b/latest.pl
index ddd5952..1bb7932 100755
--- a/latest.pl
+++ b/latest.pl
@@ -5,7 +5,8 @@ use Getopt::Std;
our $opt_l; # mix and upload files
our $opt_v; # print log for all files
-getopts('lav');
+our $opt_n; # name/tag for file
+getopts('lavn:');
our $matches = 0;
if (scalar @ARGV) {
@@ -73,6 +74,10 @@ sub process($){
# return 0;
#}
+ if ($opt_l && $opt_n) {
+ $name .= '-' . $opt_n;
+ }
+
if (-e "output/" . $name . ".mp3") {
return 1;
}
diff --git a/process_fns b/process_fns
index 0bac4e7..0cbdeee 100755
--- a/process_fns
+++ b/process_fns
@@ -36,8 +36,7 @@ function gen_len () {
exp_name=$1
n_samples=$2
sample_rate=$3
- duration=$4
- sample_length=$5
+ sample_length=$4
echo ""
echo "###################################################"