X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fpostprocessor%2Fcommon.py;h=ef9fdfa19a5562b6b85840ce129b632967b30326;hb=8749477ed0a3cbc85d1726b6526fa5e794ce6072;hp=788f94d021fa71648c3c5f521f8344f94d981e61;hpb=496c19234c3c1b50c6ad0c6a8aa0cbe09d54cea5;p=youtube-dl diff --git a/youtube_dl/postprocessor/common.py b/youtube_dl/postprocessor/common.py index 788f94d02..ef9fdfa19 100644 --- a/youtube_dl/postprocessor/common.py +++ b/youtube_dl/postprocessor/common.py @@ -1,4 +1,11 @@ -from ..utils import PostProcessingError +from __future__ import unicode_literals + +import os + +from ..utils import ( + PostProcessingError, + encodeFilename, +) class PostProcessor(object): @@ -44,6 +51,12 @@ class PostProcessor(object): """ return None, information # by default, keep file and do nothing + def try_utime(self, path, atime, mtime, errnote='Cannot update utime of file'): + try: + os.utime(encodeFilename(path), (atime, mtime)) + except Exception: + self._downloader.report_warning(errnote) + class AudioConversionError(PostProcessingError): pass