Merge branch 'master' into fork_master

Conflicts:
	.travis.yml
This commit is contained in:
Filippo Valsorda 2012-12-11 12:15:16 +01:00
commit 95eb771dcd
8 changed files with 170 additions and 101 deletions

View file

@ -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))

View file

@ -1072,8 +1072,8 @@ class VimeoIE(InfoExtractor):
self.report_extraction(video_id)
# Extract the config JSON
config = webpage.split(' = {config:')[1].split(',assets:')[0]
try:
config = webpage.split(' = {config:')[1].split(',assets:')[0]
config = json.loads(config)
except:
self._downloader.trouble(u'ERROR: unable to extract info section')

View file

@ -229,6 +229,7 @@ def parseOpts():
general.add_option('--list-extractors',
action='store_true', dest='list_extractors',
help='List all supported extractors and the URLs they would handle', default=False)
general.add_option('--test', action='store_true', dest='test', default=False, help=optparse.SUPPRESS_HELP)
selection.add_option('--playlist-start',
dest='playliststart', metavar='NUMBER', help='playlist video to start at (default is %default)', default=1)
@ -551,6 +552,7 @@ def _real_main():
'max_downloads': opts.max_downloads,
'prefer_free_formats': opts.prefer_free_formats,
'verbose': opts.verbose,
'test': opts.test,
})
if opts.verbose: