From e7ba8b935bcc8bc956629b2332f9214e2cac57d0 Mon Sep 17 00:00:00 2001 From: lshprung Date: Tue, 14 Sep 2021 16:41:24 -0700 Subject: Fixed bug in illegal character replacement --- build_playlists.plx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'build_playlists.plx') diff --git a/build_playlists.plx b/build_playlists.plx index d860d7d..9a41942 100755 --- a/build_playlists.plx +++ b/build_playlists.plx @@ -139,6 +139,11 @@ else { @db_output = flatten_array(db_cmd($dbh, "SELECT $statement FROM $table_name WHERE ID=$i;")); for my $j (0..scalar(@db_output)-1){ $tag_hash{$tags_of_interest[$j]} = $db_output[$j]; + + # remove illegal filename characters, replace them with underscore + if (!($tags_of_interest[$j] eq "PATH")){ + $tag_hash{$tags_of_interest[$j]} =~ s/[\/<>:"\\|?*]/_/g; + } } # TODO break up by semicolon (signifying array of tag values) @@ -146,10 +151,6 @@ else { $output_file = $output_pattern; $output_file =~ s/[{]([^}]*)[}]/$tag_hash{$1}/g; - # remove illegal filename characters, replace them with underscore - $output_file =~ s/[\/<>:"\\|?*]/_/g; - print "$output_file\n"; - # Open the file for writing open FH, ">> $output_file" or die $!; # DEBUG -- cgit