1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-02 13:27:56 +01:00
This commit is contained in:
Mark 2017-04-08 22:47:54 -04:00
parent 4f4410d68f
commit cae6d1950f

View File

@ -922,12 +922,7 @@ class YoutubeDL(object):
x_forwarded_for = ie_result.get('__x_forwarded_for_ip') x_forwarded_for = ie_result.get('__x_forwarded_for_ip')
if ((self.params.get('date_playlist_order') == 'desc' and self.params.get('playlistreverse')) or has_seen_withinrange_vid = False
(self.params.get('date_playlist_order') == 'asc' and not self.params.get('playlistreverse'))):
entries.reverse()
one_vid_within_range = False
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))
# This __x_forwarded_for_ip thing is a bit ugly but requires # This __x_forwarded_for_ip thing is a bit ugly but requires
@ -955,16 +950,19 @@ class YoutubeDL(object):
download=download, download=download,
extra_info=extra) extra_info=extra)
if entry_result is not None: # backwards compatibility entry_result_uploaddate = date_from_str(entry_result.get('upload_date'))
entry_result_uploaddate = entry_result.get('upload_date') date_playlist_order = self.params.get('date_playlist_order')
if entry_result_uploaddate: daterangeobj = self.params.get('daterange')
if self.params.get('date_playlist_order') in ('desc', 'asc'): dateafter = daterangeobj.start
# we've come across at least one video within the specified daterange datebefore = daterangeobj.end
if (entry_result_uploaddate in self.params.get('daterange') and if entry_result and entry_result_uploaddate and date_playlist_order in ('desc', 'asc'):
one_vid_within_range == False): if not has_seen_withinrange_vid:
one_vid_within_range = True if entry_result_uploaddate in daterangeobj:
elif (entry_result_uploaddate not in self.params.get('daterange') and has_seen_withinrange_vid = True
one_vid_within_range == True): elif ((date_playlist_order == 'desc' and entry_result_uploaddate < dateafter) or
(date_playlist_order == 'asc' and entry_result_uploaddate > datebefore)):
break
elif has_seen_withinrange_vid and entry_result_uploaddate not in daterangeobj:
break break
playlist_results.append(entry_result) playlist_results.append(entry_result)