Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Development Resources - Tools Of The Trade!
#1
Whether like me you've got into this scene with no previous coding experience (well very, very, very little!) or you're a seasoned pro the chances are you're going to need somewhere to go for point of reference. We can't all remember everything there is to know and I know I'm always doing a google search and ending up at stackoverflow looking through examples of how to implement certain features. This thread is intended to help everyone from absolute noobs to professionals and I'll update the first post with any new useful links anyone wants to share.


XBMC/Kodi Add-on Creation

Python Koding from TotalRevolution! Check out the sticky threads on this board - there's some great templates you can use to get yourself up and running - NaN is used as the official forum for the Python Koding framework.

Addon.xml Tagging - Learn what information you can add to your addon.xml file. Don't miss out on this as there's some extremely useful things you can do in here which can improve both the functionality and popularity of your add-on.

XBMC Plugin Development - This is a very old guide but a great resource for anyone starting off, this will guide you through the process of making your very own video add-on. The simpler option is to use the Python Koding framework which makes a lot of the information here redundant as it does most of these things in the background for you. That being said the more you understand how the code works the better so it's definitely still a great resource and if you're not interested in using the Python Koding module then it's a great starting point.

Add-on Portal - Find out how to get your add-on/repo added to the Add-on Portal here at noobsandnerds. This is a resource which is used for categorising and installing add-ons and the Python Koding framework can hook into this information.



Built-in XBMC (Kodi) Commands:
The various built-in modules available in Kodi makes it possible to create some seriously powerful add-ons. Calling these functions is fairly simple and details can usually be found in the top paragraph of each resource listed below:

Kodi Colour Chart - One of the simplest things to do with immediate results is edit code and add some color tags to dialogs. Take a look at the link which takes you to the official kodi.tv forum where there's a chart showing all the different colours natively available.

Kodi Documentation - A brilliant resource and probably the simplest to follow. It has all the details of everything regarding Kodi. All of the info found in the links below should be shown on here but just in case they aren't or the website is unavailable we've left them here so you always revert back to the original documentation.

Kodi PyDocs: Index of Modules - A full list of every function that's available along with examples, not the simplest to follow at times but if there's a function you need help with then this is definitely the place you should refer to for some examples. Have a look through and you'll no doubt find plenty of great commands you never even knew existed!

(Wiki) List of built-in functions - This must be one of the most frequented wiki pages for devs, it lists all the functions you can use and the parameters that can be passed through.

(Wiki) List of boolean conditions - If you need to use something that returns true or false then use one of these conditions in your statement.

(Wiki) Opening windows and dialogs - A list of all the various media windows you can open e.g. ActivateWindow(Videos,MovieTitles)

(Wiki) window IDs - A full list of every Window and dialog ID, these can be used in conditional statements to find out if a particular dialog/window is open or you can use them to open/close certain windows and dialogs.

(Wiki) infoLabels - A list of labels that can be used to grab information from the system. There are a LOT of labels available and can be very powerful when used in conditional statements. For example maybe you want to know if Kodi is currently playing an item and while it's playing do not execute a command - all this sort of thing can be done via labels and a simple while loop.

(Wiki) Action IDs - Full list of all the available action IDs you can use, as a simple example if you use with the Action(Left) command it would send a left button press to kodi.

(Wiki) Special protocol - Another very useful function is the special paths that you can use, if you want to get the location of a path such as your userdata folder but you need it to be universal and work on all devices you would need to use the special path. Be aware that when writing a file to a special path you do need to use the xbmc.translatePath() function to convert it to the real path first.

(Wiki) JSON-RPC - Official blurb: Version 6 is a stable version of Kodi's JSON-RPC API and is published with the release of v12 (Frodo). It continues to be used for v13, v14, v15 and v16 (Jarvis). It comes with support for WebSockets as an alternative transport for third party clients. Using WebSockets will allow webinterfaces (which are currently restricted to the HTTP transport only) to get access to a bidirectional transport with Kodi's JSON-RPC API and can therefore also profit from additional features like notifications.



Skinning:
The XBMC (Kodi) skinning engine is constantly improving and already has a rather huge amount of options available. If you want to get into skinning then don't confuse this code with Python. The skinning engine is completely separate to Python programming used in Kodi add-ons, however the two do interact rather nicely so some Python knowledge is definitely advantageous. When editing skin xml files or creating Python add-ons both can hook into the built-in functions listed above but skins should be used only as a GUI and they are not designed to have any code (python scripts) included in the xml files, if you need to hook into some custom code this is where your Python knowledge will definitely help as you can create simple scripts and just use the RunScript command to call that code. As I say the two work rather nicely together but Python and skin XML files are very different entities - if you think that someone who knows Python should then automatically know how to use the skinning engine in Kodi you would be very much mistaken!

