1 /* 2 * Copyright (C) 2016-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 <set> 12 #include <string> 13 #include <vector> 14 15 class CGUIDialogProgressBarHandle; 16 17 class CInfoScanner 18 { 19 public: 20 /*! 21 \brief Return values from the information lookup functions. 22 */ 23 enum INFO_RET 24 { 25 INFO_CANCELLED, 26 INFO_ERROR, 27 INFO_NOT_NEEDED, 28 INFO_HAVE_ALREADY, 29 INFO_NOT_FOUND, 30 INFO_ADDED 31 }; 32 33 /* 34 \brief Type of information returned from tag readers. 35 */ 36 37 enum INFO_TYPE 38 { 39 NO_NFO = 0, //!< No info found 40 FULL_NFO = 1, //!< Full info specified 41 URL_NFO = 2, //!< A URL to grab info from was found 42 OVERRIDE_NFO = 3, //!< Override info was found 43 COMBINED_NFO = 4, //!< A URL to grab info from + override info was found 44 ERROR_NFO = 5, //!< Error processing info 45 TITLE_NFO = 6 //!< At least Title was read (and optionally the Year) 46 }; 47 48 //! \brief Empty destructor. 49 virtual ~CInfoScanner() = default; 50 51 virtual bool DoScan(const std::string& strDirectory) = 0; 52 53 /*! \brief Check if the folder is excluded from scanning process 54 \param strDirectory Directory to scan 55 \return true if there is a .nomedia file 56 */ 57 bool HasNoMedia(const std::string& strDirectory) const; 58 59 //! \brief Set whether or not to show a progress dialog. ShowDialog(bool show)60 void ShowDialog(bool show) { m_showDialog = show; } 61 62 //! \brief Returns whether or not a scan is in progress. IsScanning()63 bool IsScanning() const { return m_bRunning; } 64 65 protected: 66 //! \brief Protected constructor to only allow subclass instances. 67 CInfoScanner() = default; 68 69 std::set<std::string> m_pathsToScan; //!< Set of paths to scan 70 bool m_showDialog = false; //!< Whether or not to show progress bar dialog 71 CGUIDialogProgressBarHandle* m_handle = nullptr; //!< Progress bar handle 72 bool m_bRunning = false; //!< Whether or not scanner is running 73 bool m_bCanInterrupt = false; //!< Whether or not scanner is currently interruptable 74 bool m_bClean = false; //!< Whether or not to perform cleaning during scanning 75 }; 76