]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/postprocessor/common.py
   1 from ..utils 
import PostProcessingError
 
   4 class PostProcessor(object): 
   5     """Post Processor class. 
   7     PostProcessor objects can be added to downloaders with their 
   8     add_post_processor() method. When the downloader has finished a 
   9     successful download, it will take its internal chain of PostProcessors 
  10     and start calling the run() method on each one of them, first with 
  11     an initial argument and then with the returned value of the previous 
  14     The chain will be stopped if one of them ever returns None or the end 
  15     of the chain is reached. 
  17     PostProcessor objects follow a "mutual registration" process similar 
  18     to InfoExtractor objects. 
  23     def __init__(self
, downloader
=None): 
  24         self
._downloader 
= downloader
 
  26     def set_downloader(self
, downloader
): 
  27         """Sets the downloader for this PP.""" 
  28         self
._downloader 
= downloader
 
  30     def run(self
, information
): 
  31         """Run the PostProcessor. 
  33         The "information" argument is a dictionary like the ones 
  34         composed by InfoExtractors. The only difference is that this 
  35         one has an extra field called "filepath" that points to the 
  38         This method returns a tuple, the first element of which describes 
  39         whether the original file should be kept (i.e. not deleted - None for 
  40         no preference), and the second of which is the updated information. 
  42         In addition, this method may raise a PostProcessingError 
  43         exception if post processing fails. 
  45         return None, information  
# by default, keep file and do nothing 
  48 class AudioConversionError(PostProcessingError
):