I am making my own addon. But I have a problem. Could someone help?
#1
So I've made an addon. It's installing on kodi and showing the correct folders which are Live TV, and Movies. (These are from public sources such as archive.org)
What the problem is when I select a directory, say live TV for example, it doesn't show what i've inputted to who up.
I'll paste my script here. Hopefully one of you could help.
Thanks.


python:
import sys
import os
import urllib
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import logging
from operator import itemgetter

def show_tags():
  tag_handle = int(sys.argv[1])
  xbmcplugin.setContent(tag_handle, 'tags')

  for tag in tags:
    iconPath = os.path.join(home, 'logos', tag['icon'])
    li = xbmcgui.ListItem(tag['name'], iconImage=iconPath)
    url = sys.argv[0] + '?tag=' + str(tag['id'])
    xbmcplugin.addDirectoryItem(handle=tag_handle, url=url, listitem=li, isFolder=True)

  xbmcplugin.endOfDirectory(tag_handle)


def show_streams(tag):
  stream_handle = int(sys.argv[1])
  xbmcplugin.setContent(stream_handle, 'streams')
  logging.warning('TAG show_streams!!!! %s', tag)
  for stream in streams[str(tag)]:
    logging.debug('STREAM HERE!!! %s', stream['name'])
    iconPath = os.path.join(home, 'logos', stream['icon'])
    li = xbmcgui.ListItem(stream['name'], iconImage=iconPath)
    xbmcplugin.addDirectoryItem(handle=stream_handle, url=stream['url'], listitem=li)

  xbmcplugin.endOfDirectory(stream_handle)


def get_params():
  """
  Retrieves the current existing parameters from XBMC.
  """
  param =
  paramstring = sys.argv[2]
  if len(paramstring) >= 2:
    params = sys.argv[2]
    cleanedparams = params.replace('?', '')
    if params[len(params) - 1] == '/':
      params = params[0:len(params) - 2]
    pairsofparams = cleanedparams.split('&')
    param = {}
    for i in range(len(pairsofparams)):
      splitparams = {}
      splitparams = pairsofparams[ i ].split('=')
      if (len(splitparams)) == 2:
        param[splitparams[0]] = splitparams[1]
  return param


def lower_getter(field):
  def _getter(obj):
    return obj[field].lower()

  return _getter


addon = xbmcaddon.Addon()
home = xbmc.translatePath(addon.getAddonInfo('path'))

tags = [
  {
    'name': 'Live TV',        #Upto here the program is absolutely fine.
    'id': 'LiveTV',
    'icon': 'livetv.png'
  }, {
    'name': 'Movies',
    'id': 'Movies',
    'icon': 'movies.png'
  }
]

#The problem happens below..

LiveTV = [{
  'name': 'some channel',
  'url': 'something here',
  'icon': '',
  'disabled': True

}]



Movies = [{
  'name': 'random',
  'url': 'archive.org/ssadsadasf',
  'icon': 'somethinf',
  'disabled': False
}]


streams = {
  'LiveTV': sorted((i for i in LiveTV if not i.get('disabled', False)), key=lower_getter('name')),
  'Movies': sorted((i for i in Movies if not i.get('disabled', False)), key=lower_getter('name')),
  #'LiveTV': sorted(LiveTV, key=lower_getter('name')),
  #'Movies': sorted(Movies, key=lower_getter('name')),
}

PARAMS = get_params()
TAG = None
logging.warning('PARAMS!!!! %s', PARAMS)

try:
  TAG = PARAMS['tag']
except:
  pass

logging.warning('ARGS!!!! sys.argv %s', sys.argv)

if TAG == None:
  show_tags()
else:
  show_streams(TAG)


Thanks for your help guys.
I have no-where to ask for help, and this was the most active forum I could see.
Thanks again.
Reply
#2
Oh and guys, I know it says disable's true, but in my actual program its 'False'
Reply
#3
Guys, I know live TV kinda seems suspicious, but I'm getting links off Youtube.
There are Live TV channels in my language on Youtube.
I am not using anything else, since I know the whole 'IPTV, illegal streaming scene' and I don't support it.
This addon, is just for my parens since they are old, and don't know how to function youtube or any other thing yet they find kodi easy to use.
Hopefully you guys can help.
Reply
#4
Give it time.
Reply
#5
Surprisingly, this works with the older versions of Kodi.
I'll try to figure out why this won't work with krypton.
Reply
#6
I've given it plenty.
The addon works perfectly with previous version of kodi where I can change the viewtypes.
It's just Krypton is not allowing me to change the viewtype on the  addon which is really strange. 
For reference I went from Jarvis, to the early Krypton and it was fine. After that it stopped working which is very annoying.
Reply
#7
certain viewtypes of a skin will be enabled based on the content provided by the addon.
a list of available types can be found here:
https://forum.kodi.tv/showthread.php?tid=299107

so make sure you pick the right one for each category of your addon.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
I am making my own addon. But I have a problem. Could someone help?0