Set A Global Default Viewtype - Annoyed with having to scroll through all the different viewtypes in a skin and keep having to set the one you want to use as the default each time you go into a new add-on? Well there is a fix but it will mean you need to edit an xml file in your skin.

PyXBMCt - A skinning framework to be used in Python add-ons. This is a script module you can hook into which makes skinning much simpler in Python code, it allows you to create a grid and add buttons, artwork etc. without too much skinning knowledge required. The add-on is officially supported on the Kodi.tv forum so if you need support we highly recommend asking on there.

Extracting/Compiling Textures.xbt - If you're modding a skin then you'll notice the images used cannot be found in any of the skins folders (if skinned up correctly). This is because Kodi has a special textures.xbt file which contains all these images - all the images the skin uses are compressed into this file and optimised for speedy transitions. You can manually add images into your skin folders and access them directly but the xbt method is what "real" skinners tend to use as it works far better than just adding a few images here and there and of course it keeps the skin size down to a minimum. The thread linked above has links to various tools which can be used to extract/compile the textures.xbt file.

Skin Dev/Debugging Tool - A great tool created by the very talented skinner hitcher from kodi.tv. This will allow you to view changes in real time, overlay a grid to help with plotting your gfx and can also show details of what XML files are currently in focus.



Python Tutorials:

Code Academy - A free interactive course you can take on how to use Python (and other languages), it even has an editor on the site where you can enter your code. Really is an excellent starting point and I wish I'd found this when I was trying to learn, had I found this site I may not have given up so many times in the past with trying to learn code!

NewBoston/Bucky - There are some brilliant YouTube videos by a guy named bucky, these are short videos focusing on one function at a time and are very clear and simple to follow. 

Stack Overflow is probably my most used resource. It's not a tutorial site as such but I'd say if you can't find an answer to your question on there then the chances are you're probably not looking hard enough! So far I've not needed to post up a question on there as I've always found my answer (although it can sometimes take a while to search for the correct answer), it's a brilliant site and there are some excellent examples of code that you can re-use.

Official Python Documents - A site I rarely use unless I get very stuck, I find it quite hard to follow and it seems to be written for those that come from a coding background. That being said I have got some very useful information from there in the past and it is a great resource but if you're still new to the coding scene you may have better luck searching on stack overflow which has better examples.

https://www.coursera.org/learn/interactive-python-1Coursera Python (recommended by mydraal)[/url] - Official blurb: T[font=OpenSans, Arial, sans-serif]his two-part course is designed to help students with very little or no computing background learn the basics of building simple interactive applications. Our language of choice, Python, is an easy-to learn, high-level computer language that is used in many of the computational courses offered on Coursera. To make learning Python easy, we have developed a new browser-based programming environment that makes developing interactive applications in Python simple. These applications will involve windows whose contents are graphical and respond to buttons, the keyboard and the mouse.
Part 1
Part 2



Editors/Interpreters:
When editing any text/code which Kodi has to interact with you must make sure you edit in a proper text editor designed for plain text. Using built-in text editors (especially on OSX) will add formatting to the text and it's no longer classed as "plain text" which means your code will fail. I highly recommend using Sublime but of course there are plenty of other alternatives out there, if you have any you want to recommend then please post up and I'll edit this post accordingly. Whatever you do just make sure you NEVER use any program which adds some kind of formatting to your text, it's also worth noting if you're on OSX that often auto-changes straight quotes to curly quotes - this is not acceptable and will cause code to fail. Follow this guide on how to fix that.

Sublime Text Editor - This is my preferred text editor, it's easy on the eyes, reasonably simple to use and is available for OSX, Windows and Linux. If you've used Notepad++ before then really this shouldn't be much of a learning curve, the same functions are all there but it's far better designed for coding. It will highlight your text to show where you have errors, make it easier to see what pieces of text are functions, variables etc. and there's a whole bunch of plugins you can install into the software if you want to get really geeky!

emacs (recommended by mydraal) - It has a rather steep learning curve, but once you have everything set up, you'll have an editor that's fully programmable to work exactly how you want it. it can even control kodi.

Notepad++ (Windows Only) - This is the editor I started out on, it's very simple to use and if you're doing just a few basic edits in code it's perfectly fine. I have since moved onto Sublime which I find far superior from a development perspective but if you just want something simple then this is a very useful bit of kit. 

PyCharm - One feature of the software is you can get it to check all your indentations and fix them. This is particularly useful if copying and pasting code from other files or online places like stackoverflow.com


Artwork Tools:
Whether you're looking to get into skinning or Python add-on development the chances are you're going to need to knock up some artwork of some sort, whether it's just a basic icon for you add-on or a full blown load of images for a skin these tools should help:

Adobe Photoshop - The daddy of artwork programs, it's not free but if you're serious about your gfx design then you're probably gonna want this!

