2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "addons/Addon.h"
12 #include "addons/AddonVersion.h"
13 #include "utils/Digest.h"
21 class CAddonExtensions
;
23 struct RepositoryDirInfo
25 CAddonVersion minversion
{""};
26 CAddonVersion maxversion
{""};
29 KODI::UTILITY::CDigest::Type checksumType
{KODI::UTILITY::CDigest::Type::INVALID
};
32 KODI::UTILITY::CDigest::Type hashType
{KODI::UTILITY::CDigest::Type::INVALID
};
35 typedef std::vector
<RepositoryDirInfo
> RepositoryDirList
;
37 class CRepository
: public CAddon
40 explicit CRepository(const AddonInfoPtr
& addonInfo
);
49 FetchStatus
FetchIfChanged(const std::string
& oldChecksum
,
50 std::string
& checksum
,
51 std::vector
<AddonInfoPtr
>& addons
,
52 int& recheckAfter
) const;
57 KODI::UTILITY::TypedDigest digest
;
59 ResolveResult
ResolvePathAndHash(AddonPtr
const& addon
) const;
61 // Implementation of CAddon
62 void OnPostInstall(bool update
, bool modal
) override
;
65 static bool FetchChecksum(const std::string
& url
,
66 std::string
& checksum
,
67 int& recheckAfter
) noexcept
;
68 static bool FetchIndex(const RepositoryDirInfo
& repo
,
69 std::string
const& digest
,
70 std::vector
<AddonInfoPtr
>& addons
) noexcept
;
72 static RepositoryDirInfo
ParseDirConfiguration(const CAddonExtensions
& configuration
);
74 RepositoryDirList m_dirs
;
77 typedef std::shared_ptr
<CRepository
> RepositoryPtr
;