Skip to content

Commit

Permalink
silencing debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
wdehoog committed Feb 4, 2019
1 parent 118b095 commit ec452da
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion qml/components/SpotifyController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Item {
//if (data.devices[i].is_active)
// playbackState.device = data.devices[i]
}
console.log("controller.checkForNewDevices: list differs")
//console.log("controller.checkForNewDevices: list differs")
devicesReloaded()
}
} catch (err) {
Expand Down
30 changes: 20 additions & 10 deletions qml/hutspot.qml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ ApplicationWindow {
property alias show_devices_page_at_startup: show_devices_page_at_startup
property alias handle_network_connection: handle_network_connection
property alias controlpanel_show_delay: controlpanel_show_delay
property alias logging_flags: logging_flags

property alias deviceId: deviceId
property alias deviceName: deviceName
Expand Down Expand Up @@ -517,13 +518,13 @@ ApplicationWindow {
// for logging Librespot discovery
var ls = isLibrespotInDiscoveredList()
if(ls !== null) {
console.log("onDevicesChanged: " + (ls!==null)?"Librespot is discovered":"not yet")
if(logging_flags.discovery)console.log("onDevicesChanged: " + (ls!==null)?"Librespot is discovered":"not yet")
if(!isLibrespotInDevicesList()) {
console.log("Librespot is not in the devices list")
if(logging_flags.discovery)console.log("Librespot is not in the devices list")
// maybe the list needs to be updated
spotifyController.checkForNewDevices()
} else {
console.log("Librespot is already in the devices list")
if(logging_flags.discovery)console.log("Librespot is already in the devices list")
}
}
//handleCurrentDevice()
Expand All @@ -535,7 +536,7 @@ ApplicationWindow {
for(i=0;i<spotifyController.devices.count;i++) {
var device = spotifyController.devices.get(i)
if(device.name === deviceName.value) {
console.log("onDevicesChanged found current: " + JSON.stringify(device))
if(logging_flags.discovery)console.log("onDevicesChanged found current: " + JSON.stringify(device))
// Now we want to make sure it is our 'current' Spotify device.
// How do we know what Spotify thinks our current device is?
// According to the documentation it should be device.is_active
Expand All @@ -555,8 +556,10 @@ ApplicationWindow {
console.log("Set device [" + deviceName.value + "] as current")
})
} else {
console.log("Device [" + deviceName.value + "] already in playbackState.")
console.log(" id: " + deviceId.value + ", pbs id: " + spotifyController.playbackState.device.id)
if(logging_flags.discovery) {
console.log("Device [" + deviceName.value + "] already in playbackState.")
console.log(" id: " + deviceId.value + ", pbs id: " + spotifyController.playbackState.device.id)
}
}
break
}
Expand All @@ -569,12 +572,12 @@ ApplicationWindow {
Connections {
target: spMdns
onServiceAdded: {
console.log("onServiceAdded: " + JSON.stringify(serviceJSON,null,2))
if(logging_flags.discovery)console.log("onServiceAdded: " + JSON.stringify(serviceJSON,null,2))
var mdns = JSON.parse(serviceJSON)
connectDevices[mdns.name] = mdns
}
onServiceUpdated: {
console.log("onServiceUpdated: " + JSON.stringify(serviceJSON,null,2))
if(logging_flags.discovery)console.log("onServiceUpdated: " + JSON.stringify(serviceJSON,null,2))
for(var deviceName in connectDevices) {
var device = connectDevices[deviceName]
var mdns = JSON.parse(serviceJSON)
Expand All @@ -586,7 +589,7 @@ ApplicationWindow {
}
}
onServiceRemoved: {
console.log("onServiceRemoved: " + name)
if(logging_flags.discovery)console.log("onServiceRemoved: " + name)
for(var deviceName in connectDevices) {
var device = connectDevices[deviceName]
if(device.name === name) {
Expand All @@ -598,7 +601,7 @@ ApplicationWindow {
}
}
onServiceResolved: {
console.log("onServiceResolved: " + name + " -> " + address)
if(logging_flags.discovery)console.log("onServiceResolved: " + name + " -> " + address)
for(var deviceName in connectDevices) {
var device = connectDevices[deviceName]
if(device.host === name) {
Expand Down Expand Up @@ -1264,6 +1267,13 @@ ApplicationWindow {
defaultValue: 700
}

ConfigurationGroup {
id: logging_flags
path: "/hutspot/logging_flags"

property bool discovery: false
}

/*function updateConfigurationData() {
if(configuration_data_version.value === currentConfigurationDataVersion)
return
Expand Down
10 changes: 5 additions & 5 deletions src/connect/spconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ void SPConnect::setCredentials(QString userName, int authType, QString authData)
cred_auth_type = authType;
cred_auth_data = QByteArray::fromBase64(authData.toUtf8());
qDebug() << "user name: " << userName;
qDebug() << "auth_type: " << authType;
qDebug() << "auth_data: " << authData;
//qDebug() << "auth_type: " << authType;
//qDebug() << "auth_data: " << authData;
}

QString SPConnect::createBlobToSend(QString deviceName, QString clientKey) {
Expand Down Expand Up @@ -130,7 +130,7 @@ QString SPConnect::createBlobToSend(QString deviceName, QString clientKey) {

// base64 encode it
encrypted_blob64 = eblob.toBase64();
qDebug() << "encrypted_blob: " << encrypted_blob64;
//qDebug() << "encrypted_blob: " << encrypted_blob64;

// create shared_key
BIGNUM * clientKeyBN;
Expand Down Expand Up @@ -160,7 +160,7 @@ QString SPConnect::createBlobToSend(QString deviceName, QString clientKey) {
unsigned char iv[16];
RAND_bytes(iv, 0x10);
QByteArray ivArray((const char*)iv, 16);
qDebug() << " iv: " << ivArray.toBase64();
//qDebug() << " iv: " << ivArray.toBase64();
QByteArray blob_to_send = QByteArray((const char *)iv, sizeof(iv));

if(AES_set_encrypt_key((const unsigned char *)encryption_key.data(), 128, &aes_key) < 0)
Expand All @@ -186,7 +186,7 @@ QString SPConnect::createBlobToSend(QString deviceName, QString clientKey) {
// add encrypted part and checksum to the blob
blob_to_send.append(encrypted_blob_part);
blob_to_send.append(checksum);
qDebug() << "blob_to_send: " << blob_to_send.toBase64();
//qDebug() << "blob_to_send: " << blob_to_send.toBase64();

// base64 encode it
return blob_to_send.toBase64();
Expand Down
2 changes: 1 addition & 1 deletion src/qmdnsengine/resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void ResolverPrivate::onTimeout()
foreach (Record record, existing()) {
emit q->resolved(record.name(), record.address());
}
qDebug() << "ResolverPrivate::onTimeout on " << name;
//qDebug() << "ResolverPrivate::onTimeout on " << name;
}

Resolver::Resolver(AbstractServer *server, const QByteArray &name, Cache *cache, QObject *parent)
Expand Down

0 comments on commit ec452da

Please sign in to comment.