-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use libcdio-paranoia to read CDs on Linux
- Loading branch information
Showing
24 changed files
with
1,158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
project(lib VERSION 1.0.0 LANGUAGES CXX) | ||
|
||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus) | ||
find_package(libcontemporary) | ||
find_package(libthefrisbee) | ||
pkg_check_modules(cdio IMPORTED_TARGET libcdio++) | ||
pkg_check_modules(MusicBrainz IMPORTED_TARGET libmusicbrainz5) | ||
pkg_check_modules(cdio-paranoia IMPORTED_TARGET libcdio_paranoia) | ||
|
||
set(SOURCES | ||
cdmonitor.cpp | ||
plugin.cpp | ||
) | ||
|
||
set(HEADERS | ||
cdmonitor.h | ||
plugin.h | ||
) | ||
|
||
add_library(plugin-paranoia SHARED ${SOURCES} ${HEADERS}) | ||
target_include_directories(plugin-paranoia PUBLIC ../../libthebeat/) | ||
|
||
cntp_init_plugin(thebeat plugin-paranoia 20 paranoia) | ||
cntp_translate(plugin-paranoia) | ||
|
||
set_target_properties(plugin-paranoia PROPERTIES | ||
OUTPUT_NAME paranoiaPlugin | ||
FRAMEWORK FALSE) | ||
|
||
qt_add_qml_module(plugin-paranoia | ||
URI com.vicr123.thebeat.plugin.paranoia | ||
VERSION 1.0 | ||
QML_FILES | ||
ParanoiaCdPane.qml | ||
NO_CACHEGEN | ||
SOURCES paranoiacdcontroller.h paranoiacdcontroller.cpp | ||
SOURCES paranoiatrackinfo.h paranoiatrackinfo.cpp | ||
QML_FILES ParanoiaPlugin.json | ||
SOURCES paranoiacdpluginmediasource.h paranoiacdpluginmediasource.cpp | ||
SOURCES paranoiaplayer.h paranoiaplayer.cpp | ||
SOURCES paranoiamediaitem.h paranoiamediaitem.cpp | ||
) | ||
|
||
target_link_libraries(plugin-paranoia PRIVATE Qt::Widgets Qt::DBus PkgConfig::cdio PkgConfig::cdio-paranoia libcontemporary libthefrisbee libthebeat) | ||
|
||
IF(${MusicBrainz_FOUND}) | ||
target_link_libraries(plugin-paranoia PRIVATE PkgConfig::MusicBrainz) | ||
target_compile_definitions(plugin-paranoia PUBLIC HAVE_MUSICBRAINZ) | ||
ENDIF() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Layouts | ||
import QtQuick.Controls | ||
import com.vicr123.Contemporary | ||
import com.vicr123.thebeat | ||
|
||
Item { | ||
property var source | ||
readonly property var controller: source.controller | ||
|
||
Pager { | ||
anchors.fill: parent | ||
|
||
Item { | ||
LibraryHeader { | ||
id: grandstand | ||
anchors.top: parent.top | ||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
innerTopMargin: SafeZone.top | ||
z: 20 | ||
|
||
text: controller.albumName | ||
color: layer1.color | ||
|
||
RowLayout { | ||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
|
||
Button { | ||
text: qsTr("Enqueue All") | ||
icon.name: "view-media-playlist" | ||
|
||
onClicked: () => trackList.enqueueAll() | ||
} | ||
Button { | ||
text: qsTr("Play All") | ||
icon.name: "media-playback-start" | ||
|
||
onClicked: () => { | ||
PlaylistManager.clear(); | ||
trackList.enqueueAll(); | ||
} | ||
} | ||
Button { | ||
text: qsTr("Shuffle All") | ||
icon.name: "media-playlist-shuffle" | ||
|
||
onClicked: () => { | ||
trackList.enqueueAll(); | ||
PlaylistManager.shuffle = true; | ||
PlaylistManager.next(); | ||
} | ||
} | ||
Item { | ||
Layout.fillWidth: true | ||
} | ||
Button { | ||
text: qsTr("Eject") | ||
icon.name: "media-eject" | ||
|
||
onClicked: () => { | ||
controller.eject(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
ColumnLayout { | ||
anchors.bottom: parent.bottom | ||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
anchors.top: grandstand.bottom | ||
|
||
LibraryListing { | ||
id: trackList | ||
Layout.fillHeight: true | ||
Layout.fillWidth: true | ||
model: controller | ||
|
||
onEnqueueItem: index => { | ||
const mediaItem = controller.mediaItem(index); | ||
PlaylistManager.addItem(mediaItem); | ||
PlaylistManager.currentItem = mediaItem; | ||
} | ||
|
||
function enqueueAll() { | ||
for (var i = 0; i < trackList.model.rowCount(); i++) { | ||
const mediaItem = controller.mediaItem(i); | ||
PlaylistManager.addItem(mediaItem); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
Connections { | ||
target: controller | ||
|
||
function onEjectError() { | ||
ejectErrorDialog.visible = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Paranoia", | ||
"icon": "media-cd-import", | ||
"uuid": "1a1f9695-efee-4e68-96fb-b8c392f14885" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "cdmonitor.h" | ||
|
||
#include "paranoiacdcontroller.h" | ||
#include <DriveObjects/blockinterface.h> | ||
#include <DriveObjects/diskobject.h> | ||
#include <DriveObjects/driveinterface.h> | ||
#include <driveobjectmanager.h> | ||
#include <statemanager.h> | ||
|
||
struct CdMonitorPrivate { | ||
QMap<DiskObject*, ParanoiaCdController*> panes; | ||
}; | ||
|
||
CdMonitor::CdMonitor(QObject* parent) : | ||
QObject{parent} { | ||
d = new CdMonitorPrivate(); | ||
|
||
for (auto drive : DriveObjectManager::drives()) { | ||
connect(drive, &DriveInterface::changed, this, &CdMonitor::updateDisks); | ||
} | ||
connect(DriveObjectManager::instance(), &DriveObjectManager::driveAdded, this, [this](DriveInterface* drive) { | ||
connect(drive, &DriveInterface::changed, this, &CdMonitor::updateDisks); | ||
}); | ||
QTimer::singleShot(0, this, &CdMonitor::updateDisks); | ||
updateDisks(); | ||
} | ||
|
||
CdMonitor::~CdMonitor() { | ||
delete d; | ||
} | ||
|
||
void CdMonitor::updateDisks() { | ||
QList<DiskObject*> keepDisks; | ||
for (auto disk : DriveObjectManager::opticalDisks()) { | ||
auto drive = disk->interface<BlockInterface>()->drive(); | ||
if (!drive->mediaAvailable()) continue; | ||
if (drive->audioTracks() == 0) continue; | ||
|
||
if (!d->panes.contains(disk)) { | ||
auto widget = new ParanoiaCdController(disk); | ||
d->panes.insert(disk, widget); | ||
} | ||
|
||
keepDisks.append(disk); | ||
} | ||
|
||
auto oldDisks = d->panes.keys(); | ||
for (auto disk : oldDisks) { | ||
if (!keepDisks.contains(disk)) { | ||
auto widget = d->panes.take(disk); | ||
widget->deleteLater(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef CDMONITOR_H | ||
#define CDMONITOR_H | ||
|
||
#include <QObject> | ||
|
||
struct CdMonitorPrivate; | ||
class CdMonitor : public QObject { | ||
Q_OBJECT | ||
public: | ||
explicit CdMonitor(QObject* parent = nullptr); | ||
~CdMonitor(); | ||
|
||
signals: | ||
|
||
private: | ||
CdMonitorPrivate* d; | ||
|
||
void updateDisks(); | ||
}; | ||
|
||
#endif // CDMONITOR_H |
Oops, something went wrong.