GIMP - Lots of people swear by this, it's free and it's linux friendly too. Must admit I only ever briefly used it when I had an Ubuntu install for a few months so can't really comment on it too much but it appeared to have pretty much the same functionality as Photoshop - I just found it harder to use as I was already used to the Photoshop layout so it was a bit of a learning curve which unfortunately I had no time for. If you do your research you'll see lots of people highly recommend this though so it must be good. NaN user gismoid also recommends this site which has a lot of scripts which can hook into GIMP.

pixlr.com - AdobePhotoshop is widely regarded as the best option when creating any artwork to be used in Kodi (I've personally not seen anything else come close) but of course it is a paid app. If you don't want to splash the cash then this is a great free alternative which you can run directly from your web browser - it's very similar to Photoshop just watered down somewhat but for basic art design for use in Kodi it should work very well.

Blender - This looks awesome, it was recommended by gismoid and is free. I think this one may be a bit above my pay grade so I'll let gismoid answer any questions about this one - from what I can tell it's mostly used for 3D rendering.

Inkscape - Another free alternative to Photoshop, once again recommended by gismoid.



Other Tools:

Python-web-pdb - A very useful debugging tool for your Python, great for exploring how code works and debugging more difficult bugs.[/size]


regexr.com - A very useful online regex checker, can save a bit of time when trying to get your regex right in an add-on.

xmlvalidation.com - Check your XML files for any errors, there are a few sites like this around - very useful if you've created some kind of playlist and you're getting errors. This will point out what line you've messed up on (usually a missing tag), can save many hours of debugging if you have particularly large XML files!

mucommander - Multi-platform simple to use file browser which allows browsing zips (and APK's if you rename them to .zip) as well as a load of other cool features like FTP. Very useful if you want to quickly edit the contents of a zip/apk or copy out just certain files/folders without having to extract the whole thing.

YemuZip (OSX) - If your'e zipping anything up on a mac then please make sure you use this! By default OSX creates a hidden .DS_Store file in EVERY one of your folders on your machine and if you use other zip compression apps when people unzip on another platform they'll also get those files extracted. This is annoying but more importantly other zip programs used on OSX just don't seem to create zips which are always accessible via Kodi - YemuZip is the only zip program I've found to fully work with Kodi every time.
IMPORTANT:
NO LOG == NO PROBLEM
Reply
#2
Could I also point people in the direction of this step by step blog on creating a video addon for complete novices. It's a couple of years old but very well explained.

http://xbmc-plugin-dev.blogspot.co.uk/p/home.html?m=1
[Image: nansig_arb.png]
Reply
#3
That's brilliant mate, cheers for that I've never seen that one before. I've added it to the first post  :icon_thumright:
IMPORTANT:
NO LOG == NO PROBLEM
Reply
#4
Great information and tutorial on how to start making your first Addon
Reply
#5
Ok first of all thanks to gismoid for recommending we add a "tools of the trade" page.

It dawned on me we already had an old thread with some useful info/links and there were some other threads dotted about with useful links to various documentation/tools so I've updated the first post with all this info.

Please feel free to post up any details of other useful links and I'll update the first post as and when any new recommendations get posted.
IMPORTANT:
NO LOG == NO PROBLEM
Reply
#6
Wow whufclee!! :-) Some awesome stuff in here. Thanks to you mate for putting it all together.

I do use GIMP (Free) Inkscape (Free) and Blender (Free)

Gimp has a scripting community so you can add lots of functionality to it.

https://www.gimp.org/

http://gimpscripts.com/

Blender is awesome for a free product. Plenty of Tutorials around for creating intro's.

https://www.blender.org/

Inkscape is also handy for Vector Graphics.

https://inkscape.org/en/
Reply
#7
Thanks for those recommendations, I've added them to the list.
IMPORTANT:
NO LOG == NO PROBLEM
Reply
#8
Thanks to you mate. :-)
Reply
#9
guess i'll add some of my own recommendations as well:

Python tutorials:
Coursera's An Introduction to Interactive Programming in Python:
i've found these rather good. they are 2 4-week courses where you learn the basics on python, you can audit them for free by clicking enroll and the click the audit link at the bottom
part 1: https://www.coursera.org/learn/interactive-python-1
part 2: https://www.coursera.org/learn/interactive-python-2

Editor:
emacs: it has a rather steep learning curve, but once you have everything set up, you'll have an editor that's fully programmable to work exactly how you want it. it can even control kodi.


also i can't recommend web-PDB enough for exploring how code works and debugging more difficult bugs: https://github.com/romanvm/python-web-pdb
Reply
#10
Thanks mid, updated first post accordingly
IMPORTANT:
NO LOG == NO PROBLEM
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Development information newfierocket 1 236 02-08-2017, 02:57 AM
Last Post: Surfacingx

Forum Jump:


Users browsing this thread: 1 Guest(s)