summaryrefslogtreecommitdiffstats
path: root/xbmc/interfaces/builtins/OpticalBuiltins.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/interfaces/builtins/OpticalBuiltins.cpp')
-rw-r--r--xbmc/interfaces/builtins/OpticalBuiltins.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/xbmc/interfaces/builtins/OpticalBuiltins.cpp b/xbmc/interfaces/builtins/OpticalBuiltins.cpp
new file mode 100644
index 0000000..4a0ec5d
--- /dev/null
+++ b/xbmc/interfaces/builtins/OpticalBuiltins.cpp
@@ -0,0 +1,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}}
+ };
+}