#!/usr/bin/env python




##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
    import builtins as builtin
except ImportError:
    import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
from Cheetah.Template import Template
from Cheetah.DummyTransaction import *
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
from Cheetah.CacheRegion import CacheRegion
import Cheetah.Filters as Filters
import Cheetah.ErrorCatchers as ErrorCatchers
from six.moves.urllib.parse import quote
from Plugins.Extensions.OpenWebif.controllers.i18n import tstrings

##################################################
## MODULE CONSTANTS
VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.4.4'
__CHEETAH_versionTuple__ = (2, 4, 4, 'development', 0)
__CHEETAH_genTime__ = 1644596121.206725
__CHEETAH_genTimestamp__ = 'Fri Feb 11 16:15:21 2022'
__CHEETAH_src__ = '/home/nonsolosat/openpli-dreambox-oe-core/build/tmp/work/dm520-oe-linux/enigma2-plugin-extensions-openwebif/gitAUTOINC+81b15e17ab-r0/git/plugin/controllers/views/mobile/channelinfo.tmpl'
__CHEETAH_srcLastModified__ = 'Fri Feb 11 15:59:45 2022'
__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'

if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
    raise AssertionError(
      'This template was compiled with Cheetah version'
      ' %s. Templates compiled before version %s must be recompiled.'%(
         __CHEETAH_version__, RequiredCheetahVersion))

##################################################
## CLASSES

