Changes to the python API for XBMC Gotham

  Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Closed
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #1
These are the changes that have been done to 13.0 Gotham till now.


Updated PyDocs can be found here:
http://mirrors.xbmc.org/docs/python-docs/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-10-25 16:08 by Martijn.)
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #2
PR2173 add onDatabaseScanStarted to xbmc.Monitor()
Quote: /**
* onDatabaseScanStarted(database) -- onDatabaseScanStarted method.
*
* database - video/music as string
*
* Will be called when database update starts and return video or music to indicate which DB is being updated
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #3
PR2176 add missing sort methods
Quote: /**
* addSortMethod(handle, sortMethod, label2Mask) -- Adds a sorting method for the media list.
*
* handle : integer - handle the plugin was started with.
* sortMethod : integer - number for sortmethod see SortFileItem.h.
* label2Mask : [opt] string - the label mask to use for the second label. Defaults to '%D'
* applies to: SORT_METHOD_NONE, SORT_METHOD_UNSORTED, SORT_METHOD_VIDEO_TITLE,
* SORT_METHOD_TRACKNUM, SORT_METHOD_FILE, SORT_METHOD_TITLE,
* SORT_METHOD_TITLE_IGNORE_THE, SORT_METHOD_LABEL,
* SORT_METHOD_LABEL_IGNORE_THE, SORT_METHOD_VIDEO_SORT_TITLE,
* SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, SORT_METHOD_FULLPATH,
* SORT_METHOD_LABEL_IGNORE_FOLDERS, SORT_METHOD_CHANNEL
*
* example:
* - xbmcplugin.addSortMethod(int(sys.argv[1]), 1)
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #4
PR2436 Add removeItem to ControlList
Quote: /**
* removeItem(index) -- Remove an item by index number.
*
* index : integer - index number of the item to remove.
*
* example:
* - cList.removeItem(12)
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #5

PR2484
adds a background progress dialog
Quote: /**
* create(heading[, message]) -- Create and show a background progress dialog.\n
*\n
* heading : string or unicode - dialog heading\n
* message : [opt] string or unicode - message text\n
*\n
* *Note, 'heading' is used for the dialog's id. Use a unique heading.\n
* Use update() to update heading, message and progressbar.\n
*\n
* example:\n
* - pDialog = xbmcgui.DialogProgressBG()\n
* - pDialog.create('Movie Trailers', 'Downloading Monsters Inc. ...')\n
*/

/**
* update([percent, heading, message]) -- Updates the background progress dialog.\n
*\n
* percent : [opt] integer - percent complete. (0:100)\n
* heading : [opt] string or unicode - dialog heading\n
* message : [opt] string or unicode - message text\n
*\n
* *Note, To clear heading or message, you must pass a blank character.\n
*\n
* example:\n
* - pDialog.update(25, message='Downloading Finding Nemo ...')\n
*/

/**
* close() -- Close the background progress dialog\n
*\n
* example:\n
* - pDialog.close()\n
*/

