add new voice commands

This commit is contained in:
Luke Pulverenti 2015-08-01 17:17:46 -04:00
parent ab9c6f4ac2
commit 998cbefa8a
13 changed files with 259 additions and 71 deletions

View File

@ -25,14 +25,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-meta", "homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
}, },
"_source": "git://github.com/polymerelements/iron-meta.git", "_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta" "_originalSource": "PolymerElements/iron-meta"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "paper-input", "name": "paper-input",
"version": "1.0.6", "version": "1.0.7",
"description": "Material design text fields", "description": "Material design text fields",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -42,11 +42,11 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.6", "_release": "1.0.7",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.6", "tag": "v1.0.7",
"commit": "327605642c1bfa5366c0d3effc638b81f24c3adc" "commit": "b3150c105a4599d50a2da0789789fa50fa73e644"
}, },
"_source": "git://github.com/PolymerElements/paper-input.git", "_source": "git://github.com/PolymerElements/paper-input.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "paper-input", "name": "paper-input",
"version": "1.0.6", "version": "1.0.7",
"description": "Material design text fields", "description": "Material design text fields",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View File

@ -74,6 +74,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<paper-textarea label="textarea" char-counter></paper-textarea> <paper-textarea label="textarea" char-counter></paper-textarea>
<paper-textarea label="textarea with maxlength" char-counter maxlength="10"></paper-textarea> <paper-textarea label="textarea with maxlength" char-counter maxlength="10"></paper-textarea>
<paper-textarea label="text area with rows and max-rows" rows="3" max-rows="4"><paper-textarea>
</div> </div>
<h4>Complex inputs</h4> <h4>Complex inputs</h4>

View File

@ -48,7 +48,9 @@ style this element.
readonly$="[[readonly]]" readonly$="[[readonly]]"
required$="[[required]]" required$="[[required]]"
maxlength$="[[maxlength]]" maxlength$="[[maxlength]]"
autocapitalize$="[[autocapitalize]]"></iron-autogrow-textarea> autocapitalize$="[[autocapitalize]]"
rows$="[[rows]]"
max-rows$="[[maxRows]]"></iron-autogrow-textarea>
<template is="dom-if" if="[[errorMessage]]"> <template is="dom-if" if="[[errorMessage]]">
<paper-input-error>[[errorMessage]]</paper-input-error> <paper-input-error>[[errorMessage]]</paper-input-error>
@ -86,7 +88,32 @@ style this element.
_ariaDescribedBy: { _ariaDescribedBy: {
observer: '_ariaDescribedByChanged', observer: '_ariaDescribedByChanged',
type: String type: String
} },
/**
* The initial number of rows.
*
* @attribute rows
* @type number
* @default 1
*/
rows: {
type: Number,
value: 1
},
/**
* The maximum number of rows this element can grow to until it
* scrolls. 0 means no maximum.
*
* @attribute maxRows
* @type number
* @default 0
*/
maxRows: {
type: Number,
value: 0
},
}, },

View File

@ -34,7 +34,7 @@
"tag": "v1.0.11", "tag": "v1.0.11",
"commit": "347542e9ebe3e6e5f0830ee10e1c20c12956ff2c" "commit": "347542e9ebe3e6e5f0830ee10e1c20c12956ff2c"
}, },
"_source": "git://github.com/PolymerLabs/paper-styles.git", "_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerLabs/paper-styles" "_originalSource": "PolymerElements/paper-styles"
} }

View File

@ -51,11 +51,6 @@
display: none !important; display: none !important;
} }
.mainDrawerPanelPreInit #main {
left: 0 !important;
position: static !important;
}
.mainDrawerPanel #drawer { .mainDrawerPanel #drawer {
z-index: 1099 !important; z-index: 1099 !important;
position: fixed !important; position: fixed !important;

View File

