Win Creating your first Youtube Add-on
#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 the Best of NHK video add-on for Kodi 19 thru 21. Install via my k19-addons repository.
Reply
#47
Thanks, works great!

Agreed on minimizing it down, but one for the future I think.
Reply
#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 ?
Reply
#49
And Youtube live ?
Reply
#50
hey folks im new at this and would like to learn how to do a multi ytoutube channel addon dont understsand this much is there a youtube vid ?
Reply
#51
(2017-06-26, 02:09)johnboy1973 Wrote: hey folks im new at this and would like to learn how to do a multi ytoutube channel addon dont understsand this much is there a youtube vid ?

My code for multiple Youtube channel Add-on: editing default.py

Code:
# -*- coding: utf-8 -*-
#------------------------------------------------------------
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Based on code from youtube addon
#------------------------------------------------------------

import os
import sys
import plugintools
import xbmc,xbmcaddon
from addon.common.addon import Addon

addonID = 'plugin.video.vanlife'
addon = Addon(addonID, sys.argv)
local = xbmcaddon.Addon(id=addonID)
icon = local.getAddonInfo('icon')

YOUTUBE_CHANNEL_ID1 = "UCHV7BvFPyD5Lixoo8yMRiLA"
YOUTUBE_CHANNEL_ID2 = "UCSCRVmBT1YyuAlCA8c9FJRA"

# Entry point
def run():
# Get params
    params = plugintools.get_params()

    if params.get("action") is None:
        main_list(params)
    else:
        action = params.get("action")
        exec action+"(params)"

    plugintools.close_item_list()

# Main menu
def main_list(params):
    plugintools.log("vanlife.main_list "+repr(params))

plugintools.add_item(
    #action="",
    title="Kombi Life",
    url="plugin://plugin.video.youtube/channel/"+YOUTUBE_CHANNEL_ID1+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item(
    #action="",
    title="Nomadic Life",
    url="plugin://plugin.video.youtube/channel/"+YOUTUBE_CHANNEL_ID2+"/",
    thumbnail=icon,
    folder=True )

run()
Reply
#52
Great and great this will bring the fun
Reply
#53
cool thanks perfect
Reply
#54
thanks so much guy
Reply
#55
When we are doing multiple channel Add-ons, can we make it more simple without assigning values to variables?
e.g.

Code:
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# The X Factor International
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Based on code from youtube addon
#------------------------------------------------------------import os
import sys
import plugintools
import xbmc,xbmcaddon
from addon.common.addon import AddonaddonID = 'plugin.video.XFactorInternational'
addon = Addon(addonID, sys.argv)
local = xbmcaddon.Addon(id=addonID)
icon = local.getAddonInfo('icon')
# Entry point
def run():
    plugintools.log("XFactorInternational.run")
   
    # Get params
    params = plugintools.get_params()
   
    if params.get("action") is None:
        main_list(params)
    else:
        action = params.get("action")
        exec action+"(params)"
   
    plugintools.close_item_list()# Main menu
def main_list(params):
    plugintools.log("XFactorInternational.main_list "+repr(params))
       
    plugintools.add_item(
        #action="",
        title="X Factor Adria",
        url="plugin://plugin.video.youtube/channel/UCex1kBiVgk1EEsf0Fi4D8HA/",
        thumbnail=icon,
        folder=True )
       
    plugintools.add_item(
        #action="",
        title="X Factor Albania",
        url="plugin://plugin.video.youtube/user/xfactoralbania/",
        thumbnail=icon,
        folder=True )
       
    plugintools.add_item(
        #action="",
        title="X Factor Arabia",
        url="plugin://plugin.video.youtube/user/TheXFactorArabia/",
        thumbnail=icon,
        folder=True )
       
    plugintools.add_item(
        #action="",
        title="X Factor Armenia",
        url="plugin://plugin.video.youtube/user/XFactorArmeniaShant/",
        thumbnail=icon,
        folder=True )
       run()
Reply
#56
Hi all,

I have successfully forked this addon to run the Empire Files Youtube channel, but they have no live section in their channel. How do I remove this link in the addon? I've looked at the code but nothing suggests what this part is?
Reply
#57
just a tip this can be done with the youtube plugin an a node
https://forum.kodi.tv/showthread.php?tid=344482
should work with any theme that links to Kodi\userdata\library
Reply
#58
(2019-07-13, 02:21)the_other_guy Wrote: just a tip this can be done with the youtube plugin an a node
https://forum.kodi.tv/showthread.php?tid=344482
should work with any theme that links to Kodi\userdata\library

NICE!
Reply
#59
can you make a addon that lets you add list of youtube channel subcriptions        and it will make menus for it ?
Reply
#60
(2019-09-09, 01:43)kido Wrote: can you make a addon that lets you add list of youtube channel subcriptions        and it will make menus for it ?

The YouTube Add-on in the official repository already does this.
Reply

Logout Mark Read Team Forum Stats Members Help
Creating your first Youtube Add-on1
This forum uses Lukasz Tkacz MyBB addons.