A bug in get_iplayer-3.01?
RS
richard22j at zoho.com
Sat Jun 17 08:32:51 PDT 2017
>From: Vangelis forthnet Sent: Tuesday, June 6, 2017 17:13
>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...
I don't use --subdir either, but it seems some users do.
https://squarepenguin.co.uk/forums/thread-96.html
Not only do they use it, but there is a demand for multi-level
subdirectories. Your change is fine for users who just use --subdir
without --subdir-format, which is what I think artisticforge was doing, but
it would prevent use of --subdir-format to create multi-level
subdirectories.
I suggest something along the lines of replacing line 4043 with
if ($opt->{subdirformat}!='') {my $subdir = $prog->substitute(
$opt->{subdirformat}, 1)};
else {$subdir = $prog->substitute ('<longname>', 0)};
I need to get some help to get the syntax right. If I put in a second my
after else it objects to it, but without it it says I am using $subdir as a
global variable which requires an explicit package name, as it does for
$prog. I have obviously upset the block structure, but I can't see where.
At one stage I was puzzled as to how / was replaced by \ for Windows paths,
as it is not done by the substitute() function. The answer seems to be that
it is done by catdir in line 4044.
As for readability of Perl, my Perl book is over 1000 pages long. If I look
in the index for catdir or canonpath or any of the other methods of
File::Spec I can't find them. Fortunately they are in the online
documentation. I think I'll stick to learning C++ and Python.
More information about the get_iplayer
mailing list