On Sat Jun 17 16:32:51 BST 2017, RS wrote:
Not only do they use it, but there is a demand for multi-level
subdirectories.
Hello Richard, thank you for bringing the "--subdir-format"
issue to everyone's attention :-). I, for one, was oblivious
to it, since not a --subdir (hence --subdir-format) user...
Your change is fine for users who just use
--subdir without --subdir-format,
(snip)
but it would prevent use of --subdir-format
to create multi-level subdirectories.
... Not on Windows, if backslashes are used,
get_iplayer --type=tv --pid=b08r69t1 --subdir --subdir-format="<nameshort>\<series>"
-i | FindStr dir =>
dir: D:\Vangelis\iPlayer Recordings\Vets_24_7\Series_4
but indeed true for Linux/Unix/OSX
when forward slashes are used ;-(
if ($opt->{subdirformat} != '') {
my $subdir = $prog->substitute($opt->{subdirformat}, 1)
};
else {
$subdir = $prog->substitute ('<longname>', 0)
};
Later the same day, RS wrote:
Anyway I have now found why --subdirformat is not working.
!= is a numeric comparison operator.
I should have used the string comparison operator ne.
The revised version becomes replace line 4043 with
my $subdir;
if ($opt->{subdirformat} ne "")
... As the "--subdir-format" option always accepts a value,
(unlike the plain "--subdir" switch), hence it would be illogical
for someone to just issue "--subdir-format" in the command
(or have in options), I would have used myself simply
if ($opt->{subdirformat})
for the "if" part...
And, again, later in the day, RS wrote:
my $subdir;
if ($opt->{subdirformat} ne "") {
$subdir = $prog->substitute( $opt->{subdirformat}, 1);
}
else {
$subdir = $prog->substitute ('<longname>', 0);
}
Trying to stay as close to the original code as possible,
I would write what you're trying to accomplish as:
my $subdir = $prog->substitute( $opt->{subdirformat}, 1 ) ||
$prog->substitute( '<longname>', 0 );
HOWEVER, both your code and mine again fall short
of dealing with the original issue that started
this thread: the existence of a forward slash inside
<name>, hence also inside <longname> and <nameshort>.
If one of the three <*name*> substitution parameters
is used inside --subdir-format value (which is highly
probable) then, because $opt->{subdirformat} undergoes
sanitize_mode == 1, that "/" will be left intact and
continue to cause the original issue...
On Windows, with your code:
get_iplayer --type=tv --pid=b08r69t1 --subdir --subdir-format="<nameshort>\<series>"
-i | FindStr dir
returns:
dir: D:\Vangelis\iPlayer Recordings\Vets_24\7\Series_4
The proper solution to this issue would be
to write code that replaces that "/" with "_"
in the <*name*> parameters when --subdir is used,
standalone or with --subdir-format...
(Nigel Taylor, where are you? :-) )
Best regards,
Vangelis.
_______________________________________________
get_iplayer mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/get_iplayer