You are not logged in.

#21 2017-03-16 03:01:18

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: mpv wrapper script

^ Works beautifully smile

...testing for audio and having a narrow window would be nice though.

EDIT: I tried with a one-liner by using

if $(file --mime-type -b <filename>) | grep audio;then...

...the smaller the window, the smaller the control bar sad

Last edited by damo (2017-03-16 03:39:52)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#22 2017-03-16 06:51:54

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,661
Website

Re: mpv wrapper script

@damo OK you've convinced me (don't need grep):

[[ $(file --mime-type --brief "$1") = audio* ]] &&...

This seems to work for all audio files except 'opus' which return a mime-type of application/octet-stream for some reason.
Even so, to shrink the window only for files which we've successfully identified as audio still might be worth doing.

EDIT: above code is bash-only.

Did you find the control bar too small at a window size of 450x250?

Last edited by johnraff (2017-03-16 07:13:47)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#23 2017-03-16 06:58:49

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: mpv wrapper script

johnraff wrote:

....
Did you find the control bar too small at a window size of 450x250?

It was tiny, on a 1920x1080 HiDP screen res.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#24 2017-03-16 07:20:15

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,661
Website

Re: mpv wrapper script

My screen's 1440x900 where 450x250 isn't particularly small to me.
Would 500x300 be a usable compromise? Still too small?

The default 640x480 looks huge here.

Bash-free mime test:

    case "$(file --mime-type --brief "$1")" in
    audio*)
        geom="$audio_size";;
    *)
        geom='';;
    esac

Last edited by johnraff (2017-03-16 07:35:45)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#25 2017-03-17 03:49:04

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,661
Website

Re: mpv wrapper script

johnraff wrote:

The default 640x480 looks huge here.

640x480 is what man mpv says is the default, but xwininfo reported 960x479 which makes more sense.

The amazing mpv also allows dimensions as a percentage of screen width though. cool

@damo how does --geometry='35%x25%' look for you?
It's a pity the control bar is scaled to use only part of the window, or it could be smaller still for audio.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#26 2017-03-17 04:01:21

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: mpv wrapper script

johnraff wrote:

...
@damo how does --geometry='35%x25%' look for you?
It's a pity the control bar is scaled to use only part of the window, or it could be smaller still for audio.

Nice find - works for me smile

Another approach might be to use different profiles (conffiles) for audio or video?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#27 2017-03-17 07:35:41

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: mpv wrapper script

johnraff wrote:

It's a pity the control bar is scaled to use only part of the window, or it could be smaller still for audio.

again something that will change in later versions.
also, if the audio has embedded coverart, the window will autoresize.

this example is audio only, no embedded artwork.
i made the window smaller, but much smaller than that, the font becomes unreadable.
and it seems to insist on the original 16:9(?) aspect ratio.

i don't think mpv will ever become a good default audio player.
but definitely good as a fallback, until $USER installs what they desire.

Last edited by ohnonot (2021-07-02 08:33:01)

Offline

#28 2017-03-17 07:52:28

nobody
The Great
Registered: 2015-08-10
Posts: 3,655

Re: mpv wrapper script

ohnonot wrote:
johnraff wrote:

It's a pity the control bar is scaled to use only part of the window, or it could be smaller still for audio.

again something that will change in later versions.
also, if the audio has embedded coverart, the window will autoresize.

this example is audio only, no embedded artwork.
i made the window smaller, but much smaller than that, the font becomes unreadable.
and it seems to insist on the original 16:9(?) aspect ratio.
http://dt.iki.fi/stuff/mpv.png

i don't think mpv will ever become a good default audio player.
but definitely good as a fallback, until $USER installs what they desire.

The scaling of the control bar (as well as its fonts) can be controlled by setting special scaling parameters in the config or on the command line.

Offline

#29 2017-03-22 07:12:17

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,661
Website

Re: mpv wrapper script

twoion wrote:

The scaling of the control bar (as well as its fonts) can be controlled by setting special scaling parameters in the config or on the command line.

I didn't find fonts, but these options got the control bar bigger, and centered, good for audio (with no image):

--lua-opts=osc-scaleforcedwindow=3,osc-valign=0

Screenshot_220317_15_53_34.jpg(click the image to see that it's not really cropped)
Anyway, I'll throw that into bl-mpv in bunsen-configs for now. No-one is obliged to use it, and it will be easy enough to improve later by upgrading bunsen-configs.

ie

#!/bin/sh

# wrapper for mpv to enable use as alternative for bl-media-player

audio_size='35%x25%' # window for playing audio
audio_osc='osc-scaleforcedwindow=3,osc-valign=0' # arrange the on-screen-controller

hash mpv || {
    echo "$0: Install mpv to use this script" >&2
    exit 1
}

if [ -n "$1" ]
then
    if [ "$#" -gt 1 ]
    then
        title='mpv' # $title is only needed for terminal
    else
        title="mpv: ${1##*/}"
    fi
    case "$(file --mime-type --brief "$1")" in
    audio*)
        geom="$audio_size"
        luaopts="$audio_osc";;
    *)
        geom=''
        luaopts='';;
    esac
# uncomment the next line to run mpv in a terminal
#   x-terminal-emulator -T "$title" -e mpv "$@"
# comment out the next line if you use x-terminal-emulator
    mpv --no-terminal --force-window --geometry="$geom" --lua-opts="$luaopts" "$@"
else
    mpv --no-terminal --force-window --idle --title='mpv - ${filename:Drop media files here}'
fi

exit

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#30 2017-03-30 00:36:09

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,030

Re: mpv wrapper script

OK late to the party, I use a Custom Action in Thunar:

Basic:
Name: MPV
Description: media files
Command: mpv %f --no-border --geometry=60:60

Icon: the MPV icon (From Applications)

Appearance Conditions:
File Pattern: *

Appears if selection contains: Tick Audio and Video Files

Thunar has a direct link to my video folder.  big_smile

EDIT:  === Above is to get a border-less MPV running ===

Since MPV is my only player here a double click on a files starts it with a window.

Hitting "f" give full screen in both
2017-03-29_214437_Scrot11.th.png


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

Board footer

Powered by FluxBB