On Mon Jun 5 23:55:58 BST 2017, RS wrote:
I was trying to work out how the procedures
substitute and sanitize_path were intended to interact.
They both seem to be doing the same job
in different ways which are hard to follow.
RS previously wrote:
substitute needs to be called before create_dir,
so that the sub-directory name is sanitised
by removal of the / before the sub-directory is created.
and
In another part of the code there is a variable sanitize_mode
which can have values between 0 and 4
to denote different treatment for
sanitising file and directory names
This is:
# sanitize_mode == 0 then sanitize final string and also sanitize '/' in
field values
# sanitize_mode == 1 then sanitize final string but don't sanitize '/' (and
'\' on Windows) in field values
# sanitize_mode == 2 then just substitute only
# sanitize_mode == 3 then substitute then use encode entities for fields
only
# sanitize_mode == 4 then substitute then escape characters in fields only
for use in double-quoted shell text.
As Ralph (thanks!) has pointed out earlier in the thread:
I think the call where it's passed as 1 is
(snip)
elsif ( $opt->{subdir} ) {
my $subdir = $prog->substitute( $opt->{subdirformat} || '<longname>',
1 );
So, the substitution parameter <longname> is
undergoing sanitize_mode == 1, hence "/" isn't replaced.
Instead of applying the patch I posted previously,
I changed
-my $subdir = $prog->substitute( $opt->{subdirformat} || '<longname>', 1 );
+my $subdir = $prog->substitute( $opt->{subdirformat} || '<longname>', 0 );
which seems to also have the desired effect:
get_iplayer --type=tv --pid=b08r69t1 --subdir -i | FindStr dir =>
dir: D:\Vangelis\iPlayer Recordings\Vets_24_7_Series_4
This has only been tested on Windows, I don't use --subdir
myself TBH, so unsure whether this breaks other stuff...
Regards,
Vangelis.
_______________________________________________
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer