diff options
author | lshprung <lshprung@yahoo.com> | 2021-09-14 16:41:24 -0700 |
---|---|---|
committer | lshprung <lshprung@yahoo.com> | 2021-09-14 16:41:24 -0700 |
commit | e7ba8b935bcc8bc956629b2332f9214e2cac57d0 (patch) | |
tree | 6ec5d344e55df46064b8a3af22aa859244e25040 | |
parent | b24de062d156ae3f04773de55379e3277452f712 (diff) |
Fixed bug in illegal character replacement
-rwxr-xr-x | build_playlists.plx | 9 |
1 files changed, 5 insertions, 4 deletions
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 |