Where _localize_ is simply an handy name that we will use to call the xbmcaddon.Addon().getLocalizedString() function. notification (heading, message, xbmcgui. That file contains only the original text, not the translation:įinally we have to change the Python code, substituting the strings with a function call and the string ID: If a localization is missing, the british english version will be used by default, so the file for the en_gb regional must exists. The msgstr is the localized version and msgctxt is an unique ID for each string. Notice that msgid is the original, untranslated English text. Msgstr "Geometria errata per l'immagine \"%s\"" Here it is an excerpt of the Italian file: Then the file contains every string to be localized along with its translation. "Plural-Forms: nplurals=2 plural=(n != 1)\n" "Content-Type: text/plain charset=UTF-8\n" NOTICE: Kodi documentation says to use here the alpha-4 ISO-639 codes (four letters) as directory name suffix. getInfoLabel ( 'ListItem.FilenameAndPath' ) Using settings.xml Inside the add-on Python code you can retrieve the item that was active when the Context Menu was selected:Ĭontextmenu_item = xbmc. See the wiki about Conditional visibility. The two conditions should be both true (the plus sign means a logical AND), so it seems that a playlist file is considered as with IsFolder = True. Here we specified two conditions, so that the menu will be available on folders and over containers containing images, which specifically means an m3u playlists. The tag allows to specify when the menu item will be visible. View in Photo Frame ListItem.IsFolder + Container.Content(images) Just add an section into the addon.xml file: It is possibile to add an item to the Context Menu to launch our add-on. The Context Menu is activated in Kodi by pressing the C key or the right mouse button. SetScreensaver (saved_screensaver ) Run the Script using the Context Menu Here it is an example using the xbmc.executeJSONRPC() function and json:Ĭommand = Passing an empty string means disabling the screensaver. We will use Kodi RPC to get the screensaver status and to set it. We also need to re-enable the same screensaver before exiting the add-on code. Our add-on script will perform a slideshow, so we have to disable the Kodi screensaver before starting it. Another approach is to use the xbmcgui.WindowXML() class, where you provide an XML file where the user interface is defined. In fact we use the Python classes xbmcgui.Window() and xbmcgui.ControlImage() to creat all we need. The addon.py in this study case is used also to create the user interface. The library attribute defines the name of the Python script to be executed, addon.py in our case. To be considered a script add-on, we have declared it at the extension point. Let's see some parts of the addon.xml file: There is a dedicated page on the wiki about addon.xml. You can modifiy it while Kodi is running and start it again to see the effects. The second file is actually the Python program run on add-on activation. The first one defines how the add-on is integrated in Kodi, so it is read on Kodi startup. The add-on is composed mainly by two files: addon.xml and addon.py. My starting point was the Hello World Addon, but I had to solve several problems, so here are my notes. The idea was to start from a playlist file, which contains the list of images to show, along with geometry data to crop each image. I also opened this forum thread about adding this functionality to Kodi. Automatic zoom/crop is not an option because I want the control on it also keeping a copy of each original photo is not an acceptable option. The need arose because I shot my photos using a 4:3 digital camera, but I wish to show them on a 16:9 TV screen. What I needed was a slideshow plugin witout fancy transition effects (no transition effects at all!), but with the ability to select only some pictures from a directory and the ability to crop a selected portion of the images, without the need to actually modify the original ones. Here are some notes I wrote while writing the Kodi plugin -frame.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |