#!/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__ = 1644596120.678534
__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/epgdialog.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 epgdialog(Template):

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


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

        super(epgdialog, 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
        
        if len(VFFSL(SL,"events",True)) == 0: # generated from line 3, col 1
            write(u'''<img src="images/not_found.jpg" title="No items found" border="0" style="display:none;" id="ajpg">
<img src="themes/not_found.png" title="No items found" border="0" onerror=\'$(this).hide();$("#ajpg").show();\'>
''')
        else: # generated from line 6, col 1
            write(u'''<style>
.tb { display:inline-block; margin-left:3px;}
.tb i.fa { font-size:32px;}
#station { cursor:pointer;}
.im { font-family:Impact,Arial;font-size:18px;text-decoration:none;}
table { font-size:12px; font-family: Verdana,Arial,sans-serif;}
.deltimer{display:none;}
.ETV table {font-size:12px;width:100%;}
.ETV table td { width:50px;height:40px;}
.eft td { height:60px;vertical-align: middle;}
.efi { width:100px;}
.eft td > div { display:table;width:100%;}
.esl1,.esl2 { display:table-cell;width:30%;font-size:13px;font-weight: bold;vertical-align: middle;height: 60px;padding-left: 10px;}
.esl2 { width:70%;border-left: 1px solid black;}
.eff {width:100% !important;vertical-align: top;padding-left:10px;}
.efi img {width:100px;height:60px; border:none;}
.eff1 {width:100%;}
.panel.ui-state-hover { background-image: none; }
</style>
<div class="ETV">
<table class="ui-widget ui-widget-content" border="0" cellspacing="1" cellpadding="5">
''')
            for event in VFFSL(SL,"events",True): # generated from line 28, col 1
                channel = VFN(VFFSL(SL,"event.sname",True),"replace",False)("'", r"\'")
                title = VFN(VFFSL(SL,"event.title",True),"replace",False)("'", r"\'")
                sref = quote(VFFSL(SL,"event.sref",True), safe=' ~@#$&()*!+=:;,.?/\'')
                write(u"""
\t<tbody data-id='""")
                _v = VFFSL(SL,"sref",True) # u'$sref' on line 33, col 18
                if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 33, col 18.
                write(u''';''')
                _v = VFFSL(SL,"event.begin_timestamp",True) # u'$event.begin_timestamp' on line 33, col 24
                if _v is not None: write(_filter(_v, rawExpr=u'$event.begin_timestamp')) # from line 33, col 24.
                write(u''';''')
                _v = VFFSL(SL,"event.duration",True) # u'$event.duration' on line 33, col 47
                if _v is not None: write(_filter(_v, rawExpr=u'$event.duration')) # from line 33, col 47.
                write(u'''\'>
\t<tr class="eft">
\t<td class="efi ui-widget-header" colspan="2"><img src="''')
                _v = VFFSL(SL,"event.picon",True) # u'$event.picon' on line 35, col 57
                if _v is not None: write(_filter(_v, rawExpr=u'$event.picon')) # from line 35, col 57.
                write(u'''" title=""></td>
\t<td style="width:100%;height:60px;">
\t\t<div>
\t\t<div class="esl1 panel ui-state-hover">''')
                _v = VFFSL(SL,"event.sname",True) # u'$event.sname' on line 38, col 42
                if _v is not None: write(_filter(_v, rawExpr=u'$event.sname')) # from line 38, col 42.
                write(u'''<br />
''')
                if 'ns' in VFFSL(SL,"event",True): # generated from line 39, col 4
                    if '4097:' in VFFSL(SL,"event.sref",True) or '5002:' in VFFSL(SL,"event.sref",True) or 'http%3a' in VFFSL(SL,"event.sref",True) or 'https%3a' in VFFSL(SL,"event.sref",True): # generated from line 40, col 5
                        write(u'''\t\t\t\t\tIPTV
''')
                    else: # generated from line 42, col 5
                        write(u'''\t\t\t\t\t''')
                        _v = VFFSL(SL,"event.service_type",True) # u'$event.service_type' on line 43, col 6
                        if _v is not None: write(_filter(_v, rawExpr=u'$event.service_type')) # from line 43, col 6.
                        write(u''' / ''')
                        _v = VFFSL(SL,"event.ns",True) # u'$event.ns' on line 43, col 28
                        if _v is not None: write(_filter(_v, rawExpr=u'$event.ns')) # from line 43, col 28.
                        write(u'''
''')
                    write(u'''\t\t\t<br />
''')
                write(u'''\t\t\t''')
                _v = VFFSL(SL,"event.date",True) # u'$event.date' on line 47, col 4
                if _v is not None: write(_filter(_v, rawExpr=u'$event.date')) # from line 47, col 4.
                write(u'''</div>
\t\t<div class="esl2 panel ui-state-hover">''')
                _v = VFFSL(SL,"event.title",True) # u'$event.title' on line 48, col 42
                if _v is not None: write(_filter(_v, rawExpr=u'$event.title')) # from line 48, col 42.
                write(u'''<br/>''')
                _v = VFFSL(SL,"event.begin",True) # u'$event.begin' on line 48, col 59
                if _v is not None: write(_filter(_v, rawExpr=u'$event.begin')) # from line 48, col 59.
                write(u'''&nbsp;-&nbsp;''')
                _v = VFFSL(SL,"event.end",True) # u'$event.end' on line 48, col 84
                if _v is not None: write(_filter(_v, rawExpr=u'$event.end')) # from line 48, col 84.
                write(u'''&nbsp;(''')
                _v = VFFSL(SL,"event.duration",True) # u'$event.duration' on line 48, col 101
                if _v is not None: write(_filter(_v, rawExpr=u'$event.duration')) # from line 48, col 101.
                write(u''' min.)</div>
\t\t</div>
\t</td>
\t</tr>
\t<tr>
\t\t<td class="timerpanel panel ui-state-hover">
\t\t\t<a class="tb addtimer" href="#" onclick="addTimerEvent(\'''')
                _v = VFFSL(SL,"sref",True) # u'$sref' on line 54, col 60
                if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 54, col 60.
                write(u"""',""")
                _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 54, col 67
                if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 54, col 67.
                write(u''',false);return false;" title="''')
                _v = VFFSL(SL,"tstrings",True)['add_timer'] # u"$tstrings['add_timer']" on line 54, col 106
                if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['add_timer']")) # from line 54, col 106.
                write(u'''">
\t\t\t<i class="fa fa-timerplus"></i>
\t\t\t</a>
\t\t\t<a class="tb deltimer" href="#" onclick="delTimerEvent(\'''')
                _v = VFFSL(SL,"sref",True) # u'$sref' on line 57, col 60
                if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 57, col 60.
                write(u"""',""")
                _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 57, col 67
                if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 57, col 67.
                write(u''');return false;" title="''')
                _v = VFFSL(SL,"tstrings",True)['delete_timer'] # u"$tstrings['delete_timer']" on line 57, col 100
                if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['delete_timer']")) # from line 57, col 100.
                write(u'''">
\t\t\t<i class="fa fa-timertrash"></i>
\t\t\t</a>
\t\t</td>
\t\t<td class="panel ui-state-hover">
\t\t\t<a class="tb" href="#" onclick="addEditTimerEvent(\'''')
                _v = VFFSL(SL,"sref",True) # u'$sref' on line 62, col 55
                if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 62, col 55.
                write(u"""',""")
                _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 62, col 62
                if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 62, col 62.
                write(u''');return false;" title="''')
                _v = VFFSL(SL,"tstrings",True)['edit_timer'] # u"$tstrings['edit_timer']" on line 62, col 95
                if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['edit_timer']")) # from line 62, col 95.
                write(u'''">
\t\t\t<i class="fa fa-timeredit"></i>
\t\t\t</a>
\t\t</td>
\t\t<td class="eff" rowspan="4"><div class="eff1">
\t\t\t<span>''')
                _v = VFFSL(SL,"event.shortdesc",True) # u'$event.shortdesc' on line 67, col 10
                if _v is not None: write(_filter(_v, rawExpr=u'$event.shortdesc')) # from line 67, col 10.
                write(u'''</span><br><br></div>
\t\t\t''')
                _v = VFFSL(SL,"event.longdesc",True) # u'$event.longdesc' on line 68, col 4
                if _v is not None: write(_filter(_v, rawExpr=u'$event.longdesc')) # from line 68, col 4.
                write(u'''
\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="panel ui-state-hover">
\t\t\t<a class="tb" href="#" onclick="addTimerEvent(\'''')
                _v = VFFSL(SL,"sref",True) # u'$sref' on line 73, col 51
                if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 73, col 51.
                write(u"""',""")
                _v = VFFSL(SL,"event.id",True) # u'$event.id' on line 73, col 58
                if _v is not None: write(_filter(_v, rawExpr=u'$event.id')) # from line 73, col 58.
                write(u''',true);return false;" title="''')
                _v = VFFSL(SL,"tstrings",True)['add_zaptimer'] # u"$tstrings['add_zaptimer']" on line 73, col 96
                if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['add_zaptimer']")) # from line 73, col 96.
                write(u'''">
\t\t\t<i class="fa fa-timerplay"></i>
\t\t\t</a>
\t\t</td>
\t\t<td class="panel ui-state-hover">
''')
                if VFFSL(SL,"at",True): # generated from line 78, col 4
                    write(u'''\t\t\t\t<a class="tb" href="#" onclick="addAutoTimerEvent(\'''')
                    _v = VFFSL(SL,"sref",True) # u'$sref' on line 79, col 56
                    if _v is not None: write(_filter(_v, rawExpr=u'$sref')) # from line 79, col 56.
                    write(u"""','""")
                    _v = VFFSL(SL,"channel",True) # u'$channel' on line 79, col 64
                    if _v is not None: write(_filter(_v, rawExpr=u'$channel')) # from line 79, col 64.
                    write(u"""','""")
                    _v = VFFSL(SL,"title",True) # u'$title' on line 79, col 75
                    if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 79, col 75.
                    write(u"""','""")
                    _v = VFFSL(SL,"event.begin",True) # u'$event.begin' on line 79, col 84
                    if _v is not None: write(_filter(_v, rawExpr=u'$event.begin')) # from line 79, col 84.
                    write(u"""','""")
                    _v = VFFSL(SL,"event.end",True) # u'$event.end' on line 79, col 99
                    if _v is not None: write(_filter(_v, rawExpr=u'$event.end')) # from line 79, col 99.
                    write(u'''\');return false;" title="''')
                    _v = VFFSL(SL,"tstrings",True)['add_autotimer'] # u"$tstrings['add_autotimer']" on line 79, col 134
                    if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['add_autotimer']")) # from line 79, col 134.
                    write(u'''">
\t\t\t\t<i class="fa fa-timerat"></i>
\t\t\t\t</a>
''')
                write(u'''\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="panel ui-state-hover">
''')
                if VFFSL(SL,"moviedb",True) == "Kinopoisk": # generated from line 87, col 4
                    write(u'''\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 88, col 93
                    if _v is not None: write(_filter(_v, rawExpr=u'$quote($event.title)')) # from line 88, col 93.
                    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 88, col 213
                    if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['search_kinopoisk']")) # from line 88, col 213.
                    write(u'''" border="0"></a>
''')
                elif VFFSL(SL,"moviedb",True) == "CSFD": # generated from line 89, col 4
                    write(u'''\t\t\t\t<a class="im tb" target="_blank" href="https://www.csfd.cz/hledat/?q=''')
                    _v = VFFSL(SL,"event.title",True) # u'$event.title' on line 90, col 74
                    if _v is not None: write(_filter(_v, rawExpr=u'$event.title')) # from line 90, col 74.
                    write(u'''" title="''')
                    _v = VFFSL(SL,"tstrings",True)['search_csfd'] # u"$tstrings['search_csfd']" on line 90, col 95
                    if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['search_csfd']")) # from line 90, col 95.
                    write(u'''">csfd</a>
''')
                else: # generated from line 91, col 4
                    write(u'''\t\t\t\t<a class="im tb" 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 92, col 81
                    if _v is not None: write(_filter(_v, rawExpr=u'$quote($event.title)')) # from line 92, col 81.
                    write(u'''" title="''')
                    _v = VFFSL(SL,"tstrings",True)['search_imdb'] # u"$tstrings['search_imdb']" on line 92, col 110
                    if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['search_imdb']")) # from line 92, col 110.
                    write(u'''">IMDb</a>
''')
                write(u'''\t\t</td>
\t\t<td></td>
\t</tr>
</tbody>
''')
            write(u'''</table>
</div>
<script type="text/javascript">
var t = [
''')
            for timer in VFFSL(SL,"timers",True): # generated from line 103, col 1
                write(u"""\t{'begin':""")
                _v = VFFSL(SL,"timer.begin",True) # u'$timer.begin' on line 104, col 11
                if _v is not None: write(_filter(_v, rawExpr=u'$timer.begin')) # from line 104, col 11.
                write(u""",'end':""")
                _v = VFFSL(SL,"timer.end",True) # u'$timer.end' on line 104, col 30
                if _v is not None: write(_filter(_v, rawExpr=u'$timer.end')) # from line 104, col 30.
                write(u""",'sref':'""")
                _v = VFFSL(SL,"timer.serviceref",True) # u'$timer.serviceref' on line 104, col 49
                if _v is not None: write(_filter(_v, rawExpr=u'$timer.serviceref')) # from line 104, col 49.
                write(u"""'},
""")
            write(u'''];
var reloadTimers = true;
$(function() {
\t$(\'#editTimerForm\').load(\'ajax/edittimer\');
\tif (t.length > 0) {
\t\tvar x = $( ".ETV tbody" );
\t\tif (x != undefined)
\t\t\tShowTimers(t);
\t}
});
</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_epgdialog= 'respond'

## END CLASS DEFINITION

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


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


