Skip to content

Commit

Permalink
Artwork_save file naming.
Browse files Browse the repository at this point in the history
Added an extra parameter to the "artwork_save" function to be able to give the file a specific name. If no name is given, the file will still be called "artwork.png"
  • Loading branch information
AVITPL authored and postlund committed Nov 2, 2024
1 parent 8a79aba commit cb2b050
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyatv/scripts/atvremote.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,11 @@ async def cli(self):
self.args, command, self.atv, self.storage, self.loop
)

async def artwork_save(self, width=None, height=None):
async def artwork_save(self, width=None, height=None, file_name="artwork"):
"""Download artwork and save it to artwork.png."""
artwork = await self.atv.metadata.artwork(width=width, height=height)
if artwork is not None:
with open("artwork.png", "wb") as file:
with open(f"{file_name}.png", "wb") as file:
file.write(artwork.bytes)
else:
print("No artwork is currently available.")
Expand Down

0 comments on commit cb2b050

Please sign in to comment.