|
@ -7,6 +7,7 @@ import collections |
|
|
import datetime |
|
|
import datetime |
|
|
import errno |
|
|
import errno |
|
|
import io |
|
|
import io |
|
|
|
|
|
import itertools |
|
|
import json |
|
|
import json |
|
|
import locale |
|
|
import locale |
|
|
import os |
|
|
import os |
|
@ -654,21 +655,28 @@ class YoutubeDL(object): |
|
|
if playlistend == -1: |
|
|
if playlistend == -1: |
|
|
playlistend = None |
|
|
playlistend = None |
|
|
|
|
|
|
|
|
if isinstance(ie_result['entries'], list): |
|
|
|
|
|
n_all_entries = len(ie_result['entries']) |
|
|
|
|
|
entries = ie_result['entries'][playliststart:playlistend] |
|
|
|
|
|
|
|
|
ie_entries = ie_result['entries'] |
|
|
|
|
|
if isinstance(ie_entries, list): |
|
|
|
|
|
n_all_entries = len(ie_entries) |
|
|
|
|
|
entries = ie_entries[playliststart:playlistend] |
|
|
n_entries = len(entries) |
|
|
n_entries = len(entries) |
|
|
self.to_screen( |
|
|
self.to_screen( |
|
|
"[%s] playlist %s: Collected %d video ids (downloading %d of them)" % |
|
|
"[%s] playlist %s: Collected %d video ids (downloading %d of them)" % |
|
|
(ie_result['extractor'], playlist, n_all_entries, n_entries)) |
|
|
(ie_result['extractor'], playlist, n_all_entries, n_entries)) |
|
|
else: |
|
|
|
|
|
assert isinstance(ie_result['entries'], PagedList) |
|
|
|
|
|
entries = ie_result['entries'].getslice( |
|
|
|
|
|
|
|
|
elif isinstance(ie_entries, PagedList): |
|
|
|
|
|
entries = ie_entries.getslice( |
|
|
playliststart, playlistend) |
|
|
playliststart, playlistend) |
|
|
n_entries = len(entries) |
|
|
n_entries = len(entries) |
|
|
self.to_screen( |
|
|
self.to_screen( |
|
|
"[%s] playlist %s: Downloading %d videos" % |
|
|
"[%s] playlist %s: Downloading %d videos" % |
|
|
(ie_result['extractor'], playlist, n_entries)) |
|
|
(ie_result['extractor'], playlist, n_entries)) |
|
|
|
|
|
else: # iterable |
|
|
|
|
|
entries = list(itertools.islice( |
|
|
|
|
|
ie_entries, playliststart, playlistend)) |
|
|
|
|
|
n_entries = len(entries) |
|
|
|
|
|
self.to_screen( |
|
|
|
|
|
"[%s] playlist %s: Downloading %d videos" % |
|
|
|
|
|
(ie_result['extractor'], playlist, n_entries)) |
|
|
|
|
|
|
|
|
for i, entry in enumerate(entries, 1): |
|
|
for i, entry in enumerate(entries, 1): |
|
|
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries)) |
|
|
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries)) |
|
|