diff options
author | Jody Bruchon <jody@jodybruchon.com> | 2020-09-18 00:11:36 -0400 |
---|---|---|
committer | Jody Bruchon <jody@jodybruchon.com> | 2020-09-18 00:11:36 -0400 |
commit | a4d834fb3ef0b9f31469c8de99797063bafbac4e (patch) | |
tree | 51025bbe201c84294aee4066683ced6675437515 | |
parent | fda63a4e873a7e5ce8282b63e30546c2c64e0458 (diff) | |
download | hypervideo-pre-a4d834fb3ef0b9f31469c8de99797063bafbac4e.tar.lz hypervideo-pre-a4d834fb3ef0b9f31469c8de99797063bafbac4e.tar.xz hypervideo-pre-a4d834fb3ef0b9f31469c8de99797063bafbac4e.zip |
Fix wrong variable in position swap corrupting archive list
It's always a simple error in the end, you know?
Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
-rw-r--r-- | youtube_dlc/YoutubeDL.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 03bb245ba..fab56f2f8 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -423,17 +423,15 @@ class YoutubeDL(object): raise lmax = len(lines) if lmax > 10: - # Populate binary search tree by splitting the archive list in half - # and then adding from the outside edges inward - # This mitigates the worst case where the archive has been sorted pos = 0 while pos < lmax: if lmax - pos <= 2: break target = random.randrange(pos + 1, lmax - 1) + # Swap line at pos with randomly chosen target temp = lines[pos] lines[pos] = lines[target] - lines[target] = lines[pos] + lines[target] = temp pos += 1 elif lmax < 1: # No lines were loaded |