[rai] Fix extraction (Closes #5396)
[youtube-dl] / youtube_dl / postprocessor / common.py
index 788f94d021fa71648c3c5f521f8344f94d981e61..ef9fdfa19a5562b6b85840ce129b632967b30326 100644 (file)
@@ -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