1

I have recently start learning how to make xbmc/kodi addons. I am trying to create multiple directories but keep getting "error:script failed:" when i click the addon icon on video section.

Could anyone help me fix this error and create multiple directories so i could populate them with data later? I searched a lot to find a beginner tutorial on how to make directories but couldn't find one. Thanks in advance.

    import urllib, urllib2, sys, re, os, unicodedata
    import xbmc, xbmcgui, xbmcplugin, xbmcaddon, base64

    plugin_handle = int(sys.argv[1])



    def CATEGORIES():
          add_dir("search",url,1,"")
          add_dir( "AnimalS",url,1,"")
          add_dir( "cars",url,1,"")
          add_dir("Fruits",url,1,"")


    url = None
    name = None
    mode = None
    iconimage = None

    if mode==None or url==None or len(url)<1:
            print ""
            CATEGORIES()

xbmcplugin.endOfDirectory(plugin_handle)

error on xbmc.log:

ERROR: EXCEPTION Thrown (PythonToCppException) : 
-->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.IndentationError'>
Error Contents: ('unindent does not match any outer indentation level', ('C:\\.....addons\\plugin.video.populateDirectory\\addon.py', 12, 32, '     add_dir("Fruits",url,1,"")\n'))
IndentationError: ('unindent does not match any outer indentation level', ('C:\\....\\addons\\plugin.video.populateDirectory\\addon.py', 12, 32, '     add_dir("Fruits",url,1,"")\n'))
-->End of Python script error report<--
ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.test/
ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.test/) failed
NOTICE: Thread BackgroundLoader start, auto delete: false
user1788736
  • 2,727
  • 20
  • 66
  • 110
  • 1
    Says `addDir` is not defined. Where did you get that method? – OneCricketeer Nov 08 '15 at 02:28
  • thanks for reply . I tried to follow this tutorial but couldn't run the sample code http://kodi.wiki/view/Archive:HOW-TO:Write_plugins_for_XBMC – user1788736 Nov 08 '15 at 02:32
  • Says the page is outdated and deprecated. You sure you want to use it? Have you searched the source code archive they provide for the `addDir` method? – OneCricketeer Nov 08 '15 at 02:37
  • i changed the original post now i use add_dir instead addDir but still get new error! i couldn't find simple source code that teaches me the basics . could you point me to a source code for a beginner tutorial or help me fix the above code ? – user1788736 Nov 08 '15 at 02:40
  • 1
    Introduction section - [Tutorial source code](http://voinage-xbmc-plugins.googlecode.com/files/Plugin-tutorial.rar) – OneCricketeer Nov 08 '15 at 02:51
  • And your edits now have an indentation error. Be careful with consistent spacing in Python – OneCricketeer Nov 08 '15 at 02:52
  • That was very nice tutorial . Now if i want to populate one of the directories with list of videos from a remote m3u where should i put the m3u url for each directory ? For example for each directory i want to use different m3u url.(in Default.py example) – user1788736 Nov 08 '15 at 03:01
  • 1
    Dunno - never made a plugin. But since you solved the initial problem, I suggest making a new question – OneCricketeer Nov 08 '15 at 03:10

0 Answers0