kodi
CueDocument.h
1 /*
2  * Copyright (C) 2005-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 "music/Song.h"
12 
13 #include <string>
14 #include <vector>
15 
16 #define MAX_PATH_SIZE 1024
17 
18 class CueReader;
19 
21 {
22  class CCueTrack
23  {
24  public:
25  std::string strArtist;
26  std::string strTitle;
27  std::string strFile;
28  int iTrackNumber = 0;
29  int iStartTime = 0;
30  int iEndTime = 0;
31  ReplayGain::Info replayGain;
32  };
33 public:
34  ~CCueDocument(void);
35  // USED
36  bool ParseFile(const std::string &strFilePath);
37  bool ParseTag(const std::string &strContent);
38  void GetSongs(VECSONGS &songs);
39  std::string GetMediaPath();
40  std::string GetMediaTitle();
41  void GetMediaFiles(std::vector<std::string>& mediaFiles);
42  void UpdateMediaFile(const std::string& oldMediaFile, const std::string& mediaFile);
43  bool IsOneFilePerTrack() const;
44  bool IsLoaded() const;
45 private:
46  void Clear();
47  bool Parse(CueReader& reader, const std::string& strFile = std::string());
48 
49  // Member variables
50  std::string m_strArtist; // album artist
51  std::string m_strAlbum; // album title
52  std::string m_strGenre; // album genre
53  int m_iYear = 0; //album year
54  int m_iTrack = 0; // current track
55  int m_iDiscNumber = 0; // Disc number
56  ReplayGain::Info m_albumReplayGain;
57 
58  bool m_bOneFilePerTrack = false;
59 
60  // cuetrack array
61  typedef std::vector<CCueTrack> Tracks;
62  Tracks m_tracks;
63 
64  std::string ExtractInfo(const std::string &line);
65  int ExtractTimeFromIndex(const std::string &index);
66  int ExtractNumericInfo(const std::string &info);
67  bool ResolvePath(std::string &strPath, const std::string &strBase);
68 };
Definition: ReplayGain.h:25
Definition: CueDocument.cpp:63
Definition: CueDocument.h:20
std::vector< CSong > VECSONGS
A vector of CSong objects, used for CMusicDatabase.
Definition: Song.h:212