/**
* isFinished() -- Returns True if the background dialog is active.\n
*\n
* example:\n
* - if (pDialog.isFinished()): return\n
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #6
PR2528 xbmcvfs.exists to support check dir existence.
Quote: /**
* exists(path)
*
* path : file or folder (folder must end with slash or backslash)
*
* example:
* success = xbmcvfs.exists(path)
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #7
PR2616 Adds autoclose to python's yesno dialog.
Quote: /**
* yesno(heading, line1[, line2, line3]) -- Show a dialog 'YES/NO'.
*
* heading : string or unicode - dialog heading.
* line1 : string or unicode - line #1 text.
* line2 : [opt] string or unicode - line #2 text.
* line3 : [opt] string or unicode - line #3 text.
* nolabel : [opt] label to put on the no button.
* yeslabel : [opt] label to put on the yes button.
* autoclose : [opt] integer - milliseconds to autoclose dialog. (default=do not autoclose)
*
* *Note, Returns True if 'Yes' was pressed, else False.
*
* example:
* - dialog = xbmcgui.Dialog()
* - ret = dialog.yesno('XBMC', 'Do you want to exit this script?')\n
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #8
PR2652 Add convertLanguage(const char* language, int format) method.
Quote: /**
* convertLanguage(language, format) -- Returns the given language converted to the given format as a string.
*
* language: string either as name in English, two letter code (ISO 639-1), or three letter code (ISO 639-2/T(B)
*
* format: format of the returned language string
* xbmc.ISO_639_1: two letter code as defined in ISO 639-1
* xbmc.ISO_639_2: three letter code as defined in ISO 639-2/T or ISO 639-2/B
* xbmc.ENGLISH_NAME: full language name in English (default)
*
* example:
* - language = xbmc.convertLanguage(English, xbmc.ISO_639_2)
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #9
PR2627 Adds a convenience dialog. Dialog.notification()
Quote: /**
* notification(heading, message[, icon, time]) -- Show a Notification alert.
*
* heading : string - dialog heading.
* message : string - dialog message.
* icon : [opt] string - icon to use. (default xbmcgui.NOTIFICATION_INFO)
* time : [opt] integer - time in milliseconds (default 5000)
*
* Builtin Icons:
* xbmcgui.NOTIFICATION_INFO
* xbmcgui.NOTIFICATION_WARNING
* xbmcgui.NOTIFICATION_ERROR
*
* example:
* - dialog = xbmcgui.Dialog()
* - dialog.notification('Movie Trailers', 'Finding Nemo download finished.', xbmcgui.NOTIFICATION_INFO, 5000)\n
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #10
PR2840 Adds an optional parameter "sound" to Dialog::notification to allow a silent notification
Quote: /**
* notification(heading, message[, icon, time, sound]) -- Show a Notification alert.
*
* heading : string - dialog heading.
* message : string - dialog message.
* icon : [opt] string - icon to use. (default xbmcgui.NOTIFICATION_INFO)
* time : [opt] integer - time in milliseconds (default 5000)
* sound : [opt] bool - play notification sound (default True)
*
* Builtin Icons:
* xbmcgui.NOTIFICATION_INFO
* xbmcgui.NOTIFICATION_WARNING
* xbmcgui.NOTIFICATION_ERROR
*
* example:
* - dialog = xbmcgui.Dialog()
* - dialog.notification('Movie Trailers', 'Finding Nemo download finished.', xbmcgui.NOTIFICATION_INFO, 5000)\n
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #11
PR2629 Adds keyboard to dialog class, using all of Dialog().numeric() methods
Quote: /**
* input(heading[, default, type, option, autoclose]) -- Show an Input dialog.
*
* heading : string - dialog heading.
* default : [opt] string - default value. (default=empty string)
* type : [opt] integer - the type of keyboard dialog. (default=xbmcgui.INPUT_ALPHANUM)
* option : [opt] integer - option for the dialog. (see Options below)
* autoclose : [opt] integer - milliseconds to autoclose dialog. (default=do not autoclose)
*
* Types:
* xbmcgui.INPUT_ALPHANUM (standard keyboard)
* xbmcgui.INPUT_NUMERIC (format: #)
* xbmcgui.INPUT_DATE (format: DD/MM/YYYY)
* xbmcgui.INPUT_TIME (format: HH:MM)
* xbmcgui.INPUT_IPADDRESS (format: #.#.#.#)
* xbmcgui.INPUT_PASSWORD (return md5 hash of input, input is masked)
*
* Options Password Dialog:
* xbmcgui.PASSWORD_VERIFY (verifies an existing (default) md5 hashed password)
*
* Options Alphanum Dialog:
* xbmcgui.ALPHANUM_HIDE_INPUT (masks input)
*
* *Note, Returns the entered data as a string.
* Returns an empty string if dialog was canceled.
*
* example:
* - dialog = xbmcgui.Dialog()
* - d = dialog.input('Enter secret code', type=xbmcgui.INPUT_ALPHANUM, option=xbmcgui.ALPHANUM_HIDE_INPUT)\n
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #12

PR3078
add Monitor::onNotification() to receive (JSON-RPC) notifications
Quote: /**
* onNotification(sender, method, data) -- onNotification method.
*
* sender - sender of the notification
* method - name of the notification
* data - JSON-encoded data of the notification
*
* Will be called when XBMC receives or sends a notification
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #13
Localization for skins shipped with addons

PHP Code:
<label>$LOCALIZE[SCRIPTXXX]</label

Must be replaced by:
PHP Code:
<label>$ADDON[<script_id> <string_id>]</label

for example
PHP Code:
<label>$ADDON[script.tvguide 30007]</label


Note:

This already works in Frodo so this is safe to change for Frodo repo

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2014-01-28 22:43 by Martijn.)
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #14
xbmc.python API version 2.1.0

We will bump the minimum API for python to 2.1.0 in Gotham.
So if you are still using old or unadjusted plugins that still rely on 2.0 or even 1.0 they will become broken.
Make sure you update accordingly.

There might be no implication besides just setting the dependency number to 2.1.0 without any code changes needed.

Note:
Any addon submitted to Frodo repo (or is already in there) will also need the same change.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-10-16 00:16 by Martijn.)
find
Martijn Offline
Team Kodi
Posts: 12,201
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #15
Changes in xbmc.Player().Play()

Quote: /**
* play([item, listitem, windowed, startpos]) -- Play this item.
*
* item : [opt] string - filename, url or playlist.
* listitem : [opt] listitem - used with setInfo() to set different infolabels.
* windowed : [opt] bool - true=play video windowed, false=play users preference.(default)
* startpos : [opt] int - starting position when playing a playlist. Default = -1
*
* *Note, If item is not given then the Player will try to play the current item
* in the current playlist.
*
* You can use the above as keywords for arguments and skip certain optional arguments.
* Once you use a keyword, all following arguments require the keyword.
*
* example:
* - listitem = xbmcgui.ListItem('Ironman')
* - listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
* - xbmc.Player().play(url, listitem, windowed)
* - xbmc.Player().play(playlist, listitem, windowed, startpos)
*/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find
Thread Closed