diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js
index 5835b3f..4141a03 100644
--- a/src/webui/static/app/tvheadend.js
+++ b/src/webui/static/app/tvheadend.js
@@ -1,352 +1,382 @@
-
-/**
- * Displays a help popup window
- */
-tvheadend.help = function(title, pagename) {
- Ext.Ajax.request({
- url: 'docs/' + pagename,
- success: function(result, request) {
-
- var content = new Ext.Panel({
- autoScroll:true,
- border: false,
- layout:'fit',
- html: result.responseText
- });
-
- var win = new Ext.Window({
- title: 'Help for ' + title,
- layout: 'fit',
- width: 900,
- height: 400,
- constrainHeader: true,
- items: [content]
- });
- win.show();
-
- }});
-}
-
-/**
- * Displays a mediaplayer using VLC plugin
- */
-tvheadend.VLC = function(url) {
-
- function randomString() {
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
- var string_length = 8;
- var randomstring = '';
- for (var i=0; iM3U Playlist
';
- missingPlugin.innerHTML += 'Embedded player could not be started.
You are probably missing VLC Mozilla plugin for your browser.
';
-
- if (url) {
- var channelid = url.substr(url.lastIndexOf('/'));
- var streamurl = 'stream/channelid/' + channelid;
- var playlisturl = 'playlist/channelid/' + channelid;
- missingPlugin.innerHTML += '' : '
'
-
- sl = Ext.get('systemlog');
- e = Ext.DomHelper.append(sl, s + '
' + msg + '
');
- e.scrollIntoView('systemlog');
-}
-
-
-
-/**
- *
- */
-// create application
-tvheadend.app = function() {
-
- // public space
- return {
-
- // public methods
- init: function() {
-
- tvheadend.rootTabPanel = new Ext.TabPanel({
- region:'center',
- activeTab:0,
- items:[new tvheadend.epg]
- });
-
- var viewport = new Ext.Viewport({
- layout:'border',
- items:[
- {
- region:'south',
- contentEl: 'systemlog',
- split:true,
- autoScroll:true,
- height: 150,
- minSize: 100,
- maxSize: 400,
- collapsible: true,
- title:'System log',
- margins:'0 0 0 0',
- tools:[{
- id:'gear',
- qtip: 'Enable debug output',
- handler: function(event, toolEl, panel){
- Ext.Ajax.request({
- url: 'comet/debug',
- params : {
- boxid: tvheadend.boxid
- }
- });
- }
- }]
- },tvheadend.rootTabPanel
- ]
- });
-
- tvheadend.comet.on('accessUpdate', accessUpdate);
-
- tvheadend.comet.on('setServerIpPort', setServerIpPort);
-
- tvheadend.comet.on('logmessage', function(m) {
- tvheadend.log(m.logtxt);
- });
-
- new tvheadend.cometPoller;
-
- Ext.QuickTips.init();
- }
-
- };
-}(); // end of app
-
+
+/**
+ * Displays a help popup window
+ */
+tvheadend.help = function(title, pagename) {
+ Ext.Ajax.request({
+ url: 'docs/' + pagename,
+ success: function(result, request) {
+
+ var content = new Ext.Panel({
+ autoScroll:true,
+ border: false,
+ layout:'fit',
+ html: result.responseText
+ });
+
+ var win = new Ext.Window({
+ title: 'Help for ' + title,
+ layout: 'fit',
+ width: 900,
+ height: 400,
+ constrainHeader: true,
+ items: [content]
+ });
+ win.show();
+
+ }});
+}
+
+/**
+ * Displays a mediaplayer using VLC plugin
+ */
+tvheadend.VLC = function(url) {
+
+ function randomString() {
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
+ var string_length = 8;
+ var randomstring = '';
+ for (var i=0; i
M3U Playlist';
+ missingPlugin.innerHTML += 'Direct URL
';
+ }
+ else {
+ vlc.playlist.stop();
+ vlc.playlist.items.clear();
+ vlc.playlist.add(streamurl);
+ vlc.playlist.playItem(0);
+ vlc.audio.volume = slider.getValue();
+ }
+ }
+ );
+
+ var slider = new Ext.Slider({
+ width: 135,
+ height: 20,
+ value: 90,
+ increment: 1,
+ minValue: 0,
+ maxValue: 100
+ });
+
+ var sliderLabel = new Ext.form.Label();
+ sliderLabel.setText("90%");
+ slider.addListener('change', function() {
+ if(vlc.playlist && vlc.playlist.isPlaying) {
+ vlc.audio.volume = slider.getValue();
+ sliderLabel.setText(vlc.audio.volume + '%');
+ } else {
+ sliderLabel.setText(slider.getValue() + '%');
+ }
+ });
+
+ var subtitles = 0;
+
+ var win = new Ext.Window({
+ title: 'VLC Player',
+ layout:'fit',
+ width: 507 + 14,
+ height: 384 + 56,
+ constrainHeader: true,
+ iconCls: 'eye',
+ resizable: true,
+ tbar: [
+ selectChannel,
+ '-',
+ {
+ iconCls: 'control_play',
+ tooltip: 'Play',
+ handler: function() {
+ if(vlc.playlist && vlc.playlist.items.count && !vlc.playlist.isPlaying) {
+ vlc.playlist.play();
+ }
+ }
+ },
+ {
+ iconCls: 'control_pause',
+ tooltip: 'Pause',
+ handler: function() {
+ if(vlc.playlist && vlc.playlist.items.count) {
+ vlc.playlist.togglePause();
+ }
+ }
+ },
+ {
+ iconCls: 'control_stop',
+ tooltip: 'Stop',
+ handler: function() {
+ if(vlc.playlist) {
+ vlc.playlist.stop();
+ }
+ }
+ },
+ '-',
+ {
+ iconCls: 'control_fullscreen',
+ tooltip: 'Fullscreen',
+ handler: function() {
+ if(vlc.playlist && vlc.playlist.isPlaying && (vlc.VersionInfo.substr(0,3) != '1.1')) {
+ vlc.video.toggleFullscreen();
+ }
+ else if (vlc.VersionInfo.substr(0,3) == '1.1') {
+ alert('Fullscreen mode is broken in VLC 1.1.x');
+ }
+ }
+ },
+ '-',
+ {
+ iconCls: 'control_subtitles',
+ tooltip: 'Subtitles',
+ handler: function() {
+ subtitles++; // Cycle subtitles.
+ setSubtitles(vlc, subtitles);
+ }
+ },
+ '-',
+ {
+ iconCls: 'control_volume',
+ tooltip: 'Volume',
+ disabled: true
+ },
+ ],
+ items: [vlc, missingPlugin]
+ });
+
+ win.on('beforeShow', function() {
+ win.getTopToolbar().add(slider);
+ win.getTopToolbar().add(new Ext.Toolbar.Spacer());
+ win.getTopToolbar().add(new Ext.Toolbar.Spacer());
+ win.getTopToolbar().add(new Ext.Toolbar.Spacer());
+ win.getTopToolbar().add(sliderLabel);
+
+ // check if vlc plugin wasn't initialised correctly
+ if(!vlc.playlist || (vlc.playlist == 'undefined')) {
+ vlc.style.display = 'none';
+
+ missingPlugin.innerHTML = 'Embedded player could not be started.
You are probably missing VLC Mozilla plugin for your browser.
';
+
+ if (url) {
+ var channelid = url.substr(url.lastIndexOf('/'));
+ var streamurl = 'stream/channelid/' + channelid;
+ var playlisturl = 'playlist/channelid/' + channelid;
+ missingPlugin.innerHTML += 'M3U Playlist
';
+ missingPlugin.innerHTML += 'Direct URL
';
+ }
+
+ missingPlugin.style.display = 'block';
+ }
+ else {
+ // check if the window was opened with an url-parameter
+ if (url) {
+ vlc.playlist.items.clear();
+ vlc.playlist.add(url);
+ vlc.playlist.playItem(0);
+
+ //enable yadif2x deinterlacer for vlc > 1.1
+ var point1 = vlc.VersionInfo.indexOf('.');
+ var point2 = vlc.VersionInfo.indexOf('.', point1+1);
+ var majVersion = vlc.VersionInfo.substring(0,point1);
+ var minVersion = vlc.VersionInfo.substring(point1+1,point2);
+ if ((majVersion >= 1) && (minVersion >= 1))
+ vlc.video.deinterlace.enable("yadif2x");
+ }
+ }
+ });
+
+ win.show();
+ setTimeout(function() {setSubtitles(vlc, 0)}, 3000); // Turn off subtitles by default.
+};
+
+/**
+ * This function tries to enable subtitles.
+ */
+function setSubtitles(vlc, lang) {
+ if(vlc.input.state==3) {
+ if(vlc.subtitle.count > 0) {
+ var currentLang = lang % vlc.subtitle.count;
+ vlc.subtitle.track=currentLang;
+ vlc.video.marquee.text="";
+ vlc.video.marquee.disable();
+ vlc.video.marquee.enable();
+ vlc.video.marquee.text="Subtitles: " + vlc.subtitle.description(currentLang);
+ vlc.video.marquee.timeout=2000;
+ }
+ }
+}
+
+
+/**
+ * This function creates top level tabs based on access so users without
+ * access to subsystems won't see them.
+ *
+ * Obviosuly, access is verified in the server too.
+ */
+function accessUpdate(o) {
+
+ if(o.dvr == true && tvheadend.dvrpanel == null) {
+ tvheadend.dvrpanel = new tvheadend.dvr;
+ tvheadend.rootTabPanel.add(tvheadend.dvrpanel);
+ }
+
+ if(o.admin == true && tvheadend.confpanel == null) {
+ tvheadend.confpanel = new Ext.TabPanel({
+ activeTab:0,
+ autoScroll:true,
+ title: 'Configuration',
+ iconCls: 'wrench',
+ items: [new tvheadend.chconf,
+ new tvheadend.xmltv,
+ new tvheadend.cteditor,
+ new tvheadend.dvrsettings,
+ new tvheadend.tvadapters,
+ new tvheadend.iptv,
+ new tvheadend.acleditor,
+ new tvheadend.cwceditor,
+ new tvheadend.capmteditor]
+ });
+ tvheadend.rootTabPanel.add(tvheadend.confpanel);
+ }
+
+ if(tvheadend.aboutPanel == null) {
+ tvheadend.aboutPanel = new Ext.Panel({
+ border: false,
+ layout:'fit',
+ title:'About',
+ iconCls:'info',
+ autoLoad: 'about.html'
+ });
+ tvheadend.rootTabPanel.add(tvheadend.aboutPanel);
+ }
+
+ tvheadend.rootTabPanel.doLayout();
+}
+
+
+/**
+*
+ */
+function setServerIpPort(o) {
+ tvheadend.serverIp = o.ip;
+ tvheadend.serverPort = o.port;
+}
+
+function makeRTSPprefix() {
+ return 'rtsp://' + tvheadend.serverIp + ':' + tvheadend.serverPort + '/';
+}
+
+/**
+*
+*/
+tvheadend.log = function(msg, style) {
+ s = style ? '' : '
'
+
+ sl = Ext.get('systemlog');
+ e = Ext.DomHelper.append(sl, s + '
' + msg + '
');
+ e.scrollIntoView('systemlog');
+}
+
+
+
+/**
+ *
+ */
+// create application
+tvheadend.app = function() {
+
+ // public space
+ return {
+
+ // public methods
+ init: function() {
+
+ tvheadend.rootTabPanel = new Ext.TabPanel({
+ region:'center',
+ activeTab:0,
+ items:[new tvheadend.epg]
+ });
+
+ var viewport = new Ext.Viewport({
+ layout:'border',
+ items:[
+ {
+ region:'south',
+ contentEl: 'systemlog',
+ split:true,
+ autoScroll:true,
+ height: 150,
+ minSize: 100,
+ maxSize: 400,
+ collapsible: true,
+ title:'System log',
+ margins:'0 0 0 0',
+ tools:[{
+ id:'gear',
+ qtip: 'Enable debug output',
+ handler: function(event, toolEl, panel){
+ Ext.Ajax.request({
+ url: 'comet/debug',
+ params : {
+ boxid: tvheadend.boxid
+ }
+ });
+ }
+ }]
+ },tvheadend.rootTabPanel
+ ]
+ });
+
+ tvheadend.comet.on('accessUpdate', accessUpdate);
+
+ tvheadend.comet.on('setServerIpPort', setServerIpPort);
+
+ tvheadend.comet.on('logmessage', function(m) {
+ tvheadend.log(m.logtxt);
+ });
+
+ new tvheadend.cometPoller;
+
+ Ext.QuickTips.init();
+ }
+
+ };
+}(); // end of app
+