From 48d9f2e2398014d39f818542795a4e176d5207a6 Mon Sep 17 00:00:00 2001 From: jules on spawn Date: Fri, 13 Apr 2018 12:03:49 +0200 Subject: get script in root dir --- get.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 get.pl (limited to 'get.pl') diff --git a/get.pl b/get.pl new file mode 100755 index 0000000..4447ab3 --- /dev/null +++ b/get.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +$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); +} + +END { + chdir('..'); +} + -- cgit v1.2.3-70-g09d2 From a61412eb1538615578e87a20ddfbc618e1eeb041 Mon Sep 17 00:00:00 2001 From: jules on spawn Date: Sun, 13 May 2018 12:03:37 +0200 Subject: get script now supports urls --- get.pl | 43 ++++++++++++++++++++++++++++++++++++++----- latest.pl | 7 ++++++- process_fns | 3 +-- 3 files changed, 45 insertions(+), 8 deletions(-) (limited to 'get.pl') 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 "###################################################" -- cgit v1.2.3-70-g09d2 From e2d8a6f26c5e44d970d7c069f171105376835495 Mon Sep 17 00:00:00 2001 From: jules on spawn Date: Mon, 14 May 2018 18:57:17 +0200 Subject: log stuff.. auto append --- get.pl | 7 +++++++ process_fns | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'get.pl') diff --git a/get.pl b/get.pl index 8a0d8f9..0ef39db 100755 --- a/get.pl +++ b/get.pl @@ -9,9 +9,11 @@ foreach my $s (@ARGV){ if ($s =~ /^http/) { if ($s =~ /(wav|aiff?|flac|mp3|opus)$/i) { my $fn = `basename $s`; + print "downloading $fn\n"; system('/usr/bin/wget', $s); system('/usr/bin/perl', 'dataset.pl', $fn); } else { + print "youtube-dl $s\n"; my $yt = `youtube-dl --extract-audio --audio-format flac -o "%(title)s.%(ext)s" $s`; my @partz = split("\n", $yt); foreach $part (@partz) { @@ -38,9 +40,14 @@ foreach my $s (@ARGV){ } } else { if ($s !~/\..*$/) { $s .= ".wav"; } + print "downloading $s\n"; system('/usr/bin/wget', 'https://neural:spawn5@asdf.us/neural/' . $s); system('/usr/bin/perl', 'dataset.pl', $s); } + open(my $fd, ">>../run_slap.sh"); + print $fd "standard $fn"; + close $fn; + $fn = undef; } diff --git a/process_fns b/process_fns index 0cbdeee..cef738d 100755 --- a/process_fns +++ b/process_fns @@ -1,12 +1,13 @@ # workon samplernn function generate () { - exp_name=$1 + exp_name=${1%.*} n_samples=$2 sample_rate=$3 duration=$4 let sample_length=$3*$4 + sleep 0.1 echo "" echo "###################################################" echo "###################################################" @@ -30,14 +31,14 @@ function generate () { --n_samples $n_samples \ --epoch_limit 1 \ --resume True - sleep 1 } function gen_len () { - exp_name=$1 + exp_name=${1%.*} n_samples=$2 sample_rate=$3 sample_length=$4 + sleep 0.1 echo "" echo "###################################################" echo "###################################################" @@ -63,13 +64,14 @@ function gen_len () { --resume True } function run () { - exp_name=$1 + exp_name=${1%.*} epoch_limit=$2 n_samples=$3 sample_rate=$4 duration=$5 let sample_length=$4*$5 + sleep 0.1 echo "" echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" @@ -93,7 +95,6 @@ function run () { --keep_old_checkpoints False \ --epoch_limit $epoch_limit \ --resume True - sleep 1 } function standard () { dataset=$1 -- cgit v1.2.3-70-g09d2