Skip to content

Commit

Permalink
added searching yt without playing it
Browse files Browse the repository at this point in the history
/searchyoutube searches and displays the results in kodi.

#224
  • Loading branch information
keydon committed Aug 20, 2019
1 parent 72cc04e commit 0e856ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Follow these steps to easily control your kodi using simple voice commands with
**Binge watch a tv show:** "Hey Google, kodi binge watch [tv show name]" --> will add all unwatched episodes to the playlist and play it.

### **Search and play a youtube video:**
"Hey Google youtube [youtube title]" --> will search a youtube video, and play the first video.
"Hey Google, kodi play youtube [youtube title]" --> will search a youtube video, and play the first video.
"Hey Google, kodi search youtube [youtube title]" --> will search youtube and show you the results on the kodi screen.

### **Pause / Resume kodi:**
"Hey Google, pause kodi"
Expand Down Expand Up @@ -515,7 +516,8 @@ For **PVR TV support - Set channel by number**, use "Say a phrase with a number"
| Say a simple phrase | Kodi reboot | _YOUR_NODE_SERVER_/reboot |
| Say a simple phrase | Kodi suspend | _YOUR_NODE_SERVER_/suspend |
| Say a phrase with a text ingredient | Kodi shuffle $ | _YOUR_NODE_SERVER_/shuffleepisode?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi youtube play $ | _YOUR_NODE_SERVER_/playyoutube?q={{TextField}}&max=15 |
| Say a phrase with a text ingredient | Kodi play youtube $ | _YOUR_NODE_SERVER_/playyoutube?q={{TextField}}&max=15 |
| Say a phrase with a text ingredient | Kodi search youtube $ | _YOUR_NODE_SERVER_/searchyoutube?q={{TextField}} |
| Say a simple phrase | Kodi scan library | _YOUR_NODE_SERVER_/scanlibrary |
| Say a simple phrase | Kodi clean library | _YOUR_NODE_SERVER_/cleanlibrary |
| Say a phrase with a number <br> Say a simple phrase | Kodi Navigate up # <br> Kodi Navigate up | _YOUR_NODE_SERVER_/navup?q={{NumberField}} <br> _YOUR_NODE_SERVER_/navup |
Expand Down
8 changes: 8 additions & 0 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,14 @@ exports.kodiPlayChannelByNumber = (request, response) => { // eslint-disable-lin
return kodiPlayChannel(request, response, pvrFuzzySearchOptions);
};

exports.kodiSearchYoutube = (request, response) => { // eslint-disable-line no-unused-vars
let searchString = request.query.q.trim();
let kodi = request.kodi;

return kodiOpenVideoWindow(
`plugin://plugin.video.youtube/kodion/search/query?q=${searchString}`, kodi);
};

exports.kodiPlayYoutube = (request, response) => { // eslint-disable-line no-unused-vars
let searchString = request.query.q.trim();
let maxItems = request.query.max !== undefined ? parseInt(request.query.max) : 15;
Expand Down
2 changes: 2 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ app.all('/playpvrchannelbyname', exec(Helper.kodiPlayChannelByName));
// http://1.1.1.1/playyoutube?q=bla
app.all('/playyoutube', exec(Helper.kodiPlayYoutube));

app.all('/searchyoutube', exec(Helper.kodiSearchYoutube));

// Parse request to watch a PVR channel by number
// Request format: http://[THIS_SERVER_IP_ADDRESS]/playpvrchannelbynumber?q=[CHANNEL_NUMBER]
app.all('/playpvrchannelbynumber', exec(Helper.kodiPlayChannelByNumber));
Expand Down

0 comments on commit 0e856ab

Please sign in to comment.