aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/options.py6
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py4
-rw-r--r--youtube_dl/postprocessor/metadatafromtitle.py9
3 files changed, 8 insertions, 11 deletions
diff --git a/youtube_dl/options.py b/youtube_dl/options.py
index be9402fdb..4e6e47d6f 100644
--- a/youtube_dl/options.py
+++ b/youtube_dl/options.py
@@ -738,10 +738,10 @@ def parseOpts(overrideArguments=None):
postproc.add_option(
'--metadata-from-title',
metavar='FORMAT', dest='metafromtitle',
- help='parse additional metadata like song title / artist from the video title. \n'
+ help='parse additional metadata like song title / artist from the video title. '
'The format syntax is the same as --output, '
- 'the parsed parameters replace existing values.\n'
- 'Additional templates: %(songtitle), %(album), %(artist). \n'
+ 'the parsed parameters replace existing values. '
+ 'Additional templates: %(album), %(artist). '
'Example: --metadata-from-title "%(artist)s - %(title)s" matches a title like '
'"Coldplay - Paradise"')
postproc.add_option(
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index a17113cbf..b6f51cfd5 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -541,9 +541,7 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
class FFmpegMetadataPP(FFmpegPostProcessor):
def run(self, info):
metadata = {}
- if info.get('songtitle') is not None:
- metadata['title'] = info['songtitle']
- elif info.get('title') is not None:
+ if info.get('title') is not None:
metadata['title'] = info['title']
if info.get('upload_date') is not None:
metadata['date'] = info['upload_date']
diff --git a/youtube_dl/postprocessor/metadatafromtitle.py b/youtube_dl/postprocessor/metadatafromtitle.py
index 4c9d3aafe..5019433d3 100644
--- a/youtube_dl/postprocessor/metadatafromtitle.py
+++ b/youtube_dl/postprocessor/metadatafromtitle.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
import re
@@ -12,20 +12,19 @@ class MetadataFromTitlePPError(PostProcessingError):
class MetadataFromTitlePP(PostProcessor):
def __init__(self, downloader, titleformat):
+ super(MetadataFromTitlePP, self).__init__(downloader)
self._titleformat = titleformat
- self._titleregex = self.fmtToRegex(titleformat)
+ self._titleregex = self.format_to_regex(titleformat)
- def fmtToRegex(self, fmt):
+ def format_to_regex(self, fmt):
"""
Converts a string like
'%(title)s - %(artist)s'
to a regex like
'(?P<title>.+)\ \-\ (?P<artist>.+)'
- and a list of the named groups [title, artist]
"""
lastpos = 0
regex = ""
- groups = []
# replace %(..)s with regex group and escape other string parts
for match in re.finditer(r'%\((\w+)\)s', fmt):
regex += re.escape(fmt[lastpos:match.start()])