diff --git a/README.md b/README.md index c39b13616..e0ed23a29 100644 --- a/README.md +++ b/README.md @@ -439,6 +439,8 @@ Alternatively, refer to the [developer instructions](#developer-instructions) fo /sdcard/Music/ && rm {}' --convert-subs FORMAT Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc) + --print-final-file Print the final output file name after + post-processing. # CONFIGURATION diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 9a659fc65..4c5242730 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -297,6 +297,11 @@ def _real_main(argv=None): # contents if opts.xattrs: postprocessors.append({'key': 'XAttrMetadata'}) + # Print the final file name close to the end + if opts.print_final_file: + postprocessors.append({ + 'key': 'PrintFilePath' + }) # Please keep ExecAfterDownload towards the bottom as it allows the user to modify the final file in any way. # So if the user is able to remove the file before your postprocessor runs it might cause a few problems. if opts.exec_cmd: diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 1ffabc62b..6248857a7 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -858,6 +858,10 @@ def parseOpts(overrideArguments=None): '--convert-subs', '--convert-subtitles', metavar='FORMAT', dest='convertsubtitles', default=None, help='Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc)') + postproc.add_option( + '--print-final-file', + action='store_true', dest='print_final_file', default=False, + help='Print the final output file name after post-processing.') parser.add_option_group(general) parser.add_option_group(network) diff --git a/youtube_dl/postprocessor/__init__.py b/youtube_dl/postprocessor/__init__.py index 3ea518399..8ce8fdff9 100644 --- a/youtube_dl/postprocessor/__init__.py +++ b/youtube_dl/postprocessor/__init__.py @@ -16,6 +16,7 @@ from .ffmpeg import ( from .xattrpp import XAttrMetadataPP from .execafterdownload import ExecAfterDownloadPP from .metadatafromtitle import MetadataFromTitlePP +from .printfilepath import PrintFilePathPP def get_postprocessor(key): @@ -36,5 +37,6 @@ __all__ = [ 'FFmpegSubtitlesConvertorPP', 'FFmpegVideoConvertorPP', 'MetadataFromTitlePP', + 'PrintFilePathPP', 'XAttrMetadataPP', ] diff --git a/youtube_dl/postprocessor/printfilepath.py b/youtube_dl/postprocessor/printfilepath.py new file mode 100644 index 000000000..f55826e3a --- /dev/null +++ b/youtube_dl/postprocessor/printfilepath.py @@ -0,0 +1,12 @@ +from __future__ import unicode_literals + +from .common import PostProcessor + + +class PrintFilePathPP(PostProcessor): + def __init__(self, downloader): + super(PrintFilePathPP, self).__init__(downloader) + + def run(self, information): + self._downloader.to_stdout(information['filepath']) + return [], information