[videodb] Remove nested transaction when saving state after stopping PVR playback
[xbmc.git] / xbmc / settings / LibExportSettings.cpp
blob15be272ec4d6a5c9d8d1976ca71a6bea01275cf5
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 */
8 // LibExportSettings.cpp: implementation of the CLibExportSettings class.
9 //
10 //////////////////////////////////////////////////////////////////////
12 #include "LibExportSettings.h"
14 //////////////////////////////////////////////////////////////////////
15 // Construction/Destruction
16 //////////////////////////////////////////////////////////////////////
18 CLibExportSettings::CLibExportSettings()
20 m_exporttype = ELIBEXPORT_SINGLEFILE;
21 m_itemstoexport = ELIBEXPORT_ALBUMS + ELIBEXPORT_ALBUMARTISTS;
22 m_overwrite = false;
23 m_artwork = false;
24 m_unscraped = false;
25 m_skipnfo = false;
28 bool CLibExportSettings::operator!=(const CLibExportSettings &right) const
30 if (m_exporttype != right.m_exporttype)
31 return true;
32 if (m_strPath != right.m_strPath)
33 return true;
34 if (m_overwrite != right.m_overwrite)
35 return true;
36 if (m_itemstoexport != right.m_itemstoexport)
37 return true;
39 if (m_artwork != right.m_artwork)
40 return true;
41 if (m_unscraped != right.m_unscraped)
42 return true;
43 if (m_skipnfo != right.m_skipnfo)
44 return true;
46 return false;
49 bool CLibExportSettings::IsItemExported(ELIBEXPORTOPTIONS item) const
51 return (m_itemstoexport & item);
54 bool CLibExportSettings::IsArtists() const
56 return (m_itemstoexport & ELIBEXPORT_ALBUMARTISTS) ||
57 (m_itemstoexport & ELIBEXPORT_SONGARTISTS) ||
58 (m_itemstoexport & ELIBEXPORT_OTHERARTISTS);
61 std::vector<int> CLibExportSettings::GetExportItems() const
63 std::vector<int> values;
64 if (IsItemExported(ELIBEXPORT_ALBUMS))
65 values.emplace_back(ELIBEXPORT_ALBUMS);
66 if (IsItemExported(ELIBEXPORT_ALBUMARTISTS))
67 values.emplace_back(ELIBEXPORT_ALBUMARTISTS);
68 if (IsItemExported(ELIBEXPORT_SONGARTISTS))
69 values.emplace_back(ELIBEXPORT_SONGARTISTS);
70 if (IsItemExported(ELIBEXPORT_OTHERARTISTS))
71 values.emplace_back(ELIBEXPORT_OTHERARTISTS);
72 if (IsItemExported(ELIBEXPORT_ACTORTHUMBS))
73 values.emplace_back(ELIBEXPORT_ACTORTHUMBS);
74 if (IsItemExported(ELIBEXPORT_SONGS))
75 values.emplace_back(ELIBEXPORT_SONGS);
76 return values;
79 std::vector<int> CLibExportSettings::GetLimitedItems(int items) const
81 std::vector<int> values;
82 if (IsItemExported(ELIBEXPORT_ALBUMS) && (items & ELIBEXPORT_ALBUMS))
83 values.emplace_back(ELIBEXPORT_ALBUMS);
84 if (IsItemExported(ELIBEXPORT_ALBUMARTISTS) && (items & ELIBEXPORT_ALBUMARTISTS))
85 values.emplace_back(ELIBEXPORT_ALBUMARTISTS);
86 if (IsItemExported(ELIBEXPORT_SONGARTISTS) && (items & ELIBEXPORT_SONGARTISTS))
87 values.emplace_back(ELIBEXPORT_SONGARTISTS);
88 if (IsItemExported(ELIBEXPORT_OTHERARTISTS) && (items & ELIBEXPORT_OTHERARTISTS))
89 values.emplace_back(ELIBEXPORT_OTHERARTISTS);
90 if (IsItemExported(ELIBEXPORT_ACTORTHUMBS) && (items & ELIBEXPORT_ACTORTHUMBS))
91 values.emplace_back(ELIBEXPORT_ACTORTHUMBS);
92 if (IsItemExported(ELIBEXPORT_SONGS) && (items & ELIBEXPORT_SONGS))
93 values.emplace_back(ELIBEXPORT_SONGS);
94 return values;
97 bool CLibExportSettings::IsSingleFile() const
99 return (m_exporttype == ELIBEXPORT_SINGLEFILE);
102 bool CLibExportSettings::IsSeparateFiles() const
104 return (m_exporttype == ELIBEXPORT_SEPARATEFILES);
107 bool CLibExportSettings::IsToLibFolders() const
109 return (m_exporttype == ELIBEXPORT_TOLIBRARYFOLDER);
112 bool CLibExportSettings::IsArtistFoldersOnly() const
114 return (m_exporttype == ELIBEXPORT_ARTISTFOLDERS);