Giter VIP home page Giter VIP logo

Comments (14)

misty- avatar misty- commented on September 2, 2024 1

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()

from plugin.video.fullycharged.

zag2me avatar zag2me commented on September 2, 2024

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

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

from plugin.video.fullycharged.

zag2me avatar zag2me commented on September 2, 2024

Very nice and easy to understand too!

Thanks

from plugin.video.fullycharged.

misty- avatar misty- commented on September 2, 2024

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 )

from plugin.video.fullycharged.

abbodj88 avatar abbodj88 commented on September 2, 2024

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

from plugin.video.fullycharged.

misty- avatar misty- commented on September 2, 2024

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 )

from plugin.video.fullycharged.

abbodj88 avatar abbodj88 commented on September 2, 2024

Brilliant. Thanks for replying

from plugin.video.fullycharged.

abbodj88 avatar abbodj88 commented on September 2, 2024

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

from plugin.video.fullycharged.

theshadows avatar theshadows commented on September 2, 2024

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

from plugin.video.fullycharged.

chesterpester avatar chesterpester commented on September 2, 2024

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 = "???????????????"

from plugin.video.fullycharged.

chesterpester avatar chesterpester commented on September 2, 2024

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

from plugin.video.fullycharged.

freakylinuxguy avatar freakylinuxguy commented on September 2, 2024

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

from plugin.video.fullycharged.

Laser78 avatar Laser78 commented on September 2, 2024

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 ?

from plugin.video.fullycharged.

MrAmericanMike avatar MrAmericanMike commented on September 2, 2024

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?

from plugin.video.fullycharged.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.