From 03ba06e3cfb064c7c2ff389ceb1a04d106819b0a Mon Sep 17 00:00:00 2001 From: vayalil <36435907+vayalil@users.noreply.github.com> Date: Sat, 17 Feb 2018 11:42:10 +1100 Subject: [PATCH] Add files via upload --- youtube_dl/postprocessor/metadatafromuser.py | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/youtube_dl/postprocessor/metadatafromuser.py b/youtube_dl/postprocessor/metadatafromuser.py index 6c048e808..8f0b99b39 100644 --- a/youtube_dl/postprocessor/metadatafromuser.py +++ b/youtube_dl/postprocessor/metadatafromuser.py @@ -1,7 +1,7 @@ -""" -Created on Fri Feb 9 16:23:16 2018 -""" from __future__ import unicode_literals + +# Created on Fri Feb 9 16:23:16 2018 + from .common import PostProcessor import re @@ -10,7 +10,6 @@ class MetadataFromUserPP(PostProcessor): def __init__(self, downloader, metadata): super(MetadataFromUserPP, self).__init__(downloader) self._metadata = metadata - def run(self, info): lastpos = 0 @@ -22,19 +21,18 @@ class MetadataFromUserPP(PostProcessor): value = self._metadata[lastpos:match.start()].strip() self._downloader.to_screen( '[fromuser] %s: %s' - %(attribute, value if value else 'NA')) + % (attribute, value if value else 'NA')) info[attribute] = value - attribute = match.group(1) + attribute = match.group(1) lastpos = match.end() if attribute is None: # No attributes is given user, default assume the text as album name - attribute = 'album' + attribute = 'album' # Add the last key value = self._metadata[lastpos:].strip() self._downloader.to_screen( - '[fromuser] %s: %s' - %(attribute, value if value else 'NA')) + '[fromuser] %s: %s' % (attribute, value if value else 'NA')) info[attribute] = value # If nothing specified for artist, extract from comments/description @@ -42,9 +40,8 @@ class MetadataFromUserPP(PostProcessor): artist = re.findall('music(?![ia]).*$', info['description'], re.MULTILINE | re.IGNORECASE) artist = artist + re.findall('sing.*$', info['description'], re.MULTILINE | re.IGNORECASE) artist = ', '.join(artist).title().strip() - self._downloader.to_screen( - '[artist] : %s : parsed from description' %(artist if artist else 'NA')) + '[artist] : %s : parsed from description' % (artist if artist else 'NA')) info['artist'] = artist - + return [], info