<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd">

<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimechannel}" shifttype="bottom" shiftmode="slowed">
    <background>
        <!-- background infobar -->
        <area x="20%" y="80%" width="80%" height="20%" layer="1">
            <fill color="{clrTransBlack}" />
        </area>
        <!-- background channellogo -->
        <area x="0" y="80%" width="20%" height="20%" layer="2">
            <fill color="{clrTransBlueLight}" />
        </area>
    </background>

    <channelinfo>
        <area x="22%" y="80%" width="76%" height="7%" layer="2">
            <fill condition="not{switching}" color="{clrTransparent}" />
            <drawtext condition="{switching}" x="0" y="-10" font="{light}" fontsize="99%" color="{clrWhite}" text="{channelnumber}: {channelname}" />
        </area>
        <area x="0" y="80%" width="20%" height="20%" layer="3">
            <drawimage cache="true" condition="{channellogoexists}" imagetype="channellogo" path="{channelid}" width="98%" height="98%" align="center" valign="center" />
            <drawtext condition="not{channellogoexists}" x="5" valign="center" font="{light}" fontsize="40%" color="{clrWhite}" text="{channelnumber}: {channelname}" />
        </area>
    </channelinfo>
    
    <epginfo>
        <area x="22%" y="80%" width="76%" height="7%" layer="2">
            <drawtext name="title" x="0" valign="center" font="{light}" fontsize="99%" color="{clrWhite}" text="{currenttitle}" width="{areawidth} - {width(startstop)}"/>
            <drawtext name="startstop" align="right" y="0" font="{light}" fontsize="60%" color="{clrWhite}" text="{currentstart} - {currentstop}" />
            <drawtext align="right" y="45%" font="{light}" fontsize="60%" color="{clrWhite}" text="+ {currentremaining} min" />
        </area>
        <area x="22%" y="87%" width="76%" height="7%" layer="2">
            <drawtext x="0" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{nexttitle}" width="{areawidth} - {width(startstop)}"/>
            <drawtext name="startstop" align="right" y="0" font="{light}" fontsize="60%" color="{clrWhite}" text="{nextstart} - {nextstop}" />
            <drawtext align="right" y="45%" font="{light}" fontsize="60%" color="{clrWhite}" text="{nextduration} min" />
        </area>
    </epginfo>

    <progressbar>
        <area condition="not{permashift}" x="22%" y="87%" width="76%" height="3" layer="2">
            <drawrectangle x="0" y="1" width="100%" height="1" color="{clrWhite}" />
            <drawrectangle x="0" y="0" width="{elapsed}/{duration}*{areawidth}" height="3" color="{clrTransBlueLight}" />
        </area>
        <area condition="{permashift}" x="22%" y="87%" width="76%" height="5" layer="2">
            <drawrectangle x="0" y="2" width="100%" height="1" color="{clrWhite}" />
            <drawrectangle x="{elapsed}/{duration}*{areawidth} - {livebuffer}/{duration}*{areawidth}" y="0" width="{livebuffer}/{duration}*{areawidth}" height="5" color="{clrRed}" />
            <drawrectangle x="0" y="1" width="{elapsed}/{duration}*{areawidth}" height="3" color="{clrTransBlueLight}" />
        </area>
    </progressbar>

    <statusinfo>
        <area x="22%" y="94%" width="76%" height="6%" layer="2">
            <!-- encrypted / decrypted icon -->
            <drawimage name="enc" condition="{isEncrypted}" imagetype="icon" path="ico_crypt_on" x="{areawidth} - {width(enc)}" valign="center" width="{areaheight}*0.8*1.76" height="{areaheight}*0.8"/>
            <drawimage condition="not{isEncrypted}" imagetype="icon" path="ico_crypt_off" x="{areawidth} - {width(enc)}" valign="center" width="{areaheight}*0.8*1.76" height="{areaheight}*0.8"/>
            <!-- dolby icon -->
            <drawimage name="dolby" condition="{isDolby}" imagetype="icon" path="ico_dolby_on" x="{posx(enc)} - 15 - {width(dolby)}" valign="center" width="{areaheight}*0.8*1.48" height="{areaheight}*0.8"/>
            <drawimage condition="not{isDolby}" imagetype="icon" path="ico_dolby_off" x="{posx(enc)} - 15 - {width(dolby)}" valign="center" width="{areaheight}*0.8*1.48" height="{areaheight}*0.8"/>
            <!-- videotext icon -->
            <drawimage name="txt" condition="{hasVT}" imagetype="icon" path="ico_txt_on" x="{posx(dolby)} - 15 - {width(txt)}" valign="center" width="{areaheight}*0.8*1.3" height="{areaheight}*0.8"/>
            <drawimage condition="not{hasVT}" imagetype="icon" path="ico_txt_off" x="{posx(dolby)} - 15 - {width(txt)}" valign="center" width="{areaheight}*0.8*1.3" height="{areaheight}*0.8"/>
            <!-- recording icon -->
            <drawimage animtype="blink" animfreq="500" name="rec" condition="{isRecording}" imagetype="icon" path="ico_rec_on" x="{posx(txt)} - 15 - {width(rec)}" valign="center" width="{areaheight}*0.8*1.96" height="{areaheight}*0.8"/>
            <drawimage condition="not{isRecording}" imagetype="icon" path="ico_rec_off" x="{posx(txt)} - 15 - {width(rec)}" valign="center" width="{areaheight}*0.8*1.95652" height="{areaheight}*0.8"/>
        </area>
    </statusinfo>

    <audioinfo>
    </audioinfo>

    <screenresolution>
        <area x="22%" y="94%" width="76%" height="6%" layer="2">
            <!-- widescreen icon -->
            <drawimage name="widescreen" condition="{isWideScreen}" imagetype="icon" path="ico_widescreen_on" x="{areawidth} - {areaheight}*0.8*1.76 - 15 - {areaheight}*0.8*1.48 - 15 - {areaheight}*0.8*1.3 - 15 - {areaheight}*0.8*1.96 - 15 - {width(widescreen)}" valign="center" width="{areaheight}*0.8*1.87" height="{areaheight}*0.8"/>
            <drawimage condition="not{isWideScreen}" imagetype="icon" path="ico_widescreen_off" x="{areawidth} - {areaheight}*0.8*1.76 - 15 - {areaheight}*0.8*1.48 - 15 - {areaheight}*0.8*1.3 - 15 - {areaheight}*0.8*1.96 - 15 - {width(widescreen)}" valign="center" width="{areaheight}*0.8*1.87" height="{areaheight}*0.8"/>
            <!-- hd/sd icon -->
            <drawimage name="hd" condition="{isHD}" imagetype="icon" path="ico_hd_on" x="{posx(widescreen)} - 15 - {width(hd)}" valign="center" width="{areaheight}*0.8*2.04" height="{areaheight}*0.8"/>
            <drawimage condition="not{isHD}" imagetype="icon" path="ico_hd_off" x="{posx(widescreen)} - 15 - {width(hd)}" valign="center" width="{areaheight}*0.8*2.04" height="{areaheight}*0.8"/>
            <!-- screenresolution text -->
            <drawtext name="reslabel" x="{posx(hd)} - 30 - {width(reslabel)}" valign="center" font="{light}" fontsize="70%" color="{clrWhite}" text="{screenwidth}x{screenheight}" />
        </area>
    </screenresolution>

    <channelgroup>
        <area x="0" y="80%" width="20%" height="20%" layer="2">
            <drawimage condition="{sepexists}" imagetype="seplogo" path="{seppath}" width="98%" height="98%" align="center" valign="center" />
            <drawimage condition="not{sepexists}" imagetype="icon" path="ico_channelsep" align="center" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
        </area>
        <area x="22%" y="85%" width="76%" height="10%" layer="2">
            <drawtext x="0" width="30%" valign="center" font="{light}" fontsize="60%" color="{clrWhite}" text="{prevgroup}" />
            <drawtext x="30%" width="40%" valign="center" font="{semibold}" fontsize="80%" color="{clrWhite}" text="{group}" />
            <drawtext align="right" width="30%" valign="center" font="{light}" fontsize="60%" color="{clrWhite}" text="{nextgroup}" />
        </area>             
    </channelgroup>

    <signalquality>
        <area x="22%" y="94%" width="76%" height="6%" layer="3">
            <drawtext x="0" valign="center" font="{light}" fontsize="70%" color="{clrWhite}" text="STR: {signalstrength}% SNR: {signalquality}%" />
        </area>
    </signalquality>

    <devices condition="{showdevices}" shifttime="{shifttimedatetime}" shifttype="right" shiftmode="slowed">
        <area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1" background="true">
            <fill color="{clrTransBlack}"/>
        </area>
        <area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
            <loop name="devices" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight} / {numdevices}" overflow="cut">
                <drawtext name="label" x="5" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="{devices[num]}: {devices[type]}" />
                <drawtext condition="{devices[hascam]}" x="{width(label)} + 15" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="(CAM {devices[cam]})" />
                <drawtext condition="{devices[recording]} ++ {devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrRed}" text="LiveTV, Recording ({devices[channelname]}) " />
                <drawtext condition="{devices[recording]} ++ not{devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrRed}" text="Recording ({devices[channelname]}) " />
                <drawtext condition="not{devices[recording]} ++ {devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="LiveTV ({devices[channelname]}) " />
                <drawrectangle condition="{devices[istuned]}" x="5" y="{rowheight}/3 + 5" width="{areawidth} * {devices[signalstrength]} / 100 - 10 * {devices[signalstrength]} / 100" height="{rowheight}/3 - 10" color="{clrTransWhite}" />
                <drawrectangle condition="{devices[istuned]}" x="5" y="2*{rowheight}/3 + 5" width="{areawidth} * {devices[signalquality]} / 100 - 10 * {devices[signalquality]} / 100" height="{rowheight}/3 - 10" color="{clrTransWhite}" />
                <drawtext condition="not{devices[istuned]}" align="center" y="{rowheight}/2" font="{light}" fontsize="{rowheight}*0.40" color="{clrWhite}" text="not tuned" />
            </loop>
        </area>
    </devices>

    <currentweather shifttime="{shifttimedatetime}" shifttype="right" shiftmode="slowed">
        <area background="true" x="70%" y="15%" width="30%" height="13%" layer="1">
            <fill color="{clrTransBlack}" />
            <drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
        </area>
        <area x="70%" y="15%" width="30%" height="13%" layer="2">
            <drawimage name="weathericon" imagetype="icon" path="{icon}" x="0.43*{areawidth}/2 - {width(weathericon)}/2" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
        </area>
        <area x="70%" y="15%" width="30%" height="13%" layer="2">
            <drawtext x="50%" y="0" font="{light}" fontsize="25%" color="{clrWhite}" text="{mintemperature}°C" />
            <drawtext x="50%" y="75%" font="{light}" fontsize="25%" color="{clrWhite}" text="{maxtemperature}°C" />
        </area>
        <area x="70%" y="15%" width="30%" height="13%" layer="3">
            <drawtext x="50%" valign="center" font="{light}" fontsize="60%" color="{clrWhite}" text="{temperature}°C" />
        </area>
    </currentweather>

    <scrapercontent shifttime="{shifttimedatetime}" shifttype="left" shiftmode="slowed">
        <area condition="{isbanner}" x="0" y="0" width="{areaheight}*0.13*{mediawidth}/{mediaheight}" height="13%" layer="2">
            <drawimage imagetype="image" path="{mediapath}" align="center" valign="center" width="{areawidth}" height="{areaheight}"/>
        </area>
        <area condition="not{isbanner}" x="0" y="0" width="{areaheight}*0.5*{mediawidth}/{mediaheight}" height="50%" layer="2">
            <drawimage imagetype="image" path="{mediapath}" x="5" y="5" width="{areawidth}-10" height="{areaheight}-10"/>
        </area>
    </scrapercontent>

    <datetime shifttime="{shifttimedatetime}" shifttype="right" shiftmode="slowed">
        <area background="true" x="70%" y="0" width="30%" height="13%" layer="1">
            <fill color="{clrTransBlack}" />
            <drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
        </area>
        <area x="70%" y="0" width="30%" height="13%" layer="2">
            <drawtext align="right" y="0" font="{light}" fontsize="50%" color="{clrWhite}" text="{dayname} " />
            <drawtext align="right" y="48%" font="{light}" fontsize="50%" color="{clrWhite}" text="{day}. {monthnameshort} " />
        </area>
        <area x="70%" y="0" width="30%" height="13%" layer="2">
            <drawtext x="1%" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{time}" />
        </area>
    </datetime>
    
    <message>
        <area x="10%" y="45%" width="80%" height="10%" layer="1">
            <fill color="{clrTransBlack}" />
            <drawrectangle condition="{status}" x="20" y="0" width="20" height="100%" color="{clrGreen}" />
            <drawrectangle condition="{info}" x="20" y="0" width="20" height="100%" color="{clrBlue}" />
            <drawrectangle condition="{warning}" x="20" y="0" width="20" height="100%" color="{clrYellow}" />
            <drawrectangle condition="{error}" x="20" y="0" width="20" height="100%" color="{clrRed}" />
            <drawtext align="center" valign="center" width="{areawidth} - 80" font="{light}" fontsize="40%" color="{clrWhite}" text="{text}" />
        </area>
    </message>

</displaychannel>
