1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "swighelper.h"
#include "addons/IAddon.h"
#include "AddonString.h"
#include "AddonClass.h"
#include "Exception.h"
namespace XBMCAddon
{
namespace xbmcaddon
{
XBMCCOMMONS_STANDARD_EXCEPTION(AddonException);
/**
* Addon class.
*
* Addon([id]) -- Creates a new Addon class.
*
* id : [opt] string - id of the addon as specified in addon.xml
*
* *Note, specifying the addon id is not needed.\n
* Important however is that the addon folder has the same name as the addon id provided in addon.xml.\n
* You can optionally specify the addon id from another installed addon to retrieve settings from it.
*
* example:
* - self.Addon = xbmcaddon.Addon()
* - self.Addon = xbmcaddon.Addon('script.foo.bar')
*/
class Addon : public AddonClass
{
ADDON::AddonPtr pAddon;
String getDefaultId();
String getAddonVersion();
public:
/**
* Addon class.
*
* Addon([id]) -- Creates a new Addon class.
*
* id : [opt] string - id of the addon as specified in addon.xml\n
*
* *Note, specifying the addon id is not needed.\n
* Important however is that the addon folder has the same name as the addon id provided in addon.xml.\n
* You can optionally specify the addon id from another installed addon to retrieve settings from it.
*
* example:
* - self.Addon = xbmcaddon.Addon()
* - self.Addon = xbmcaddon.Addon('script.foo.bar')
*/
Addon(const char* id = NULL) throw (AddonException);
virtual ~Addon();
/**
* getLocalizedString(id) -- Returns an addon's localized 'unicode string'.
*
* id : integer - id# for string you want to localize.
*
* example:
* - locstr = self.Addon.getLocalizedString(32000)
*/
String getLocalizedString(int id);
/**
* getSetting(id) -- Returns the value of a setting as a unicode string.
*
* id : string - id of the setting that the module needs to access.
*
* example:
* - apikey = self.Addon.getSetting('apikey')
*/
String getSetting(const char* id);
/**
* setSetting(id, value) -- Sets a script setting.
*
* id : string - id of the setting that the module needs to access.
* value : string or unicode - value of the setting.
*
* *Note, You can use the above as keywords for arguments.
*
* example:
* - self.Settings.setSetting(id='username', value='teamxbmc')\n
*/
void setSetting(const char* id, const String& value);
/**
* openSettings() -- Opens this scripts settings dialog.
*
* example:
* - self.Settings.openSettings()
*/
void openSettings();
/**
* getAddonInfo(id) -- Returns the value of an addon property as a string.
*
* id : string - id of the property that the module needs to access.
*
* *Note, choices are (author, changelog, description, disclaimer, fanart. icon, id, name, path,\n
* profile, stars, summary, type, version)
*
* example:
* - version = self.Addon.getAddonInfo('version')
*/
String getAddonInfo(const char* id) throw (AddonException);
};
}
}
|