Fix the mpv tests: xdotool sends Alt+F1 instead of F1
Update feh (3.11.2) and mpv (0.41.0)
Fix mpv by cherry-picking https://github.com/mpv-player/mpv/commit/26b29fba02a2782f68e2906f837d21201fc6f1b9
My Python wrappers and around feh and mpv.
The package builds its own instances of forks of feh and mpv (feh, mpv) parametrizing the relevant XDG directories in order to obtain isolation from any already present configurations.
Other small features I've found useful are:
while feh ...; do ...; end)These wrappers primarily evolved from my inability to remember the flags when switching from mplayer to mplayer2 to mpv.
My scheme being: one purposeful wrapper around whatever tool implements the functionality at the time:
play, view and edit.
So when fashions change, the implementation changes not the facade (hey I remember this from the Gang of Four).
The Python wrappers evolved to being capable of triggering callbacks in the Python host program. The idea came from binding feh's action keys to use socat to sending back the trigger over a Unix socket.
Following are two examples binding actions/keys in feh and mpv to Python callbacks. These are tested (results) using xdotool and Xvfb.
import asyncio
import sys
from media.play import Player
sources = sys.argv[1:]
result = None
def sample_action(path, instance):
global result
result = True
instance.terminate()
actions = [
Player.Action(key="F1", f=sample_action),
]
async def amain():
async with Player(mute=True).run(sources, actions) as i:
rc = await i.wait()
asyncio.run(amain())
sys.exit(0 if result else 1)
import asyncio
import sys
from media.view import Viewer
sources = sys.argv[1:]
result = None
def sample_action(path, instance):
global result
result = True
instance.terminate()
actions = [
Viewer.Action(number=1, f=sample_action),
]
async def amain():
async with Viewer().run(sources, actions) as i:
rc = await i.wait()
asyncio.run(amain())
sys.exit(0 if result else 1)