summaryrefslogtreecommitdiffstats
path: root/xbmc/interfaces/builtins/OpticalBuiltins.cpp
blob: 4a0ec5de41cf6261fa2f05281f94817b99bb96c3 (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
/*
 *  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.
 */

#include "OpticalBuiltins.h"

#include "ServiceBroker.h"

#ifdef HAS_DVD_DRIVE
#include "storage/MediaManager.h"
#endif

#ifdef HAS_CDDA_RIPPER
#include "cdrip/CDDARipper.h"
#endif

/*! \brief Eject the tray of an optical drive.
 *  \param params (ignored)
 */
static int Eject(const std::vector<std::string>& params)
{
#ifdef HAS_DVD_DRIVE
  CServiceBroker::GetMediaManager().ToggleTray();
#endif

  return 0;
}

/*! \brief Rip currently inserted CD.
 *  \param params (ignored)
 */
static int RipCD(const std::vector<std::string>& params)
{
#ifdef HAS_CDDA_RIPPER
  KODI::CDRIP::CCDDARipper::GetInstance().RipCD();
#endif

  return 0;
}

// Note: For new Texts with comma add a "\" before!!! Is used for table text.
//
/// \page page_List_of_built_in_functions
/// \section built_in_functions_9 Optical container built-in's
///
/// -----------------------------------------------------------------------------
///
/// \table_start
///   \table_h2_l{
///     Function,
///     Description }
///   \table_row2_l{
///     <b>`EjectTray`</b>
///     ,
///     Either opens or closes the DVD tray\, depending on its current state.
///   }
///   \table_row2_l{
///     <b>`RipCD`</b>
///     ,
///     Will rip the inserted CD from the DVD-ROM drive.
///   }
/// \table_end
///

CBuiltins::CommandMap COpticalBuiltins::GetOperations() const
{
  return {
           {"ejecttray", {"Close or open the DVD tray", 0, Eject}},
           {"ripcd",     {"Rip the currently inserted audio CD", 0, RipCD}}
         };
}