class channelinfo(Template):

    ##################################################
    ## CHEETAH GENERATED METHODS


    def __init__(self, *args, **KWs):

        super(channelinfo, self).__init__(*args, **KWs)
        if not self._CHEETAH__instanceInitialized:
            cheetahKWArgs = {}
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
            for k,v in KWs.items():
                if k in allowedKWs: cheetahKWArgs[k] = v
            self._initCheetahInstance(**cheetahKWArgs)
        

    def respond(self, trans=None):



        ## CHEETAH: main method generated for this template
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write(u'''<body>
\t<div data-role="page">
\t\t<div id="header">
\t\t\t<div class="button" onclick="history.back()">''')
        _v = VFFSL(SL,"tstrings",True)['back'] # u"$tstrings['back']" on line 6, col 49
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['back']")) # from line 6, col 49.
        write(u'''</div>
\t\t\t<h1><a style="color:#FFF;text-decoration:none;" href=\'/mobile\'>OpenWebif</a></h1>
''')
        link = quote(VFFSL(SL,"channelinfo.sref",True), safe=' ~@#$&()*!+=:;,.?/\'')
        write(u'''\t\t\t<div class="button" style="right:5px;left:auto;" onclick="zapChannel(\'''')
        _v = VFFSL(SL,"link",True) # u'$link' on line 9, col 74
        if _v is not None: write(_filter(_v, rawExpr=u'$link')) # from line 9, col 74.
        write(u'''\');return false;">''')
        _v = VFFSL(SL,"tstrings",True)['zap'] # u"$tstrings['zap']" on line 9, col 97
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['zap']")) # from line 9, col 97.
        write(u'''</div>
\t\t</div>
\t\t<div id="mainContent" class="ui-corner-all">
\t\t\t<table width="100%" border="0" cellspacing="1" cellpadding="5">
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<th colspan="3" class="ui-btn-up-b" style="text-align: left;">''')
        _v = VFFSL(SL,"tstrings",True)['service'] # u"$tstrings['service']" on line 14, col 70
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['service']")) # from line 14, col 70.
        write(u'''</th>
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t<tr style="background-color:  #f0f7fc;">
\t\t\t\t\t\t\t<td width="200"><img src="''')
        _v = VFFSL(SL,"channelinfo.picon",True) # u'$channelinfo.picon' on line 17, col 34
        if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.picon')) # from line 17, col 34.
        write(u'''" border="0" alt="" style="max-width:100px"></td>
\t\t\t\t\t\t\t<td width="100%" valign="top">
\t\t\t\t\t\t\t<strong>''')
        _v = VFFSL(SL,"channelinfo.sname",True) # u'$channelinfo.sname' on line 19, col 16
        if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.sname')) # from line 19, col 16.
        write(u'''</strong><br />
''')
        if VFFSL(SL,"channelinfo.title",True): # generated from line 20, col 8
            write(u'''\t\t\t\t\t\t\t\t''')
            _v = VFFSL(SL,"channelinfo.title",True) # u'$channelinfo.title' on line 21, col 9
            if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.title')) # from line 21, col 9.
            write(u'''<br />
\t\t\t\t\t\t\t\t''')
            _v = VFFSL(SL,"channelinfo.begin",True) # u'$channelinfo.begin' on line 22, col 9
            if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.begin')) # from line 22, col 9.
            write(u'''-''')
            _v = VFFSL(SL,"channelinfo.end",True) # u'$channelinfo.end' on line 22, col 28
            if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.end')) # from line 22, col 28.
            write(u''' (''')
            _v = VFFSL(SL,"channelinfo.duration",True) # u'$channelinfo.duration' on line 22, col 46
            if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.duration')) # from line 22, col 46.
            write(u''' min)<br />
''')
        write(u'''\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<th colspan="2" class="ui-btn-up-b" style="text-align: left;">''')
        _v = VFFSL(SL,"tstrings",True)['current_event'] # u"$tstrings['current_event']" on line 27, col 70
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['current_event']")) # from line 27, col 70.
        write(u'''</th>
\t\t\t\t\t\t</tr>
''')
        if 'shortdesc' in VFFSL(SL,"channelinfo",True): # generated from line 29, col 7
            write(u'''\t\t\t\t\t\t<tr style="background-color:  #f0f7fc;">
\t\t\t\t\t\t\t<td colspan="2">''')
            _v = VFFSL(SL,"channelinfo.shortdesc",True) # u'$channelinfo.shortdesc' on line 31, col 24
            if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.shortdesc')) # from line 31, col 24.
            write(u'''</td>
\t\t\t\t\t\t</tr>
''')
        if 'longdesc' in VFFSL(SL,"channelinfo",True): # generated from line 34, col 7
            write(u'''\t\t\t\t\t\t<tr style="background-color:  #f0f7fc;">
\t\t\t\t\t\t\t<td colspan="2">''')
            _v = VFFSL(SL,"channelinfo.longdesc",True) # u'$channelinfo.longdesc' on line 36, col 24
            if _v is not None: write(_filter(_v, rawExpr=u'$channelinfo.longdesc')) # from line 36, col 24.
            write(u'''</td>
\t\t\t\t\t\t</tr>
''')
        write(u'''\t\t\t</table>
\t\t</div>
''')
        if VFFSL(SL,"channelepg",True): # generated from line 41, col 3
            write(u'''\t\t<div id="contentContainer">
\t\t\t<ul data-role="listview" data-inset="true" data-theme="d">
\t\t\t\t<li data-role="list-divider" role="heading" data-theme="b">''')
            _v = VFFSL(SL,"tstrings",True)['upcoming_events'] # u"$tstrings['upcoming_events']" on line 44, col 64
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['upcoming_events']")) # from line 44, col 64.
            write(u'''</li>
''')
            date = ""
            for event in VFFSL(SL,"channelepg",True): # generated from line 46, col 5
                if VFFSL(SL,"date",True) != VFFSL(SL,"event.date",True): # generated from line 47, col 6
                    write(u'''\t\t\t\t\t\t<li data-role="list-divider" role="heading" data-theme="b">''')
                    _v = VFFSL(SL,"event.date",True) # u'$event.date' on line 48, col 66
                    if _v is not None: write(_filter(_v, rawExpr=u'$event.date')) # from line 48, col 66.
                    write(u'''</li>
''')
                    date = VFFSL(SL,"event.date",True)
                write(u'''\t\t\t\t<li style="padding: 3px;">
\t\t\t\t\t<a href="/mobile/eventview?eventid=''')
                _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 52, col 41
                if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 52, col 41.
                write(u'''&eventref=''')
                _v = VFFSL(SL,"event.sref",True) # u'$event.sref' on line 52, col 60
                if _v is not None: write(_filter(_v, rawExpr=u'$event.sref')) # from line 52, col 60.
                write(u'''" style="padding: 3px;">
\t\t\t\t\t\t<h3>''')
                _v = VFFSL(SL,"event.title",True) # u'$event.title' on line 53, col 11
                if _v is not None: write(_filter(_v, rawExpr=u'$event.title')) # from line 53, col 11.
                write(u'''</h3>
\t\t\t\t\t\t<p>''')
                _v = VFFSL(SL,"event.begin",True) # u'$event.begin' on line 54, col 10
                if _v is not None: write(_filter(_v, rawExpr=u'$event.begin')) # from line 54, col 10.
                write(u''' - ''')
                _v = VFFSL(SL,"event.end",True) # u'$event.end' on line 54, col 25
                if _v is not None: write(_filter(_v, rawExpr=u'$event.end')) # from line 54, col 25.
                write(u'''</p>
\t\t\t\t\t</a>
\t\t\t\t</li>
''')
            write(u'''\t\t\t</ul>
\t\t</div>
''')
        write(u'''\t\t<div id="footer">
\t\t\t<p>OpenWebif Mobile</p>
\t\t\t<a onclick="document.location.href=\'/index?mode=fullpage\';return false;" href="#">''')
        _v = VFFSL(SL,"tstrings",True)['show_full_openwebif'] # u"$tstrings['show_full_openwebif']" on line 63, col 86
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['show_full_openwebif']")) # from line 63, col 86.
        write(u"""</a>
\t\t</div>
<script>
function zapChannel(sref) {
\t$.ajax('/api/zap?sRef=' + escape(sref));
}
</script>
</div>
</body>
</html>
""")
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        
    ##################################################
    ## CHEETAH GENERATED ATTRIBUTES


    _CHEETAH__instanceInitialized = False

    _CHEETAH_version = __CHEETAH_version__

    _CHEETAH_versionTuple = __CHEETAH_versionTuple__

    _CHEETAH_genTime = __CHEETAH_genTime__

    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__

    _CHEETAH_src = __CHEETAH_src__

    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__

    _mainCheetahMethod_for_channelinfo= 'respond'

## END CLASS DEFINITION

if not hasattr(channelinfo, '_initCheetahAttributes'):
    templateAPIClass = getattr(channelinfo, '_CHEETAH_templateClass', Template)
    templateAPIClass._addCheetahPlumbingCodeToClass(channelinfo)


# CHEETAH was developed by Tavis Rudd and Mike Orr
# with code, advice and input from many other volunteers.
# For more information visit http://www.CheetahTemplate.org/

##################################################
## if run from command line:
if __name__ == '__main__':
    from Cheetah.TemplateCmdLineIface import CmdLineIface
    CmdLineIface(templateObj=channelinfo()).run()


