#!/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 json import dumps
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__ = 1644596120.806395
__CHEETAH_genTimestamp__ = 'Fri Feb 11 16:15:20 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/ajax/event.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 event(Template):

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


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

        super(event, 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
        
        etime = time.localtime(VFFSL(SL,"event.begin",True))
        channel = VFN(VFFSL(SL,"event.channel",True),"replace",False)("'", r"\'")
        title = VFN(VFFSL(SL,"event.title",True),"replace",False)("'", r"\'")
        sref = quote(VFFSL(SL,"event.sref",True), safe=' ~@#$&()*!+=:;,.?/\'')
        write(u'''
<style>
.tb { padding:0; margin:0 0 0 0; background:none;width:40px}
.tb i.fa { font-size:32px;}
#station { cursor:pointer;overflow:hidden;}
.im { font-family:Impact,Arial;font-size:24px; }
.d_timer{display:none;}
.tstation { width:80px;margin-top: 5px;}
.eventt td {width:40px;text-align:center;height:40px;}
</style>

<div id="leftmenu_main ui-widget-content">
\t<div id="leftmenu_top" class="ui-widget-header">
\t\t<div class="handle" style="cursor:move;float:left;width:95%">''')
        _v = VFFSL(SL,"channel",True) # u'$channel' on line 21, col 64
        if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 21, col 64.
        write(u'''</div>
\t\t<div id="leftmenu_expander_main" class="ui-selectmenu-icon ui-icon ui-icon-closethick" onclick="$(\'#eventdescription\').hide(200)" style="cursor:pointer"></div>
\t</div>
\t<div id="leftmenu_container_main" class="ui-widget ui-widget-content" style="padding:6px">
\t\t<table class="eventt" style="width: 100%;">
\t\t<tbody>
\t\t<tr style="height: 160px;">
\t\t<td style="width: 80px;" colspan="2">
\t\t\t<div class="ui-widget-header" id="station" onclick="zapChannel(\'''')
        _v = VFFSL(SL,"str",False)(VFFSL(SL,"event",True)['sref']) # u"$str($event['sref'])" on line 29, col 68
        if _v is not None: write(_filter(_v, rawExpr=u"$str($event['sref'])")) # from line 29, col 68.
        write(u"""', '""")
        _v = VFFSL(SL,"channel",True) # u'$channel' on line 29, col 92
        if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 29, col 92.
        write(u'''\')" title="''')
        _v = VFFSL(SL,"tstrings",True)['zap'] # u"$tstrings['zap']" on line 29, col 111
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['zap']")) # from line 29, col 111.
        write(u'''">''')
        _v = VFFSL(SL,"event",True)['channel'] # u"$event['channel']" on line 29, col 129
        if _v is not None: write(_filter(_v, rawExpr=u"$event['channel']")) # from line 29, col 129.
        write(u'''</div>
\t\t
\t\t\t<div class="ui-widget-header" style="padding:3px;margin-top:2px">
\t\t\t\t<div style="font-size:1.7em;text-align:center">''')
        _v = VFFSL(SL,"event.begin_str",True) # u'$event.begin_str' on line 32, col 52
        if _v is not None: write(_filter(_v, rawExpr=u'$event.begin_str')) # from line 32, col 52.
        write(u'''</div>
\t\t\t\t<div style="text-align:center">''')
        _v = VFFSL(SL,"int",False)(VFFSL(SL,"event.duration",True)/60) # u'$int($event.duration/60)' on line 33, col 36
        if _v is not None: write(_filter(_v, rawExpr=u'$int($event.duration/60)')) # from line 33, col 36.
        write(u''' min</div>
\t\t\t</div>
\t\t\t<div class="ui-widget-header" style="padding:3px;margin-top:2px">
\t\t\t\t<div style="font-size:1.7em; text-align:center">''')
        _v = VFFSL(SL,"tstrings",True)[("day_" + (VFN(VFFSL(SL,"time",True),"strftime",False)("%w", VFFSL(SL,"etime",True))))] # u'$tstrings[("day_" + ($time.strftime("%w", $etime)))]' on line 36, col 53
        if _v is not None: write(_filter(_v, rawExpr=u'$tstrings[("day_" + ($time.strftime("%w", $etime)))]')) # from line 36, col 53.
        write(u'''</div>
\t\t\t\t<div style="color:#A9D1FA; text-align:center">''')
        _v = VFN(VFFSL(SL,"time",True),"strftime",False)("%d", VFFSL(SL,"etime",True)) # u'$time.strftime("%d", $etime)' on line 37, col 51
        if _v is not None: write(_filter(_v, rawExpr=u'$time.strftime("%d", $etime)')) # from line 37, col 51.
        write(u''' ''')
        _v = VFFSL(SL,"tstrings",True)[("month_" + (VFN(VFFSL(SL,"time",True),"strftime",False)("%m", VFFSL(SL,"etime",True))))] # u'$tstrings[("month_" + ($time.strftime("%m", $etime)))]' on line 37, col 80
        if _v is not None: write(_filter(_v, rawExpr=u'$tstrings[("month_" + ($time.strftime("%m", $etime)))]')) # from line 37, col 80.
        write(u'''</div>
\t\t\t</div>
\t\t</td>
\t\t<td style="width: 100%;text-align:left;" rowspan="6">
\t\t\t<div style="font-size:1.4em; font-weight: bold">''')
        _v = VFFSL(SL,"event.title",True) # u'$event.title' on line 41, col 52
        if _v is not None: write(_filter(_v, rawExpr=u'$event.title')) # from line 41, col 52.
        write(u'''</div>
''')
        if VFFSL(SL,"event.title",True) != VFFSL(SL,"event.shortdesc",True): # generated from line 42, col 1
            write(u'''\t\t\t<div style="font-size:1.2em; font-weight:bold;margin-top:0.2em">''')
            _v = VFFSL(SL,"event.shortdesc",True) # u'$event.shortdesc' on line 43, col 68
            if _v is not None: write(_filter(_v, rawExpr=u'$event.shortdesc')) # from line 43, col 68.
            write(u'''</div>
''')
        write(u'''\t\t\t<div style="font-size:1.1em;max-height:300px;overflow:auto;margin-top:0.4em"><p>''')
        _v = VFN(VFN(VFFSL(SL,"event.longdesc",True),"replace",False)("\n","<br/>"),"replace",False)(u"\u008a","<br/>") # u'$(event.longdesc.replace("\\n","<br/>").replace(u"\\u008a","<br/>"))' on line 45, col 84
        if _v is not None: write(_filter(_v, rawExpr=u'$(event.longdesc.replace("\\n","<br/>").replace(u"\\u008a","<br/>"))')) # from line 45, col 84.
        write(u'''</p></div>
\t\t</td>
\t\t</tr>
\t\t<tr>
''')
        if VFFSL(SL,"transcoding",True): # generated from line 49, col 4
            write(u'''\t\t\t<td><a href="#" onclick="jumper8001(\'''')
            _v = VFFSL(SL,"sref",True) # u'$sref' on line 50, col 41
            if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 50, col 41.
            write(u"""', '""")
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 50, col 50
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 50, col 50.
            write(u'''\');" title="''')
            _v = VFFSL(SL,"tstrings",True)['stream'] # u"$tstrings['stream']" on line 50, col 70
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['stream']")) # from line 50, col 70.
            write(u''': ''')
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 50, col 91
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 50, col 91.
            write(u'''"><i class="fa fa-desktop" style="font-size:22px;"></i></a></td>
\t\t\t<td><a href="#" onclick="jumper8002(\'''')
            _v = VFFSL(SL,"sref",True) # u'$sref' on line 51, col 41
            if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 51, col 41.
            write(u"""', '""")
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 51, col 50
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 51, col 50.
            write(u'''\');" title="''')
            _v = VFFSL(SL,"tstrings",True)['stream'] # u"$tstrings['stream']" on line 51, col 70
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['stream']")) # from line 51, col 70.
            write(u''' (''')
            _v = VFFSL(SL,"tstrings",True)['transcoded'] # u"$tstrings['transcoded']" on line 51, col 91
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['transcoded']")) # from line 51, col 91.
            write(u'''): ''')
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 51, col 117
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 51, col 117.
            write(u'''"><i class="fa fa-mobile" style="font-size:26px;margin-top:-3px;"></i></a></td>
''')
        else: # generated from line 52, col 4
            write(u'''\t\t\t<td><a target="_blank" href=\'../web/stream.m3u?ref=''')
            _v = VFFSL(SL,"sref",True) # u'$sref' on line 53, col 55
            if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 53, col 55.
            write(u'''&name=''')
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 53, col 66
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 53, col 66.
            write(u'''\' title="''')
            _v = VFFSL(SL,"tstrings",True)['stream'] # u"$tstrings['stream']" on line 53, col 83
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['stream']")) # from line 53, col 83.
            write(u''' ''')
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 53, col 103
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 53, col 103.
            write(u'''"><i class="fa fa-desktop" style="font-size:22px;"></i></a></td>
\t\t\t<td></td>
''')
        write(u'''\t\t</tr>
\t\t<tr>
\t\t\t<td>
\t\t\t\t<a class="tb" href="#" onclick="addTimerEvent(\'''')
        _v = VFFSL(SL,"sref",True) # u'$sref' on line 59, col 52
        if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 59, col 52.
        write(u"""',""")
        _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 59, col 59
        if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 59, col 59.
        write(u''',false,cbAddTimerEvent);return false;" title="''')
        _v = VFFSL(SL,"tstrings",True)['add_timer'] # u"$tstrings['add_timer']" on line 59, col 114
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['add_timer']")) # from line 59, col 114.
        write(u'''">
\t\t\t\t<i class="fa fa-timerplus"></i>
\t\t\t\t</a>
\t\t\t\t</td>
\t\t\t\t<td>
\t\t\t\t<a class="tb" href="#" onclick="addEditTimerEvent(\'''')
        _v = VFFSL(SL,"sref",True) # u'$sref' on line 64, col 56
        if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 64, col 56.
        write(u"""',""")
        _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 64, col 63
        if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 64, col 63.
        write(u''');return false;" title="''')
        _v = VFFSL(SL,"tstrings",True)['edit_timer'] # u"$tstrings['edit_timer']" on line 64, col 96
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['edit_timer']")) # from line 64, col 96.
        write(u'''">
\t\t\t\t<i class="fa fa-timeredit"></i>
\t\t\t\t</a>
\t\t\t</td>
\t\t</tr>
\t\t<tr>
\t\t\t<td>
\t\t\t\t<a class="tb" href="#" onclick="addTimerEvent(\'''')
        _v = VFFSL(SL,"sref",True) # u'$sref' on line 71, col 52
        if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 71, col 52.
        write(u"""',""")
        _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 71, col 59
        if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 71, col 59.
        write(u''',true,cbAddTimerEvent);return false;" title="''')
        _v = VFFSL(SL,"tstrings",True)['add_zaptimer'] # u"$tstrings['add_zaptimer']" on line 71, col 113
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['add_zaptimer']")) # from line 71, col 113.
        write(u'''">
\t\t\t\t<i class="fa fa-timerplay"></i>
\t\t\t\t</a>
\t\t\t</td>
\t\t\t<td>
''')
        if VFFSL(SL,"at",True): # generated from line 76, col 5
            write(u'''\t\t\t\t<a class="tb" href="#" onclick="addAutoTimerEvent(\'''')
            _v = VFFSL(SL,"sref",True) # u'$sref' on line 77, col 56
            if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 77, col 56.
            write(u"""','""")
            _v = VFFSL(SL,"channel",True) # u'$channel' on line 77, col 64
            if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 77, col 64.
            write(u"""','""")
            _v = VFFSL(SL,"title",True) # u'$title' on line 77, col 75
            if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 77, col 75.
            write(u"""','""")
            _v = VFFSL(SL,"event.begin_str",True) # u'$event.begin_str' on line 77, col 84
            if _v is not None: write(_filter(_v, rawExpr=u'$event.begin_str')) # from line 77, col 84.
            write(u"""','""")
            _v = VFFSL(SL,"event.end",True) # u'$event.end' on line 77, col 103
            if _v is not None: write(_filter(_v, rawExpr=u'$event.end')) # from line 77, col 103.
            write(u'''\');return false;" title="''')
            _v = VFFSL(SL,"tstrings",True)['add_autotimer'] # u"$tstrings['add_autotimer']" on line 77, col 138
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['add_autotimer']")) # from line 77, col 138.
            write(u'''">
\t\t\t\t<i class="fa fa-timerat"></i>
\t\t\t\t</a>
''')
        write(u'''\t\t\t</td>
\t\t</tr>
\t\t<tr>
\t\t\t<td>
\t\t\t\t<a class="d_timer tb" href="#" onclick="delTimerEvent(\'''')
        _v = VFFSL(SL,"sref",True) # u'$sref' on line 85, col 60
        if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 85, col 60.
        write(u"""','""")
        _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 85, col 68
        if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 85, col 68.
        write(u'''\');return false;" title="''')
        _v = VFFSL(SL,"tstrings",True)['delete_timer'] # u"$tstrings['delete_timer']" on line 85, col 102
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['delete_timer']")) # from line 85, col 102.
        write(u'''">
\t\t\t\t<i class="fa fa-timertrash"></i>
\t\t\t\t</a>
\t\t\t</td>
\t\t\t<td>
\t\t\t</td>
\t\t</tr>
\t\t<tr>
\t\t\t<td>
''')
        if VFFSL(SL,"moviedb",True) == "Kinopoisk": # generated from line 94, col 5
            write(u'''\t\t\t\t\t<a class="tb" target="_blank" href="http://www.kinopoisk.ru/index.php?first=no&kp_query=''')
            _v = VFFSL(SL,"quote",False)(VFFSL(SL,"event.title",True)) # u'$quote($event.title)' on line 95, col 94
            if _v is not None: write(_filter(_v, rawExpr=u'$quote($event.title)')) # from line 95, col 94.
            write(u'''"><img src="../images/kinopoisk.png" style="width:24px; height:24px; margin:0px 3px 0px 0px" title="''')
            _v = VFFSL(SL,"tstrings",True)['search_kinopoisk'] # u"$tstrings['search_kinopoisk']" on line 95, col 214
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['search_kinopoisk']")) # from line 95, col 214.
            write(u'''" border="0"></a>
''')
        elif VFFSL(SL,"moviedb",True) == "CSFD": # generated from line 96, col 5
            write(u'''\t\t\t\t\t<a class="tb im" target="_blank" href="https://www.csfd.cz/hledat/?q=''')
            _v = VFFSL(SL,"event.title",True) # u'$event.title' on line 97, col 75
            if _v is not None: write(_filter(_v, rawExpr=u'$event.title')) # from line 97, col 75.
            write(u'''" title="''')
            _v = VFFSL(SL,"tstrings",True)['search_csfd'] # u"$tstrings['search_csfd']" on line 97, col 96
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['search_csfd']")) # from line 97, col 96.
            write(u'''">csfd</a>
''')
        else: # generated from line 98, col 5
            write(u'''\t\t\t\t\t<a class="tb im" target="_blank" href="http://www.imdb.com/find?s=all&amp;q=''')
            _v = VFFSL(SL,"quote",False)(VFFSL(SL,"event.title",True)) # u'$quote($event.title)' on line 99, col 82
            if _v is not None: write(_filter(_v, rawExpr=u'$quote($event.title)')) # from line 99, col 82.
            write(u'''" title="''')
            _v = VFFSL(SL,"tstrings",True)['search_imdb'] # u"$tstrings['search_imdb']" on line 99, col 111
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['search_imdb']")) # from line 99, col 111.
            write(u'''">IMDb</a>
''')
        write(u'''\t\t\t</td>
\t\t\t<td>
\t\t\t</td>
\t\t\t</div>
\t\t</tr>
\t\t</tbody>
\t\t</table>
\t</div>
</div>
<script>
var theevent = ''')
        _v = VFFSL(SL,"dumps",False)(VFFSL(SL,"event",True)) # u'$dumps($event)' on line 111, col 16
        if _v is not None: write(_filter(_v, rawExpr=u'$dumps($event)')) # from line 111, col 16.
        write(u''';
if (picons[theevent[\'channel\']])
\t$(\'#station\').html(\'<img src="\'+picons[theevent[\'channel\']]+\'" width="80" />\');
</script>
''')
        
        ########################################
        ## 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_event= 'respond'

## END CLASS DEFINITION

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


# 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=event()).run()


