Windows - Creating your first Youtube Add-on

  Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
misty01 Offline
Senior Member
Posts: 117
Joined: May 2014
Reputation: 22
Post: #46
The section of code you are concerned with:

Code:
def run():
    plugintools.log("fullycharged.run")
    
    # Get params
    params = plugintools.get_params()
    
    if params.get("action") is None:
        main_list(params)
    else:
        action = params.get("action")
        exec action+"(params)"   <<<---- this line of code with exec
    
plugintools.close_item_list()

We don't need that code at all. Big Grin

Use this instead:

Code:
def run():
    plugintools.log("fullycharged.run")
    
    # Get params
    params = plugintools.get_params()
    
    if params.get("action") is None:
        main_list(params)
    else:
        pass
    
plugintools.close_item_list()

Your youtube add-on will run fine.

Hope that helps.

As far as Addon.id, not sure as I didn't write the plugintools.py. I think with some code examination, what we want to use for creating simple youtube add-ons, the small portion of pertinent code from plugintools.py could probably be extracted and added directly into the main default.py. I haven't dug into the code to see what small portions are used, but it should not be too hard to figure out.

Get Best of NHK, DigitalRev TV and XiveTv add-ons via my repository. Enjoy!
find quote
docwra Offline
Fan
Posts: 440
Joined: Nov 2014
Reputation: 16
Post: #47
Thanks, works great!

Agreed on minimizing it down, but one for the future I think.

[Image: cook.png] Formally chef Zag
(This post was last modified: 2016-11-29 11:30 by docwra.)
find quote
Laser78 Offline
Member
Posts: 80
Joined: May 2009
Reputation: 4
Post: #48
Hi,

I can not get the SEARCH option and PLAYLIST option working.

Code:
plugintools.add_item(
    #action="",
    title="Youtube Search for 'NHK World'",
    url='plugin://plugin.video.youtube/search/?q=NHK World',
    thumbnail=icon,
    folder=True )

Or

Code:
plugintools.add_item(
    #action="",
    title="UNESCO/NHK",
    url="plugin://plugin.video.youtube/playlist/PLWuYED1WVJIPKU_tUlzLTfkbNnAtkDOhS/",
    thumbnail=icon,
    folder=True )

It does not work for me, I have created multiple channels but when I add these I get error


Any Ideas please ?

[Image: bbb.png]
(This post was last modified: 2017-04-04 08:47 by Laser78.)
find quote
Laser78 Offline
Member
Posts: 80
Joined: May 2009
Reputation: 4
Post: #49
And Youtube live ?

[Image: bbb.png]
find quote
Post Reply