mirror of
				https://gitlab.com/ytdl-org/youtube-dl.git
				synced 2025-11-03 20:37:08 -05:00 
			
		
		
		
	Add support for the "simulate" option
This commit is contained in:
		
				
					committed by
					
						
						Ricardo Garcia
					
				
			
			
				
	
			
			
			
						parent
						
							9fcd8355e5
						
					
				
				
					commit
					b609fd549f
				
			@@ -55,6 +55,7 @@ class FileDownloader(object):
 | 
			
		||||
	password:	Password for authentication purposes.
 | 
			
		||||
	usenetrc:	Use netrc for authentication instead.
 | 
			
		||||
	quiet:		Do not print messages to stdout.
 | 
			
		||||
	simulate:	Do not download the video files.
 | 
			
		||||
	format:		Video format code.
 | 
			
		||||
	outtmpl:	Template for output names.
 | 
			
		||||
	"""
 | 
			
		||||
@@ -162,6 +163,9 @@ class FileDownloader(object):
 | 
			
		||||
				if (len(url_list) > 1 or len(results) > 1) and re.search(r'%\(.+?\)s', self._params['outtmpl']) is None:
 | 
			
		||||
					sys.exit('ERROR: fixed output name but more than one file to download')
 | 
			
		||||
 | 
			
		||||
				if self._params.get('simulate', False):
 | 
			
		||||
					continue
 | 
			
		||||
 | 
			
		||||
				for result in results:
 | 
			
		||||
					try:
 | 
			
		||||
						filename = self._params['outtmpl'] % result
 | 
			
		||||
@@ -435,6 +439,7 @@ if __name__ == '__main__':
 | 
			
		||||
			'username': None,
 | 
			
		||||
			'password': None,
 | 
			
		||||
			'quiet': False,
 | 
			
		||||
			'simulate': True,
 | 
			
		||||
			'format': None,
 | 
			
		||||
			'outtmpl': '%(id)s.%(ext)s'
 | 
			
		||||
			})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user