From dd29eb7f816bae7cf7807db9f26b7f5621b8d557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Wed, 8 Apr 2015 21:40:31 +0600 Subject: [postprocessor/common:postprocessor/ffmpeg] Generalize utime --- youtube_dl/postprocessor/common.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'youtube_dl/postprocessor/common.py') diff --git a/youtube_dl/postprocessor/common.py b/youtube_dl/postprocessor/common.py index e54ae678d..ef9fdfa19 100644 --- a/youtube_dl/postprocessor/common.py +++ b/youtube_dl/postprocessor/common.py @@ -1,6 +1,11 @@ from __future__ import unicode_literals -from ..utils import PostProcessingError +import os + +from ..utils import ( + PostProcessingError, + encodeFilename, +) class PostProcessor(object): @@ -46,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 -- cgit v1.2.3