@ -49,9 +49,9 @@
<paper-fab icon="movie" class="btnChapters videoButton btnPlayStateCommand subdued" title="${ButtonScenes}" data-command="GoToSearch"></paper-fab> <paper-fab icon="movie" class="btnChapters videoButton btnPlayStateCommand subdued" title="${ButtonScenes}" data-command="GoToSearch"></paper-fab>
<paper-fab icon="fullscreen" class="btnToggleFullscreen videoButton btnPlayStateCommand subdued" title="${ButtonFullscreen}" data-command="ToggleFullscreen"></paper-fab> <paper-fab icon="fullscreen" class="btnToggleFullscreen videoButton btnPlayStateCommand subdued" title="${ButtonFullscreen}" data-command="ToggleFullscreen"></paper-fab>
</div> </div>
<div class="buttonsRow3"> <!--<div class="buttonsRow3">
<paper-fab icon="info" class="btnCommand videoButton subdued" title="${ButtonOsd}" data-command="ToggleOsdMenu"></paper-fab> <paper-fab icon="info" class="btnCommand videoButton subdued" title="${ButtonOsd}" data-command="ToggleOsdMenu"></paper-fab>
</div> </div>-->
<div class="nowPlayingPageVolumeControl"> <div class="nowPlayingPageVolumeControl">
<paper-fab icon="repeat" class="btnCommand subdued repeatToggleButton" title="${ButtonRepeat}" data-command="SetRepeatMode"></paper-fab> <paper-fab icon="repeat" class="btnCommand subdued repeatToggleButton" title="${ButtonRepeat}" data-command="SetRepeatMode"></paper-fab>
<paper-fab icon="volume-off" class="btnCommand subdued volumeButton" title="${ButtonMute}" data-command="ToggleMute"></paper-fab> <paper-fab icon="volume-off" class="btnCommand subdued volumeButton" title="${ButtonMute}" data-command="ToggleMute"></paper-fab>

View File

