John Hawkinson 99315aa252 ExternalFD:real_download(): Skip getsize/rename when writing to stdout
In the real_download() method of the ExternalFD class:

Special-case output to stdout, when filename=='-', because otherwise
the call to os.path.getsize() raises
  OSError: [Errno 2] No such file or directory: '-'
which in turn gets masked by a try block and re-raised as
UnavailableVideoError().

And even if getsize had succeeded, we would fail on renaming, and then
we would also fail on reporting progress as report_progress() expects
to have file size information.

So report download completion with self.to_screen() just as
report_progress() would in the noprogress==True case.

You might ask whether it's an abstraction violation for external.py to
have to know and think about '-' as a filename, but unfortunately
we're there already. _call_downloader() thinks about it, and also
real_download() calls common.py's temp_name() which special-cases the
'-' filename to preserve it instead of returnign a temp file. So we
already worry about this case at this abstraction level, as well as
both below and above. Perhaps that should change, but that's for
another day.
2016-10-08 09:51:00 -04:00
..
2016-04-21 23:02:17 +06:00
2016-04-14 15:07:31 +08:00