aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/postprocessor/common.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-04-08 21:40:31 +0600
committerSergey M․ <dstftw@gmail.com>2015-04-08 21:40:31 +0600
commitdd29eb7f816bae7cf7807db9f26b7f5621b8d557 (patch)
tree380122c090495d6c63caec01fa02ebb066a9c30d /youtube_dl/postprocessor/common.py
parentbca788ab1d477abfc29edb29480075ed10cace25 (diff)
[postprocessor/common:postprocessor/ffmpeg] Generalize utime
Diffstat (limited to 'youtube_dl/postprocessor/common.py')
-rw-r--r--youtube_dl/postprocessor/common.py13
1 files changed, 12 insertions, 1 deletions
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