@ -1,16 +1,5 @@
(function ($, window) { (function ($, window) {
function setMirrorModeEnabled(enabled) {
var val = enabled ? '1' : '0';
appStorage.setItem('displaymirror--' + Dashboard.getCurrentUserId(), val);
}
function isMirrorModeEnabled() {
return (appStorage.getItem('displaymirror--' + Dashboard.getCurrentUserId()) || '') != '0';
}
var currentDisplayInfo; var currentDisplayInfo;
function mirrorItem(info) { function mirrorItem(info) {
@ -25,9 +14,11 @@
}); });
} }
function mirrorIfEnabled(info) { function mirrorIfEnabled() {
if (isMirrorModeEnabled()) { var info = currentDisplayInfo;
if (info && MediaController.enableDisplayMirroring()) {
var player = MediaController.getPlayerInfo(); var player = MediaController.getPlayerInfo();
@ -110,9 +101,9 @@
html += '<p class="fieldDescription">' + Globalize.translate('LabelAllPlaysSentToPlayer') + '</p>'; html += '<p class="fieldDescription">' + Globalize.translate('LabelAllPlaysSentToPlayer') + '</p>';
checkedHtml = isMirrorModeEnabled() ? ' checked="checked"' : ''; checkedHtml = MediaController.enableDisplayMirroring() ? ' checked="checked"' : '';
html += '<div style="margin-top:1.5em;" class="fldMirrorMode"><label for="chkEnableMirrorMode">Enable display mirroring</label><input type="checkbox" class="chkEnableMirrorMode" id="chkEnableMirrorMode" data-mini="true"' + checkedHtml + ' /></div>'; html += '<div style="margin-top:1.5em;" class="fldMirrorMode"><label for="chkEnableMirrorMode">' + Globalize.translate('OptionEnableDisplayMirroring') + '</label><input type="checkbox" class="chkEnableMirrorMode" id="chkEnableMirrorMode" data-mini="true"' + checkedHtml + ' /></div>';
html += '</form>'; html += '</form>';
@ -146,13 +137,7 @@
$('.players', elem).html(getTargetsHtml(targets)).trigger('create'); $('.players', elem).html(getTargetsHtml(targets)).trigger('create');
$('.chkEnableMirrorMode', elem).on('change', function () { $('.chkEnableMirrorMode', elem).on('change', function () {
setMirrorModeEnabled(this.checked); MediaController.enableDisplayMirroring(this.checked);
if (this.checked && currentDisplayInfo) {
mirrorItem(currentDisplayInfo);
}
}); });
@ -182,10 +167,7 @@
}); });
if (currentDisplayInfo) { mirrorIfEnabled();
mirrorIfEnabled(currentDisplayInfo);
}
}); });
@ -343,6 +325,27 @@
}); });
}; };
self.trySetActiveDeviceName = function (name) {
function normalizeName(t) {
return t.toLowerCase().replace(' ', '');
}
name = normalizeName(name);
self.getTargets().done(function (result) {
var target = result.filter(function (p) {
return normalizeName(p.name) == name;
})[0];
if (target) {
self.trySetActivePlayer(target.playerName, target);
}
});
};
self.setDefaultPlayerActive = function () { self.setDefaultPlayerActive = function () {
var player = self.getDefaultPlayer(); var player = self.getDefaultPlayer();
@ -417,6 +420,26 @@
}); });
} }
self.toggleDisplayMirroring = function () {
self.enableDisplayMirroring(!self.enableDisplayMirroring());
};
self.enableDisplayMirroring = function (enabled) {
if (enabled != null) {
var val = enabled ? '1' : '0';
appStorage.setItem('displaymirror--' + Dashboard.getCurrentUserId(), val);
if (enabled) {
mirrorIfEnabled();
}
return;
}
return (appStorage.getItem('displaymirror--' + Dashboard.getCurrentUserId()) || '') != '0';
};
self.play = function (options) { self.play = function (options) {
doWithPlaybackValidation(function () { doWithPlaybackValidation(function () {

View File

@ -123,13 +123,6 @@
var isVlc = AppInfo.isNativeApp && $.browser.android; var isVlc = AppInfo.isNativeApp && $.browser.android;
var bitrateSetting = AppSettings.maxStreamingBitrate(); var bitrateSetting = AppSettings.maxStreamingBitrate();
if (isVlc) {
// Work around vlc 1080p stutter for now
if ((maxHeight || 1080) >= 1080) {
bitrateSetting = Math.min(bitrateSetting, 4000002);
}
}
var canPlayWebm = self.canPlayWebm(); var canPlayWebm = self.canPlayWebm();
var profile = {}; var profile = {};

View File

@ -521,10 +521,8 @@
if (item && item.MediaType == 'Audio') { if (item && item.MediaType == 'Audio') {
$('.buttonsRow2', page).hide(); $('.buttonsRow2', page).hide();
$('.buttonsRow3', page).hide();
} else { } else {
$('.buttonsRow2', page).show(); $('.buttonsRow2', page).show();
$('.buttonsRow3', page).show();
} }
var toggleRepeatButton = page.querySelector('.repeatToggleButton'); var toggleRepeatButton = page.querySelector('.repeatToggleButton');
@ -751,7 +749,7 @@
$('.requiresJqmCreate', this).trigger('create'); $('.requiresJqmCreate', this).trigger('create');
var tabs = page.querySelectorAll('paper-tabs')[0]; var tabs = page.querySelector('paper-tabs');
tabs.alignBottom = true; tabs.alignBottom = true;
LibraryBrowser.configureSwipeTabs(page, tabs, page.querySelectorAll('neon-animated-pages')[0]); LibraryBrowser.configureSwipeTabs(page, tabs, page.querySelectorAll('neon-animated-pages')[0]);

View File

@ -36,6 +36,11 @@
commands.push('show my tv guide'); commands.push('show my tv guide');
commands.push('pull up my recordings'); commands.push('pull up my recordings');
commands.push('control chromecast');
commands.push('control [device name]');
commands.push('turn on display mirroring');
commands.push('turn off display mirroring');
commands.push('toggle display mirroring');
deferred.resolveWith(null, [shuffleArray(commands)]); deferred.resolveWith(null, [shuffleArray(commands)]);
@ -75,6 +80,8 @@
} }
} }
result.what = text;
text = text.trim(); text = text.trim();
var words = text.toLowerCase().split(' '); var words = text.toLowerCase().split(' ');
@ -146,9 +153,18 @@
userId: Dashboard.getCurrentUserId() userId: Dashboard.getCurrentUserId()
}; };
var textLower = text.toLowerCase();
var words = text.toLowerCase().split(' '); var words = text.toLowerCase().split(' ');
if (words.indexOf('show') != -1 || words.indexOf('pull') != -1 || words.indexOf('display') != -1 || words.indexOf('go') != -1) { var displayWords = [
'show',
'pull up',
'display',
'go to',
'view'
];
if (displayWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
if (words.indexOf('guide') != -1) { if (words.indexOf('guide') != -1) {
result.action = 'show'; result.action = 'show';
@ -160,31 +176,92 @@
result.category = 'recordings'; result.category = 'recordings';
} }
result.removeWords.push('show'); result.removeWords = displayWords;
result.removeWords.push('pull up');
result.removeWords.push('pull');
result.removeWords.push('display');
result.removeWords.push('go to');
return result; return result;
} }
if (words.indexOf('search') != -1 || words.indexOf('find') != -1) { var searchWords = [
'search',
'search for',
'find',
'query'
];
if (searchWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Search // Search
result.action = 'search'; result.action = 'search';
result.removeWords.push('search for'); result.removeWords = searchWords;
result.removeWords.push('search');
result.removeWords.push('find');
return result; return result;
} }
if (words.indexOf('play') != -1) { var playWords = [
'play',
'watch'
];
if (playWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Play // Play
result.action = 'play'; result.action = 'play';
result.removeWords.push('play'); result.removeWords = playWords;
return result;
}
var controlWords = [
'use',
'control'
];
if (controlWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Play
result.action = 'control';
result.removeWords = controlWords;
return result;
}
var enableWords = [
'enable',
'turn on'
];
if (enableWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Play
result.action = 'enable';
result.removeWords = enableWords;
return result;
}
var disableWords = [
'disable',
'turn off'
];
if (disableWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Play
result.action = 'disable';
result.removeWords = disableWords;
return result;
}
var toggleWords = [
'toggle'
];
if (toggleWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Play
result.action = 'toggle';
result.removeWords = toggleWords;
return result; return result;
} }
@ -237,6 +314,22 @@
parseContext(text, result); parseContext(text, result);
playCommand(result); playCommand(result);
break; break;
case 'control':
parseContext(text, result);
controlCommand(result);
break;
case 'enable':
parseContext(text, result);
enableCommand(result);
break;
case 'disable':
parseContext(text, result);
disableCommand(result);
break;
case 'toggle':
parseContext(text, result);
toggleCommand(result);
break;
default: default:
deferred.reject(); deferred.reject();
return; return;
@ -258,6 +351,38 @@
} }
} }
function enableCommand(result) {
var what = result.what.toLowerCase();
if (what.indexOf('mirror') != -1) {
MediaController.enableDisplayMirroring(true);
}
}
function disableCommand(result) {
var what = result.what.toLowerCase();
if (what.indexOf('mirror') != -1) {
MediaController.enableDisplayMirroring(false);
}
}
function toggleCommand(result) {
var what = result.what.toLowerCase();
if (what.indexOf('mirror') != -1) {
MediaController.toggleDisplayMirroring();
}
}
function controlCommand(result) {
MediaController.trySetActiveDeviceName(result.what);
}
function playCommand(result, shuffle) { function playCommand(result, shuffle) {
var query = { var query = {
@ -379,12 +504,12 @@
html += '<p>' + Globalize.translate('MessageWeDidntRecognizeCommand') + '</p>'; html += '<p>' + Globalize.translate('MessageWeDidntRecognizeCommand') + '</p>';
html += '<br/>'; html += '<br/>';
html += '<button class="btn btnRetry" data-role="none" type="button"><span>' + Globalize.translate('ButtonTryAgain') + '</span><i class="fa fa-microphone"></i></button>'; html += '<paper-button raised class="submit block btnRetry"><iron-icon icon="mic"></iron-icon><span>' + Globalize.translate('ButtonTryAgain') + '</span></paper-button>';
html += '<p class="blockedMessage" style="display:none;">' + Globalize.translate('MessageIfYouBlockedVoice') + '<br/><br/></p>'; html += '<p class="blockedMessage" style="display:none;">' + Globalize.translate('MessageIfYouBlockedVoice') + '<br/><br/></p>';
html += '</div>'; html += '</div>';
html += '<button class="btn btnCancel" data-role="none" type="button"><span>' + Globalize.translate('ButtonCancel') + '</span><i class="fa fa-close"></i></button>'; html += '<paper-button raised class="block btnCancel" style="background-color:#444;"><iron-icon icon="close"></iron-icon><span>' + Globalize.translate('ButtonCancel') + '</span></paper-button>';
// voiceHelpContent // voiceHelpContent
html += '</div>'; html += '</div>';

View File

@ -17765,7 +17765,7 @@ paper-ripple {
<label hidden$="[[!label]]">[[label]]</label> <label hidden$="[[!label]]">[[label]]</label>
<iron-autogrow-textarea id="input" class="paper-input-input" bind-value="{{value}}" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" required$="[[required]]" maxlength$="[[maxlength]]" autocapitalize$="[[autocapitalize]]"></iron-autogrow-textarea> <iron-autogrow-textarea id="input" class="paper-input-input" bind-value="{{value}}" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" required$="[[required]]" maxlength$="[[maxlength]]" autocapitalize$="[[autocapitalize]]" rows$="[[rows]]" max-rows$="[[maxRows]]"></iron-autogrow-textarea>
<template is="dom-if" if="[[errorMessage]]"> <template is="dom-if" if="[[errorMessage]]">
<paper-input-error>[[errorMessage]]</paper-input-error> <paper-input-error>[[errorMessage]]</paper-input-error>
@ -17803,7 +17803,32 @@ paper-ripple {
_ariaDescribedBy: { _ariaDescribedBy: {
observer: '_ariaDescribedByChanged', observer: '_ariaDescribedByChanged',
type: String type: String
} },
/**
* The initial number of rows.
*
* @attribute rows
* @type number
* @default 1
*/
rows: {
type: Number,
value: 1
},
/**
* The maximum number of rows this element can grow to until it
* scrolls. 0 means no maximum.
*
* @attribute maxRows
* @type number
* @default 0
*/
maxRows: {
type: Number,
value: 0
},
}, },