PageRenderTime 27ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/xbmc/interfaces/legacy/ModuleXbmcplugin.h

https://gitlab.com/sandihidayat/kodi
C Header | 235 lines | 69 code | 13 blank | 153 comment | 0 complexity | 5aed7c1a0739de589c78f3bdaf77abe4 MD5 | raw file
  1. /*
  2. * Copyright (C) 2005-2013 Team XBMC
  3. * http://xbmc.org
  4. *
  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)
  8. * any later version.
  9. *
  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.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with XBMC; see the file COPYING. If not, see
  17. * <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #include "Tuple.h"
  21. #include "AddonString.h"
  22. #include "ListItem.h"
  23. #include "swighelper.h"
  24. namespace XBMCAddon
  25. {
  26. namespace xbmcplugin
  27. {
  28. /**
  29. * addDirectoryItem(handle, url, listitem [,isFolder, totalItems]) -- Callback function to pass directory contents back to XBMC.
  30. * - Returns a bool for successful completion.
  31. *
  32. * handle : integer - handle the plugin was started with.\n
  33. * url : string - url of the entry. would be plugin:// for another virtual directory\n
  34. * listitem : ListItem - item to add.\n
  35. * isFolder : [opt] bool - True=folder / False=not a folder(default).\n
  36. * totalItems : [opt] integer - total number of items that will be passed.(used for progressbar)\n
  37. *
  38. * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
  39. * Once you use a keyword, all following arguments require the keyword.\n
  40. *
  41. * example:
  42. * - if not xbmcplugin.addDirectoryItem(int(sys.argv[1]), 'F:\\Trailers\\300.mov', listitem, totalItems=50): break
  43. */
  44. bool addDirectoryItem(int handle, const String& url, const XBMCAddon::xbmcgui::ListItem* listitem,
  45. bool isFolder = false, int totalItems = 0);
  46. /**
  47. * addDirectoryItems(handle, items [,totalItems]) -- Callback function to pass directory contents back to Kodi as a list.
  48. * - Returns a bool for successful completion.
  49. *
  50. * handle : integer - handle the plugin was started with.\n
  51. * items : List - list of (url, listitem[, isFolder]) as a tuple to add.\n
  52. * totalItems : [opt] integer - total number of items that will be passed.(used for progressbar)\n
  53. *
  54. * Large lists benefit over using the standard addDirectoryItem()
  55. * You may call this more than once to add items in chunks
  56. *
  57. * example:
  58. * - if not xbmcplugin.addDirectoryItems(int(sys.argv[1]), [(url, listitem, False,)]: raise
  59. */
  60. bool addDirectoryItems(int handle,
  61. const std::vector<Tuple<String,const XBMCAddon::xbmcgui::ListItem*,bool> >& items,
  62. int totalItems = 0);
  63. /**
  64. * endOfDirectory(handle[, succeeded, updateListing, cacheToDisc]) -- Callback function to tell Kodi that the end of the directory listing in a virtualPythonFolder module is reached.
  65. *
  66. * handle : integer - handle the plugin was started with.\n
  67. * succeeded : [opt] bool - True=script completed successfully(Default)/False=Script did not.\n
  68. * updateListing : [opt] bool - True=this folder should update the current listing/False=Folder is a subfolder(Default).\n
  69. * cacheToDisc : [opt] bool - True=Folder will cache if extended time(default)/False=this folder will never cache to disc.
  70. *
  71. * example:
  72. * - xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)
  73. */
  74. void endOfDirectory(int handle, bool succeeded = true, bool updateListing = false,
  75. bool cacheToDisc = true);
  76. /**
  77. * setResolvedUrl(handle, succeeded, listitem) -- Callback function to tell Kodi that the file plugin has been resolved to a url
  78. *
  79. * handle : integer - handle the plugin was started with.\n
  80. * succeeded : bool - True=script completed successfully/False=Script did not.\n
  81. * listitem : ListItem - item the file plugin resolved to for playback.
  82. *
  83. * example:
  84. * - xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
  85. */
  86. void setResolvedUrl(int handle, bool succeeded, const XBMCAddon::xbmcgui::ListItem* listitem);
  87. /**
  88. * addSortMethod(handle, sortMethod [,label2Mask]) -- Adds a sorting method for the media list.
  89. *
  90. * handle : integer - handle the plugin was started with.\n
  91. * sortMethod : integer - see available sort methods at the bottom (or see SortFileItem.h).\n
  92. * label2Mask : [opt] string - the label mask to use for the second label. Defaults to '%D'
  93. * - applies to:
  94. * - SORT_METHOD_NONE, SORT_METHOD_UNSORTED, SORT_METHOD_VIDEO_TITLE,
  95. * - SORT_METHOD_TRACKNUM, SORT_METHOD_FILE, SORT_METHOD_TITLE,
  96. * - SORT_METHOD_TITLE_IGNORE_THE, SORT_METHOD_LABEL,
  97. * - SORT_METHOD_LABEL_IGNORE_THE, SORT_METHOD_VIDEO_SORT_TITLE,
  98. * - SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, SORT_METHOD_FULLPATH,
  99. * - SORT_METHOD_LABEL_IGNORE_FOLDERS, SORT_METHOD_CHANNEL
  100. * *Note: to add multiple sort methods just call the method multiple times.
  101. *
  102. * example:
  103. * - xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORTMETHOD_DATEADDED)
  104. */
  105. void addSortMethod(int handle, int sortMethod, const String& label2Mask = emptyString);
  106. /**
  107. * getSetting(handle, id) -- Returns the value of a setting as a string.
  108. *
  109. * handle : integer - handle the plugin was started with.\n
  110. * id : string - id of the setting that the module needs to access.
  111. *
  112. * *Note, You can use the above as a keyword.
  113. *
  114. * example:
  115. * - apikey = xbmcplugin.getSetting(int(sys.argv[1]), 'apikey')
  116. */
  117. String getSetting(int handle, const char* id);
  118. /**
  119. * setSetting(handle, id, value) -- Sets a plugin setting for the current running plugin.
  120. *
  121. * handle : integer - handle the plugin was started with.\n
  122. * id : string - id of the setting that the module needs to access.\n
  123. * value : string or unicode - value of the setting.
  124. *
  125. * example:
  126. * - xbmcplugin.setSetting(int(sys.argv[1]), id='username', value='teamxbmc')
  127. */
  128. void setSetting(int handle, const String& id, const String& value);
  129. /**
  130. * setContent(handle, content) -- Sets the plugins content.
  131. *
  132. * handle : integer - handle the plugin was started with.\n
  133. * content : string - content type (eg. movies)
  134. *
  135. * *Note: content: files, songs, artists, albums, movies, tvshows, episodes, musicvideos
  136. *
  137. * example:
  138. * - xbmcplugin.setContent(int(sys.argv[1]), 'movies')
  139. */
  140. void setContent(int handle, const char* content);
  141. /**
  142. * setPluginCategory(handle, category) -- Sets the plugins name for skins to display.
  143. *
  144. * handle : integer - handle the plugin was started with.\n
  145. * category : string or unicode - plugins sub category.
  146. *
  147. * example:
  148. * - xbmcplugin.setPluginCategory(int(sys.argv[1]), 'Comedy')
  149. */
  150. void setPluginCategory(int handle, const String& category);
  151. /**
  152. * setPluginFanart(handle, image, color1, color2, color3) -- Sets the plugins fanart and color for skins to display.
  153. *
  154. * handle : integer - handle the plugin was started with.\n
  155. * image : [opt] string - path to fanart image.\n
  156. * color1 : [opt] hexstring - color1. (e.g. '0xFFFFFFFF')\n
  157. * color2 : [opt] hexstring - color2. (e.g. '0xFFFF3300')\n
  158. * color3 : [opt] hexstring - color3. (e.g. '0xFF000000')
  159. *
  160. * example:
  161. * - xbmcplugin.setPluginFanart(int(sys.argv[1]), 'special://home/addons/plugins/video/Apple movie trailers II/fanart.png', color2='0xFFFF3300')
  162. */
  163. void setPluginFanart(int handle, const char* image = NULL,
  164. const char* color1 = NULL,
  165. const char* color2 = NULL,
  166. const char* color3 = NULL);
  167. /**
  168. * setProperty(handle, key, value) -- Sets a container property for this plugin.
  169. *
  170. * handle : integer - handle the plugin was started with.\n
  171. * key : string - property name.\n
  172. * value : string or unicode - value of property.
  173. *
  174. * *Note, Key is NOT case sensitive.
  175. *
  176. * example:
  177. * - xbmcplugin.setProperty(int(sys.argv[1]), 'Emulator', 'M.A.M.E.')
  178. */
  179. void setProperty(int handle, const char* key, const String& value);
  180. SWIG_CONSTANT(int,SORT_METHOD_NONE);
  181. SWIG_CONSTANT(int,SORT_METHOD_LABEL);
  182. SWIG_CONSTANT(int,SORT_METHOD_LABEL_IGNORE_THE);
  183. SWIG_CONSTANT(int,SORT_METHOD_DATE);
  184. SWIG_CONSTANT(int,SORT_METHOD_SIZE);
  185. SWIG_CONSTANT(int,SORT_METHOD_FILE);
  186. SWIG_CONSTANT(int,SORT_METHOD_DRIVE_TYPE);
  187. SWIG_CONSTANT(int,SORT_METHOD_TRACKNUM);
  188. SWIG_CONSTANT(int,SORT_METHOD_DURATION);
  189. SWIG_CONSTANT(int,SORT_METHOD_TITLE);
  190. SWIG_CONSTANT(int,SORT_METHOD_TITLE_IGNORE_THE);
  191. SWIG_CONSTANT(int,SORT_METHOD_ARTIST);
  192. SWIG_CONSTANT(int,SORT_METHOD_ARTIST_IGNORE_THE);
  193. SWIG_CONSTANT(int,SORT_METHOD_ALBUM);
  194. SWIG_CONSTANT(int,SORT_METHOD_ALBUM_IGNORE_THE);
  195. SWIG_CONSTANT(int,SORT_METHOD_GENRE);
  196. SWIG_CONSTANT2(int,SORT_METHOD_VIDEO_YEAR,SORT_METHOD_YEAR);
  197. SWIG_CONSTANT(int,SORT_METHOD_VIDEO_RATING);
  198. SWIG_CONSTANT(int,SORT_METHOD_PROGRAM_COUNT);
  199. SWIG_CONSTANT(int,SORT_METHOD_PLAYLIST_ORDER);
  200. SWIG_CONSTANT(int,SORT_METHOD_EPISODE);
  201. SWIG_CONSTANT(int,SORT_METHOD_VIDEO_TITLE);
  202. SWIG_CONSTANT(int,SORT_METHOD_VIDEO_SORT_TITLE);
  203. SWIG_CONSTANT(int,SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE);
  204. SWIG_CONSTANT(int,SORT_METHOD_PRODUCTIONCODE);
  205. SWIG_CONSTANT(int,SORT_METHOD_SONG_RATING);
  206. SWIG_CONSTANT(int,SORT_METHOD_MPAA_RATING);
  207. SWIG_CONSTANT(int,SORT_METHOD_VIDEO_RUNTIME);
  208. SWIG_CONSTANT(int,SORT_METHOD_STUDIO);
  209. SWIG_CONSTANT(int,SORT_METHOD_STUDIO_IGNORE_THE);
  210. SWIG_CONSTANT(int,SORT_METHOD_UNSORTED);
  211. SWIG_CONSTANT(int,SORT_METHOD_BITRATE);
  212. SWIG_CONSTANT(int,SORT_METHOD_LISTENERS);
  213. SWIG_CONSTANT(int,SORT_METHOD_COUNTRY);
  214. SWIG_CONSTANT(int,SORT_METHOD_DATEADDED);
  215. SWIG_CONSTANT(int,SORT_METHOD_FULLPATH);
  216. SWIG_CONSTANT(int,SORT_METHOD_LABEL_IGNORE_FOLDERS);
  217. SWIG_CONSTANT(int,SORT_METHOD_LASTPLAYED);
  218. SWIG_CONSTANT(int,SORT_METHOD_PLAYCOUNT);
  219. SWIG_CONSTANT(int,SORT_METHOD_CHANNEL);
  220. SWIG_CONSTANT(int,SORT_METHOD_DATE_TAKEN);
  221. }
  222. }