torque / mpv-progressbar

A simple progress bar for mpv.
ISC License
155 stars 8 forks source link

Progress bar position #44

Closed 2V3EvG4LMJFdRe closed 6 years ago

2V3EvG4LMJFdRe commented 6 years ago

I'm looking for a way to center the progress bar. I tried playing around with the settings, but apparently none of them change any setting at all for me, so I'm kind of double asking where to put the "torque-progressbar.conf" file too (I tried "scripts" and next to "mpv.exe").

torque commented 6 years ago

I'm not sure what you mean by "center" the progress bar. You'll have to explain further exactly what you're trying to achieve for me to help you.

As for the configuration file, you will need to make a directory at the same level as the scripts directory, named lua-settings and put torque-progressbar.conf in that. i.e. your directory structure should look something like:

.
├── lua-settings
│   └── torque-progressbar.conf
├── mpv.conf
└── scripts
    └── progressbar.lua

Note that I'm not exactly sure which folder this all goes in on Windows, but if you've managed to get the script loaded, I hope this is enough information to figure out the rest.

2V3EvG4LMJFdRe commented 6 years ago

Right, sorry, I should have been clearer - I'd like to have it right on the center of the screen. Like, height = 50%.

Thanks for the tip on the config file, I'll try it tomorrow!

2V3EvG4LMJFdRe commented 6 years ago

Didn't mean to close!

FichteFoll commented 6 years ago

@firewater2 how do you expect the hover mechanism to work in this case? Show the progress bar when the mouse is moved anywhere on the window?

2V3EvG4LMJFdRe commented 6 years ago

Oh, I forgot to also mention, I only use the "script-binding progressbar/request-display" part of the script. So it'd simply appear on the middle of the screen when mapped to whichever input.conf I have it set to.

In case anyone is wondering about the odd location - basically I 1. don't like having it at the bottom (no big reason, just don't) and 2. I can't predict letterboxd content, so wherever else I place it, it won't always look symmetrical depending on the aspect ratio oft he film (which really bothered me). So I settled on having it on the middle. I don't like using the default MPV one much because 1. they don't have the option to disable episode markers, and 2. the style is adopted from the subtitle style, which I change around depending on the type of content (movie, anime, etc), therefore altering the progress bar to a point were it looks bad (thin lines with subtitle-border: 1 or 2 being the worst offender).

torque commented 6 years ago

The script isn't designed to have the progress bar moved from the bottom of the screen, so there isn't currently a configuration option to change that. It's simply not a use-case I had considered.

I'd be ok with properly implementing such an option in the future, but development is pretty slow at the moment as I've been very busy with other things. Your best bet to try it sooner rather than later is to hack it into the current script. It should be very easy to just hack it in. I can provide a patch for you in the next couple of days.

torque commented 6 years ago

It's a super quick hack that probably behaves somewhat oddly, but try this out:

https://gist.github.com/torque/e92c363b9734be68f81be2630b4ea939

e: updated link to just point at the gist

2V3EvG4LMJFdRe commented 6 years ago

Hey thanks! I actually won't have Internet until the the beginning of 2018 so I'm not prepared to test this much these days, but I appreciate the fast fix much! This version should accept the torque-progressbar.conf too, right? Because for example, I tried width=50, but it seems to take the entire screen still.

torque commented 6 years ago

Yes, it should load the same configuration file. I suspect that you're misunderstanding what the progress-bar-width setting does (admittedly, the description is fairly ambiguous). Also, I just checked and it doesn't work properly with that modification anyway (I've updated the link).

The point of progress-bar-width is to make the actual progress indicator a segment that moves, rather than grow from the left. It does not change the width of the background or the cache bar (though the cache UI will probably be changing a bit in the future). I've attached 2 images showing the difference.

edit: I just backported a fix from my current development branch to quickly check that it worked as expected, and now it is possible to do something like this:

with the settings:

bar-default-style=\alpha&HFF&
# inherit \bord3 from default-style setting
bar-foreground-style=\alpha&H00&
progress-bar-width=20
2V3EvG4LMJFdRe commented 6 years ago

Hey there again. So I've been fiddling around with a mockup of how I'd like the bar to look like, and this is what I've come up with:

osd

I think the options that I'd need for this would be for a setting to specify the placement of the bar. Something like a % value from 1-100 relating to the Y coordinate of the bar, much like MPV's osd-bar-align-y. I think the other values support the transparency needed, and that I could use some big borders to get the result desired, correct?

torque commented 6 years ago

Yes, except for the positioning and width, this is currently feasible (though the border will have rounded corners—a limitation of ASS). I've hacked two new options into the modified script I posted above:

# The vertical position of the progress bar in the window, percentage. 100 is
# at the bottom, 0 is off the top. Experimental.
progress-bar-y-pos=100

# The overall width the progress bar in the window, percentage. 100 is full width,
# 0 is undefined. The bar will always be centered. Experimental.
progress-bar-overall-width=100

Then, with the following configuration,

progress-bar-y-pos=20
progress-bar-overall-width=80
bar-foreground-style=\c&HFFFFFF&
bar-cache-style=\c&HA4A4A4&
bar-background-style=\bord8\c&H2D2D2D&\3a&H7F&\3c&H202020&

the result is:

2V3EvG4LMJFdRe commented 6 years ago

How cool!!! I love it! Thanks so much! I do have one last question regarding the hovering function, though. Since I call the bar with ; script-binding progressbar/request-display I'm wondering if there's any way to disable it from appearing when one hovers the mouse at the bottom?

torque commented 6 years ago

hover-zone-height=0 should do it (and you might want to set top-hover-zone-height=0 while you're at it).