diff options
author | Ricardo Garcia <sarbalap+freshmeat@gmail.com> | 2010-08-01 01:15:43 +0200 |
---|---|---|
committer | Ricardo Garcia <sarbalap+freshmeat@gmail.com> | 2010-10-31 11:28:36 +0100 |
commit | 268fb2bdd8962fb2064e32caff95cc098bb0f49a (patch) | |
tree | c282b25a782a09482d836551799d10a5430df9cc | |
parent | 101e0d1e9178ba209dcf1ef79cb532cbb1025d93 (diff) |
Consider the file downloaded if the size differs in less than 100 bytes (fixes issue #175)
-rwxr-xr-x | youtube-dl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube-dl b/youtube-dl index cf0336e56..6be25baa4 100755 --- a/youtube-dl +++ b/youtube-dl @@ -542,8 +542,15 @@ class FileDownloader(object): raise else: # Examine the reported length - if content_length is not None and long(content_length) == resume_len: - # The file had already been fully downloaded + if (content_length is not None and + resume_len - 100 < long(content_length) < resume_len + 100): + # The file had already been fully downloaded. + # Explanation to the above condition: in issue #175 it was revealed that + # YouTube sometimes adds or removes a few bytes from the end of the file, + # changing the file size slightly and causing problems for some users. So + # I decided to implement a suggested change and consider the file + # completely downloaded if the file size differs less than 100 bytes from + # the one in the hard drive. self.report_file_already_downloaded(filename) return True else: |