Kodi Community Forum
Release Banners - (Display ad-banners over full screen video) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152)
+---- Thread: Release Banners - (Display ad-banners over full screen video) (/showthread.php?tid=298093)

Pages: 1 2 3 4 5 6 7


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2017-10-22

v1.9

- banner size and position fix and offset for standalone json calls


RE: Banners - (Display ad-banners over full screen video) - twilight0 - 2018-01-08

Could you please setup a github repo for this, I 'd like to send you a couple of pull requests.


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-08

That looked really complicated to me, that's why I use own repo Smile What changes do you want?


RE: Banners - (Display ad-banners over full screen video) - twilight0 - 2018-01-08

Ok I can give you the requested changes directly here, no problem...

1) default.py & standalone.py, latest addon version, line 99+
Code:
def _get_skin_resolution(self):
    xmlFile = os.path.join(xbmc.translatePath("special://skin/"), "addon.xml")
    xmldoc = minidom.parse(xmlFile)

    res = xmldoc.getElementsByTagName("res")
    xval = int(res[0].attributes["width"].value)
    yval = int(res[0].attributes["height"].value)

    return(xval, yval)
change to something like this:
Code:
def _get_skin_resolution(self):

    xval = xbmc.getInfoLabel('System.ScreenWidth')
    yval = xbmc.getInfoLabel('System.ScreenHeight')

    return int(xval), int(yval)

Reason: Skin's metadata provision has several resolutions and getting the first (with a slice) does not mean it will be correct for any given setup. Parenthesis is also redundant.

Second requested change:

Ability to set a banner/thumbnail/logo/whatever at top left or top right corner corner. Spacing can be 20 or 30 pixels for example from each edge. It can also be a remote url, I suppose.

Finally, be able to set a single image via the settings:

Example of settings.xml
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
    <category label="30000">
        <setting id="on" label="30001" type="bool" default="true"/>
        <setting id="changetime" label="30002" type="slider" default="30" range="5,5,120" option="int"/>
        <setting id="cyclepause" label="30004" type="slider" default="30" range="0,10,240" option="int"/>
        <setting id="bannerpos" label="30003" type="enum" lvalues="30011|30012" default="1"/>
        <setting id="yoffset" label="30006" type="slider" default="15" range="0,5,40" option="int"/>
        <setting id="random" label="30005" type="bool" default="false"/>
        <setting id="single_file" label="Set just a single file for display" type="bool" default="false"/>
        <setting id="image_file" label="Image file" type="file" default="" visible="eq(-1,true)"/>
    </category>
</settings>

Additionally, I 'd like to provide Greek translation. But this when you complete your changes.


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-08

OK, shouldn't be a problem. Only last item - why set only 1 banner? I think if you have only 1 image in banners folder, it will show only 1 banner, right?


RE: Banners - (Display ad-banners over full screen video) - twilight0 - 2018-01-08

I 'd like to be able to set that via a python command on another addon. It is possible however as it is now, but I was thinking this could be an alternative approach.


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-08

You can use JSON call to display arbitrary image: https://forum.kodi.tv/showthread.php?tid=298093&pid=2641415#pid2641415


RE: Banners - (Display ad-banners over full screen video) - twilight0 - 2018-01-09

(2018-01-08, 22:14)DaLanik Wrote: You can use JSON call to display arbitrary image: https://forum.kodi.tv/showthread.php?tid=298093&pid=2641415#pid2641415

Yes, It can do that, but it cannot stay for long time or until playback stops, unless I tweak the code. Moreover, it doesn't have corner option as we discussed.

Also, if the item is a playlist and standalone.py detects change in tracks it will only show the logo on the first item and not second and later.


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-09

(2018-01-08, 12:38)twilight0 Wrote: Ok I can give you the requested changes directly here, no problem...

1) default.py & standalone.py, latest addon version, line 99+
Code:
def _get_skin_resolution(self):
    xmlFile = os.path.join(xbmc.translatePath("special://skin/"), "addon.xml")
    xmldoc = minidom.parse(xmlFile)

    res = xmldoc.getElementsByTagName("res")
    xval = int(res[0].attributes["width"].value)
    yval = int(res[0].attributes["height"].value)

    return(xval, yval)
change to something like this:
Code:
def _get_skin_resolution(self):

    xval = xbmc.getInfoLabel('System.ScreenWidth')
    yval = xbmc.getInfoLabel('System.ScreenHeight')

    return int(xval), int(yval)

Reason: Skin's metadata provision has several resolutions and getting the first (with a slice) does not mean it will be correct for any given setup. Parenthesis is also redundant.
 Just tested with getInfoLabel('System.ScreenWidth') and it DOESN'T center the image correctly, while with my code it does... ??


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-09

