v20191224
authorkilian (ksmachome) <ksaffran@dks.lu>
Thu, 26 Dec 2019 07:13:22 +0000 (08:13 +0100)
committerkilian (ksmachome) <ksaffran@dks.lu>
Thu, 26 Dec 2019 07:13:22 +0000 (08:13 +0100)
bin/clr_tmpsetplaylists.pl [new file with mode: 0644]

diff --git a/bin/clr_tmpsetplaylists.pl b/bin/clr_tmpsetplaylists.pl
new file mode 100644 (file)
index 0000000..b74ea98
--- /dev/null
@@ -0,0 +1,27 @@
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
+use strict;
+use File::Basename;
+use FindBin qw($RealBin);
+
+my $inyear = "2019";
+my $outyear = "2020";
+my $inpath = dirname($RealBin).'/data/coloradio/aral/playlists/default/'.$inyear;
+my $outpath = dirname($RealBin).'/data/coloradio/aral/playlists/default/'.$outyear;
+print "$inpath => $outpath\n";
+opendir(INP,$inpath);
+while (my $m3u = readdir(INP)){
+  if ($m3u =~ /\.m3u$/){
+    my @files = ();
+    open(M3U,$inpath.'/'.$m3u);
+    @files = <M3U>;
+    close(M3U);
+    print $m3u."\n";
+    my $newfile = $m3u;
+    $newfile =~ s/$inyear/$outyear/; 
+    open(OUT,">".$outpath.'/'.$newfile);
+    @files = reverse(@files);
+    print OUT join("\n",@files);
+    close(OUT);
+  }
+}
+closedir(INP);
\ No newline at end of file