summaryrefslogtreecommitdiffstats
path: root/xbmc/settings/LibExportSettings.cpp
blob: 15be272ec4d6a5c9d8d1976ca71a6bea01275cf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 *  Copyright (C) 2017-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */
// LibExportSettings.cpp: implementation of the CLibExportSettings class.
//
//////////////////////////////////////////////////////////////////////

#include "LibExportSettings.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CLibExportSettings::CLibExportSettings()
{
  m_exporttype = ELIBEXPORT_SINGLEFILE;
  m_itemstoexport = ELIBEXPORT_ALBUMS + ELIBEXPORT_ALBUMARTISTS;
  m_overwrite = false;
  m_artwork = false;
  m_unscraped  = false;
  m_skipnfo = false;
}

bool CLibExportSettings::operator!=(const CLibExportSettings &right) const
{
  if (m_exporttype != right.m_exporttype)
    return true;
  if (m_strPath != right.m_strPath)
    return true;
  if (m_overwrite != right.m_overwrite)
    return true;
  if (m_itemstoexport != right.m_itemstoexport)
    return true;

  if (m_artwork != right.m_artwork)
    return true;
  if (m_unscraped != right.m_unscraped)
    return true;
  if (m_skipnfo != right.m_skipnfo)
    return true;

  return false;
}

bool CLibExportSettings::IsItemExported(ELIBEXPORTOPTIONS item) const
{
  return (m_itemstoexport & item);
}

bool CLibExportSettings::IsArtists() const
{
  return (m_itemstoexport & ELIBEXPORT_ALBUMARTISTS) ||
         (m_itemstoexport & ELIBEXPORT_SONGARTISTS) ||
         (m_itemstoexport & ELIBEXPORT_OTHERARTISTS);
}

std::vector<int> CLibExportSettings::GetExportItems() const
{
  std::vector<int> values;
  if (IsItemExported(ELIBEXPORT_ALBUMS))
    values.emplace_back(ELIBEXPORT_ALBUMS);
  if (IsItemExported(ELIBEXPORT_ALBUMARTISTS))
    values.emplace_back(ELIBEXPORT_ALBUMARTISTS);
  if (IsItemExported(ELIBEXPORT_SONGARTISTS))
    values.emplace_back(ELIBEXPORT_SONGARTISTS);
  if (IsItemExported(ELIBEXPORT_OTHERARTISTS))
    values.emplace_back(ELIBEXPORT_OTHERARTISTS);
  if (IsItemExported(ELIBEXPORT_ACTORTHUMBS))
    values.emplace_back(ELIBEXPORT_ACTORTHUMBS);
  if (IsItemExported(ELIBEXPORT_SONGS))
    values.emplace_back(ELIBEXPORT_SONGS);
  return values;
}

std::vector<int> CLibExportSettings::GetLimitedItems(int items) const
{
  std::vector<int> values;
  if (IsItemExported(ELIBEXPORT_ALBUMS) && (items & ELIBEXPORT_ALBUMS))
    values.emplace_back(ELIBEXPORT_ALBUMS);
  if (IsItemExported(ELIBEXPORT_ALBUMARTISTS) && (items & ELIBEXPORT_ALBUMARTISTS))
    values.emplace_back(ELIBEXPORT_ALBUMARTISTS);
  if (IsItemExported(ELIBEXPORT_SONGARTISTS) && (items & ELIBEXPORT_SONGARTISTS))
    values.emplace_back(ELIBEXPORT_SONGARTISTS);
  if (IsItemExported(ELIBEXPORT_OTHERARTISTS) && (items & ELIBEXPORT_OTHERARTISTS))
    values.emplace_back(ELIBEXPORT_OTHERARTISTS);
  if (IsItemExported(ELIBEXPORT_ACTORTHUMBS) && (items & ELIBEXPORT_ACTORTHUMBS))
    values.emplace_back(ELIBEXPORT_ACTORTHUMBS);
  if (IsItemExported(ELIBEXPORT_SONGS) && (items & ELIBEXPORT_SONGS))
    values.emplace_back(ELIBEXPORT_SONGS);
  return values;
}

bool CLibExportSettings::IsSingleFile() const
{
  return (m_exporttype == ELIBEXPORT_SINGLEFILE);
}

bool CLibExportSettings::IsSeparateFiles() const
{
  return (m_exporttype == ELIBEXPORT_SEPARATEFILES);
}

bool CLibExportSettings::IsToLibFolders() const
{
  return (m_exporttype == ELIBEXPORT_TOLIBRARYFOLDER);
}

bool CLibExportSettings::IsArtistFoldersOnly() const
{
  return (m_exporttype == ELIBEXPORT_ARTISTFOLDERS);
}