Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thanks. Is it possible to put multiple channels in the addon or only 1? #1

Open
misa2610 opened this issue Jan 1, 2016 · 14 comments
Open

Comments

@misa2610
Copy link

misa2610 commented Jan 1, 2016

Thanks. Is it possible to put multiple channels in the addon or only 1?

@zag2me
Copy link
Owner

zag2me commented Jan 2, 2016

I am sure its possible yes, but I don't know how.

It will work with any single channel out of the box though.

@misty-
Copy link

misty- commented Jan 3, 2016

Hi, I am the original coder of this "method" and can give some tips. Yes it is possible to put as many channels as desired. Here is code for X Factor International. This is a good working example because youtube uses both "user" and "channel" IDs. My code shows how to implement either situation.

Anyway enjoy!

-- 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 Addon

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

YOUTUBE_CHANNEL_ID1 = "UCex1kBiVgk1EEsf0Fi4D8HA"
YOUTUBE_CHANNEL_ID2 = "xfactoralbania"
YOUTUBE_CHANNEL_ID3 = "TheXFactorArabia"
YOUTUBE_CHANNEL_ID4 = "XFactorArmeniaShant"
YOUTUBE_CHANNEL_ID5 = "thexfactoraustralia"
YOUTUBE_CHANNEL_ID6 = "BGXFactor"
YOUTUBE_CHANNEL_ID7 = "elfactorxus"
YOUTUBE_CHANNEL_ID8 = "xfactorslovensko"
YOUTUBE_CHANNEL_ID9 = "XFactorDR1"
YOUTUBE_CHANNEL_ID10 = "xfactorge"
YOUTUBE_CHANNEL_ID11 = "xfactorglobal"
YOUTUBE_CHANNEL_ID12 = "XFactorIndia"
YOUTUBE_CHANNEL_ID13 = "XFactorIndonesiaFM"
YOUTUBE_CHANNEL_ID14 = "XFactorIsrael"
YOUTUBE_CHANNEL_ID15 = "xfactoritalia"
YOUTUBE_CHANNEL_ID16 = "XFactorKazakhstan"
YOUTUBE_CHANNEL_ID17 = "XFactorNL"
YOUTUBE_CHANNEL_ID18 = "UCxoJBfDcAMKL5jZZoKXILdg"
YOUTUBE_CHANNEL_ID19 = "XFactorDR1"
YOUTUBE_CHANNEL_ID20 = "XFactorOkinawaJP"
YOUTUBE_CHANNEL_ID21 = "XFactorPhilippines"
YOUTUBE_CHANNEL_ID22 = "TheXFactorPortugal"
YOUTUBE_CHANNEL_ID23 = "thexfactora1"
YOUTUBE_CHANNEL_ID24 = "ukrainexfactor"
YOUTUBE_CHANNEL_ID25 = "TheXFactorUK"
YOUTUBE_CHANNEL_ID26 = "TheXFactorUSA"
YOUTUBE_CHANNEL_ID27 = "nhantobianvietnam"

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/"+YOUTUBE_CHANNEL_ID1+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Albania",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID2+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Arabia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID3+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Armenia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID4+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Australia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID5+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Bulgaria",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID6+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Colombia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID7+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Czech / Slovakia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID8+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Denmark",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID9+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Georgia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID10+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Global",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID11+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor India",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID12+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Indonesia",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID13+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Israel",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID14+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Italy",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID15+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Kazakhstan",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID16+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Netherlands",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID17+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor New Zealand",
    url="plugin://plugin.video.youtube/channel/"+YOUTUBE_CHANNEL_ID18+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Norway",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID19+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Okinawa",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID20+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Philippines",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID21+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Portugal",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID22+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Romania",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID23+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Ukraine",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID24+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor UK",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID25+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor USA",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID26+"/",
    thumbnail=icon,
    folder=True )

plugintools.add_item( 
    #action="", 
    title="X Factor Vietnam",
    url="plugin://plugin.video.youtube/user/"+YOUTUBE_CHANNEL_ID27+"/",
    thumbnail=icon,
    folder=True )

run()

@zag2me
Copy link
Owner

zag2me commented Jan 3, 2016

Very nice and easy to understand too!

Thanks

@misty-
Copy link

misty- commented Jan 3, 2016

There is also the capability to implement a "fixed" search and displaying a playlist from a users youtube channel. I use that technique in my BestofNHK addon. The "fixed" search could easily be adopted to accept user input for any search parameter. Different thumbnail icons can be used by simply replacing "icon" with a url to a jpeg or png image as well.

Here's a quick example of "fixed" search:

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

And here's a playlist example:

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

@abbodj88
Copy link

Hi, do you know if you can you link directly to a video off youtube rather than just the channel? Many thanks

@misty-
Copy link

misty- commented Feb 27, 2016

Yes you can link directly to a video. As you can see in the example, thumbnail pointing to jpg for icon and fanart pointing to bigger jpg for background image. Most important is to be sure parameter 'folder=False', if by mistake you set 'folder=True', then when you click the video link in kodi gui, the video will not play, instead you get a new blank menu page.

Here's example 1 code:

plugintools.add_item(
    #action="",
    title="Wheel of Musical Impressions with Demi Lovato",
    url="plugin://plugin.video.youtube/play/?video_id=GWpVTGnr_hA",
    thumbnail="https://i.ytimg.com/vi/GWpVTGnr_hA/mqdefault.jpg",
    fanart="https://i.ytimg.com/vi/GWpVTGnr_hA/hqdefault.jpg",
    folder=False )

example 2 code: Here I separate the youtube video id and assign it to v_id_1 variable. Both ways will work.

v_id_1 = "GWpVTGnr_hA"

plugintools.add_item(
    #action="",
    title="Wheel of Musical Impressions with Demi Lovato",
    url="plugin://plugin.video.youtube/play/?video_id=%s" % v_id_1,
    thumbnail="https://i.ytimg.com/vi/GWpVTGnr_hA/mqdefault.jpg",
    fanart="https://i.ytimg.com/vi/GWpVTGnr_hA/hqdefault.jpg",
    folder=False )

@abbodj88
Copy link

Brilliant. Thanks for replying

@abbodj88
Copy link

Hi, me again! Do you know how to create submenus within the addon and then display different youtube links in each submenu? If that is at all possible. Many thanks

@theshadows
Copy link

Hi M8, Pls help im having error "Accessed not configured YouTube data API has not ........
Your help will be highly appreciated!

@chesterpester
Copy link

Hi misty. love your work!!!!!!!!!!!!!!!

What if the url contained "channel or playlist" but at the end would have "/videos"... something like... https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ/videos

Is it possible to link to content on a page like that?
How would the following line be filled out?... YOUTUBE_CHANNEL_ID1 = "???????????????"

@chesterpester
Copy link

Misty same question for your Feb.27 comment.
How would the following line be filled out?... YOUTUBE_CHANNEL_ID1 = "???????????????"

Thanks for being a great teacher!!!

@freakylinuxguy
Copy link

Is there away of putting given users or channels into different directories or groups. like say astronomy, biology?

@Laser78
Copy link

Laser78 commented Apr 3, 2017

Hi,

I follow all the steps and it works with 1 channel. When I do it with multiple channels I always get error

Kodi 17 Krypton

Any ideas ?

@MrAmericanMike
Copy link

Hey, first of all, thanks for all the great answers. One question I have and not sure how it could be done. I see that the "icon" is either, the same of the AddOn, or a hardcoded URL. Is there a way to grab it actumatically from the YouTube channel itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants