Author Topic: script.voxtools default.py needs updating  (Read 2620 times)

0 Members and 1 Guest are viewing this topic.

dazed

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
script.voxtools default.py needs updating
« on: July 01, 2015, 05:03:58 PM »
I was coming here to ask for help but managed to solve it myself (blind luck mostly  :P). The youtube addon changed a couple weeks ago "ADD: EndPoint: 'plugin://plugin.video.youtube/search/?q=[URL_ENC_TEXT]'" so i had to replace
Code: [Select]
if cmdtype == "youtube.search":
    xbmc.executebuiltin("XBMC.ActivateWindow(10025,plugin://plugin.video.youtube/?path=/root/search&feed=search&search="+cmdparm1+"&)")
with this
Code: [Select]
if cmdtype == "youtube.search":
    xbmc.executebuiltin("XBMC.ActivateWindow(10025,plugin://plugin.video.youtube/search/?q="+cmdparm1+"&)")

Now it works perfectly I've attached the file if you dont want to edit it just replace your default.py with it

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: script.voxtools default.py needs updating
« Reply #1 on: July 02, 2015, 01:43:40 PM »
Hi Dazed.

Welcome to VoxCommando.  A very helpful first post, and much appreciated.

Thanks for the heads-up on this.

So, it seems that the YouTube plugin was improved in this regard.  Instead of changing the VoxTools Addon, a much better solution will be to change the command that we use to do YouTube searches on Kodi.

This command does not use VoxTools at all, only the JSON API directly, which is always the better choice if possible.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.5.1-->
<command id="550" name="search youtube for {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <params>
      <param>GUI.ActivateWindow</param>
      <param>"window": "videos", "parameters": ["plugin://plugin.video.youtube/kodion/search/query/?q={1}" ]</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>searching youtube for {1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>search youtube</phrase>
  <phrase optional="true">for</phrase>
  <payloadDictation>payloadDictation: Regular</payloadDictation>
</command>

Big thanks to PegLeg (and possibly others) who turned me on to the fact that we can often use the Kodi log to figure out how to make these calls.  Previously, I had always used Kodi's favourites.xml to look for clues, and although that method can work, it does not help for things like searches which cannot be turned into favourites.

Here is the corresponding log entry that I used to figure this one out, after searching with the YouTube plugin for "melons" via the UI:
Code: [Select]
12:23:18 T:3956   DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.youtube/kodion/search/query/?q=melons)
12:23:18 T:3956   DEBUG:   ParentPath = [plugin://plugin.video.youtube/kodion/search/list/]
12:23:18 T:7332   DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin YouTube('plugin://plugin.video.youtube/kodion/search/query/','20','?q=melons')

This is in Kodi 15.0-BETA1...   Still need to check if it also works in 14.x Helix.
« Last Edit: July 02, 2015, 01:47:20 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: script.voxtools default.py needs updating
« Reply #2 on: July 02, 2015, 02:23:27 PM »
Tested and it seems to work in Helix as well.

By the way, I like to use the same phrases for searching YouTube whether I am using Kori or not.

This command will search Youtube whether Kodi is open or not.

If Kodi is running then it will use the Kodi YouTube plugin, and if not then it will use my web browser instead (to search YouTube directly).

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.5.1-->
<command id="1103" name="search youtube for {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>searching youtube for {1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>kodi&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>GUI.ActivateWindow</param>
          <param>"window": "videos", "parameters": ["plugin://plugin.video.youtube/kodion/search/query/?q={1}" ]</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Launch.OpenURL</cmdType>
        <params>
          <param>www.google.com/webhp?hl=en#hl=en&amp;source=hp&amp;q="youtube {1}"</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>search you tube, you tube search</phrase>
  <phrase optional="true">for</phrase>
  <payloadDictation>payloadDictation: Regular</payloadDictation>
</command>