(2018-01-08, 20:29)twilight0 Wrote: I 'd like to be able to set that via a python command on another addon. It is possible however as it is now, but I was thinking this could be an alternative approach.
 Just tested with 1 image and it displays only 1 image. So the solution is to set "change banners every" to any value (probably best to highest), and "pause between banners" to 0.


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-09

(2018-01-08, 12:38)twilight0 Wrote: Second requested change:

Ability to set a banner/thumbnail/logo/whatever at top left or top right corner corner. Spacing can be 20 or 30 pixels for example from each edge. It can also be a remote url, I suppose.

Finally, be able to set a single image via the settings:

Example of settings.xml
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
<setting id="on" label="30001" type="bool" default="true"/>
<setting id="changetime" label="30002" type="slider" default="30" range="5,5,120" option="int"/>
<setting id="cyclepause" label="30004" type="slider" default="30" range="0,10,240" option="int"/>
<setting id="bannerpos" label="30003" type="enum" lvalues="30011|30012" default="1"/>
<setting id="yoffset" label="30006" type="slider" default="15" range="0,5,40" option="int"/>
<setting id="random" label="30005" type="bool" default="false"/>
<setting id="single_file" label="Set just a single file for display" type="bool" default="false"/>
<setting id="image_file" label="Image file" type="file" default="" visible="eq(-1,true)"/>
</category>
</settings>
Additionally, I 'd like to provide Greek translation. But this when you complete your changes. 
 You can achieve this easily by making a transparent PNG/GIF and moving the image to the far left or right.


RE: Banners - (Display ad-banners over full screen video) - twilight0 - 2018-01-09

(2018-01-09, 11:06)DaLanik Wrote: Just tested with getInfoLabel('System.ScreenWidth') and it DOESN'T center the image correctly, while with my code it does... ?? 
 
Ok, so here is an example of estuary's skin addon.xml:

Code:
    <extension point="xbmc.gui.skin" debugging="false">
        <res width="1920" height="1440" aspect="4:3" default="false" folder="xml" />
        <res width="1920" height="1280" aspect="3:2" default="false" folder="xml" />
        <res width="1920" height="1200" aspect="16:10" default="false" folder="xml" />
        <res width="1920" height="1080" aspect="16:9" default="true" folder="xml" />
        <res width="2560" height="1080" aspect="21:9" default="false" folder="xml" />
    </extension>

Imho, simply using the first res doesn't apply to all setups, unless I am wrong and special://skin has a runtime-modified addon xml with simply only the current width/height used.

(2018-01-09, 11:21)DaLanik Wrote: Just tested with 1 image and it displays only 1 image. So the solution is to set "change banners every" to any value (probably best to highest), and "pause between banners" to 0. 

I 'll probably use this solution.

(2018-01-09, 12:13)DaLanik Wrote: You can achieve this easily by making a transparent PNG/GIF and moving the image to the far left or right. 

I 've never thought about it, very good idea. I hope its not being drawed of the playback controls and users can't use them.


RE: Banners - (Display ad-banners over full screen video) - twilight0 - 2018-01-09

By the way, here the strings.xml for the greek language:

https://pastebin.com/rm0XXTYa


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-09

(2018-01-09, 16:36)twilight0 Wrote:
(2018-01-09, 11:06)DaLanik Wrote: Just tested with getInfoLabel('System.ScreenWidth') and it DOESN'T center the image correctly, while with my code it does... ?? 
 
Ok, so here is an example of estuary's skin addon.xml:
Code:
<extension point="xbmc.gui.skin" debugging="false">
<res width="1920" height="1440" aspect="4:3" default="false" folder="xml" />
<res width="1920" height="1280" aspect="3:2" default="false" folder="xml" />
<res width="1920" height="1200" aspect="16:10" default="false" folder="xml" />
<res width="1920" height="1080" aspect="16:9" default="true" folder="xml" />
<res width="2560" height="1080" aspect="21:9" default="false" folder="xml" />
</extension>

Imho, simply using the first res doesn't apply to all setups, unless I am wrong and special://skin has a runtime-modified addon xml with simply only the current width/height used.
(2018-01-09, 11:21)DaLanik Wrote: Just tested with 1 image and it displays only 1 image. So the solution is to set "change banners every" to any value (probably best to highest), and "pause between banners" to 0. 

I 'll probably use this solution.
(2018-01-09, 12:13)DaLanik Wrote: You can achieve this easily by making a transparent PNG/GIF and moving the image to the far left or right. 

I 've never thought about it, very good idea. I hope its not being drawed of the playback controls and users can't use them. 
No, you can still use the controls. I had problems with sizing and positioning the image and I'd hate to mess something with unnecessary changes Smile

As far as resolution is concerned, I'll examine it in more depth. I'm using MIMIC both in v16 and v17 and it works for me, but you are correct. I have to find out what is the correlation between skin resolution and Kodi resolution.


RE: Banners - (Display ad-banners over full screen video) - User 325245 - 2018-01-09

Cool, thanx for the translation!