joh / when-changed

Execute a command when a file is changed
Other
1.22k stars 107 forks source link

-1 option still re-running command when file not changed #99

Open chamber32 opened 1 month ago

chamber32 commented 1 month ago

I'm using a python script to display an image on an e-ink display when the image changes. For some reason, it is indicating "==> '/media/share1/cover.png' deleted", then running again, even though image content hasn't changed. Here is the script I'm running:

!/usr/bin/env python3

import sys

from PIL import Image

from inky.auto import auto

inky = auto(ask_user=True, verbose=True) saturation = 1

if len(sys.argv) == 1: print(""" Usage: {file} image-file """.format(file=sys.argv[0])) sys.exit(1)

image = Image.open(sys.argv[1]) resizedimage = image.resize(inky.resolution)

if len(sys.argv) > 2: saturation = float(sys.argv[2])

inky.set_image(resizedimage, saturation=saturation) inky.show()

It's album art that I'm displaying, so I know from the song still playing that command shouldn't be running again.

Thanks,

Dave

chamber32 commented 1 month ago

Never mind, it turns out that OBS w/Tuna really does delete the file and re-add it. I'm now using this instead: https://github.com/Aldaviva/WinampNowPlayingToFile .

Thanks,

Dave