aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/postprocessor
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-07-25 00:17:15 +0100
committerdirkf <fieldhouse@gmx.net>2023-07-25 13:19:43 +0100
commita25e9f3c84a34d43f78a4e5a6f6c2e98e2a0ade3 (patch)
tree869bde60dab873963705baae5b879b94a4b9c3a9 /youtube_dl/postprocessor
parentaac33155e40af3da96a2467dd05faea201815989 (diff)
downloadyoutube-dl-a25e9f3c84a34d43f78a4e5a6f6c2e98e2a0ade3.tar.xz
[compat] Use `compat_open()`
Diffstat (limited to 'youtube_dl/postprocessor')
-rw-r--r--youtube_dl/postprocessor/embedthumbnail.py2
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dl/postprocessor/embedthumbnail.py b/youtube_dl/postprocessor/embedthumbnail.py
index 5e7b6e2df..b6c60e127 100644
--- a/youtube_dl/postprocessor/embedthumbnail.py
+++ b/youtube_dl/postprocessor/embedthumbnail.py
@@ -18,6 +18,8 @@ from ..utils import (
shell_quote,
)
+from ..compat import compat_open as open
+
class EmbedThumbnailPPError(PostProcessingError):
pass
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index 8c29c8d59..801160e6c 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import io
import os
import subprocess
import time
@@ -9,6 +8,7 @@ import re
from .common import AudioConversionError, PostProcessor
+from ..compat import compat_open as open
from ..utils import (
encodeArgument,
encodeFilename,
@@ -493,7 +493,7 @@ class FFmpegMetadataPP(FFmpegPostProcessor):
chapters = info.get('chapters', [])
if chapters:
metadata_filename = replace_extension(filename, 'meta')
- with io.open(metadata_filename, 'wt', encoding='utf-8') as f:
+ with open(metadata_filename, 'w', encoding='utf-8') as f:
def ffmpeg_escape(text):
return re.sub(r'(=|;|#|\\|\n)', r'\\\1', text)
@@ -636,7 +636,7 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor):
with open(dfxp_file, 'rb') as f:
srt_data = dfxp2srt(f.read())
- with io.open(srt_file, 'wt', encoding='utf-8') as f:
+ with open(srt_file, 'w', encoding='utf-8') as f:
f.write(srt_data)
old_file = srt_file
@@ -652,7 +652,7 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor):
self.run_ffmpeg(old_file, new_file, ['-f', new_format])
- with io.open(new_file, 'rt', encoding='utf-8') as f:
+ with open(new_file, 'r', encoding='utf-8') as f:
subs[lang] = {
'ext': new_ext,
'data': f.read(),