osumoclement / script.black.bars.never

An addon to automatically remove black bars in KODI
GNU General Public License v3.0
12 stars 2 forks source link

[Question] Opening “Zoom amount” window through python code #4

Closed TwilightMercy closed 1 year ago

TwilightMercy commented 1 year ago

Hi friend,

In the meantime, until the android workaround is in development to perfection, I want to configure in Estuary’s player OSD a button to simply open the manual zoom slider available in Video settings in player - “Zoom amount”: image

image

For simple “onclick” function in skin’s VideoOSD.xml file, I only found that it’s possible to do ZoomIn/ZoomOut functions: image

But I’m looking for a direct shortcut to “Zoom Amount” window, for manually moving the slider. Do you know if it’s possible with small python code as a small Kodi addon?

Thanks.

osumoclement commented 1 year ago

From looking at logs in KODI, the window activated is sliderdialog ID 1045. So I also think it works similarly to how you implemented the addon toggle, meaning you have to read current values and increment manually. Reference for slider. So logic is this:

  1. Instantiate slider, read current zoom amount and use setPercent to set the initial position
  2. React to left and right buttons to move slider appropriately and at the same time setting the actual zoom
TwilightMercy commented 1 year ago

Wouldn’t be opening the window 10145 “sliderdialog” be enough? To open this: image

And it will work as usual like opening it in manually in Kodi?

osumoclement commented 1 year ago

I don't think so. The dialog is reusable, which means it doesn't exist specifically for just zooming. Here's the code where it gets created as seen here:

if (g_application.GetAppPlayer().Supports(RENDERFEATURE_ZOOM))
    AddSlider(groupVideo, SETTING_VIDEO_ZOOM, 216, SettingLevel::Basic,
              videoSettings.m_CustomZoomAmount, "{:2.2f}", 0.5f, 0.01f, 2.0f, 216, usePopup);
TwilightMercy commented 1 year ago

I see, thanks for the explanation, I’m not that experienced in that area.

Is it hard/complicated to make a small python code addon to reproduce the “Zoom amount” window on button press? I’m afraid I don’t have the knowledge for that.

osumoclement commented 1 year ago

Not too difficult. I'll give it a try sometime next week

TwilightMercy commented 1 year ago

Thank you, appreciated.

osumoclement commented 1 year ago

Hey. Do you know an addon which uses Control Slider?

TwilightMercy commented 1 year ago

I don't think I know something for OSD. I found this in Kodi forum if it helps:

https://forum.kodi.tv/showthread.php?tid=372010

TwilightMercy commented 1 year ago

Hey. Do you know an addon which uses Control Slider?

I know that FEN addon has control slider but in addon settings image

osumoclement commented 1 year ago

I give up, I have gotten only as far as showing a Control Slider which for some reason looks weird, like a webpage without CSS. Would have uploaded screenshot but don't know how

TwilightMercy commented 1 year ago

Just press "Prt screen" button in keyboard and paste directly here

Anyway, don't give up : ) If you can make it work (regardless the design), I have a friend who knows to design addon/skins and stuff.

osumoclement commented 1 year ago

image

TwilightMercy commented 1 year ago

Haha :) but don’t worry about it, I’ll later give it to my friend to check The goal if possible to open this slider in player OSD with button that have “onclick” function similar to black bars never, like: RunScript(addon_name, function)

osumoclement commented 1 year ago

Yes. If you look at this he is using XML like you did (while I am using Python). From here you can see the code will look like this

<include name="OSD_PlaySpeed_Label">
        <param name="width">52</param>
        <param name="selected">false</param>
        <param name="textcolor">dialog_fg_70</param>
        <definition>
            <control type="label">
                <font>font_tiny</font>
                <label>$PARAM[label]</label>
                <include content="Object_TextColor" condition="$PARAM[selected]">
                    <param name="textcolor">$VAR[ColorSelected]</param>
                </include>
                <textcolor>$PARAM[textcolor]</textcolor>
                <width>$PARAM[width]</width>
                <align>center</align>
            </control>
        </definition>
    </include>
osumoclement commented 1 year ago

So this is what I have right now, if they could modify it to use XML for ControlSlider instead (or make it look good in Python) then it would be okay script.zoomshortcut (1).zip

TwilightMercy commented 1 year ago

I've installed it and it opened the scroller with the big white circle How can I call in the the player to activate it? and will using right/left keys in keyboard will move the zoom slider?

osumoclement commented 1 year ago

Then increment/deincrement values using \<onleft> and \<onright> with conditionals.

From the link I gave seems you're supposed to react to left and right manually for example like this <onleft>incrementZoom()</onleft>

TwilightMercy commented 1 year ago

I see, I thought (if possible) that the python code itself will open the slider and react to left/right which will change the zoom

Or it isn’t?

osumoclement commented 1 year ago

Seems for most things Kodi offers both Python way and XML way. But documentation too lacking