A bug in get_iplayer-3.01?
RS
richard22j at zoho.com
Sat Jun 3 13:26:23 PDT 2017
>Sent: Saturday, June 3, 2017 14:26 Iwrote
>In Windows / is replaced with _. In Linux it is not. If the justification
>for removing --fatfilename was that Linux was to treated in the same way as
>Windows it seems to me you are right to call it a bug.
>I have now found where --fatfilename was removed. It was in v2.98. The
>Release Notes say,
>File name sanitisation options (replaced by uniform naming scheme)
> All file names are now always ASCII-only, with most punctuation removed.
> All dates in episode titles are now always converted to YYYY-MM-DD
> format for use in file names
The relevant code in v3.01 would seem to be
<code>
# Generic
# Make a filename/path sane
sub StringUtils::sanitize_path {
my $string = shift;
my $is_path = shift || 0;
my $force_default = shift || 0;
my $punct_bad = '[!"#$%&\'()*+,:;<=>?@[\]^`{|}~]';
# Replace forward slashes with _ if not path
$string =~ s/\//_/g unless $is_path;
# Replace backslashes with _ if not Windows path
$string =~ s/\\/_/g unless $^O eq "MSWin32" && $is_path;
# use ISO8601 dates
$string =~ s|(\d\d)[/_](\d\d)[/_](20\d\d)|$3-$2-$1|g;
# ASCII-fy some punctuation
$string = StringUtils::convert_punctuation($string);
# Remove non-ASCII chars
$string = StringUtils::remove_marks($string);
$string =~ s/[^\x{20}-\x{7e}]//g;
# Truncate duplicate colon/semi-colon/comma
$string =~ s/([:;,])(\1)+/$1/g;
# Add whitespace behind colon/semi-colon/comma if not present
$string =~ s/([:;,])(\S)/$1 $2/g;
# Remove most punctuation chars
# Includes invalid chars for FAT and HFS
$string =~ s/$punct_bad//g;
# Replace ellipsis
$string =~ s/\.{3}/_/g;
# Remove extra/leading/trailing whitespace
$string =~ s/\s+/ /g;
$string =~ s/(^\s+|\s+$)//g;
# Replace whitespace with _ unless --whitespace
$string =~ s/\s/_/g unless ( $opt->{whitespace} && ! $force_default );
# Truncate multiple replacement chars
$string =~ s/_+/_/g;
return $string;
</code>
The question would appear to be why $is_path is true in Linux but not in
Windows. I don't know enough Perl to be able to answer.
More information about the get_iplayer
mailing list