Debian Codegraph @

xbmc/video/tags/IVideoInfoTagLoader.h

raw
1 /*
2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include "InfoScanner.h"
12 #include "addons/Scraper.h"
13
14 #include <string>
15 #include <utility>
16
17 class CFileItem;
18 class CVideoInfoTag;
19 class EmbeddedArt;
20
21 namespace VIDEO
22 {
23
24 //! \brief Base class for video tag loaders.
25 class IVideoInfoTagLoader
26 {
27 public:
28 //! \brief Constructor
29 //! \param item The item to load info for
30 //! \param info Scraper info
31 //! \param llokInFolder True to look in folder holding file
32 IVideoInfoTagLoader(const CFileItem& item, ADDON::ScraperPtr info, bool lookInFolder)
33 : m_item(item), m_info(std::move(info))
34 {
35 }
36 virtual ~IVideoInfoTagLoader() = default;
37
38 //! \brief Returns true if we have info to provide.
39 virtual bool HasInfo() const = 0;
40
41 //! \brief Load tag from file.
42 //! \brief tag Tag to load info into
43 //! \brief prioritise True to prioritise data over existing data in tag
44 //! \returns True if tag was read, false otherwise
45 virtual CInfoScanner::INFO_TYPE Load(CVideoInfoTag& tag,
46 bool prioritise,
47 std::vector<EmbeddedArt>* art = nullptr) = 0;
48
49 //! \brief Returns url associated with obtained URL (NFO_URL et al).
50 const CScraperUrl& ScraperUrl() const { return m_url; }
51
52 //! \brief Returns current scaper info.
53 const ADDON::ScraperPtr GetAddonInfo() const { return m_info; }
54
55 protected:
56 const CFileItem& m_item; //!< Reference to item to load for
57 ADDON::ScraperPtr m_info; //!< Scraper info
58 CScraperUrl m_url; //!< URL for scraper
59 };
60
61 }