1.18.0 date.extract - function does not work correctly? (1 Viewer)

123vak123

Portal Pro
December 13, 2010
207
161
Minsk
Home Country
Belarus Belarus
Thank you. I almost got what I wanted. Everything works fine, although there are some incomprehensible moments for me.
 

123vak123

Portal Pro
December 13, 2010
207
161
Minsk
Home Country
Belarus Belarus
Small report.
For "videoOSD.xml" everything works almost perfectly:
Code:
<define property="true" evaluateNow="true">#lenght:#(string.length(#currentremaining))</define>
<define property="true" evaluateNow="true">#end1:#(date.add('n',date.extract('n',cdate(#currentremaining)), date.add('h',date.extract('h',cdate(#currentremaining)),cdate(#time))))</define>
<define property="true" evaluateNow="true">#end2:#(date.add('n',date.extract('n',cdate(#currentremaining,'mm:ss')), date.add('h',date.extract('h',cdate(#currentremaining,'mm:ss')),cdate(#time))))</define>
<define property="true" evaluateNow="true">#end3:#(date.add('s',date.extract('s',cdate(#currentremaining,'m:ss')), date.add('n',date.extract('n',cdate(#currentremaining,'m:ss')), date.add('h',date.extract('h',cdate(#currentremaining,'m:ss')),cdate(#time)))))</define>

Code:
    <control>
        <description>End1</description>
        <type>label</type>
        <id>0</id>
            <posX>1635</posX>
            <posY>1005</posY>
        <label>Закончится в #(string.ltrim(#end1,'1,2,3,4,5,6,7,8,9,0,.'))</label>
            <textcolor>e6e6e6</textcolor>
            <font>fontB10</font>
        <align>right</align>
        <visible>string.equals(#lenght,7)</visible>
    </control>

    <control>
        <description>End2</description>
        <type>label</type>
        <id>0</id>
            <posX>1635</posX>
            <posY>1005</posY>
        <label>Закончится в #(string.ltrim(#end2,'1,2,3,4,5,6,7,8,9,0,.'))</label>
            <textcolor>e6e6e6</textcolor>
            <font>fontB10</font>
        <align>right</align>
        <visible>string.equals(#lenght,5)</visible>
    </control>

    <control>
        <description>End3</description>
        <type>label</type>
        <id>0</id>
            <posX>1635</posX>
            <posY>1005</posY>
        <label>Закончится в #(string.ltrim(#end3,'1,2,3,4,5,6,7,8,9,0,.'))</label>
            <textcolor>e6e6e6</textcolor>
            <font>fontB10</font>
        <align>right</align>   
        <visible>string.equals(#lenght,4)</visible>
    </control>

End1 - #currentremaining more than one hour, End2 - #currentremaining less than one hour, more than 10 minutes, End3 - #currentremaining less than 10 minutes.

The "ctimespan" function could not be used - I got either an error or the current time (maybe I did not use it correctly or violated the syntax).
The above codes work only in "videoOSD.xml". In "videoFullScreen.xml" they do not work. For "videoFullScreen.xml" work:
Code:
<define property="true" evaluateNow="true">#lenght:#(string.length(#currentremaining))</define>
...
    <control>
        <description>End1</description>
        <type>label</type>
        <id>0</id>
            <posX>1635</posX>
            <posY>1005</posY>
        <label>Закончится: #(date.add('n',date.extract('n',cdate(#currentremaining)), date.add('h',date.extract('h',cdate(#currentremaining)),cdate(#time))))</label>
            <textcolor>e6e6e6</textcolor>
            <font>fontB10</font>
        <align>right</align>
        <visible>[control.isVisible(111)|control.isVisible(10)|control.isVisible(11)|control.isVisible(12)] + string.equals(#lenght,7)</visible>
    </control>

    <control>
        <description>End2</description>
        <type>label</type>
        <id>0</id>
            <posX>1635</posX>
            <posY>1005</posY>
        <label>Закончится: #(date.add('n',date.extract('n',cdate(#currentremaining,'mm:ss')), date.add('h',date.extract('h',cdate(#currentremaining,'mm:ss')),cdate(#time))))</label>
            <textcolor>e6e6e6</textcolor>
            <font>fontB10</font>
        <align>right</align>
        <visible>[control.isVisible(111)|control.isVisible(10)|control.isVisible(11)|control.isVisible(12)] + string.equals(#lenght,5)</visible>
    </control>

    <control>
        <description>End3</description>
        <type>label</type>
        <id>0</id>
            <posX>1635</posX>
            <posY>1005</posY>
        <label>Закончится: #(date.add('s',date.extract('s',cdate(#currentremaining,'m:ss')), date.add('n',date.extract('n',cdate(#currentremaining,'m:ss')), date.add('h',date.extract('h',cdate(#currentremaining,'m:ss')),cdate(#time)))))</label>
            <textcolor>e6e6e6</textcolor>
            <font>fontB10</font>
        <align>right</align>   
        <visible>[control.isVisible(111)|control.isVisible(10)|control.isVisible(11)|control.isVisible(12)] + string.equals(#lenght,4)</visible>
    </control>

But in this case I can not use the function string.ltrim - getting error (0).
Well, something like this
 

123vak123

Portal Pro
December 13, 2010
207
161
Minsk
Home Country
Belarus Belarus
There are a few more points. But their features is difficult for me to explain in Russian, and even more so in English :)
 

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    16,062
    11,144
    Kyiv
    Home Country
    Ukraine Ukraine
    But in this case I can not use the function string.ltrim - getting error (0).
    Well, something like this
    Yes, date.add return DateTime, string.ltrim work only with string, format DateTime to string and then use ltrim ;)



    --
    WBR, ajs
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,062
    11,144
    Kyiv
    Home Country
    Ukraine Ukraine
    There are a few more points. But their features is difficult for me to explain in Russian, and even more so in English :)
    we can go to the Russian part of the forum and continue there.

    --
    WBR, ajs
     

    Users who are viewing this thread

    Top Bottom