mirror of
https://github.com/QuasarApp/SoundBand.git
synced 2025-04-30 09:14:33 +00:00
fix #75
This commit is contained in:
parent
abc7fe3d34
commit
09be71c9ec
@ -1 +1 @@
|
|||||||
Subproject commit 7492728b745ec644f8abe6af002de1aeba1e8518
|
Subproject commit 56a93aaf65cbf04ac06f400473563b95262ceec5
|
@ -1 +1 @@
|
|||||||
Subproject commit 381518d52a122f6892e12d8480de40d61ed44e2c
|
Subproject commit 745a66bd5bc9c0f9bd2f0add1e35a3b00f7d70a0
|
@ -7,8 +7,8 @@ message( DEPLOY_FILES_MASTER = $$DEPLOY_FILES)
|
|||||||
ENABLE_SNAP = 0 #only linux
|
ENABLE_SNAP = 0 #only linux
|
||||||
ENABLE_INSTALLER = 1 #only desctop
|
ENABLE_INSTALLER = 1 #only desctop
|
||||||
|
|
||||||
SUBDIRS += Sync \
|
SUBDIRS += QuasarAppLib/QuasarApp.pro \
|
||||||
QuasarAppLib/QuasarApp.pro \
|
Sync \
|
||||||
SoundBand \
|
SoundBand \
|
||||||
CQtDeployer \
|
CQtDeployer \
|
||||||
tests
|
tests
|
||||||
|
@ -9,6 +9,7 @@ TARGET = Sync
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
|
|
||||||
include($$PWD/../deploy.pri);
|
include($$PWD/../deploy.pri);
|
||||||
|
include('$$PWD/../QuasarAppLib/QuasarLib.pri');
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
sql/InitLacaleDataBase.sql
|
sql/InitLacaleDataBase.sql
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// general otions
|
// general otions
|
||||||
#define CURRENT_PLAYLIST_KEY "currentPlayList"
|
#define CURRENT_PLAYLIST_KEY "currentPlayList"
|
||||||
#define MAIN_FOLDER_KEY "songsfolder"
|
#define MAIN_FOLDER_KEY "songsfolder"
|
||||||
#define MAIN_FOLDER "soundBand"
|
#define MAIN_FOLDER QDir::homePath() + "/soundBand"
|
||||||
|
|
||||||
|
|
||||||
// LIB VERSION
|
// LIB VERSION
|
||||||
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
// sqlite config
|
// sqlite config
|
||||||
#define DATABASE_NAME "songdata.dat"
|
#define DATABASE_NAME "songdata.dat"
|
||||||
#define BUFFER_NAME "buffer"
|
|
||||||
#define ALL_SONGS_LIST "all songs"
|
#define ALL_SONGS_LIST "all songs"
|
||||||
|
|
||||||
// network config
|
// network config
|
||||||
@ -37,5 +36,5 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOGER // define this macros if want use logs
|
#define LOGER // define this macros if want use logs
|
||||||
#define LOG_FILE "logs.log"
|
#define LOG_FILE MAIN_FOLDER + "/logs.log"
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "exaptions.h"
|
#include "exaptions.h"
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#ifdef LOGER
|
#ifdef LOGER
|
||||||
Log debug_log(LOG_FILE);
|
Log debug_log(LOG_FILE);
|
||||||
|
@ -45,10 +45,10 @@ void MySql::initDB(const QString &database){
|
|||||||
if(db) return;
|
if(db) return;
|
||||||
dataBaseName = database;
|
dataBaseName = database;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
songDir = settings.value(MAIN_FOLDER_KEY, QDir::homePath() + "/soundBand").toString();
|
songDir = settings.value(MAIN_FOLDER_KEY, MAIN_FOLDER).toString();
|
||||||
db = new QSqlDatabase();
|
db = new QSqlDatabase();
|
||||||
*db = QSqlDatabase::addDatabase("QSQLITE", database);
|
*db = QSqlDatabase::addDatabase("QSQLITE", database);
|
||||||
QDir d(QString("./%0").arg(dataBaseName));
|
QDir d(MAIN_FOLDER + "/" + dataBaseName);
|
||||||
db->setDatabaseName(d.absolutePath());
|
db->setDatabaseName(d.absolutePath());
|
||||||
if(db->open()){
|
if(db->open()){
|
||||||
qyery = new QSqlQuery(*db);
|
qyery = new QSqlQuery(*db);
|
||||||
@ -60,19 +60,18 @@ void MySql::initDB(const QString &database){
|
|||||||
"data TEXT NOT NULL "
|
"data TEXT NOT NULL "
|
||||||
")");
|
")");
|
||||||
if(!qyery->exec(qyer)){
|
if(!qyery->exec(qyer)){
|
||||||
|
|
||||||
sqlErrorLog(qyer);
|
sqlErrorLog(qyer);
|
||||||
throw InitDBError();
|
|
||||||
delete db;
|
delete db;
|
||||||
return;
|
throw InitDBError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qyer = QString("CREATE UNIQUE INDEX IF NOT EXISTS isongs ON songs(name,size)");
|
qyer = QString("CREATE UNIQUE INDEX IF NOT EXISTS isongs ON songs(name,size)");
|
||||||
if(!qyery->exec(qyer)){
|
if(!qyery->exec(qyer)){
|
||||||
sqlErrorLog(qyer);
|
sqlErrorLog(qyer);
|
||||||
throw InitDBError();
|
|
||||||
delete db;
|
delete db;
|
||||||
return;
|
throw InitDBError();
|
||||||
}
|
}
|
||||||
|
|
||||||
qyer = QString("CREATE TABLE IF NOT EXISTS playlists("
|
qyer = QString("CREATE TABLE IF NOT EXISTS playlists("
|
||||||
@ -83,9 +82,8 @@ void MySql::initDB(const QString &database){
|
|||||||
")");
|
")");
|
||||||
if(!qyery->exec(qyer)){
|
if(!qyery->exec(qyer)){
|
||||||
sqlErrorLog(qyer);
|
sqlErrorLog(qyer);
|
||||||
throw InitDBError();
|
|
||||||
delete db;
|
delete db;
|
||||||
return;
|
throw InitDBError();
|
||||||
}
|
}
|
||||||
|
|
||||||
qyer = QString("CREATE TABLE IF NOT EXISTS playlistsdata("
|
qyer = QString("CREATE TABLE IF NOT EXISTS playlistsdata("
|
||||||
@ -100,18 +98,16 @@ void MySql::initDB(const QString &database){
|
|||||||
")");
|
")");
|
||||||
if(!qyery->exec(qyer)){
|
if(!qyery->exec(qyer)){
|
||||||
sqlErrorLog(qyer);
|
sqlErrorLog(qyer);
|
||||||
throw InitDBError();
|
|
||||||
delete db;
|
delete db;
|
||||||
return;
|
throw InitDBError();
|
||||||
}
|
}
|
||||||
|
|
||||||
qyer = QString("CREATE UNIQUE INDEX IF NOT EXISTS iplaylistsdata ON "
|
qyer = QString("CREATE UNIQUE INDEX IF NOT EXISTS iplaylistsdata ON "
|
||||||
"playlistsdata(playlist,song)");
|
"playlistsdata(playlist,song)");
|
||||||
if(!qyery->exec(qyer)){
|
if(!qyery->exec(qyer)){
|
||||||
sqlErrorLog(qyer);
|
sqlErrorLog(qyer);
|
||||||
throw InitDBError();
|
|
||||||
delete db;
|
delete db;
|
||||||
return;
|
throw InitDBError();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -125,7 +121,7 @@ bool MySql::find(const SongHeader &song, SongStorage &response){
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(SongStorage &i: songs){
|
for(SongStorage &i: songs){
|
||||||
if((SongHeader&)i == song){
|
if(static_cast<SongHeader&>(i) == song){
|
||||||
response = i;
|
response = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,9 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
|
||||||
Player::Player(const QString &bufferFile, QObject *parent, Flags flags):
|
Player::Player(QObject *parent, Flags flags):
|
||||||
QMediaPlayer(parent, flags)
|
QMediaPlayer(parent, flags)
|
||||||
{
|
{
|
||||||
buffer = bufferFile;
|
|
||||||
bufferVolume = 0;
|
bufferVolume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ class Player : public QMediaPlayer
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QString buffer;
|
|
||||||
milliseconds playDelay;
|
milliseconds playDelay;
|
||||||
QMediaPlayer::State predState;
|
QMediaPlayer::State predState;
|
||||||
int bufferVolume;
|
int bufferVolume;
|
||||||
@ -19,7 +18,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Player(const QString& bufferFile, QObject *parent = Q_NULLPTR, Flags flags = Flags());
|
Player( QObject *parent = Q_NULLPTR, Flags flags = Flags());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief syncBegin - palyer waiting for sunced.
|
* @brief syncBegin - palyer waiting for sunced.
|
||||||
|
@ -16,7 +16,7 @@ Sync::Sync(const QString &address, int port, const QString &datadir):
|
|||||||
{
|
{
|
||||||
node = new Node(address , this->port = port);
|
node = new Node(address , this->port = port);
|
||||||
|
|
||||||
player = new Player(BUFFER_NAME,nullptr,QMediaPlayer::LowLatency);
|
player = new Player(nullptr, QMediaPlayer::LowLatency);
|
||||||
if(!player->isAvailable()){
|
if(!player->isAvailable()){
|
||||||
throw MediaException();
|
throw MediaException();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user