• 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1. Terminology & Structure
#1
UPDATE: If using the new Python Koding framework we recommend watching episodes 1-5 only. Also note that some features you learn in these are now fairly redundant as Python Koding can handle them in a simpler way but the information given in those episodes is (for the most part) still relevant and a great starting point.



In this guide we explain the requirements needed for coding (text editor and Python) and go through some of the basic terminology; variables, modules and functions.

We also briefly go through the addon.xml file to explain what it does, this is only a brief guide through the addon.xml and we will be doing a more in depth one at a later date.

Please only post questions relating to the subjects covered in the video, thank you.

Related Links:
Python (Make sure you get 2.x and NOT 3.x)
Sublime Text Editor




IMPORTANT:
NO LOG == NO PROBLEM
Away
  Reply
#2
Hi could you please advise how i go about testing the addon in Kodi as per your comment at 34:37 in the video.
It is probably something simple that I just can't figure out - many thanks
  Reply
#3
Assuming you have followed the previous steps in the video, you should be able to test the addon by opening Kodi, navigate to Test addon under Video>Addons section and click it. After that open the kodi.log folder in the text editor you are using (Sublime in tutorial). There should be a line that contains "NOTICE: Two".

Hopefully this helps.
  Reply
#4
(08-01-2016, 09:28 PM)Lemonjello Wrote: Assuming you have followed the previous steps in the video, you should be able to test the addon by opening Kodi, navigate to Test addon under Video>Addons section and click it. After that open the kodi.log folder in the text editor you are using (Sublime in tutorial). There should be a line that contains "NOTICE: Two".

Hopefully this helps.

Hi - thanks for the quick response, I can see where I was going wrong now and I am getting the correct data in the kodi.log.
For some reason I was trying to do an add from zip like when you are inputting a new addon - many thanks for putting me on the right track - i'll see how i go on with the next episode Smile
  Reply
#5
hi i have being trying to test this first addon ran it in kodi then went to log  to cheek it keep getting this error


ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.test/
16:16:43.478 T:7704   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.test/) failed
16:16:44.270 T:7704   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.test/
16:16:44.270 T:7704   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.test/) failed

  • import xbmc, xbmcgui
    import os

    # global verables
    barroni = 1
    shan = 'two'
    arb = 'three\'s'
    houdin = 'he says "hi guys"'
    lee ='what\'s all "this" about '

    xbmc.log('################ '+shan)
this is my py
this is my xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.test"
       name="test"
       version="0.0.1"
       provider-name="irishrebel">
  <requires>
<import addon="xbmc.python" version="2.14.0" />
  </requires>
  <extension point="xbmc.python.pluginsource"
            library="default.py">
        <provides>video</provides>
  </extension>
  <extension point="xbmc.addon.metadata">
<summary lang="en">test addon</summary>
<description lang="en">this is my test addon</description>
<platform>all</platform>
<language>en</language>
<license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
  </extension>
</addon>


thanks 
irishrebel (Michelle)
  Reply
#6
I have removed your other posts regarding this matter, please do not post duplicates as it's strictly against the site rules. Thank you.

I have a feeling the logging is done differently in Krypton, still yet to mess around with coding for Krypton myself as I still use Jarvis. If you have a look at this thread on the official Kodi.tv forum you'll see a list of changes to add-on development in Krypton - one of them being kodi.log being changed to debugging mode. I just had a quick look at the pydocs page for the xbmc module so based on that could you try changing your log statement to something like this:

Code:
xbmc.log('your message here',1)

If I've understood the documentation correctly 1 should be debug mode - the modes are:

Quote:TAKEN FROM THIS PAGE: http://mirrors.xbmc.org/docs/python-docs.../xbmc.html

Text is written to the log for the following conditions.

- loglevel == -1 (NONE, nothing at all is logged)
- loglevel == 0 (NORMAL, shows LOGNOTICE, LOGERROR, LOGSEVERE and LOGFATAL)
- loglevel == 1 (DEBUG, shows all) See pydocs for valid values for level.
IMPORTANT:
NO LOG == NO PROBLEM
Away
  Reply
#7
I'm having the same issues as irishrebel on Kodi 17.1. I tried your suggestion like this:

Code:
xbmc.log("##### "+shan,1)

But I still get the the same error. Is there anyone who can help on how to solve this?
  Reply
#8
I have a solution which works.

By creating the file advancedsettings.xml with the following content:

Code:
<advancedsettings>
   <loglevel hide="false">1</loglevel>
</advancedsettings>

I was able to change the loglevel which makes the output of 
Code:
xbmc.log("##### "+shan) 
visible in the logfile. The only difference is that much more is logged in the log file which makes it more difficult to find your own line, but at least it works now  Smile
  Reply
#9
Thanks for the update, my apologies for not being able to test further on this folks. I'm currently in the process of a lot of coding on Jarvis but will try and load up Krypton and take a look at this tomorrow
IMPORTANT:
NO LOG == NO PROBLEM
Away
  Reply
#10
(03-16-2017, 07:59 PM)Patrick Brandts Wrote: I'm having the same issues as irishrebel on Kodi 17.1. I tried your suggestion like this:

Code:
xbmc.log("##### "+shan,1)

But I still get the the same error. Is there anyone who can help on how to solve this?

I finally got around to switching to Krypton for development, I can now tell you it's actually xbmc.log(<text>, 2) to print to the log. Note the number 2 and not 1, sorry my mistake - I'd obviously misread the documentation.
IMPORTANT:
NO LOG == NO PROBLEM
Away
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  6. Creating A Directory Structure. ARBTT 21 5,099 02-11-2017, 10:55 PM
Last Post: whufclee

Forum Jump:


Users browsing this thread: 1 Guest(s)