1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

voice fixes

This commit is contained in:
Luke Pulverenti 2016-07-06 16:16:56 -04:00
parent 0ccf565956
commit 9a4a0e78a9
11 changed files with 231 additions and 175 deletions

View file

@ -1,9 +1,15 @@
define(['playbackManager'], function (playbackManager) { define(['playbackManager'], function (playbackManager) {
function setActiveDevice(name) {
return function () {
playbackManager.trySetActiveDeviceName(name);
};
}
return function (result) { return function (result) {
result.success = true;
if (result.properties.devicename) { if (result.properties.devicename) {
playbackManager.trySetActiveDeviceName(result.properties.devicename); return setActiveDevice(result.properties.devicename);
} }
return; return;
} }

View file

@ -1,13 +1,18 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
function disableDisplayMirror() {
return function () {
inputManager.trigger('disabledisplaymirror');
};
}
return function (result) { return function (result) {
result.success = true;
switch (result.item.deviceid) { switch (result.item.deviceid) {
case 'displaymirroring': case 'displaymirroring':
inputManager.trigger('disabledisplaymirror'); return disableDisplayMirror();
break; break;
default: default:
result.success = false;
return; return;
} }
} }

View file

@ -1,13 +1,18 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
function enableDisplayMirror() {
return function () {
inputManager.trigger('enabledisplaymirror');
};
}
return function (result) { return function (result) {
result.success = true;
switch (result.item.deviceid) { switch (result.item.deviceid) {
case 'displaymirroring': case 'displaymirroring':
inputManager.trigger('enabledisplaymirror'); return enableDisplayMirror();
break; break;
default: default:
result.success = false;
return; return;
} }
} }

View file

@ -49,8 +49,8 @@
} }
return function (result) { return function (result) {
result.success = false;
return function () {
var query = { var query = {
Limit: result.item.limit || 100, Limit: result.item.limit || 100,
@ -70,8 +70,6 @@
playItems(queryResult.Items, result.item.shuffle); playItems(queryResult.Items, result.item.shuffle);
}); });
result.success = true;
return;
} }
if (result.item.shuffle) { if (result.item.shuffle) {
@ -97,10 +95,6 @@
playItems(queryResult.Items, result.item.shuffle); playItems(queryResult.Items, result.item.shuffle);
}); });
};
result.success = true;
return;
} }
}); });

View file

@ -3,7 +3,6 @@
return function (result) { return function (result) {
switch (result.item.deviceid) { switch (result.item.deviceid) {
default: default:
result.success = false;
return; return;
} }
} }

View file

