aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2012-12-11 12:15:16 +0100
committerFilippo Valsorda <filippo.valsorda@gmail.com>2012-12-11 12:15:16 +0100
commit95eb771dcda47f948b050da85c7ff22539e3ee12 (patch)
tree3bea4b6975544ef76241ccf402de541da350b4ac /youtube_dl/FileDownloader.py
parent3c6ffbaedbbae8734f6b86fea1169413b656abf3 (diff)
parent4fb1acc212555e3e817f858dce964876eef75d85 (diff)
Merge branch 'master' into fork_master
Conflicts: .travis.yml
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index c471cc160..b43acd19b 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -10,6 +10,7 @@ import socket
import subprocess
import sys
import time
+import traceback
if os.name == 'nt':
import ctypes
@@ -78,6 +79,7 @@ class FileDownloader(object):
writeinfojson: Write the video description to a .info.json file
writesubtitles: Write the video subtitles to a .srt file
subtitleslang: Language of the subtitles to download
+ test: Download only first bytes to test the downloader.
"""
params = None
@@ -216,6 +218,8 @@ class FileDownloader(object):
"""
if message is not None:
self.to_stderr(message)
+ if self.params.get('verbose'):
+ self.to_stderr(u''.join(traceback.format_list(traceback.extract_stack())))
if not self.params.get('ignoreerrors', False):
raise DownloadError(message)
self._download_retcode = 1
@@ -594,6 +598,9 @@ class FileDownloader(object):
basic_request = compat_urllib_request.Request(url, None, headers)
request = compat_urllib_request.Request(url, None, headers)
+ if self.params.get('test', False):
+ request.add_header('Range','bytes=0-10240')
+
# Establish possible resume length
if os.path.isfile(encodeFilename(tmpfilename)):
resume_len = os.path.getsize(encodeFilename(tmpfilename))