#!/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 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.830993
__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/webtv.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 webtv(Template):

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


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

        super(webtv, 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
        
        _orig_filter_75826921 = _filter
        filterName = u'WebSafe'
        if self._CHEETAH__filters.has_key("WebSafe"):
            _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
        else:
            _filter = self._CHEETAH__currentFilter = \
			self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
        write(u'''<style>
#streamchannels-menu {max-height: 300px;}
</style>
<div id="content_main" style="min-height: 550px;background-image:none;" class="ui-widget-content">
\t<div id="info">
\t<div style="display: inline-block; width: 100%; zoom: 1;background-image:none;" class="ui-widget-content">
\t\t<h3 class="ui-widget-header">Player</h3>
\t\t\t\t<div id="vlcPlayer" style="margin:0 auto 0 auto;width:640px;height:400px;display:none;">
\t\t\t\t\t<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" width="640px" height="360px" id="vlc"></embed>
\t\t\t\t</div>
\t\t\t\t<div id="htmlPlayer" style="margin:0 auto 0 auto;width:640px;height:400px;display:none;">
\t\t\t\t<video id="htmlp" width="640" height="360" controls>
\t\t\t\t</video>
\t\t\t\t</div>
''')
        if VFFSL(SL,"vxgenabled",True): # generated from line 17, col 5
            write(u'''\t\t\t\t<div id="vxgPlayer" style="margin:0 auto 0 auto;width:640px;height:500px;display:none;">
\t\t\t\t</div>
''')
        write(u'''\t\t\t\t<div style="display:table;margin:10 auto 10 auto;">
\t\t\t\t\t<span id="plbuttons" style="margin-right:10px;">
\t\t\t\t\t<input type="radio" id="plbtn_vlc" name="rplbutton" /><label id="lplbtn_vlc" for="plbtn_vlc">VLC</label>
\t\t\t\t\t<input type="radio" id="plbtn_vxg" name="rplbutton" /><label id="lplbtn_vxg" for="plbtn_vxg">VXG</label>
\t\t\t\t\t<input type="radio" id="plbtn_html" name="rplbutton" /><label id="lplbtn_html" for="plbtn_html">HTML</label>
\t\t\t\t\t</span>
\t\t\t\t\t<div style="display:inline-block;margin-left:10px;">
\t\t\t\t\t\t<span id="Deinterlace">
\t\t\t\t\t\t\tDeinterlace: <select id="deinterlace">
\t\t\t\t\t\t\t\t<option value="off">Off</option>
\t\t\t\t\t\t\t\t<option value="blend">Blend</option>
\t\t\t\t\t\t\t\t<option value="bob">Bob</option>
\t\t\t\t\t\t\t\t<option value="discard">Discard</option>
\t\t\t\t\t\t\t\t<option value="linear">Linear</option>
\t\t\t\t\t\t\t\t<option value="mean">Mean</option>
\t\t\t\t\t\t\t\t<option value="x">X</option>
\t\t\t\t\t\t\t\t<option value="yadif">Yadif</option>
\t\t\t\t\t\t\t\t<option value="yadif2x">Yadif2x</option>
\t\t\t\t\t\t\t</select>
\t\t\t\t\t\t</span>
\t\t\t\t\t\t<div style="display:inline-block;margin-left:10px;">
\t\t\t\t\t\t\t<label for="wautoplay">Autoplay</label>
\t\t\t\t\t\t\t<input type="checkbox" name="wautoplay" id="wautoplay">
\t\t\t\t\t\t\t<label id="wtranscodingl" for="wtranscoding">Transcoding</label>
\t\t\t\t\t\t\t<input type="checkbox" data-port="''')
        _v = VFFSL(SL,"transcoder_port",True) # u'$transcoder_port' on line 45, col 42
        if _v is not None: write(_filter(_v, rawExpr=u'$transcoder_port')) # from line 45, col 42.
        write(u'''" name="wtranscoding" id="wtranscoding">
\t\t\t\t\t\t\t<button id="btnstop" style="margin-left:5px;">Stop</button>
\t\t\t\t\t\t\t<button id="btnplay" style="margin-left:5px;">Play</button>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<div style="display:table;margin-top:10px;margin-bottom:10px;width: 95%;">
\t\t\t\t\t<div style="display:table;margin:10 auto 10 auto;">
\t\t\t\t\t<span id="srcbuttons" style="margin-right:10px;">
\t\t\t\t\t<input type="radio" id="sbtn0" name="srcbutton" checked="checked" /><label for="sbtn0">''')
        _v = VFFSL(SL,"tstrings",True)['channels'] # u"$tstrings['channels']" on line 54, col 93
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['channels']")) # from line 54, col 93.
        write(u'''</label>
\t\t\t\t\t<input type="radio" id="sbtn1" name="srcbutton" /><label for="sbtn1">''')
        _v = VFFSL(SL,"tstrings",True)['movies'] # u"$tstrings['movies']" on line 55, col 75
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['movies']")) # from line 55, col 75.
        write(u'''</label>
\t\t\t\t\t</span>
\t\t\t\t\t<span style="display:inline-block;">
\t\t\t\t\t<select name="streamchannels" id="streamchannels" tabindex="16"></select>
\t\t\t\t\t<select name="streamrecordings" id="streamrecordings" tabindex="10"></select>
\t\t\t\t\t<select id="moviesort">
''')
        count = 0
        da = VFFSL(SL,"tstrings",True)['date']
        na = VFFSL(SL,"tstrings",True)['name']
        sortnames = [VFFSL(SL,"na",True),VFFSL(SL,"na",True),VFFSL(SL,"da",True),VFFSL(SL,"da",True)]
        sorttypes = ['name','named','date','dated']
        sortimg = ['fa-sort-alpha-asc','fa-sort-alpha-desc','fa-sort-numeric-asc','fa-sort-numeric-desc']
        for title in VFFSL(SL,"sortnames",True): # generated from line 67, col 6
            write(u'''\t\t\t\t\t\t<option value="''')
            _v = VFFSL(SL,"sorttypes",True)[VFFSL(SL,"count",True)] # u'$sorttypes[$count]' on line 68, col 22
            if _v is not None: write(_filter(_v, rawExpr=u'$sorttypes[$count]')) # from line 68, col 22.
            write(u'''" data-class="''')
            _v = VFFSL(SL,"sortimg",True)[VFFSL(SL,"count",True)] # u'$sortimg[$count]' on line 68, col 54
            if _v is not None: write(_filter(_v, rawExpr=u'$sortimg[$count]')) # from line 68, col 54.
            write(u'''">''')
            _v = VFFSL(SL,"title",True) # u'$title' on line 68, col 72
            if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 68, col 72.
            write(u'''</option>
''')
            count += 1
        write(u'''\t\t\t\t\t</select>
\t\t\t\t\t</span>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t
\t\t\t</div>
\t\t</div>
''')
        if VFFSL(SL,"vxgenabled",True): # generated from line 78, col 1
            write(u'''<script type="text/javascript" src="/vxg/vxgplayer-1.8.51.min.js"></script>
''')
        write(u'''<script type="text/javascript" src="/webtv/webtv.js"></script>
<script type="text/javascript">
$(function() { var playerObj=new PlayerObj(); playerObj.setup((\'''')
        _v = VFFSL(SL,"vxgenabled",True) # u'$vxgenabled' on line 83, col 66
        if _v is not None: write(_filter(_v, rawExpr=u'$vxgenabled')) # from line 83, col 66.
        write(u"""' === 'True'),'""")
        _v = VFFSL(SL,"auth",True) # u'$auth' on line 83, col 92
        if _v is not None: write(_filter(_v, rawExpr=u'$auth')) # from line 83, col 92.
        write(u"""','""")
        _v = VFFSL(SL,"streaming_port",True) # u'$streaming_port' on line 83, col 100
        if _v is not None: write(_filter(_v, rawExpr=u'$streaming_port')) # from line 83, col 100.
        write(u'''\')});
</script>
<link rel="stylesheet" type="text/css" href="/css/chosen.min.css" />
''')
        if VFFSL(SL,"vxgenabled",True): # generated from line 86, col 1
            write(u'''<link rel="stylesheet" type="text/css" href="/vxg/vxgplayer-1.8.51.min.css" />
<style>
.vxgplayer-error { margin-left:0px;}
</style>
''')
        _filter = self._CHEETAH__currentFilter = _orig_filter_75826921
        
        ########################################
        ## 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_webtv= 'respond'

## END CLASS DEFINITION

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


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