@ -1,12 +1,13 @@
define(['inputManager', 'connectionManager', 'embyRouter'], function (inputManager, connectionManager, embyRouter) { define(['inputManager', 'connectionManager', 'embyRouter'], function (inputManager, connectionManager, embyRouter) {
return function (result) { function getMusicCommand(result) {
result.success = true; return function () {
switch (result.item.sourceid) {
case 'music':
inputManager.trigger('music'); inputManager.trigger('music');
break; };
case 'movies': }
function getMoviesCommand(result) {
return function () {
if (result.properties.movieName) { if (result.properties.movieName) {
//TODO: Find a way to display movie //TODO: Find a way to display movie
@ -32,12 +33,17 @@
} else { } else {
inputManager.trigger('movies'); inputManager.trigger('movies');
} }
};
}
break; function getTVCommand(result) {
case 'tvseries': return function () {
inputManager.trigger('tv'); inputManager.trigger('tv');
break; };
case 'livetv': }
function getLiveTVCommand(result) {
return function () {
var act = result.item.menuid; var act = result.item.menuid;
if (act) { if (act) {
if (act.indexOf('livetv') != -1) { if (act.indexOf('livetv') != -1) {
@ -58,13 +64,23 @@
} else { } else {
inputManager.trigger('livetv'); inputManager.trigger('livetv');
} }
break; };
case 'recordings': }
function getRecordingsCommand(result) {
return function () {
inputManager.trigger('recordedtv'); inputManager.trigger('recordedtv');
break; };
case 'latestepisodes': }
function getLatestEpisodesCommand(result) {
return function () {
inputManager.trigger('latestepisodes'); inputManager.trigger('latestepisodes');
case 'home': };
}
function getHomeCommand(result) {
return function () {
var act = result.item.menuid; var act = result.item.menuid;
if (act) { if (act) {
if (act.indexOf('home') != -1) { if (act.indexOf('home') != -1) {
@ -87,10 +103,29 @@
} else { } else {
inputManager.trigger('home'); inputManager.trigger('home');
} }
};
}
return function (result) {
switch (result.item.sourceid) {
case 'music':
return getMusicCommand(result);
case 'movies':
return getMoviesCommand(result);
case 'tvseries':
return getTVCommand(result);
case 'livetv':
return getLiveTVCommand(result);
case 'recordings':
return getRecordingsCommand(result);
case 'latestepisodes':
return getLatestEpisodesCommand(result);
case 'home':
return getHomeCommand(result);
case 'group': case 'group':
break; return;
default: default:
result.success = false;
return; return;
} }

View file

@ -1,14 +1,20 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
function toggleDisplayMirror() {
return function () {
inputManager.trigger('toggledisplaymirror');
};
}
return function (result) { return function (result) {
result.success = true;
switch (result.item.deviceid) { switch (result.item.deviceid) {
case 'displaymirroring': case 'displaymirroring':
inputManager.trigger('toggledisplaymirror'); return toggleDisplayMirror();
break; break;
default: default:
result.success = false;
return; return;
} }
} }
}); });

View file

@ -11,11 +11,15 @@ define(['require'], function (require) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
require([commandPath], function (command) { require([commandPath], function (command) {
command(result);
if (result.success) { var fn = command(result);
if (fn) {
result.fn = fn;
resolve(result); resolve(result);
} } else {
reject(); reject();
}
}); });
}); });
@ -23,38 +27,34 @@ define(['require'], function (require) {
return function (result) { return function (result) {
return new Promise(function (resolve, reject) {
switch (result.item.actionid) { switch (result.item.actionid) {
case 'show': case 'show':
processCommand('./commands/showcommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/showcommands.js', result);
break; break;
case 'play': case 'play':
processCommand('./commands/playcommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/playcommands.js', result);
break; break;
case 'shuffle': case 'shuffle':
processCommand('./commands/playcommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/playcommands.js', result);
break; break;
case 'search': case 'search':
processCommand('./commands/searchcommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/searchcommands.js', result);
break; break;
case 'control': case 'control':
processCommand('./commands/controlcommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/controlcommands.js', result);
break; break;
case 'enable': case 'enable':
processCommand('./commands/enablecommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/enablecommands.js', result);
break; break;
case 'disable': case 'disable':
processCommand('./commands/disablecommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/disablecommands.js', result);
break; break;
case 'toggle': case 'toggle':
processCommand('./commands/togglecommands.js', result).then(function (result) { resolve(result); }); return processCommand('./commands/togglecommands.js', result);
break; break;
default: default:
reject(); return Promise.reject();
return;
} }
});
} }
}); });

View file

@ -247,10 +247,15 @@ define(['dialogHelper', './voicereceiver', './voiceprocessor', 'globalize', 'emb
listen(); listen();
} }
function listen() { function listen() {
voicereceiver.listenForCommand(lang || "en-US").then(processInput).then(function (data) { voicereceiver.listenForCommand(lang || "en-US").then(processInput).then(function (result) {
closeDialog(); closeDialog();
// Put a delay here in case navigation/popstate is involved. Allow that to flush out
setTimeout(function () {
result.fn();
}, 1);
}, function (result) { }, function (result) {
if (result.error == 'group') { if (result.error == 'group') {
showVoiceHelp(result.item.groupid, result.groupName); showVoiceHelp(result.item.groupid, result.groupName);

View file

@ -28,11 +28,12 @@
console.log("Command from Grammar Processor", processor); console.log("Command from Grammar Processor", processor);
return voicecommands(processor) return voicecommands(processor)
.then(function (result) { .then(function (result) {
console.log("Result of executed command", result); console.log("Result of executed command", result);
if (result.item.actionid === 'show' && result.item.sourceid === 'group') { if (result.item.actionid === 'show' && result.item.sourceid === 'group') {
return Promise.resolve({ error: "group", item: result.item, groupName: result.name }); return Promise.resolve({ error: "group", item: result.item, groupName: result.name, fn: result.fn });
} else { } else {
return Promise.resolve({ item: result.item }); return Promise.resolve({ item: result.item, fn: result.fn });
} }
}, function () { }, function () {
return Promise.reject({ error: "unrecognized-command", text: text }); return Promise.reject({ error: "unrecognized-command", text: text });

View file

@ -18,7 +18,7 @@
view.querySelector('.fldSelectEncoderPathType').classList.remove('hide'); view.querySelector('.fldSelectEncoderPathType').classList.remove('hide');
} }
/*if (systemInfo.OperatingSystem == 'Windows' && systemInfo.SystemArchitecture != 'Arm') { if (systemInfo.OperatingSystem == 'Windows' && systemInfo.SystemArchitecture != 'Arm') {
view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="https://ffmpeg.zeranoe.com/builds">https://ffmpeg.zeranoe.com</a>'); view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="https://ffmpeg.zeranoe.com/builds">https://ffmpeg.zeranoe.com</a>');
@ -29,7 +29,7 @@
instructions = 'Download FFmpeg 64-Bit Static'; instructions = 'Download FFmpeg 64-Bit Static';
} }
} else*/ if (systemInfo.OperatingSystem == 'Linux' && systemInfo.SystemArchitecture != 'Arm') { } else if (systemInfo.OperatingSystem == 'Linux' && systemInfo.SystemArchitecture != 'Arm') {
view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="http://johnvansickle.com/ffmpeg">http://johnvansickle.com/ffmpeg</a>'); view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="http://johnvansickle.com/ffmpeg">http://johnvansickle.com/ffmpeg</a>');