mpv
mpv copied to clipboard
Help with Script
Below I have the script to pause mpv whenever it is not in focus.
This is great, but I would like it to be only activated when video is on. In other words, files such as mp3 (and any other files) that has no video, would NOT pause mpv, when it is not focused.
mp.get_property_native("current-tracks/video") gives you a table with information about the currently selected video track.
I think it returns nil when there is currently no video track selected.
Pictures also count as video track, so you might want to check the image and albumart table entries.
You can append this profile to mpv.conf:
[focus-lost]
profile-cond=get('current-tracks/video/image') == false and not focused
profile-restore=copy
pause
mp.get_property_native("current-tracks/video")gives you a table with information about the currently selected video track. I think it returnsnilwhen there is currently no video track selected. Pictures also count as video track, so you might want to check theimageandalbumarttable entries.
How can I implement this into the lua script. I apologize I'm not too familiar with lua
You don't need a Lua script to pause an focus. That conditional profile does it. But in Lua you would use mp.get_property_native("current-tracks/video/image").
You can append this profile to
mpv.conf:[focus-lost] profile-cond=get('current-tracks/video/image') == false and not focused profile-restore=copy pause
This works however for whatever reason it messes with mpv_thumbnail_script_server.
It does not generate any thumbnails, when this profile is active
I can't tell you why thumbnail generation breaks with this, but you could try using https://github.com/po5/thumbfast instead.
You can append this profile to
mpv.conf:[focus-lost] profile-cond=get('current-tracks/video/image') == false and not focused profile-restore=copy pause
this works great, doesn't pause music, pauses video, but it doesn't pause image slideshow when i use mpv to "play back" a photo album. how would you modify it for it to do that? shouldn't /video/image pause for images?
You can append this profile to
mpv.conf:[focus-lost] profile-cond=get('current-tracks/video/image') == false and not focused profile-restore=copy pausethis works great, doesn't pause music, pauses video, but it doesn't pause image slideshow when i use mpv to "play back" a photo album. how would you modify it for it to do that? shouldn't /video/image pause for images?
As I mentioned above, this works however for whatever reason it messes with mpv_thumbnail_script_server.
It does not generate any thumbnails, when this conditioner profile is active. Thanks for the help though
this works great, doesn't pause music, pauses video, but it doesn't pause image slideshow when i use mpv to "play back" a photo album. how would you modify it for it to do that? shouldn't /video/image pause for images?
profile-cond=get('current-tracks/video/albumart') == false and not focused
('current-tracks/video/albumart') == false and not focused` that works and pauses image slideshows. apologies OP for hijacking the thread for my purposes. i see this was also mentioned above I didn't know where to include it because I'm new to these configs. cheers
('current-tracks/video/albumart') == false and not focused` that works and pauses image slideshows. apologies OP for hijacking the thread for my purposes. i see this was also mentioned above I didn't know where to include it because I'm new to these configs. cheers
Hey no worries, glad you got what you were looking for.
You can append this profile to
mpv.conf:[focus-lost] profile-cond=get('current-tracks/video/image') == false and not focused profile-restore=copy pause
I switched over to thumbfast and this works perfectly. Thanks for the help