1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-29 19:47:54 +01:00

Add --print-final-file option

This commit is contained in:
alxnull 2019-10-19 20:46:03 +02:00
parent 824fa51165
commit a0358b66c7
5 changed files with 25 additions and 0 deletions

View File

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

View File

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

View File

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

View File

@ -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',
]

View File

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