2 * Copyright (C) 2005-2012 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 #include "AddonString.h"
27 #include "utils/log.h"
29 #include "SortFileItem.h"
30 #include "swighelper.h"
37 * addDirectoryItem(handle, url, listitem [,isFolder, totalItems]) -- Callback function to pass directory contents back to XBMC.
38 * - Returns a bool for successful completion.
40 * handle : integer - handle the plugin was started with.
41 * url : string - url of the entry. would be plugin:// for another virtual directory
42 * listitem : ListItem - item to add.
43 * isFolder : [opt] bool - True=folder / False=not a folder(default).
44 * totalItems : [opt] integer - total number of items that will be passed.(used for progressbar)
46 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.
47 * Once you use a keyword, all following arguments require the keyword.
50 * - if not xbmcplugin.addDirectoryItem(int(sys.argv[1]), 'F:\\\\Trailers\\\\300.mov', listitem, totalItems=50): break
52 bool addDirectoryItem(int handle, const String& url, const XBMCAddon::xbmcgui::ListItem* listitem,
53 bool isFolder = false, int totalItems = 0);
56 * addDirectoryItems(handle, items [,totalItems]) -- Callback function to pass directory contents back to XBMC as a list.
57 * - Returns a bool for successful completion.
59 * handle : integer - handle the plugin was started with.
60 * items : List - list of (url, listitem[, isFolder]) as a tuple to add.
61 * totalItems : [opt] integer - total number of items that will be passed.(used for progressbar)
63 * Large lists benefit over using the standard addDirectoryItem()
64 * You may call this more than once to add items in chunks
67 * - if not xbmcplugin.addDirectoryItems(int(sys.argv[1]), [(url, listitem, False,)]: raise
69 bool addDirectoryItems(int handle,
70 const std::vector<Tuple<String,const XBMCAddon::xbmcgui::ListItem*,bool> >& items,
74 * endOfDirectory(handle[, succeeded, updateListing, cacheToDisc]) -- Callback function to tell XBMC that the end of the directory listing in a virtualPythonFolder module is reached.
76 * handle : integer - handle the plugin was started with.
77 * succeeded : [opt] bool - True=script completed successfully(Default)/False=Script did not.
78 * updateListing : [opt] bool - True=this folder should update the current listing/False=Folder is a subfolder(Default).
79 * cacheToDisc : [opt] bool - True=Folder will cache if extended time(default)/False=this folder will never cache to disc.
82 * - xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)
84 void endOfDirectory(int handle, bool succeeded = true, bool updateListing = false,
85 bool cacheToDisc = true);
88 * setResolvedUrl(handle, succeeded, listitem) -- Callback function to tell XBMC that the file plugin has been resolved to a url
90 * handle : integer - handle the plugin was started with.
91 * succeeded : bool - True=script completed successfully/False=Script did not.
92 * listitem : ListItem - item the file plugin resolved to for playback.
95 * - xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
97 void setResolvedUrl(int handle, bool succeeded, const XBMCAddon::xbmcgui::ListItem* listitem);
100 * addSortMethod(handle, sortMethod, label2) -- Adds a sorting method for the media list.
102 * handle : integer - handle the plugin was started with.
103 * sortMethod : integer - number for sortmethod see FileItem.h.
104 * label2Mask : [opt] string - the label mask to use for the second label. Defaults to '%D'
105 * applies to: SORT_METHOD_NONE, SORT_METHOD_UNSORTED, SORT_METHOD_VIDEO_TITLE,
106 * SORT_METHOD_TRACKNUM, SORT_METHOD_FILE, SORT_METHOD_TITLE,
107 * SORT_METHOD_TITLE_IGNORE_THE, SORT_METHOD_LABEL,
108 * SORT_METHOD_LABEL_IGNORE_THE, SORT_METHOD_VIDEO_SORT_TITLE,
109 * SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE
112 * - xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_TITLE)
114 void addSortMethod(int handle, int sortMethod, const String& label2Mask = emptyString);
117 * getSetting(handle, id) -- Returns the value of a setting as a string.
119 * handle : integer - handle the plugin was started with.
120 * id : string - id of the setting that the module needs to access.
122 * *Note, You can use the above as a keyword.
125 * - apikey = xbmcplugin.getSetting(int(sys.argv[1]), 'apikey')
127 String getSetting(int handle, const char* id);
130 * setSetting(handle, id, value) -- Sets a plugin setting for the current running plugin.
132 * handle : integer - handle the plugin was started with.
133 * id : string - id of the setting that the module needs to access.
134 * value : string or unicode - value of the setting.
137 * - xbmcplugin.setSetting(int(sys.argv[1]), id='username', value='teamxbmc')
139 void setSetting(int handle, const String& id, const String& value);
142 * setContent(handle, content) -- Sets the plugins content.
144 * handle : integer - handle the plugin was started with.
145 * content : string - content type (eg. movies)
147 * *Note: content: files, songs, artists, albums, movies, tvshows, episodes, musicvideos
150 * - xbmcplugin.setContent(int(sys.argv[1]), 'movies')
152 void setContent(int handle, const char* content);
155 * setPluginCategory(handle, category) -- Sets the plugins name for skins to display.
157 * handle : integer - handle the plugin was started with.
158 * category : string or unicode - plugins sub category.
161 * - xbmcplugin.setPluginCategory(int(sys.argv[1]), 'Comedy')
163 void setPluginCategory(int handle, const String& category);
166 * setPluginFanart(handle, image, color1, color2, color3) -- Sets the plugins fanart and color for skins to display.
168 * handle : integer - handle the plugin was started with.
169 * image : [opt] string - path to fanart image.
170 * color1 : [opt] hexstring - color1. (e.g. '0xFFFFFFFF')
171 * color2 : [opt] hexstring - color2. (e.g. '0xFFFF3300')
172 * color3 : [opt] hexstring - color3. (e.g. '0xFF000000')
175 * - xbmcplugin.setPluginFanart(int(sys.argv[1]), 'special://home/addons/plugins/video/Apple movie trailers II/fanart.png', color2='0xFFFF3300')\n
177 void setPluginFanart(int handle, const char* image = NULL,
178 const char* color1 = NULL,
179 const char* color2 = NULL,
180 const char* color3 = NULL);
183 * setProperty(handle, key, value) -- Sets a container property for this plugin.
185 * handle : integer - handle the plugin was started with.
186 * key : string - property name.
187 * value : string or unicode - value of property.
189 * *Note, Key is NOT case sensitive.
192 * - xbmcplugin.setProperty(int(sys.argv[1]), 'Emulator', 'M.A.M.E.')\n
194 void setProperty(int handle, const char* key, const String& value);
196 SWIG_CONSTANT(int,SORT_METHOD_NONE);
197 SWIG_CONSTANT(int,SORT_METHOD_LABEL);
198 SWIG_CONSTANT(int,SORT_METHOD_LABEL_IGNORE_THE);
199 SWIG_CONSTANT(int,SORT_METHOD_DATE);
200 SWIG_CONSTANT(int,SORT_METHOD_SIZE);
201 SWIG_CONSTANT(int,SORT_METHOD_FILE);
202 SWIG_CONSTANT(int,SORT_METHOD_DRIVE_TYPE);
203 SWIG_CONSTANT(int,SORT_METHOD_TRACKNUM);
204 SWIG_CONSTANT(int,SORT_METHOD_DURATION);
205 SWIG_CONSTANT(int,SORT_METHOD_TITLE);
206 SWIG_CONSTANT(int,SORT_METHOD_TITLE_IGNORE_THE);
207 SWIG_CONSTANT(int,SORT_METHOD_ARTIST);
208 SWIG_CONSTANT(int,SORT_METHOD_ARTIST_IGNORE_THE);
209 SWIG_CONSTANT(int,SORT_METHOD_ALBUM);
210 SWIG_CONSTANT(int,SORT_METHOD_ALBUM_IGNORE_THE);
211 SWIG_CONSTANT(int,SORT_METHOD_GENRE);
212 SWIG_CONSTANT2(int,SORT_METHOD_VIDEO_YEAR,SORT_METHOD_YEAR);
213 SWIG_CONSTANT(int,SORT_METHOD_VIDEO_RATING);
214 SWIG_CONSTANT(int,SORT_METHOD_PROGRAM_COUNT);
215 SWIG_CONSTANT(int,SORT_METHOD_PLAYLIST_ORDER);
216 SWIG_CONSTANT(int,SORT_METHOD_EPISODE);
217 SWIG_CONSTANT(int,SORT_METHOD_VIDEO_TITLE);
218 SWIG_CONSTANT(int,SORT_METHOD_VIDEO_SORT_TITLE);
219 SWIG_CONSTANT(int,SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE);
220 SWIG_CONSTANT(int,SORT_METHOD_PRODUCTIONCODE);
221 SWIG_CONSTANT(int,SORT_METHOD_SONG_RATING);
222 SWIG_CONSTANT(int,SORT_METHOD_MPAA_RATING);
223 SWIG_CONSTANT(int,SORT_METHOD_VIDEO_RUNTIME);
224 SWIG_CONSTANT(int,SORT_METHOD_STUDIO);
225 SWIG_CONSTANT(int,SORT_METHOD_STUDIO_IGNORE_THE);
226 SWIG_CONSTANT(int,SORT_METHOD_UNSORTED);
227 SWIG_CONSTANT(int,SORT_METHOD_BITRATE);
228 SWIG_CONSTANT(int,SORT_METHOD_LISTENERS);