Do not translate newlines in `--print-to-file`

Fixes https://github.com/yt-dlp/yt-dlp/issues/6808#issuecomment-1509361107
This commit is contained in:
pukkandan 2023-04-16 08:54:48 +05:30
parent 84ffeb7d5e
commit 9874e82b5a
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
1 changed files with 2 additions and 2 deletions

View File

@ -2890,8 +2890,8 @@ class YoutubeDL:
tmpl = format_tmpl(tmpl) tmpl = format_tmpl(tmpl)
self.to_screen(f'[info] Writing {tmpl!r} to: {filename}') self.to_screen(f'[info] Writing {tmpl!r} to: {filename}')
if self._ensure_dir_exists(filename): if self._ensure_dir_exists(filename):
with open(filename, 'a', encoding='utf-8') as f: with open(filename, 'a', encoding='utf-8', newline='') as f:
f.write(self.evaluate_outtmpl(tmpl, info_copy) + '\n') f.write(self.evaluate_outtmpl(tmpl, info_copy) + os.linesep)
def __forced_printings(self, info_dict, filename, incomplete): def __forced_printings(self, info_dict, filename, incomplete):
def print_mandatory(field, actual_field=None): def print_mandatory(field, actual_field=None):