diff options
| author | 2025-12-20 05:49:11 -0500 | |
|---|---|---|
| committer | 2025-12-20 05:49:11 -0500 | |
| commit | c586ea4b3c871f5696626f9820e8c88a4e78f4a6 (patch) | |
| tree | e6d7bae96282c3d147159f091d451e53bdaa2efe /gallery_dl/postprocessor/metadata.py | |
| parent | 01a2bf622c31072d1322884584404b9bd59b28cc (diff) | |
| parent | a24ec1647aeac35a63b744ea856011ad6e06be3b (diff) | |
Update upstream source from tag 'upstream/1.31.1'
Update to upstream version '1.31.1'
with Debian dir b5d91c25143175f933b1c69c7e82249cd7e145ab
Diffstat (limited to 'gallery_dl/postprocessor/metadata.py')
| -rw-r--r-- | gallery_dl/postprocessor/metadata.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gallery_dl/postprocessor/metadata.py b/gallery_dl/postprocessor/metadata.py index 90e6e3d..0017b5b 100644 --- a/gallery_dl/postprocessor/metadata.py +++ b/gallery_dl/postprocessor/metadata.py @@ -117,9 +117,15 @@ class MetadataPP(PostProcessor): self.mtime = options.get("mtime") self.omode = options.get("open", omode) self.encoding = options.get("encoding", "utf-8") + self.newline = options.get("newline") self.skip = options.get("skip", False) self.meta_path = options.get("metadata-path") + def open(self, path): + return open(path, self.omode, + encoding=self.encoding, + newline=self.newline) + def run(self, pathfmt): archive = self.archive if archive and archive.check(pathfmt.kwdict): @@ -138,11 +144,11 @@ class MetadataPP(PostProcessor): return try: - with open(path, self.omode, encoding=self.encoding) as fp: + with self.open(path) as fp: self.write(fp, pathfmt.kwdict) except FileNotFoundError: os.makedirs(directory, exist_ok=True) - with open(path, self.omode, encoding=self.encoding) as fp: + with self.open(path) as fp: self.write(fp, pathfmt.kwdict) if archive: |
