Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 1de183e

Browse files
authored
Merge pull request #6 from oPromessa/printInfo
VsMetaInfo.printInfo save poster and back_drop jpgs into its own JPG files.
2 parents 0cb3fd9 + d082033 commit 1de183e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vsmetaCodec/vsmetaInfo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def timestamp(self) -> int:
130130
def timestamp(self, stamp: int | float):
131131
self._timestamp = int(stamp) # if the parameter is float, cut of the milliseconds with int()
132132

133-
def printInfo(self, path: str):
133+
def printInfo(self, path: str, prefix: str = None):
134134
path += "" if path[:-1] == "/" else "/"
135135

136136
print("Title : {0}".format(self.showTitle))
@@ -155,9 +155,9 @@ def printInfo(self, path: str):
155155
print("Episode Meta :\n{0}".format(json.dumps(json.loads(self.episodeMetaJson), indent=3)))
156156

157157
if self.backdropImageInfo is not None:
158-
with open(path + "image_back_drop.jpg", "wb") as f:
158+
with open(path + "image_back_drop.jpg" if not prefix else prefix + "_back_drop.jpg", "wb") as f:
159159
f.write(self.backdropImageInfo.image)
160160

161161
for idx, image_info in enumerate(self.episodeImageInfo):
162-
with open(path + "image_poster_{0:02d}.jpg".format(idx + 1), "wb") as f:
163-
f.write(image_info.image)
162+
with open(path + "image_poster_{0:02d}.jpg".format(idx + 1) if not prefix else prefix + "_poster_{0:02d}.jpg".format(idx + 1), "wb") as f:
163+
f.write(image_info.image)

0 commit comments

Comments
 (0)