mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	[YoutubeDL] Always set the '_filename' field in the info_dict (reported in #4053)
It's also useful when you use the '--write-info-json' option.
This commit is contained in:
		@@ -1130,7 +1130,7 @@ class YoutubeDL(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self._num_downloads += 1
 | 
					        self._num_downloads += 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        filename = self.prepare_filename(info_dict)
 | 
					        info_dict['_filename'] = filename = self.prepare_filename(info_dict)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Forced printings
 | 
					        # Forced printings
 | 
				
			||||||
        if self.params.get('forcetitle', False):
 | 
					        if self.params.get('forcetitle', False):
 | 
				
			||||||
@@ -1155,10 +1155,7 @@ class YoutubeDL(object):
 | 
				
			|||||||
        if self.params.get('forceformat', False):
 | 
					        if self.params.get('forceformat', False):
 | 
				
			||||||
            self.to_stdout(info_dict['format'])
 | 
					            self.to_stdout(info_dict['format'])
 | 
				
			||||||
        if self.params.get('forcejson', False):
 | 
					        if self.params.get('forcejson', False):
 | 
				
			||||||
            info_dict['_filename'] = filename
 | 
					 | 
				
			||||||
            self.to_stdout(json.dumps(info_dict))
 | 
					            self.to_stdout(json.dumps(info_dict))
 | 
				
			||||||
        if self.params.get('dump_single_json', False):
 | 
					 | 
				
			||||||
            info_dict['_filename'] = filename
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Do nothing else if in simulate mode
 | 
					        # Do nothing else if in simulate mode
 | 
				
			||||||
        if self.params.get('simulate', False):
 | 
					        if self.params.get('simulate', False):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user