Skip to content

Instantly share code, notes, and snippets.

@paveljurca
Created January 18, 2017 22:43
Show Gist options
  • Save paveljurca/7d03cb5f2edc558acf9bd01133394aec to your computer and use it in GitHub Desktop.
Save paveljurca/7d03cb5f2edc558acf9bd01133394aec to your computer and use it in GitHub Desktop.
use strict;
use warnings;
# SINGLE
# perl iradio.pl 20min_marketa_pravdova_cestina.mp3
# MULTI
# perl iradio.pl ladislav_hejdanek_dopisy_priteli_
my $name = shift;
die unless $name;
my ($list) = $name =~ /_(\d+)$/;
$name =~ s/_\d+$//;
for (<>) {
chomp;
next unless $_ // m|^http|;
s/prehravac/media/;
s/audio/_audio/;
system 'curl', '-o', ($name . ( $list ? ('_'.$list++) : '') . '.mp3'), $_;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment