Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3576

Python • Feh image viewer - file name to variable

$
0
0
Hi, i am fairly new to python programming but enjoying it so far.

Using a python script i am wanting to have a slideshow running with Feh image viewer. The slideshow is started with a Popen command, and the subprocess is killed after the slideshow is finished / last image in folder is reached. (and a next process is started).

the command to starting the slideshow, displaying all files in the folder images:

Code:

p2 = Popen(['feh', 'images', '-F', '-Y'])
To kill the process when the last image is reached, i was wondering if it was possible to get the filename of the current file and store it to a varia ble. Using feh's --action option, i was hoping to get it sorted, but no luck.

Using echo i can get the filename:

Code:

p2 = Popen(['feh', 'images', '-F', '-Y', -A, "echo %F"])
however getting it to a variable is difficult, i have tried:

Code:

p2 = Popen(['feh', 'images', '-F', '-Y', -A, 'filename = %F'])p2 = Popen(['feh', 'images', '-F', '-Y', -A, '"filename = %F"'])p2 = Popen(['feh', 'images', '-F', '-Y', -A, 'filename = str(%F)'])
however no luck.

So the Feh action command would be a bash command, i have also tried:

Code:

p2 = Popen(['feh', 'images', '-F', '-Y', -A, 'filename = $(%F)'])
This gives me a permission denied.

Any suggestions? Thanks in advance!

Statistics: Posted by rastamano — Sat Jun 08, 2024 10:07 pm — Replies 0 — Views 3



Viewing all articles
Browse latest Browse all 3576

Trending Articles