[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / music / jobs / MusicLibraryScanningJob.cpp
blobd2626a18d6f18ada6e0998b5a14713939fc41d8a
1 /*
2 * Copyright (C) 2017-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.
7 */
9 #include "MusicLibraryScanningJob.h"
11 #include "music/MusicDatabase.h"
13 CMusicLibraryScanningJob::CMusicLibraryScanningJob(const std::string& directory, int flags, bool showProgress /* = true */)
14 : m_scanner(),
15 m_directory(directory),
16 m_showProgress(showProgress),
17 m_flags(flags)
18 { }
20 CMusicLibraryScanningJob::~CMusicLibraryScanningJob() = default;
22 bool CMusicLibraryScanningJob::Cancel()
24 if (!m_scanner.IsScanning())
25 return true;
27 m_scanner.Stop();
28 return true;
31 bool CMusicLibraryScanningJob::operator==(const CJob* job) const
33 if (strcmp(job->GetType(), GetType()) != 0)
34 return false;
36 const CMusicLibraryScanningJob* scanningJob = dynamic_cast<const CMusicLibraryScanningJob*>(job);
37 if (scanningJob == nullptr)
38 return false;
40 return m_directory == scanningJob->m_directory &&
41 m_flags == scanningJob->m_flags;
44 bool CMusicLibraryScanningJob::Work(CMusicDatabase &db)
46 m_scanner.ShowDialog(m_showProgress);
47 if (m_flags & MUSIC_INFO::CMusicInfoScanner::SCAN_ALBUMS)
48 // Scrape additional album information
49 m_scanner.FetchAlbumInfo(m_directory, m_flags & MUSIC_INFO::CMusicInfoScanner::SCAN_RESCAN);
50 else if (m_flags & MUSIC_INFO::CMusicInfoScanner::SCAN_ARTISTS)
51 // Scrape additional artist information
52 m_scanner.FetchArtistInfo(m_directory, m_flags & MUSIC_INFO::CMusicInfoScanner::SCAN_RESCAN);
53 else
54 // Scan tags from music files, and optionally scrape artist and album info
55 m_scanner.Start(m_directory, m_flags);
57 return true;