blob: 7d52ee04310c411357b3bdaaf08ffb236fe27b63 (
plain)
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
|
/*
* Copyright (C) 2016-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "addons/AddonBuilder.h"
#include "ServiceBroker.h"
#include "addons/ContextMenuAddon.h"
#include "addons/FontResource.h"
#include "addons/GameResource.h"
#include "addons/ImageResource.h"
#include "addons/LanguageResource.h"
#include "addons/PluginSource.h"
#include "addons/Repository.h"
#include "addons/Scraper.h"
#include "addons/Service.h"
#include "addons/Skin.h"
#include "addons/UISoundsResource.h"
#include "addons/Webinterface.h"
#include "addons/addoninfo/AddonInfo.h"
#include "addons/addoninfo/AddonType.h"
#include "games/addons/GameClient.h"
#include "games/controllers/Controller.h"
#include "pvr/addons/PVRClient.h"
#include "utils/StringUtils.h"
using namespace KODI;
namespace ADDON
{
AddonPtr CAddonBuilder::Generate(const AddonInfoPtr& info, AddonType type)
{
if (!info || info->ID().empty())
return AddonPtr();
if (type == AddonType::UNKNOWN)
type = info->MainType();
if (type == AddonType::UNKNOWN)
return std::make_shared<CAddon>(info, AddonType::UNKNOWN);
// Handle screensaver special cases
if (type == AddonType::SCREENSAVER)
{
// built in screensaver or python screensaver
if (StringUtils::StartsWithNoCase(info->ID(), "screensaver.xbmc.builtin.") ||
URIUtils::HasExtension(info->LibName(), ".py"))
return std::make_shared<CAddon>(info, type);
}
// Handle audio encoder special cases
if (type == AddonType::AUDIOENCODER)
{
// built in audio encoder
if (StringUtils::StartsWithNoCase(info->ID(), "audioencoder.kodi.builtin."))
return std::make_shared<CAddonDll>(info, type);
}
switch (type)
{
case AddonType::AUDIODECODER:
case AddonType::AUDIOENCODER:
case AddonType::IMAGEDECODER:
case AddonType::INPUTSTREAM:
case AddonType::PERIPHERALDLL:
case AddonType::PVRDLL:
case AddonType::VFS:
case AddonType::VISUALIZATION:
case AddonType::SCREENSAVER:
return std::make_shared<CAddonDll>(info, type);
case AddonType::GAMEDLL:
return std::make_shared<GAME::CGameClient>(info);
case AddonType::PLUGIN:
case AddonType::SCRIPT:
return std::make_shared<CPluginSource>(info, type);
case AddonType::SCRIPT_LIBRARY:
case AddonType::SCRIPT_LYRICS:
case AddonType::SCRIPT_MODULE:
case AddonType::SUBTITLE_MODULE:
case AddonType::SCRIPT_WEATHER:
return std::make_shared<CAddon>(info, type);
case AddonType::WEB_INTERFACE:
return std::make_shared<CWebinterface>(info);
case AddonType::SERVICE:
return std::make_shared<CService>(info);
case AddonType::SCRAPER_ALBUMS:
case AddonType::SCRAPER_ARTISTS:
case AddonType::SCRAPER_MOVIES:
case AddonType::SCRAPER_MUSICVIDEOS:
case AddonType::SCRAPER_TVSHOWS:
case AddonType::SCRAPER_LIBRARY:
return std::make_shared<CScraper>(info, type);
case AddonType::SKIN:
return std::make_shared<CSkinInfo>(info);
case AddonType::RESOURCE_FONT:
return std::make_shared<CFontResource>(info);
case AddonType::RESOURCE_IMAGES:
return std::make_shared<CImageResource>(info);
case AddonType::RESOURCE_GAMES:
return std::make_shared<CGameResource>(info);
case AddonType::RESOURCE_LANGUAGE:
return std::make_shared<CLanguageResource>(info);
case AddonType::RESOURCE_UISOUNDS:
return std::make_shared<CUISoundsResource>(info);
case AddonType::REPOSITORY:
return std::make_shared<CRepository>(info);
case AddonType::CONTEXTMENU_ITEM:
return std::make_shared<CContextMenuAddon>(info);
case AddonType::GAME_CONTROLLER:
return std::make_shared<GAME::CController>(info);
default:
break;
}
return AddonPtr();
}
}
|