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
|
/*
* Copyright (C) 2005-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.
*/
#pragma once
#include "utils/JobManager.h"
#include <string>
class CFileItem;
namespace MUSIC_INFO
{
class CMusicInfoTag;
}
namespace KODI
{
namespace CDRIP
{
/*!
* \brief Rip an entire CD or a single track
*
* The CCDDARipper class is used to rip an entire CD or just a single track.
* Tracks are stored in a folder constructed from two user settings: audiocds.recordingpath and
* audiocds.trackpathformat. The former is the absolute file system path for the root folder
* where ripped music is stored, and the latter specifies the format for the album subfolder and
* for the track file name.
* Format used to encode ripped tracks is defined by the audiocds.encoder user setting, and
* there are several choices: wav, ogg vorbis and mp3.
*/
class CCDDARipper : public CJobQueue
{
public:
/*!
* \brief The only way through which the global instance of the CDDARipper should be accessed.
*
* \return the global instance.
*/
static CCDDARipper& GetInstance();
/*!
* \brief Rip a single track
*
* \param[in] pItem CFileItem representing a track to rip
* \return true if success, false if failure
*/
bool RipTrack(CFileItem* pItem);
/*!
* \brief Rip an entire CD
*
* \return true if success, false if failure
*/
bool RipCD();
void OnJobComplete(unsigned int jobID, bool success, CJob* job) override;
private:
// private construction and no assignments
CCDDARipper();
CCDDARipper(const CCDDARipper&) = delete;
~CCDDARipper() override;
CCDDARipper const& operator=(CCDDARipper const&) = delete;
/*!
* \brief Create folder where CD tracks will be stored
*
* \param[in] infoTag music info tags for the CD, used to format album name
* \param[out] strDirectory full path of the created folder
* \param[out] legalType created directory type (see LEGAL_... constants)
* \return true if success, false if failure
*/
bool CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag,
std::string& strDirectory,
int& legalType);
/*!
* \brief Return formatted album subfolder for rip path
*
* \param infoTag music info tags for the CD, used to format album name
* \return album subfolder path name
*/
std::string GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag);
/*!
* \brief Return file name for the track
*
* \param[in] item CFileItem representing a track
* \return track file name
*/
std::string GetTrackName(CFileItem* item);
};
} /* namespace CDRIP */
} /* namespace KODI */
|