mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 15:32:37 +00:00
Added BindInt32, BindInt64, ColumnInt32, ColumnInt64 to make dealing
with different sized integers more explicit.
This commit is contained in:
parent
d019ec3da9
commit
d1069a0d94
@ -34,6 +34,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IDecoder.h>
|
||||
#include <core/sdk/IDataStream.h>
|
||||
#include <FLAC/stream_decoder.h>
|
||||
@ -101,7 +102,7 @@ class FlacDecoder : public musik::core::sdk::IDecoder {
|
||||
|
||||
long channels;
|
||||
long sampleRate;
|
||||
unsigned long long totalSamples;
|
||||
musik_uint64 totalSamples;
|
||||
int bitsPerSample;
|
||||
double duration;
|
||||
|
||||
|
@ -864,7 +864,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||
long extra=b->sample_count-vb->granulepos;
|
||||
|
||||
/* we use ogg_int64_t for granule positions because a
|
||||
uint64 isn't universally available. Unfortunately,
|
||||
musik_uint64 isn't universally available. Unfortunately,
|
||||
that means granposes can be 'negative' and result in
|
||||
extra being negative */
|
||||
if(extra<0)
|
||||
@ -912,7 +912,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||
extra = (v->pcm_current - v->pcm_returned)<<hs;
|
||||
|
||||
/* we use ogg_int64_t for granule positions because a
|
||||
uint64 isn't universally available. Unfortunately,
|
||||
musik_uint64 isn't universally available. Unfortunately,
|
||||
that means granposes can be 'negative' and result in
|
||||
extra being negative */
|
||||
if(extra<0)
|
||||
|
@ -325,7 +325,7 @@ int HttpServer::HandleRequest(
|
||||
IRetainedTrack* track = nullptr;
|
||||
|
||||
if (parts.at(1) == fragment::id) {
|
||||
unsigned long long id = std::stoull(urlDecode(parts.at(2)));
|
||||
musik_uint64 id = std::stoull(urlDecode(parts.at(2)));
|
||||
track = server->context.dataProvider->QueryTrackById(id);
|
||||
}
|
||||
else if (parts.at(1) == fragment::external_id) {
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "WebSocketServer.h"
|
||||
#include "Constants.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
using websocketpp::lib::placeholders::_1;
|
||||
@ -519,7 +521,7 @@ void WebSocketServer::RespondWithQueryAlbums(connection_hdl connection, json& re
|
||||
|
||||
std::string filter = options.value(key::filter, "");
|
||||
std::string category = options.value(key::category, "");
|
||||
unsigned long long categoryId = options.value(key::category_id, -1);
|
||||
musik_uint64 categoryId = options.value(key::category_id, -1);
|
||||
|
||||
IMetadataMapList* albumList = context.dataProvider
|
||||
->QueryAlbums(category.c_str(), categoryId, filter.c_str());
|
||||
@ -589,7 +591,7 @@ ITrackList* WebSocketServer::QueryTracksByCategory(json& request, int& limit, in
|
||||
json& options = request[message::options];
|
||||
|
||||
std::string category = options[key::category];
|
||||
unsigned long long selectedId = options[key::id];
|
||||
musik_uint64 selectedId = options[key::id];
|
||||
|
||||
std::string filter = options.value(key::filter, "");
|
||||
|
||||
|
@ -296,7 +296,7 @@ void Crossfader::ProcessMessage(IMessage &message) {
|
||||
}
|
||||
else {
|
||||
auto end = system_clock::now().time_since_epoch();
|
||||
int64 duration = duration_cast<milliseconds>(end - start).count();
|
||||
musik_int64 duration = duration_cast<milliseconds>(end - start).count();
|
||||
ENQUEUE_ADJUSTED_TICK(TICK_TIME_MILLIS - duration);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ void PlaybackService::ToggleShuffle() {
|
||||
|
||||
/* remember the ID of the playing track -- we're going to need to look
|
||||
it up after the shuffle */
|
||||
DBID id = -1;
|
||||
musik_uint64 id = -1;
|
||||
if (this->index < this->playlist.Count()) {
|
||||
id = this->playlist.GetId(this->index);
|
||||
}
|
||||
@ -271,7 +271,7 @@ void PlaybackService::ProcessMessage(IMessage &message) {
|
||||
if (type == MESSAGE_STREAM_EVENT) {
|
||||
StreamMessage* streamMessage = static_cast<StreamMessage*>(&message);
|
||||
|
||||
int64 eventType = streamMessage->GetEventType();
|
||||
musik_int64 eventType = streamMessage->GetEventType();
|
||||
|
||||
if (eventType == StreamPlaying) {
|
||||
TrackPtr track;
|
||||
@ -310,7 +310,7 @@ void PlaybackService::ProcessMessage(IMessage &message) {
|
||||
}
|
||||
}
|
||||
else if (type == MESSAGE_PLAYBACK_EVENT) {
|
||||
int64 eventType = message.UserData1();
|
||||
musik_int64 eventType = message.UserData1();
|
||||
|
||||
if (eventType == PlaybackStopped) {
|
||||
this->OnTrackChanged(NO_POSITION, TrackPtr());
|
||||
@ -794,7 +794,7 @@ PlaybackService::Editor::~Editor() {
|
||||
/* implicitly unlocks the mutex when this block exists */
|
||||
}
|
||||
|
||||
bool PlaybackService::Editor::Insert(unsigned long long id, size_t index) {
|
||||
bool PlaybackService::Editor::Insert(musik_uint64 id, size_t index) {
|
||||
if ((this->edited = this->tracks.Insert(id, index))) {
|
||||
if (index == this->playIndex) {
|
||||
++this->playIndex;
|
||||
@ -862,7 +862,7 @@ bool PlaybackService::Editor::Delete(size_t index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void PlaybackService::Editor::Add(const unsigned long long id) {
|
||||
void PlaybackService::Editor::Add(const musik_uint64 id) {
|
||||
this->tracks.Add(id);
|
||||
|
||||
if (this->playback.Count() - 1 == this->playIndex + 1) {
|
||||
|
@ -131,11 +131,11 @@ namespace musik { namespace core { namespace audio {
|
||||
~Editor();
|
||||
|
||||
/* ITrackListEditor */
|
||||
virtual bool Insert(unsigned long long id, size_t index);
|
||||
virtual bool Insert(musik_uint64 id, size_t index);
|
||||
virtual bool Swap(size_t index1, size_t index2);
|
||||
virtual bool Move(size_t from, size_t to);
|
||||
virtual bool Delete(size_t index);
|
||||
virtual void Add(const unsigned long long id);
|
||||
virtual void Add(const musik_uint64 id);
|
||||
virtual void Clear();
|
||||
virtual void Shuffle();
|
||||
virtual void Release();
|
||||
|
@ -97,7 +97,7 @@ double Stream::SetPosition(double requestedSeconds) {
|
||||
double rate = (double) this->decoderSampleRate;
|
||||
|
||||
this->decoderSamplePosition =
|
||||
(uint64)(actualSeconds * rate) * this->decoderChannels;
|
||||
(musik_uint64)(actualSeconds * rate) * this->decoderChannels;
|
||||
|
||||
/* move all the filled buffers back to the recycled queue */
|
||||
auto it = this->filledBuffers.begin();
|
||||
|
@ -83,7 +83,7 @@ namespace musik { namespace core { namespace audio {
|
||||
|
||||
long decoderSampleRate;
|
||||
long decoderChannels;
|
||||
uint64 decoderSamplePosition;
|
||||
musik_uint64 decoderSamplePosition;
|
||||
std::string uri;
|
||||
musik::core::io::DataStreamFactory::DataStreamPtr dataStream;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "utfutil.h"
|
||||
#include "sdk/constants.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -49,14 +50,5 @@
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
|
||||
#include <windows.h>
|
||||
#else
|
||||
typedef __uint64_t uint64;
|
||||
typedef __int64_t int64;
|
||||
#endif
|
||||
|
||||
typedef uint64 DBID;
|
||||
typedef uint64 DBTIME;
|
@ -154,7 +154,7 @@ void Connection::Checkpoint() {
|
||||
sqlite3_wal_checkpoint(this->connection, nullptr);
|
||||
}
|
||||
|
||||
unsigned long long Connection::LastInsertedId() {
|
||||
musik_uint64 Connection::LastInsertedId() {
|
||||
return sqlite3_last_insert_rowid(this->connection);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace musik { namespace core { namespace db {
|
||||
int Close();
|
||||
int Execute(const char* sql);
|
||||
int Execute(const wchar_t* sql);
|
||||
unsigned long long LastInsertedId();
|
||||
musik_uint64 LastInsertedId();
|
||||
int LastModifiedRowCount();
|
||||
|
||||
void Interrupt();
|
||||
|
@ -77,12 +77,20 @@ int Statement::Step() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void Statement::BindInt(int position, int bindInt) {
|
||||
void Statement::BindInt32(int position, int bindInt) {
|
||||
sqlite3_bind_int(this->stmt, position + 1, bindInt);
|
||||
}
|
||||
|
||||
void Statement::BindInt(int position, uint64 bindInt) {
|
||||
sqlite3_bind_int64(this->stmt, position + 1, bindInt);
|
||||
void Statement::BindUint32(int position, size_t bindInt) {
|
||||
sqlite3_bind_int(this->stmt, position + 1, (int) bindInt);
|
||||
}
|
||||
|
||||
void Statement::BindInt64(int position, musik_int64 bindInt) {
|
||||
sqlite3_bind_int64(this->stmt, position + 1, (sqlite3_int64) bindInt);
|
||||
}
|
||||
|
||||
void Statement::BindUint64(int position, musik_uint64 bindInt) {
|
||||
sqlite3_bind_int64(this->stmt, position + 1, (sqlite3_int64) bindInt);
|
||||
}
|
||||
|
||||
void Statement::BindText(int position, const char* bindText) {
|
||||
@ -124,14 +132,22 @@ void Statement::BindNull(int position) {
|
||||
sqlite3_bind_null(this->stmt, position + 1);
|
||||
}
|
||||
|
||||
int Statement::ColumnInt(int column) {
|
||||
int Statement::ColumnInt32(int column) {
|
||||
return sqlite3_column_int(this->stmt, column);
|
||||
}
|
||||
|
||||
uint64 Statement::ColumnInt64(int column) {
|
||||
size_t Statement::ColumnUint32(int column) {
|
||||
return (size_t) sqlite3_column_int(this->stmt, column);
|
||||
}
|
||||
|
||||
musik_int64 Statement::ColumnInt64(int column) {
|
||||
return sqlite3_column_int64(this->stmt, column);
|
||||
}
|
||||
|
||||
musik_uint64 Statement::ColumnUint64(int column) {
|
||||
return (musik_uint64) sqlite3_column_int64(this->stmt, column);
|
||||
}
|
||||
|
||||
const char* Statement::ColumnText(int column) {
|
||||
const char* text = (char*) sqlite3_column_text(this->stmt, column);
|
||||
return text ? text : "";
|
||||
|
@ -53,16 +53,20 @@ namespace musik { namespace core { namespace db {
|
||||
void Reset();
|
||||
int Step();
|
||||
|
||||
void BindInt(int position, int bindInt);
|
||||
void BindInt(int position, uint64 bindInt);
|
||||
void BindInt32(int position, int bindInt);
|
||||
void BindUint32(int position, size_t bindInt);
|
||||
void BindInt64(int position, musik_int64 bindInt);
|
||||
void BindUint64(int position, musik_uint64 bindInt);
|
||||
void BindText(int position, const char* bindText);
|
||||
void BindText(int position, const std::string &bindText);
|
||||
void BindTextW(int position, const wchar_t* bindText);
|
||||
void BindTextW(int position, const std::wstring &bindText);
|
||||
void BindNull(int position);
|
||||
|
||||
int ColumnInt(int column);
|
||||
uint64 ColumnInt64(int column);
|
||||
int ColumnInt32(int column);
|
||||
size_t ColumnUint32(int column);
|
||||
musik_uint64 ColumnUint64(int column);
|
||||
musik_int64 ColumnInt64(int column);
|
||||
const char* ColumnText(int column);
|
||||
const wchar_t* ColumnTextW(int column);
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
static const std::string TAG = "Indexer";
|
||||
static const int MAX_THREADS = 2;
|
||||
static const size_t TRANSACTION_INTERVAL = 300;
|
||||
static std::atomic<unsigned long long> nextExternalId;
|
||||
static std::atomic<musik_uint64> nextExternalId;
|
||||
|
||||
using namespace musik::core;
|
||||
using namespace musik::core::sdk;
|
||||
@ -251,20 +251,20 @@ void Indexer::Synchronize(const SyncContext& context, boost::asio::io_service* i
|
||||
{
|
||||
db::Statement stmt("SELECT MAX(id) FROM tracks", this->dbConnection);
|
||||
if (stmt.Step() == db::Row) {
|
||||
auto id = std::max(1ULL, stmt.ColumnInt64(0));
|
||||
auto id = std::max((musik_uint64) 1, stmt.ColumnUint64(0));
|
||||
nextExternalId.store(id);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> paths;
|
||||
std::vector<DBID> pathIds;
|
||||
std::vector<musik_uint64> pathIds;
|
||||
|
||||
/* resolve all the path and path ids (required for local files */
|
||||
db::Statement stmt("SELECT id, path FROM paths", this->dbConnection);
|
||||
|
||||
while (stmt.Step() == db::Row) {
|
||||
try {
|
||||
DBID id = stmt.ColumnInt(0);
|
||||
musik_uint64 id = stmt.ColumnUint64(0);
|
||||
std::string path = stmt.ColumnText(1);
|
||||
boost::filesystem::path dir(path);
|
||||
|
||||
@ -415,7 +415,7 @@ void Indexer::SyncDirectory(
|
||||
boost::asio::io_service* io,
|
||||
const std::string &syncRoot,
|
||||
const std::string ¤tPath,
|
||||
DBID pathId)
|
||||
musik_uint64 pathId)
|
||||
{
|
||||
if (this->Exited()) {
|
||||
return;
|
||||
@ -485,9 +485,9 @@ ScanResult Indexer::SyncSource(IIndexerSource* source) {
|
||||
"SELECT id, filename, external_id FROM tracks WHERE source_id=? ORDER BY id",
|
||||
this->dbConnection);
|
||||
|
||||
tracks.BindInt(0, source->SourceId());
|
||||
tracks.BindInt32(0, source->SourceId());
|
||||
while (tracks.Step() == db::Row) {
|
||||
TrackPtr track(new IndexerTrack(tracks.ColumnInt(0)));
|
||||
TrackPtr track(new IndexerTrack(tracks.ColumnUint64(0)));
|
||||
track->SetValue(constants::Track::FILENAME, tracks.ColumnText(1));
|
||||
source->ScanTrack(this, new RetainedTrackWriter(track), tracks.ColumnText(2));
|
||||
}
|
||||
@ -596,7 +596,7 @@ void Indexer::SyncDelete() {
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
stmtRemove.BindInt(0, allTracks.ColumnInt(0));
|
||||
stmtRemove.BindInt32(0, allTracks.ColumnInt32(0));
|
||||
stmtRemove.Step();
|
||||
stmtRemove.Reset();
|
||||
}
|
||||
@ -637,8 +637,8 @@ void Indexer::SyncCleanup() {
|
||||
" WHERE source_id == ?)";
|
||||
|
||||
db::Statement stmt(query.c_str(), this->dbConnection);
|
||||
stmt.BindInt(0, source->SourceId());
|
||||
stmt.BindInt(1, source->SourceId());
|
||||
stmt.BindInt32(0, source->SourceId());
|
||||
stmt.BindInt32(1, source->SourceId());
|
||||
stmt.Step();
|
||||
}
|
||||
}
|
||||
@ -669,8 +669,8 @@ static int optimize(
|
||||
|
||||
int count = 0;
|
||||
while (outerStmt.Step() == db::Row) {
|
||||
innerStmt.BindInt(0, count);
|
||||
innerStmt.BindInt(1, outerStmt.ColumnInt(0));
|
||||
innerStmt.BindInt32(0, count);
|
||||
innerStmt.BindUint64(1, outerStmt.ColumnUint64(0));
|
||||
innerStmt.Step();
|
||||
innerStmt.Reset();
|
||||
++count;
|
||||
@ -732,16 +732,16 @@ void Indexer::RunAnalyzers() {
|
||||
|
||||
/* for each track... */
|
||||
|
||||
DBID trackId = 0;
|
||||
musik_uint64 trackId = 0;
|
||||
|
||||
db::Statement getNextTrack(
|
||||
"SELECT id FROM tracks WHERE id>? ORDER BY id LIMIT 1",
|
||||
this->dbConnection);
|
||||
|
||||
getNextTrack.BindInt(0, trackId);
|
||||
getNextTrack.BindUint64(0, trackId);
|
||||
|
||||
while(getNextTrack.Step() == db::Row ) {
|
||||
trackId = getNextTrack.ColumnInt(0);
|
||||
trackId = getNextTrack.ColumnUint64(0);
|
||||
|
||||
getNextTrack.Reset();
|
||||
getNextTrack.UnbindAll();
|
||||
@ -802,11 +802,11 @@ void Indexer::RunAnalyzers() {
|
||||
}
|
||||
}
|
||||
|
||||
if (this->Exited()){
|
||||
if (this->Exited()) {
|
||||
return;
|
||||
}
|
||||
|
||||
getNextTrack.BindInt(0, trackId);
|
||||
getNextTrack.BindUint64(0, trackId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -856,7 +856,7 @@ bool Indexer::RemoveByUri(IIndexerSource* source, const char* uri) {
|
||||
"DELETE FROM tracks WHERE source_id=? AND filename=?",
|
||||
this->dbConnection);
|
||||
|
||||
stmt.BindInt(0, source->SourceId());
|
||||
stmt.BindInt32(0, source->SourceId());
|
||||
stmt.BindText(1, uri);
|
||||
|
||||
return (stmt.Step() == db::Okay);
|
||||
@ -875,7 +875,7 @@ bool Indexer::RemoveByExternalId(IIndexerSource* source, const char* id) {
|
||||
"DELETE FROM tracks WHERE source_id=? AND external_id=?",
|
||||
this->dbConnection);
|
||||
|
||||
stmt.BindInt(0, source->SourceId());
|
||||
stmt.BindInt32(0, source->SourceId());
|
||||
stmt.BindText(1, id);
|
||||
|
||||
return (stmt.Step() == db::Okay);
|
||||
@ -890,7 +890,7 @@ int Indexer::RemoveAll(IIndexerSource* source) {
|
||||
"DELETE FROM tracks WHERE source_id=?",
|
||||
this->dbConnection);
|
||||
|
||||
stmt.BindInt(0, source->SourceId());
|
||||
stmt.BindInt32(0, source->SourceId());
|
||||
|
||||
if (stmt.Step() == db::Okay) {
|
||||
return dbConnection.LastModifiedRowCount();
|
||||
|
@ -131,7 +131,7 @@ namespace musik { namespace core {
|
||||
boost::asio::io_service* io,
|
||||
const std::string& syncRoot,
|
||||
const std::string& currentPath,
|
||||
DBID pathId);
|
||||
musik_uint64 pathId);
|
||||
|
||||
void ReadMetadataFromFile(
|
||||
const boost::filesystem::path& path,
|
||||
|
@ -254,15 +254,15 @@ static void upgradeV1toV2(db::Connection &db) {
|
||||
/* ensure each track has an external_id */
|
||||
{
|
||||
db::ScopedTransaction transaction(db);
|
||||
unsigned long long id;
|
||||
musik_uint64 id;
|
||||
|
||||
db::Statement update("UPDATE tracks SET external_id=? WHERE id=?", db);
|
||||
db::Statement query("SELECT id FROM tracks WHERE coalesce(external_id, '') == ''", db);
|
||||
while (query.Step() == db::Row) {
|
||||
id = query.ColumnInt64(0);
|
||||
id = query.ColumnUint64(0);
|
||||
update.Reset();
|
||||
update.BindText(0, "local://" + std::to_string(id));
|
||||
update.BindInt(1, id);
|
||||
update.BindUint64(1, id);
|
||||
update.Step();
|
||||
}
|
||||
}
|
||||
@ -283,7 +283,7 @@ static void setVersion(db::Connection& db, int version) {
|
||||
db.Execute("DELETE FROM version");
|
||||
|
||||
db::Statement stmt("INSERT INTO version VALUES(?)", db);
|
||||
stmt.BindInt(0, version);
|
||||
stmt.BindInt32(0, version);
|
||||
stmt.Step();
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ void LocalLibrary::CreateDatabase(db::Connection &db){
|
||||
stmt.Step();
|
||||
}
|
||||
else {
|
||||
lastVersion = stmt.ColumnInt(0);
|
||||
lastVersion = stmt.ColumnInt32(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ ITrackList* LocalSimpleDataProvider::QueryTracks(const char* query, int limit, i
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IRetainedTrack* LocalSimpleDataProvider::QueryTrackById(unsigned long long trackId) {
|
||||
IRetainedTrack* LocalSimpleDataProvider::QueryTrackById(musik_uint64 trackId) {
|
||||
try {
|
||||
TrackPtr target(new LibraryTrack(trackId, this->library));
|
||||
|
||||
@ -132,7 +132,7 @@ IRetainedTrack* LocalSimpleDataProvider::QueryTrackByExternalId(const char* exte
|
||||
|
||||
ITrackList* LocalSimpleDataProvider::QueryTracksByCategory(
|
||||
const char* categoryType,
|
||||
unsigned long long selectedId,
|
||||
musik_uint64 selectedId,
|
||||
const char* filter,
|
||||
int limit,
|
||||
int offset)
|
||||
@ -185,7 +185,7 @@ IMetadataValueList* LocalSimpleDataProvider::QueryCategory(const char* type, con
|
||||
|
||||
IMetadataMapList* LocalSimpleDataProvider::QueryAlbums(
|
||||
const char* categoryIdName,
|
||||
unsigned long long categoryIdValue,
|
||||
musik_uint64 categoryIdValue,
|
||||
const char* filter)
|
||||
{
|
||||
try {
|
||||
|
@ -51,14 +51,14 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
int limit = -1,
|
||||
int offset = 0);
|
||||
|
||||
virtual musik::core::sdk::IRetainedTrack* QueryTrackById(unsigned long long trackId);
|
||||
virtual musik::core::sdk::IRetainedTrack* QueryTrackById(musik_uint64 trackId);
|
||||
|
||||
virtual musik::core::sdk::IRetainedTrack* QueryTrackByExternalId(const char* externalId);
|
||||
|
||||
virtual musik::core::sdk::ITrackList*
|
||||
QueryTracksByCategory(
|
||||
const char* categoryType,
|
||||
unsigned long long selectedId,
|
||||
musik_uint64 selectedId,
|
||||
const char* filter = "",
|
||||
int limit = -1,
|
||||
int offset = 0);
|
||||
@ -73,7 +73,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
|
||||
virtual musik::core::sdk::IMetadataMapList* QueryAlbums(
|
||||
const char* categoryIdName,
|
||||
unsigned long long categoryIdValue,
|
||||
musik_uint64 categoryIdValue,
|
||||
const char* filter = "");
|
||||
|
||||
private:
|
||||
|
@ -55,9 +55,9 @@ namespace {
|
||||
public:
|
||||
SdkWrapper(MetadataMapPtr wrapped) { this->wrapped = wrapped; };
|
||||
virtual void Release() { this->wrapped.reset(); }
|
||||
virtual unsigned long long GetId() { return this->wrapped->GetId(); }
|
||||
virtual musik_uint64 GetId() { return this->wrapped->GetId(); }
|
||||
virtual int GetValue(const char* key, char* dst, int size) { return this->wrapped->GetValue(key, dst, size); }
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue) { return this->wrapped->GetUint64(key, defaultValue); }
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue) { return this->wrapped->GetUint64(key, defaultValue); }
|
||||
virtual long long GetInt64(const char* key, long long defaultValue) { return this->wrapped->GetInt64(key, defaultValue); }
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue) { return this->wrapped->GetUint32(key, defaultValue); }
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue) { return this->wrapped->GetInt32(key, defaultValue); }
|
||||
@ -69,7 +69,7 @@ namespace {
|
||||
}
|
||||
|
||||
MetadataMap::MetadataMap(
|
||||
unsigned long long id,
|
||||
musik_uint64 id,
|
||||
const std::string& description,
|
||||
const std::string& type)
|
||||
{
|
||||
@ -86,7 +86,7 @@ void MetadataMap::Release() {
|
||||
/* nothing... */
|
||||
}
|
||||
|
||||
unsigned long long MetadataMap::GetId() {
|
||||
musik_uint64 MetadataMap::GetId() {
|
||||
return this->id;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ std::string MetadataMap::GetValue(const char* key) {
|
||||
return "";
|
||||
}
|
||||
|
||||
unsigned long long MetadataMap::GetUint64(const char* key, unsigned long long defaultValue) {
|
||||
musik_uint64 MetadataMap::GetUint64(const char* key, musik_uint64 defaultValue) {
|
||||
try {
|
||||
std::string value = GetValue(key);
|
||||
if (value.size()) {
|
||||
|
@ -47,7 +47,7 @@ namespace musik { namespace core {
|
||||
{
|
||||
public:
|
||||
MetadataMap(
|
||||
unsigned long long id,
|
||||
musik_uint64 id,
|
||||
const std::string& description,
|
||||
const std::string& type);
|
||||
|
||||
@ -55,12 +55,12 @@ namespace musik { namespace core {
|
||||
|
||||
/* IMetadataMap */
|
||||
virtual void Release();
|
||||
virtual unsigned long long GetId();
|
||||
virtual musik_uint64 GetId();
|
||||
virtual const char* GetDescription();
|
||||
virtual const char* GetType();
|
||||
|
||||
virtual int GetValue(const char* key, char* dst, int size);
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL);
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL);
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0);
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
|
||||
@ -72,7 +72,7 @@ namespace musik { namespace core {
|
||||
musik::core::sdk::IMetadataMap* GetSdkValue();
|
||||
|
||||
private:
|
||||
unsigned long long id;
|
||||
musik_uint64 id;
|
||||
std::string type, description;
|
||||
std::unordered_map<std::string, std::string> metadata;
|
||||
};
|
||||
|
@ -93,7 +93,7 @@ AlbumListQuery::AlbumListQuery(const std::string& filter)
|
||||
|
||||
AlbumListQuery::AlbumListQuery(
|
||||
const std::string& fieldIdName,
|
||||
unsigned long long fieldIdValue,
|
||||
musik_uint64 fieldIdValue,
|
||||
const std::string& filter)
|
||||
: filter(filter)
|
||||
, fieldIdValue(fieldIdValue) {
|
||||
@ -143,12 +143,12 @@ bool AlbumListQuery::OnRun(Connection& db) {
|
||||
}
|
||||
|
||||
if (category) {
|
||||
stmt.BindInt(bindIndex, (uint64) this->fieldIdValue);
|
||||
stmt.BindUint64(bindIndex, this->fieldIdValue);
|
||||
}
|
||||
|
||||
while (stmt.Step() == Row) {
|
||||
std::shared_ptr<MetadataMap> row(new MetadataMap(
|
||||
(unsigned long long) stmt.ColumnInt64(0),
|
||||
stmt.ColumnUint64(0),
|
||||
stmt.ColumnText(1),
|
||||
"album"));
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
public:
|
||||
AlbumListQuery(
|
||||
const std::string& fieldIdName,
|
||||
unsigned long long fieldIdValue,
|
||||
musik_uint64 fieldIdValue,
|
||||
const std::string& filter = "");
|
||||
|
||||
AlbumListQuery(
|
||||
@ -62,7 +62,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
|
||||
std::string filter;
|
||||
std::string fieldIdName;
|
||||
unsigned long long fieldIdValue;
|
||||
musik_uint64 fieldIdValue;
|
||||
musik::core::MetadataMapListPtr result;
|
||||
};
|
||||
|
||||
|
@ -171,7 +171,7 @@ musik::core::sdk::IMetadataValueList* CategoryListQuery::GetSdkResult() {
|
||||
return new MetadataList(this->result);
|
||||
}
|
||||
|
||||
int CategoryListQuery::GetIndexOf(DBID id) {
|
||||
int CategoryListQuery::GetIndexOf(musik_uint64 id) {
|
||||
auto result = this->GetResult();
|
||||
for (size_t i = 0; i < result->size(); i++) {
|
||||
if (id == (*result)[i]->id) {
|
||||
@ -202,7 +202,7 @@ bool CategoryListQuery::OnRun(Connection& db) {
|
||||
|
||||
while (stmt.Step() == Row) {
|
||||
std::shared_ptr<Result> row(new Result());
|
||||
row->id = stmt.ColumnInt64(0);
|
||||
row->id = stmt.ColumnUint64(0);
|
||||
row->displayValue = stmt.ColumnText(1);
|
||||
result->push_back(row);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
/* note we implement the SDK's IMetadataValue interface so
|
||||
we can return data to plugins! */
|
||||
struct Result : public musik::core::sdk::IMetadataValue {
|
||||
virtual unsigned long long GetId() {
|
||||
virtual musik_uint64 GetId() {
|
||||
return this->id;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
}
|
||||
|
||||
std::string displayValue;
|
||||
DBID id;
|
||||
musik_uint64 id;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<std::vector<
|
||||
@ -75,7 +75,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
std::string Name() { return "CategoryListQuery"; }
|
||||
|
||||
virtual ResultList GetResult();
|
||||
virtual int GetIndexOf(DBID id);
|
||||
virtual int GetIndexOf(musik_uint64 id);
|
||||
|
||||
musik::core::sdk::IMetadataValueList* GetSdkResult();
|
||||
|
||||
|
@ -66,7 +66,7 @@ static std::map<std::string, std::string> FIELD_TO_FOREIGN_KEY =
|
||||
CategoryTrackListQuery::CategoryTrackListQuery(
|
||||
ILibraryPtr library,
|
||||
const std::string& column,
|
||||
DBID id,
|
||||
musik_uint64 id,
|
||||
const std::string& filter)
|
||||
{
|
||||
this->library = library;
|
||||
@ -134,18 +134,18 @@ bool CategoryTrackListQuery::OnRun(Connection& db) {
|
||||
Statement trackQuery(query.c_str(), db);
|
||||
|
||||
if (this->filter.size()) {
|
||||
trackQuery.BindInt(0, this->id);
|
||||
trackQuery.BindUint64(0, this->id);
|
||||
trackQuery.BindText(1, this->filter);
|
||||
trackQuery.BindText(2, this->filter);
|
||||
trackQuery.BindText(3, this->filter);
|
||||
trackQuery.BindText(4, this->filter);
|
||||
}
|
||||
else {
|
||||
trackQuery.BindInt(0, this->id);
|
||||
trackQuery.BindUint64(0, this->id);
|
||||
}
|
||||
|
||||
while (trackQuery.Step() == Row) {
|
||||
DBID id = trackQuery.ColumnInt64(0);
|
||||
musik_uint64 id = trackQuery.ColumnUint64(0);
|
||||
std::string album = trackQuery.ColumnText(1);
|
||||
|
||||
if (album != lastAlbum) {
|
||||
|
@ -47,7 +47,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
CategoryTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& column,
|
||||
DBID id,
|
||||
musik_uint64 id,
|
||||
const std::string& filter = "");
|
||||
|
||||
virtual ~CategoryTrackListQuery();
|
||||
@ -66,7 +66,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
Result result;
|
||||
Headers headers;
|
||||
std::string column;
|
||||
DBID id;
|
||||
musik_uint64 id;
|
||||
size_t hash;
|
||||
std::string filter;
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ static std::string DELETE_PLAYLIST_TRACKS_QUERY =
|
||||
static std::string DELETE_PLAYLIST_QUERY =
|
||||
"DELETE FROM playlists WHERE id=?;";
|
||||
|
||||
DeletePlaylistQuery::DeletePlaylistQuery(const DBID playlistId) {
|
||||
DeletePlaylistQuery::DeletePlaylistQuery(const musik_uint64 playlistId) {
|
||||
this->playlistId = playlistId;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ bool DeletePlaylistQuery::OnRun(musik::core::db::Connection &db) {
|
||||
|
||||
/* create playlist */
|
||||
Statement deleteTracks(DELETE_PLAYLIST_TRACKS_QUERY.c_str(), db);
|
||||
deleteTracks.BindInt(0, this->playlistId);
|
||||
deleteTracks.BindUint64(0, this->playlistId);
|
||||
|
||||
if (deleteTracks.Step() == db::Error) {
|
||||
transaction.Cancel();
|
||||
@ -69,7 +69,7 @@ bool DeletePlaylistQuery::OnRun(musik::core::db::Connection &db) {
|
||||
|
||||
/* add tracks to playlist */
|
||||
Statement deletePlaylist(DELETE_PLAYLIST_QUERY.c_str(), db);
|
||||
deletePlaylist.BindInt(0, this->playlistId);
|
||||
deletePlaylist.BindUint64(0, this->playlistId);
|
||||
|
||||
if (deletePlaylist.Step() == db::Error) {
|
||||
transaction.Cancel();
|
||||
|
@ -41,7 +41,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
|
||||
class DeletePlaylistQuery : public musik::core::db::LocalQueryBase {
|
||||
public:
|
||||
DeletePlaylistQuery(const DBID playlistId);
|
||||
DeletePlaylistQuery(const musik_uint64 playlistId);
|
||||
virtual ~DeletePlaylistQuery();
|
||||
|
||||
virtual std::string Name() { return "DeletePlaylistQuery"; }
|
||||
@ -50,7 +50,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
virtual bool OnRun(musik::core::db::Connection &db);
|
||||
|
||||
private:
|
||||
DBID playlistId;
|
||||
musik_uint64 playlistId;
|
||||
};
|
||||
|
||||
} } } }
|
||||
|
@ -49,12 +49,12 @@ using namespace musik::core::db;
|
||||
using namespace musik::core::library::constants;
|
||||
using namespace musik::core::db::local;
|
||||
|
||||
GetPlaylistQuery::GetPlaylistQuery(ILibraryPtr library, DBID playlistId) {
|
||||
GetPlaylistQuery::GetPlaylistQuery(ILibraryPtr library, musik_uint64 playlistId) {
|
||||
this->library = library;
|
||||
this->playlistId = playlistId;
|
||||
this->result.reset(new musik::core::TrackList(library));
|
||||
this->headers.reset(new std::set<size_t>());
|
||||
this->hash = std::hash<DBID>()(this->playlistId);
|
||||
this->hash = std::hash<musik_uint64>()(this->playlistId);
|
||||
}
|
||||
|
||||
GetPlaylistQuery::~GetPlaylistQuery() {
|
||||
@ -87,10 +87,10 @@ bool GetPlaylistQuery::OnRun(Connection& db) {
|
||||
this->GetLimitAndOffset();
|
||||
|
||||
Statement trackQuery(query.c_str(), db);
|
||||
trackQuery.BindInt(0, this->playlistId);
|
||||
trackQuery.BindUint64(0, this->playlistId);
|
||||
|
||||
while (trackQuery.Step() == Row) {
|
||||
result->Add(trackQuery.ColumnInt64(0));
|
||||
result->Add(trackQuery.ColumnUint64(0));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -46,7 +46,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
public:
|
||||
GetPlaylistQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
DBID playlistId);
|
||||
musik_uint64 playlistId);
|
||||
|
||||
virtual ~GetPlaylistQuery();
|
||||
|
||||
@ -63,7 +63,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
musik::core::ILibraryPtr library;
|
||||
Result result;
|
||||
Headers headers;
|
||||
DBID playlistId;
|
||||
musik_uint64 playlistId;
|
||||
size_t hash;
|
||||
};
|
||||
|
||||
|
@ -63,7 +63,7 @@ std::shared_ptr<SavePlaylistQuery> SavePlaylistQuery::Save(
|
||||
}
|
||||
|
||||
std::shared_ptr<SavePlaylistQuery> SavePlaylistQuery::Replace(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks)
|
||||
{
|
||||
return std::shared_ptr<SavePlaylistQuery>(
|
||||
@ -71,7 +71,7 @@ std::shared_ptr<SavePlaylistQuery> SavePlaylistQuery::Replace(
|
||||
}
|
||||
|
||||
std::shared_ptr<SavePlaylistQuery> SavePlaylistQuery::Rename(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
const std::string& playlistName)
|
||||
{
|
||||
return std::shared_ptr<SavePlaylistQuery>(
|
||||
@ -88,7 +88,7 @@ SavePlaylistQuery::SavePlaylistQuery(
|
||||
}
|
||||
|
||||
SavePlaylistQuery::SavePlaylistQuery(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks)
|
||||
{
|
||||
this->playlistId = playlistId;
|
||||
@ -96,7 +96,7 @@ SavePlaylistQuery::SavePlaylistQuery(
|
||||
}
|
||||
|
||||
SavePlaylistQuery::SavePlaylistQuery(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
const std::string& playlistName)
|
||||
{
|
||||
this->playlistId = playlistId;
|
||||
@ -106,7 +106,7 @@ SavePlaylistQuery::SavePlaylistQuery(
|
||||
SavePlaylistQuery::~SavePlaylistQuery() {
|
||||
}
|
||||
|
||||
bool SavePlaylistQuery::AddTracksToPlaylist(musik::core::db::Connection &db, DBID playlistId) {
|
||||
bool SavePlaylistQuery::AddTracksToPlaylist(musik::core::db::Connection &db, musik_uint64 playlistId) {
|
||||
Statement insertTrack(INSERT_PLAYLIST_TRACK_QUERY.c_str(), db);
|
||||
|
||||
TrackPtr track;
|
||||
@ -116,8 +116,8 @@ bool SavePlaylistQuery::AddTracksToPlaylist(musik::core::db::Connection &db, DBI
|
||||
insertTrack.Reset();
|
||||
insertTrack.BindText(0, track->GetValue("external_id"));
|
||||
insertTrack.BindText(1, track->GetValue("source_id"));
|
||||
insertTrack.BindInt(2, playlistId);
|
||||
insertTrack.BindInt(3, (int) i);
|
||||
insertTrack.BindUint64(2, playlistId);
|
||||
insertTrack.BindInt32(3, (int) i);
|
||||
|
||||
if (insertTrack.Step() == db::Error) {
|
||||
return false;
|
||||
@ -139,7 +139,7 @@ bool SavePlaylistQuery::CreatePlaylist(musik::core::db::Connection &db) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DBID playlistId = db.LastInsertedId();
|
||||
musik_uint64 playlistId = db.LastInsertedId();
|
||||
|
||||
/* add tracks to playlist */
|
||||
if (!this->AddTracksToPlaylist(db, playlistId)) {
|
||||
@ -153,7 +153,7 @@ bool SavePlaylistQuery::CreatePlaylist(musik::core::db::Connection &db) {
|
||||
bool SavePlaylistQuery::RenamePlaylist(musik::core::db::Connection &db) {
|
||||
Statement renamePlaylist(RENAME_PLAYLIST_QUERY.c_str(), db);
|
||||
renamePlaylist.BindText(0, this->playlistName);
|
||||
renamePlaylist.BindInt(1, this->playlistId);
|
||||
renamePlaylist.BindUint64(1, this->playlistId);
|
||||
return (renamePlaylist.Step() != db::Error);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ bool SavePlaylistQuery::ReplacePlaylist(musik::core::db::Connection &db) {
|
||||
|
||||
/* delete existing tracks, we'll replace 'em */
|
||||
Statement createPlaylist(DELETE_PLAYLIST_TRACKS_QUERY.c_str(), db);
|
||||
createPlaylist.BindInt(0, this->playlistId);
|
||||
createPlaylist.BindUint64(0, this->playlistId);
|
||||
|
||||
if (createPlaylist.Step() == db::Error) {
|
||||
transaction.Cancel();
|
||||
|
@ -48,11 +48,11 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Replace(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Rename(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
const std::string& playlistName);
|
||||
|
||||
virtual std::string Name() { return "SavePlaylistQuery"; }
|
||||
@ -68,20 +68,20 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
SavePlaylistQuery(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
SavePlaylistQuery(
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
const std::string& newName);
|
||||
|
||||
bool CreatePlaylist(musik::core::db::Connection &db);
|
||||
bool RenamePlaylist(musik::core::db::Connection &db);
|
||||
bool ReplacePlaylist(musik::core::db::Connection &db);
|
||||
bool AddTracksToPlaylist(musik::core::db::Connection &db, DBID playlistId);
|
||||
bool AddTracksToPlaylist(musik::core::db::Connection &db, musik_uint64 playlistId);
|
||||
|
||||
std::string playlistName;
|
||||
DBID playlistId;
|
||||
musik_uint64 playlistId;
|
||||
std::shared_ptr<musik::core::TrackList> tracks;
|
||||
};
|
||||
|
||||
|
@ -125,7 +125,7 @@ bool SearchTrackListQuery::OnRun(Connection& db) {
|
||||
}
|
||||
|
||||
while (trackQuery.Step() == Row) {
|
||||
DBID id = trackQuery.ColumnInt64(0);
|
||||
musik_uint64 id = trackQuery.ColumnUint64(0);
|
||||
std::string album = trackQuery.ColumnText(1);
|
||||
|
||||
if (!album.size()) {
|
||||
|
@ -97,11 +97,11 @@ namespace musik { namespace core { namespace db { namespace local {
|
||||
return this->wrapped->GetRetainedTrack(index);
|
||||
}
|
||||
|
||||
virtual unsigned long long GetId(size_t index) const {
|
||||
virtual musik_uint64 GetId(size_t index) const {
|
||||
return this->wrapped->GetId(index);
|
||||
}
|
||||
|
||||
virtual int IndexOf(unsigned long long id) const {
|
||||
virtual int IndexOf(musik_uint64 id) const {
|
||||
return this->wrapped->IndexOf(id);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ bool TrackMetadataQuery::OnRun(Connection& db) {
|
||||
Statement trackQuery(query.c_str(), db);
|
||||
|
||||
if (queryById) {
|
||||
trackQuery.BindInt(0, (uint64) this->result->GetId());
|
||||
trackQuery.BindUint64(0, (musik_uint64) this->result->GetId());
|
||||
}
|
||||
else {
|
||||
const std::string& externalId = this->result->GetValue("external_id");
|
||||
|
@ -59,13 +59,13 @@ using namespace musik::core;
|
||||
#define ARTIST_TRACK_FOREIGN_KEY "artist_id"
|
||||
|
||||
static std::mutex trackWriteLock;
|
||||
static std::unordered_map<std::string, int64> metadataIdCache;
|
||||
static std::unordered_map<std::string, musik_int64> metadataIdCache;
|
||||
|
||||
void IndexerTrack::ResetIdCache() {
|
||||
metadataIdCache.clear();
|
||||
}
|
||||
|
||||
IndexerTrack::IndexerTrack(DBID id)
|
||||
IndexerTrack::IndexerTrack(musik_uint64 id)
|
||||
: internalMetadata(new IndexerTrack::MetadataWithThumbnail())
|
||||
, id(id)
|
||||
{
|
||||
@ -87,7 +87,7 @@ std::string IndexerTrack::GetValue(const char* metakey) {
|
||||
return "";
|
||||
}
|
||||
|
||||
unsigned long long IndexerTrack::GetUint64(const char* key, unsigned long long defaultValue) {
|
||||
musik_uint64 IndexerTrack::GetUint64(const char* key, musik_uint64 defaultValue) {
|
||||
try {
|
||||
std::string value = GetValue(key);
|
||||
if (value.size()) {
|
||||
@ -197,7 +197,7 @@ Track::MetadataIteratorRange IndexerTrack::GetAllValues() {
|
||||
return Track::MetadataIteratorRange();
|
||||
}
|
||||
|
||||
unsigned long long IndexerTrack::GetId() {
|
||||
musik_uint64 IndexerTrack::GetId() {
|
||||
return this->id;
|
||||
}
|
||||
|
||||
@ -214,8 +214,8 @@ bool IndexerTrack::NeedsToBeIndexed(
|
||||
this->SetValue("extension", file.leaf().string().substr(lastDot + 1).c_str());
|
||||
}
|
||||
|
||||
DBID fileSize = (DBID)boost::filesystem::file_size(file);
|
||||
DBTIME fileTime = (DBTIME)boost::filesystem::last_write_time(file);
|
||||
size_t fileSize = (size_t) boost::filesystem::file_size(file);
|
||||
size_t fileTime = (size_t) boost::filesystem::last_write_time(file);
|
||||
|
||||
this->SetValue("filesize", boost::lexical_cast<std::string>(fileSize).c_str());
|
||||
this->SetValue("filetime", boost::lexical_cast<std::string>(fileTime).c_str());
|
||||
@ -230,9 +230,9 @@ bool IndexerTrack::NeedsToBeIndexed(
|
||||
bool fileDifferent = true;
|
||||
|
||||
if (stmt.Step() == db::Row) {
|
||||
this->id = stmt.ColumnInt(0);
|
||||
int dbFileSize = stmt.ColumnInt(2);
|
||||
int dbFileTime = stmt.ColumnInt(3);
|
||||
this->id = stmt.ColumnUint64(0);
|
||||
int dbFileSize = stmt.ColumnInt32(2);
|
||||
int dbFileTime = stmt.ColumnInt32(3);
|
||||
|
||||
if (fileSize == dbFileSize && fileTime == dbFileTime) {
|
||||
return false;
|
||||
@ -245,7 +245,7 @@ bool IndexerTrack::NeedsToBeIndexed(
|
||||
return true;
|
||||
}
|
||||
|
||||
static DBID writeToTracksTable(
|
||||
static musik_uint64 writeToTracksTable(
|
||||
db::Connection &dbConnection,
|
||||
IndexerTrack& track)
|
||||
{
|
||||
@ -262,10 +262,10 @@ static DBID writeToTracksTable(
|
||||
IInputSource plugins are reading/writing track data. */
|
||||
if (track.GetId() == 0 && sourceId != 0) {
|
||||
db::Statement stmt("SELECT id FROM tracks WHERE source_id=? AND external_id=?", dbConnection);
|
||||
stmt.BindInt(0, sourceId);
|
||||
stmt.BindInt32(0, sourceId);
|
||||
stmt.BindText(1, externalId);
|
||||
if (stmt.Step() == db::Row) {
|
||||
track.SetId(stmt.ColumnInt64(0));
|
||||
track.SetId(stmt.ColumnUint64(0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,17 +276,17 @@ static DBID writeToTracksTable(
|
||||
stmt.BindText(1, track.GetValue("track"));
|
||||
stmt.BindText(2, track.GetValue("disc"));
|
||||
stmt.BindText(3, track.GetValue("bpm"));
|
||||
stmt.BindInt(4, track.GetInt32("duration"));
|
||||
stmt.BindInt(5, track.GetInt32("filesize"));
|
||||
stmt.BindInt32(4, track.GetInt32("duration"));
|
||||
stmt.BindInt32(5, track.GetInt32("filesize"));
|
||||
stmt.BindText(6, track.GetValue("year"));
|
||||
stmt.BindText(7, track.GetValue("title"));
|
||||
stmt.BindText(8, track.GetValue("filename"));
|
||||
stmt.BindInt(9, track.GetInt32("filetime"));
|
||||
stmt.BindInt(10, track.GetInt32("path_id"));
|
||||
stmt.BindInt32(9, track.GetInt32("filetime"));
|
||||
stmt.BindUint64(10, track.GetInt64("path_id"));
|
||||
stmt.BindText(11, track.GetValue("external_id"));
|
||||
|
||||
if (track.GetId() != 0) {
|
||||
stmt.BindInt(0, (uint64) track.GetId());
|
||||
stmt.BindUint64(0, (musik_uint64) track.GetId());
|
||||
}
|
||||
|
||||
if (stmt.Step() == db::Done) {
|
||||
@ -301,11 +301,11 @@ static DBID writeToTracksTable(
|
||||
static void removeRelation(
|
||||
db::Connection& connection,
|
||||
const std::string& field,
|
||||
DBID trackId)
|
||||
musik_uint64 trackId)
|
||||
{
|
||||
std::string query = boost::str(boost::format("DELETE FROM %1% WHERE track_id=?") % field);
|
||||
db::Statement stmt(query.c_str(), connection);
|
||||
stmt.BindInt(0, trackId);
|
||||
stmt.BindUint64(0, trackId);
|
||||
stmt.Step();
|
||||
}
|
||||
|
||||
@ -331,24 +331,24 @@ static void removeKnownFields(Track::MetadataMap& metadata) {
|
||||
metadata.erase("visible");
|
||||
}
|
||||
|
||||
DBID IndexerTrack::SaveThumbnail(db::Connection& connection, const std::string& libraryDirectory) {
|
||||
DBID thumbnailId = 0;
|
||||
musik_uint64 IndexerTrack::SaveThumbnail(db::Connection& connection, const std::string& libraryDirectory) {
|
||||
musik_uint64 thumbnailId = 0;
|
||||
|
||||
if (this->internalMetadata->thumbnailData) {
|
||||
uint64 sum = Checksum(this->internalMetadata->thumbnailData, this->internalMetadata->thumbnailSize);
|
||||
musik_uint64 sum = Checksum(this->internalMetadata->thumbnailData, this->internalMetadata->thumbnailSize);
|
||||
|
||||
db::Statement thumbs("SELECT id FROM thumbnails WHERE filesize=? AND checksum=?", connection);
|
||||
thumbs.BindInt(0, this->internalMetadata->thumbnailSize);
|
||||
thumbs.BindInt(1, sum);
|
||||
thumbs.BindInt32(0, this->internalMetadata->thumbnailSize);
|
||||
thumbs.BindUint64(1, sum);
|
||||
|
||||
if (thumbs.Step() == db::Row) {
|
||||
thumbnailId = thumbs.ColumnInt(0); /* thumbnail already exists */
|
||||
thumbnailId = thumbs.ColumnUint64(0); /* thumbnail already exists */
|
||||
}
|
||||
|
||||
if (thumbnailId == 0) { /* doesn't exist yet, let's insert the record and write the file */
|
||||
db::Statement insertThumb("INSERT INTO thumbnails (filesize,checksum) VALUES (?,?)", connection);
|
||||
insertThumb.BindInt(0, this->internalMetadata->thumbnailSize);
|
||||
insertThumb.BindInt(1, sum);
|
||||
insertThumb.BindInt32(0, this->internalMetadata->thumbnailSize);
|
||||
insertThumb.BindUint64(1, sum);
|
||||
|
||||
if (insertThumb.Step() == db::Done) {
|
||||
thumbnailId = connection.LastInsertedId();
|
||||
@ -386,7 +386,7 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) {
|
||||
|
||||
MetadataMap::const_iterator it = unknownFields.begin();
|
||||
for ( ; it != unknownFields.end(); ++it){
|
||||
DBID keyId = 0;
|
||||
musik_uint64 keyId = 0;
|
||||
std::string key;
|
||||
|
||||
/* lookup the ID for the key; insert if it doesn't exist.. */
|
||||
@ -396,7 +396,7 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) {
|
||||
else {
|
||||
selectMetaKey.BindText(0, it->first);
|
||||
if (selectMetaKey.Step() == db::Row) {
|
||||
keyId = selectMetaKey.ColumnInt(0);
|
||||
keyId = selectMetaKey.ColumnUint64(0);
|
||||
}
|
||||
else {
|
||||
insertMetaKey.BindText(0, it->first);
|
||||
@ -417,20 +417,20 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) {
|
||||
/* see if we already have the value as a normalized row in our table.
|
||||
if we don't, insert it. */
|
||||
|
||||
DBID valueId = 0;
|
||||
musik_uint64 valueId = 0;
|
||||
|
||||
if (metadataIdCache.find("metaValue-" + it->second) != metadataIdCache.end()) {
|
||||
valueId = metadataIdCache["metaValue-" + it->second];
|
||||
}
|
||||
else {
|
||||
selectMetaValue.BindInt(0, keyId);
|
||||
selectMetaValue.BindUint64(0, keyId);
|
||||
selectMetaValue.BindText(1, it->second);
|
||||
|
||||
if (selectMetaValue.Step() == db::Row) {
|
||||
valueId = selectMetaValue.ColumnInt(0);
|
||||
valueId = selectMetaValue.ColumnUint64(0);
|
||||
}
|
||||
else {
|
||||
insertMetaValue.BindInt(0, keyId);
|
||||
insertMetaValue.BindUint64(0, keyId);
|
||||
insertMetaValue.BindText(1, it->second);
|
||||
|
||||
if (insertMetaValue.Step() == db::Done) {
|
||||
@ -447,20 +447,20 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) {
|
||||
/* now that we have a keyId and a valueId, create the relationship */
|
||||
|
||||
if (valueId != 0) {
|
||||
insertTrackMeta.BindInt(0, this->id);
|
||||
insertTrackMeta.BindInt(1, valueId);
|
||||
insertTrackMeta.BindUint64(0, this->id);
|
||||
insertTrackMeta.BindUint64(1, valueId);
|
||||
insertTrackMeta.Step();
|
||||
insertTrackMeta.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBID IndexerTrack::SaveSingleValueField(
|
||||
musik_uint64 IndexerTrack::SaveSingleValueField(
|
||||
db::Connection& dbConnection,
|
||||
const std::string& trackMetadataKeyName,
|
||||
const std::string& fieldTableName)
|
||||
{
|
||||
DBID id = 0;
|
||||
musik_uint64 id = 0;
|
||||
|
||||
std::string selectQuery = boost::str(boost::format(
|
||||
"SELECT id FROM %1% WHERE name=?") % fieldTableName);
|
||||
@ -474,7 +474,7 @@ DBID IndexerTrack::SaveSingleValueField(
|
||||
else {
|
||||
stmt.BindText(0, value);
|
||||
if (stmt.Step() == db::Row) {
|
||||
id = stmt.ColumnInt(0);
|
||||
id = stmt.ColumnUint64(0);
|
||||
}
|
||||
else {
|
||||
std::string insertStatement = boost::str(boost::format(
|
||||
@ -494,7 +494,7 @@ DBID IndexerTrack::SaveSingleValueField(
|
||||
return id;
|
||||
}
|
||||
|
||||
DBID IndexerTrack::SaveMultiValueField(
|
||||
musik_uint64 IndexerTrack::SaveMultiValueField(
|
||||
db::Connection& connection,
|
||||
const std::string& tracksTableColumnName,
|
||||
const std::string& fieldTableName,
|
||||
@ -502,7 +502,7 @@ DBID IndexerTrack::SaveMultiValueField(
|
||||
const std::string& junctionTableForeignKeyColumnName)
|
||||
{
|
||||
std::string aggregatedValue;
|
||||
DBID fieldId = 0;
|
||||
musik_uint64 fieldId = 0;
|
||||
int count = 0;
|
||||
|
||||
std::set<std::string> processed; /* for deduping */
|
||||
@ -545,7 +545,7 @@ DBID IndexerTrack::SaveMultiValueField(
|
||||
return fieldId;
|
||||
}
|
||||
|
||||
DBID IndexerTrack::SaveGenre(db::Connection& dbConnection) {
|
||||
musik_uint64 IndexerTrack::SaveGenre(db::Connection& dbConnection) {
|
||||
return this->SaveMultiValueField(
|
||||
dbConnection,
|
||||
GENRE_TRACK_COLUMN_NAME,
|
||||
@ -554,7 +554,7 @@ DBID IndexerTrack::SaveGenre(db::Connection& dbConnection) {
|
||||
GENRE_TRACK_FOREIGN_KEY);
|
||||
}
|
||||
|
||||
DBID IndexerTrack::SaveArtist(db::Connection& dbConnection) {
|
||||
musik_uint64 IndexerTrack::SaveArtist(db::Connection& dbConnection) {
|
||||
return this->SaveMultiValueField(
|
||||
dbConnection,
|
||||
ARTIST_TRACK_COLUMN_NAME,
|
||||
@ -582,11 +582,11 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
|
||||
|
||||
this->id = writeToTracksTable(dbConnection, *this);
|
||||
|
||||
DBID albumId = this->SaveSingleValueField(dbConnection, "album", "albums");
|
||||
DBID genreId = this->SaveGenre(dbConnection);
|
||||
DBID artistId = this->SaveArtist(dbConnection);
|
||||
DBID albumArtistId = this->SaveSingleValueField(dbConnection, "album_artist", "artists");
|
||||
DBID thumbnailId = this->SaveThumbnail(dbConnection, libraryDirectory);
|
||||
musik_uint64 albumId = this->SaveSingleValueField(dbConnection, "album", "albums");
|
||||
musik_uint64 genreId = this->SaveGenre(dbConnection);
|
||||
musik_uint64 artistId = this->SaveArtist(dbConnection);
|
||||
musik_uint64 albumArtistId = this->SaveSingleValueField(dbConnection, "album_artist", "artists");
|
||||
musik_uint64 thumbnailId = this->SaveThumbnail(dbConnection, libraryDirectory);
|
||||
|
||||
/* ensure we have a correct source id */
|
||||
int sourceId = 0;
|
||||
@ -609,13 +609,13 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
|
||||
"SET album_id=?, visual_genre_id=?, visual_artist_id=?, album_artist_id=?, thumbnail_id=?, source_id=? " \
|
||||
"WHERE id=?", dbConnection);
|
||||
|
||||
stmt.BindInt(0, albumId);
|
||||
stmt.BindInt(1, genreId);
|
||||
stmt.BindInt(2, artistId);
|
||||
stmt.BindInt(3, albumArtistId);
|
||||
stmt.BindInt(4, thumbnailId);
|
||||
stmt.BindInt(5, sourceId);
|
||||
stmt.BindInt(6, this->id);
|
||||
stmt.BindUint64(0, albumId);
|
||||
stmt.BindUint64(1, genreId);
|
||||
stmt.BindUint64(2, artistId);
|
||||
stmt.BindUint64(3, albumArtistId);
|
||||
stmt.BindUint64(4, thumbnailId);
|
||||
stmt.BindUint64(5, sourceId);
|
||||
stmt.BindUint64(6, this->id);
|
||||
stmt.Step();
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
|
||||
return true;
|
||||
}
|
||||
|
||||
DBID IndexerTrack::SaveNormalizedFieldValue(
|
||||
musik_uint64 IndexerTrack::SaveNormalizedFieldValue(
|
||||
db::Connection &dbConnection,
|
||||
const std::string& tableName,
|
||||
const std::string& fieldValue,
|
||||
@ -632,7 +632,7 @@ DBID IndexerTrack::SaveNormalizedFieldValue(
|
||||
const std::string& relationJunctionTableName,
|
||||
const std::string& relationJunctionTableColumn)
|
||||
{
|
||||
DBID fieldId = 0;
|
||||
musik_uint64 fieldId = 0;
|
||||
|
||||
/* find by value */
|
||||
|
||||
@ -646,7 +646,7 @@ DBID IndexerTrack::SaveNormalizedFieldValue(
|
||||
stmt.BindText(0, fieldValue);
|
||||
|
||||
if (stmt.Step() == db::Row) {
|
||||
fieldId = stmt.ColumnInt(0);
|
||||
fieldId = stmt.ColumnUint64(0);
|
||||
metadataIdCache[tableName + "-" + fieldValue] = fieldId;
|
||||
}
|
||||
}
|
||||
@ -660,7 +660,7 @@ DBID IndexerTrack::SaveNormalizedFieldValue(
|
||||
|
||||
db::Statement stmt(query.c_str(), dbConnection);
|
||||
stmt.BindText(0, fieldValue);
|
||||
stmt.BindInt(1, isAggregatedValue ? 1 : 0);
|
||||
stmt.BindInt32(1, isAggregatedValue ? 1 : 0);
|
||||
|
||||
if (stmt.Step() == db::Done) {
|
||||
fieldId = dbConnection.LastInsertedId();
|
||||
@ -676,8 +676,8 @@ DBID IndexerTrack::SaveNormalizedFieldValue(
|
||||
% relationJunctionTableName % relationJunctionTableColumn);
|
||||
|
||||
db::Statement stmt(query.c_str(), dbConnection);
|
||||
stmt.BindInt(0, this->id);
|
||||
stmt.BindInt(1, fieldId);
|
||||
stmt.BindUint64(0, this->id);
|
||||
stmt.BindUint64(1, fieldId);
|
||||
stmt.Step();
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace musik { namespace core {
|
||||
|
||||
class IndexerTrack : public Track {
|
||||
public:
|
||||
IndexerTrack(DBID id);
|
||||
IndexerTrack(musik_uint64 id);
|
||||
virtual ~IndexerTrack(void);
|
||||
|
||||
/* IWritableTrack */
|
||||
@ -53,7 +53,7 @@ namespace musik { namespace core {
|
||||
/* ITrack */
|
||||
virtual std::string GetValue(const char* metakey);
|
||||
virtual int GetValue(const char* key, char* dst, int size);
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL);
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL);
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0);
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
|
||||
@ -66,8 +66,8 @@ namespace musik { namespace core {
|
||||
virtual MetadataIteratorRange GetAllValues();
|
||||
virtual TrackPtr Copy();
|
||||
|
||||
virtual unsigned long long GetId();
|
||||
virtual void SetId(DBID id) { this->id = id; }
|
||||
virtual musik_uint64 GetId();
|
||||
virtual void SetId(musik_uint64 id) { this->id = id; }
|
||||
|
||||
bool NeedsToBeIndexed(
|
||||
const boost::filesystem::path &file,
|
||||
@ -80,7 +80,7 @@ namespace musik { namespace core {
|
||||
static void ResetIdCache();
|
||||
|
||||
private:
|
||||
DBID id;
|
||||
musik_uint64 id;
|
||||
|
||||
private:
|
||||
class MetadataWithThumbnail {
|
||||
@ -95,27 +95,27 @@ namespace musik { namespace core {
|
||||
|
||||
MetadataWithThumbnail *internalMetadata;
|
||||
|
||||
DBID SaveThumbnail(
|
||||
musik_uint64 SaveThumbnail(
|
||||
db::Connection& connection,
|
||||
const std::string& libraryDirectory);
|
||||
|
||||
DBID SaveGenre(db::Connection& connection);
|
||||
musik_uint64 SaveGenre(db::Connection& connection);
|
||||
|
||||
DBID SaveArtist(db::Connection& connection);
|
||||
musik_uint64 SaveArtist(db::Connection& connection);
|
||||
|
||||
DBID SaveSingleValueField(
|
||||
musik_uint64 SaveSingleValueField(
|
||||
db::Connection& connection,
|
||||
const std::string& trackMetadataKeyName,
|
||||
const std::string& fieldTableName);
|
||||
|
||||
DBID SaveMultiValueField(
|
||||
musik_uint64 SaveMultiValueField(
|
||||
db::Connection& connection,
|
||||
const std::string& tracksTableColumnName,
|
||||
const std::string& fieldTableName,
|
||||
const std::string& junctionTableName,
|
||||
const std::string& junctionTableForeignKeyColumnName);
|
||||
|
||||
DBID SaveNormalizedFieldValue(
|
||||
musik_uint64 SaveNormalizedFieldValue(
|
||||
db::Connection& dbConnection,
|
||||
const std::string& tableName,
|
||||
const std::string& fieldValue,
|
||||
|
@ -49,12 +49,12 @@ LibraryTrack::LibraryTrack()
|
||||
, libraryId(0) {
|
||||
}
|
||||
|
||||
LibraryTrack::LibraryTrack(DBID id, int libraryId)
|
||||
LibraryTrack::LibraryTrack(musik_uint64 id, int libraryId)
|
||||
: id(id)
|
||||
, libraryId(libraryId) {
|
||||
}
|
||||
|
||||
LibraryTrack::LibraryTrack(DBID id, musik::core::ILibraryPtr library)
|
||||
LibraryTrack::LibraryTrack(musik_uint64 id, musik::core::ILibraryPtr library)
|
||||
: id(id)
|
||||
, libraryId(library->Id()) {
|
||||
}
|
||||
@ -71,7 +71,7 @@ std::string LibraryTrack::GetValue(const char* metakey) {
|
||||
return "";
|
||||
}
|
||||
|
||||
unsigned long long LibraryTrack::GetUint64(const char* key, unsigned long long defaultValue) {
|
||||
musik_uint64 LibraryTrack::GetUint64(const char* key, musik_uint64 defaultValue) {
|
||||
try {
|
||||
std::string value = GetValue(key);
|
||||
if (value.size()) {
|
||||
@ -174,7 +174,7 @@ Track::MetadataIteratorRange LibraryTrack::GetAllValues() {
|
||||
return Track::MetadataIteratorRange();
|
||||
}
|
||||
|
||||
unsigned long long LibraryTrack::GetId() {
|
||||
musik_uint64 LibraryTrack::GetId() {
|
||||
return this->id;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ bool LibraryTrack::Load(Track *target, db::Connection &db) {
|
||||
return false;
|
||||
}
|
||||
|
||||
target->SetId(idFromFn.ColumnInt(0));
|
||||
target->SetId(idFromFn.ColumnUint64(0));
|
||||
}
|
||||
|
||||
db::Statement genresQuery(
|
||||
@ -234,7 +234,7 @@ bool LibraryTrack::Load(Track *target, db::Connection &db) {
|
||||
"FROM tracks t, paths p, albums al " \
|
||||
"WHERE t.id=? AND t.album_id=al.id", db);
|
||||
|
||||
trackQuery.BindInt(0, (uint64) target->GetId());
|
||||
trackQuery.BindUint64(0, (musik_uint64) target->GetId());
|
||||
if (trackQuery.Step() == db::Row) {
|
||||
target->SetValue("track", trackQuery.ColumnText(0));
|
||||
target->SetValue("disc", trackQuery.ColumnText(1));
|
||||
@ -252,17 +252,17 @@ bool LibraryTrack::Load(Track *target, db::Connection &db) {
|
||||
target->SetValue("album_artist_id", trackQuery.ColumnText(13));
|
||||
target->SetValue("album_id", trackQuery.ColumnText(14));
|
||||
|
||||
genresQuery.BindInt(0, (uint64) target->GetId());
|
||||
genresQuery.BindUint64(0, (musik_uint64) target->GetId());
|
||||
while (genresQuery.Step() == db::Row) {
|
||||
target->SetValue("genre", genresQuery.ColumnText(0));
|
||||
}
|
||||
|
||||
artistsQuery.BindInt(0, (uint64) target->GetId());
|
||||
artistsQuery.BindUint64(0, (musik_uint64) target->GetId());
|
||||
while (artistsQuery.Step() == db::Row) {
|
||||
target->SetValue("artist", artistsQuery.ColumnText(0));
|
||||
}
|
||||
|
||||
allMetadataQuery.BindInt(0, (uint64) target->GetId());
|
||||
allMetadataQuery.BindUint64(0, (musik_uint64) target->GetId());
|
||||
while (allMetadataQuery.Step() == db::Row) {
|
||||
target->SetValue(allMetadataQuery.ColumnText(1), allMetadataQuery.ColumnText(0));
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ namespace musik { namespace core {
|
||||
class LibraryTrack : public Track {
|
||||
public:
|
||||
LibraryTrack();
|
||||
LibraryTrack(DBID id, int libraryId);
|
||||
LibraryTrack(DBID id, musik::core::ILibraryPtr library);
|
||||
LibraryTrack(musik_uint64 id, int libraryId);
|
||||
LibraryTrack(musik_uint64 id, musik::core::ILibraryPtr library);
|
||||
virtual ~LibraryTrack();
|
||||
|
||||
virtual int LibraryId();
|
||||
|
||||
virtual unsigned long long GetId();
|
||||
virtual void SetId(DBID id) { this->id = id; }
|
||||
virtual musik_uint64 GetId();
|
||||
virtual void SetId(musik_uint64 id) { this->id = id; }
|
||||
|
||||
virtual std::string GetValue(const char* metakey);
|
||||
virtual std::string Uri();
|
||||
@ -63,7 +63,7 @@ namespace musik { namespace core {
|
||||
virtual void SetThumbnail(const char *data, long size);
|
||||
|
||||
/* ITrack */
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL);
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL);
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0);
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
|
||||
@ -78,7 +78,7 @@ namespace musik { namespace core {
|
||||
static bool Load(Track *target, db::Connection &db);
|
||||
|
||||
private:
|
||||
DBID id;
|
||||
musik_uint64 id;
|
||||
int libraryId;
|
||||
|
||||
struct LibraryData {
|
||||
|
@ -68,7 +68,7 @@ int RetainedTrack::Uri(char* dst, int size) {
|
||||
return track->Uri(dst, size);
|
||||
}
|
||||
|
||||
unsigned long long RetainedTrack::GetUint64(const char* key, unsigned long long defaultValue) {
|
||||
musik_uint64 RetainedTrack::GetUint64(const char* key, musik_uint64 defaultValue) {
|
||||
return track->GetUint64(key, defaultValue);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ double RetainedTrack::GetDouble(const char* key, double defaultValue) {
|
||||
return track->GetDouble(key, defaultValue);
|
||||
}
|
||||
|
||||
unsigned long long RetainedTrack::GetId() {
|
||||
musik_uint64 RetainedTrack::GetId() {
|
||||
return track->GetId();
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,9 @@ namespace musik { namespace core {
|
||||
virtual void Retain();
|
||||
|
||||
/* ITrack */
|
||||
virtual unsigned long long GetId();
|
||||
virtual musik_uint64 GetId();
|
||||
virtual int GetValue(const char* key, char* dst, int size);
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL);
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL);
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0);
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
|
||||
@ -68,7 +68,7 @@ namespace musik { namespace core {
|
||||
RetainedTrackWriter(TrackPtr track);
|
||||
virtual ~RetainedTrackWriter();
|
||||
|
||||
template <typename T> T As() {
|
||||
template <typename T> T As() {
|
||||
return dynamic_cast<T>(track.get());
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ using namespace musik::core;
|
||||
Track::~Track() {
|
||||
}
|
||||
|
||||
unsigned long long Track::GetId() {
|
||||
musik_uint64 Track::GetId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -57,8 +57,8 @@ namespace musik { namespace core {
|
||||
|
||||
virtual ~Track();
|
||||
|
||||
virtual unsigned long long GetId();
|
||||
virtual void SetId(DBID id) = 0;
|
||||
virtual musik_uint64 GetId();
|
||||
virtual void SetId(musik_uint64 id) = 0;
|
||||
|
||||
virtual musik::core::ILibraryPtr Library();
|
||||
virtual int LibraryId();
|
||||
@ -73,7 +73,7 @@ namespace musik { namespace core {
|
||||
|
||||
/* ITrack */
|
||||
virtual int GetValue(const char* key, char* dst, int size) = 0;
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL) = 0;
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL) = 0;
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL) = 0;
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0) = 0;
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0) = 0;
|
||||
|
@ -65,11 +65,11 @@ size_t TrackList::Count() const {
|
||||
return ids.size();
|
||||
}
|
||||
|
||||
void TrackList::Add(const unsigned long long id) {
|
||||
void TrackList::Add(const musik_uint64 id) {
|
||||
this->ids.push_back(id);
|
||||
}
|
||||
|
||||
bool TrackList::Insert(unsigned long long id, size_t index) {
|
||||
bool TrackList::Insert(musik_uint64 id, size_t index) {
|
||||
if (index < (int) this->ids.size()) {
|
||||
this->ids.insert(this->ids.begin() + index, id);
|
||||
return true;
|
||||
@ -143,7 +143,7 @@ ITrack* TrackList::GetTrack(size_t index) const {
|
||||
return this->Get(index).get();
|
||||
}
|
||||
|
||||
unsigned long long TrackList::GetId(size_t index) const {
|
||||
musik_uint64 TrackList::GetId(size_t index) const {
|
||||
return this->ids.at(index);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ void TrackList::CopyFrom(const TrackList& from) {
|
||||
std::back_inserter(this->ids));
|
||||
}
|
||||
|
||||
int TrackList::IndexOf(unsigned long long id) const {
|
||||
int TrackList::IndexOf(musik_uint64 id) const {
|
||||
auto it = std::find(this->ids.begin(), this->ids.end(), id);
|
||||
return (it == this->ids.end()) ? -1 : it - this->ids.begin();
|
||||
}
|
||||
@ -179,7 +179,7 @@ void TrackList::Swap(TrackList& tl) {
|
||||
std::swap(tl.ids, this->ids);
|
||||
}
|
||||
|
||||
TrackPtr TrackList::GetFromCache(DBID key) const {
|
||||
TrackPtr TrackList::GetFromCache(musik_uint64 key) const {
|
||||
auto it = this->cacheMap.find(key);
|
||||
if (it != this->cacheMap.end()) {
|
||||
this->cacheList.splice( /* promote to front */
|
||||
@ -193,7 +193,7 @@ TrackPtr TrackList::GetFromCache(DBID key) const {
|
||||
return TrackPtr();
|
||||
}
|
||||
|
||||
void TrackList::AddToCache(DBID key, TrackPtr value) const {
|
||||
void TrackList::AddToCache(musik_uint64 key, TrackPtr value) const {
|
||||
auto it = this->cacheMap.find(key);
|
||||
if (it != this->cacheMap.end()) {
|
||||
cacheList.erase(it->second.second);
|
||||
|
@ -66,13 +66,13 @@ namespace musik { namespace core {
|
||||
/* ITrackList */
|
||||
virtual size_t Count() const;
|
||||
virtual musik::core::sdk::IRetainedTrack* GetRetainedTrack(size_t index) const;
|
||||
virtual unsigned long long GetId(size_t index) const;
|
||||
virtual int IndexOf(unsigned long long id) const;
|
||||
virtual musik_uint64 GetId(size_t index) const;
|
||||
virtual int IndexOf(musik_uint64 id) const;
|
||||
virtual musik::core::sdk::ITrack* GetTrack(size_t index) const;
|
||||
|
||||
/* ITrackListEditor */
|
||||
virtual void Add(const unsigned long long id);
|
||||
virtual bool Insert(unsigned long long id, size_t index);
|
||||
virtual void Add(const musik_uint64 id);
|
||||
virtual bool Insert(musik_uint64 id, size_t index);
|
||||
virtual bool Swap(size_t index1, size_t index2);
|
||||
virtual bool Move(size_t from, size_t to);
|
||||
virtual bool Delete(size_t index);
|
||||
@ -86,18 +86,18 @@ namespace musik { namespace core {
|
||||
void CopyFrom(const TrackList& from);
|
||||
|
||||
private:
|
||||
typedef std::list<DBID> CacheList;
|
||||
typedef std::list<musik_uint64> CacheList;
|
||||
typedef std::pair<TrackPtr, CacheList::iterator> CacheValue;
|
||||
typedef std::unordered_map<DBID, CacheValue> CacheMap;
|
||||
typedef std::unordered_map<musik_uint64, CacheValue> CacheMap;
|
||||
|
||||
TrackPtr GetFromCache(DBID key) const;
|
||||
void AddToCache(DBID key, TrackPtr value) const;
|
||||
TrackPtr GetFromCache(musik_uint64 key) const;
|
||||
void AddToCache(musik_uint64 key, TrackPtr value) const;
|
||||
|
||||
/* lru cache structures */
|
||||
mutable CacheList cacheList;
|
||||
mutable CacheMap cacheMap;
|
||||
|
||||
std::vector<DBID> ids;
|
||||
std::vector<musik_uint64> ids;
|
||||
ILibraryPtr library;
|
||||
};
|
||||
} }
|
||||
|
@ -46,8 +46,8 @@ namespace musik { namespace core { namespace runtime {
|
||||
virtual ~IMessage() { }
|
||||
virtual IMessageTarget* Target() = 0;
|
||||
virtual int Type() = 0;
|
||||
virtual int64 UserData1() = 0;
|
||||
virtual int64 UserData2() = 0;
|
||||
virtual musik_int64 UserData1() = 0;
|
||||
virtual musik_int64 UserData2() = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IMessage> IMessagePtr;
|
||||
|
@ -43,11 +43,11 @@ namespace musik {
|
||||
class IMessageQueue {
|
||||
public:
|
||||
virtual ~IMessageQueue() { }
|
||||
virtual void Post(IMessagePtr message, int64 delayMs = 0) = 0;
|
||||
virtual void Post(IMessagePtr message, musik_int64 delayMs = 0) = 0;
|
||||
virtual int Remove(IMessageTarget *target, int type = -1) = 0;
|
||||
virtual void Broadcast(IMessagePtr message, int64 delayMs = 0) = 0;
|
||||
virtual void Broadcast(IMessagePtr message, musik_int64 delayMs = 0) = 0;
|
||||
virtual bool Contains(IMessageTarget *target, int type = -1) = 0;
|
||||
virtual void Debounce(IMessagePtr message, int64 delayMs = 0) = 0;
|
||||
virtual void Debounce(IMessagePtr message, musik_int64 delayMs = 0) = 0;
|
||||
virtual void RegisterForBroadcasts(IMessageTargetPtr target) = 0;
|
||||
virtual void UnregisterForBroadcasts(IMessageTargetPtr target) = 0;
|
||||
virtual void WaitAndDispatch() = 0;
|
||||
|
@ -40,8 +40,8 @@ using namespace musik::core::runtime;
|
||||
IMessagePtr Message::Create(
|
||||
IMessageTarget* target,
|
||||
int messageType,
|
||||
int64 data1,
|
||||
int64 data2)
|
||||
musik_int64 data1,
|
||||
musik_int64 data2)
|
||||
{
|
||||
return IMessagePtr(new Message(target, messageType, data1, data2));
|
||||
}
|
||||
@ -49,8 +49,8 @@ IMessagePtr Message::Create(
|
||||
Message::Message(
|
||||
IMessageTarget* target,
|
||||
int messageType,
|
||||
int64 data1,
|
||||
int64 data2)
|
||||
musik_int64 data1,
|
||||
musik_int64 data2)
|
||||
{
|
||||
this->target = target;
|
||||
this->messageType = messageType;
|
||||
@ -66,10 +66,10 @@ int Message::Type() {
|
||||
return this->messageType;
|
||||
}
|
||||
|
||||
int64 Message::UserData1() {
|
||||
musik_int64 Message::UserData1() {
|
||||
return this->data1;
|
||||
}
|
||||
|
||||
int64 Message::UserData2() {
|
||||
musik_int64 Message::UserData2() {
|
||||
return this->data2;
|
||||
}
|
@ -42,27 +42,27 @@ namespace musik { namespace core { namespace runtime {
|
||||
Message(
|
||||
IMessageTarget* target,
|
||||
int messageType,
|
||||
int64 data1,
|
||||
int64 data2);
|
||||
musik_int64 data1,
|
||||
musik_int64 data2);
|
||||
|
||||
public:
|
||||
static IMessagePtr Create(
|
||||
IMessageTarget* target,
|
||||
int messageType,
|
||||
int64 data1 = 0LL,
|
||||
int64 data2 = 0LL);
|
||||
musik_int64 data1 = 0LL,
|
||||
musik_int64 data2 = 0LL);
|
||||
|
||||
virtual ~Message() {
|
||||
}
|
||||
|
||||
virtual IMessageTarget* Target();
|
||||
virtual int Type();
|
||||
virtual int64 UserData1();
|
||||
virtual int64 UserData2();
|
||||
virtual musik_int64 UserData1();
|
||||
virtual musik_int64 UserData2();
|
||||
|
||||
private:
|
||||
IMessageTarget* target;
|
||||
int messageType;
|
||||
int64 data1, data2;
|
||||
musik_int64 data1, data2;
|
||||
};
|
||||
} } }
|
@ -75,7 +75,7 @@ void MessageQueue::Dispatch() {
|
||||
milliseconds now = duration_cast<milliseconds>(
|
||||
system_clock::now().time_since_epoch());
|
||||
|
||||
int64 nextTime = nextMessageTime.load();
|
||||
musik_int64 nextTime = nextMessageTime.load();
|
||||
|
||||
if (nextTime > now.count() || nextTime < 0) {
|
||||
return; /* short circuit before any iteration. */
|
||||
@ -182,7 +182,7 @@ bool MessageQueue::Contains(IMessageTarget *target, int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void MessageQueue::Broadcast(IMessagePtr message, int64 delayMs) {
|
||||
void MessageQueue::Broadcast(IMessagePtr message, musik_int64 delayMs) {
|
||||
if (message->Target()) {
|
||||
throw new std::runtime_error("broadcasts cannot have a target!");
|
||||
}
|
||||
@ -190,10 +190,10 @@ void MessageQueue::Broadcast(IMessagePtr message, int64 delayMs) {
|
||||
this->Post(message, delayMs);
|
||||
}
|
||||
|
||||
void MessageQueue::Post(IMessagePtr message, int64 delayMs) {
|
||||
void MessageQueue::Post(IMessagePtr message, musik_int64 delayMs) {
|
||||
LockT lock(this->queueMutex);
|
||||
|
||||
delayMs = std::max((int64) 0, delayMs);
|
||||
delayMs = std::max((musik_int64) 0, delayMs);
|
||||
|
||||
milliseconds now = duration_cast<milliseconds>(
|
||||
system_clock::now().time_since_epoch());
|
||||
@ -230,7 +230,7 @@ void MessageQueue::Post(IMessagePtr message, int64 delayMs) {
|
||||
}
|
||||
}
|
||||
|
||||
void MessageQueue::Debounce(IMessagePtr message, int64 delayMs) {
|
||||
void MessageQueue::Debounce(IMessagePtr message, musik_int64 delayMs) {
|
||||
Remove(message->Target(), message->Type());
|
||||
Post(message, delayMs);
|
||||
}
|
||||
|
@ -49,18 +49,18 @@ namespace musik { namespace core { namespace runtime {
|
||||
MessageQueue();
|
||||
virtual ~MessageQueue();
|
||||
|
||||
virtual void Post(IMessagePtr message, int64 delayMs = 0);
|
||||
virtual void Broadcast(IMessagePtr message, int64 messageMs = 0);
|
||||
virtual void Post(IMessagePtr message, musik_int64 delayMs = 0);
|
||||
virtual void Broadcast(IMessagePtr message, musik_int64 messageMs = 0);
|
||||
virtual int Remove(IMessageTarget *target, int type = -1);
|
||||
virtual bool Contains(IMessageTarget *target, int type = -1);
|
||||
virtual void Debounce(IMessagePtr message, int64 delayMs = 0);
|
||||
virtual void Debounce(IMessagePtr message, musik_int64 delayMs = 0);
|
||||
virtual void RegisterForBroadcasts(IMessageTargetPtr target);
|
||||
virtual void UnregisterForBroadcasts(IMessageTargetPtr target);
|
||||
virtual void WaitAndDispatch();
|
||||
virtual void Dispatch();
|
||||
|
||||
protected:
|
||||
int64 GetNextMessageTime() {
|
||||
musik_int64 GetNextMessageTime() {
|
||||
return nextMessageTime.load();
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace musik { namespace core { namespace runtime {
|
||||
std::list<EnqueuedMessage*> dispatch;
|
||||
std::set<IMessageTargetPtr> receivers;
|
||||
std::condition_variable_any waitForDispatch;
|
||||
std::atomic<int64> nextMessageTime;
|
||||
std::atomic<musik_int64> nextMessageTime;
|
||||
|
||||
void Dispatch(IMessagePtr message);
|
||||
};
|
||||
|
@ -34,14 +34,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
namespace musik { namespace core { namespace sdk {
|
||||
|
||||
class IMetadataMap {
|
||||
public:
|
||||
virtual void Release() = 0;
|
||||
virtual unsigned long long GetId() = 0;
|
||||
virtual musik_uint64 GetId() = 0;
|
||||
virtual int GetValue(const char* key, char* dst, int size) = 0;
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL) = 0;
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL) = 0;
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL) = 0;
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0) = 0;
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0) = 0;
|
||||
|
@ -40,7 +40,7 @@ namespace musik { namespace core { namespace sdk {
|
||||
|
||||
class IMetadataValue {
|
||||
public:
|
||||
virtual unsigned long long GetId() = 0;
|
||||
virtual musik_uint64 GetId() = 0;
|
||||
virtual const char* GetValue() = 0;
|
||||
virtual int GetValue(char* dst, size_t size) = 0;
|
||||
};
|
||||
|
@ -48,13 +48,13 @@ namespace musik { namespace core { namespace sdk {
|
||||
int limit = -1,
|
||||
int offset = 0) = 0;
|
||||
|
||||
virtual IRetainedTrack* QueryTrackById(unsigned long long trackId) = 0;
|
||||
virtual IRetainedTrack* QueryTrackById(musik_uint64 trackId) = 0;
|
||||
|
||||
virtual IRetainedTrack* QueryTrackByExternalId(const char* externalId) = 0;
|
||||
|
||||
virtual ITrackList* QueryTracksByCategory(
|
||||
const char* categoryType,
|
||||
unsigned long long selectedId,
|
||||
musik_uint64 selectedId,
|
||||
const char* filter = "",
|
||||
int limit = -1,
|
||||
int offset = 0) = 0;
|
||||
@ -67,7 +67,7 @@ namespace musik { namespace core { namespace sdk {
|
||||
|
||||
virtual IMetadataMapList* QueryAlbums(
|
||||
const char* categoryIdName,
|
||||
unsigned long long categoryIdValue,
|
||||
musik_uint64 categoryIdValue,
|
||||
const char* filter = "") = 0;
|
||||
};
|
||||
|
||||
|
@ -34,13 +34,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
namespace musik { namespace core { namespace sdk {
|
||||
|
||||
class ITrack {
|
||||
public:
|
||||
virtual unsigned long long GetId() = 0;
|
||||
virtual musik_uint64 GetId() = 0;
|
||||
virtual int GetValue(const char* key, char* dst, int size) = 0;
|
||||
virtual unsigned long long GetUint64(const char* key, unsigned long long defaultValue = 0ULL) = 0;
|
||||
virtual musik_uint64 GetUint64(const char* key, musik_uint64 defaultValue = 0ULL) = 0;
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL) = 0;
|
||||
virtual unsigned int GetUint32(const char* key, unsigned long defaultValue = 0) = 0;
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0) = 0;
|
||||
|
@ -47,8 +47,8 @@ namespace musik {
|
||||
virtual void Release() = 0;
|
||||
virtual size_t Count() const = 0;
|
||||
virtual IRetainedTrack* GetRetainedTrack(size_t index) const = 0;
|
||||
virtual unsigned long long GetId(size_t index) const = 0;
|
||||
virtual int IndexOf(unsigned long long id) const = 0;
|
||||
virtual musik_uint64 GetId(size_t index) const = 0;
|
||||
virtual int IndexOf(musik_uint64 id) const = 0;
|
||||
|
||||
/* sdk v3 */
|
||||
virtual ITrack* GetTrack(size_t index) const = 0;
|
||||
|
@ -42,11 +42,11 @@ namespace musik {
|
||||
|
||||
class ITrackListEditor {
|
||||
public:
|
||||
virtual bool Insert(unsigned long long id, size_t index) = 0;
|
||||
virtual bool Insert(musik_uint64 id, size_t index) = 0;
|
||||
virtual bool Swap(size_t index1, size_t index2) = 0;
|
||||
virtual bool Move(size_t from, size_t to) = 0;
|
||||
virtual bool Delete(size_t index) = 0;
|
||||
virtual void Add(const unsigned long long id) = 0;
|
||||
virtual void Add(const musik_uint64 id) = 0;
|
||||
virtual void Clear() = 0;
|
||||
virtual void Shuffle() = 0;
|
||||
virtual void Release() = 0;
|
||||
|
@ -34,6 +34,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 musik_int64;
|
||||
typedef unsigned __int64 musik_uint64;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
typedef uint64_t musik_uint64;
|
||||
typedef int64_t musik_int64;
|
||||
#endif
|
||||
|
||||
namespace musik {
|
||||
namespace core {
|
||||
namespace sdk {
|
||||
@ -125,4 +134,4 @@ namespace musik {
|
||||
}
|
||||
|
||||
static const int SdkVersion = 6;
|
||||
} } }
|
||||
} } }
|
||||
|
@ -185,11 +185,11 @@ std::string musik::core::GetPath(const std::string &sFile) {
|
||||
return sPath;
|
||||
}
|
||||
|
||||
uint64 musik::core::Checksum(char *data,unsigned int bytes) {
|
||||
uint64 sum = 0;
|
||||
musik_uint64 musik::core::Checksum(char *data,unsigned int bytes) {
|
||||
musik_uint64 sum = 0;
|
||||
for(unsigned int i = 0; i < bytes; ++i) {
|
||||
char ch = *(data + i);
|
||||
sum += (uint64) ch;
|
||||
sum += (musik_uint64) ch;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace musik { namespace core {
|
||||
std::string GetDataDirectory(bool create = true);
|
||||
std::string GetPath(const std::string &sFile);
|
||||
std::string GetPluginDirectory();
|
||||
uint64 Checksum(char *data,unsigned int bytes);
|
||||
musik_uint64 Checksum(char *data,unsigned int bytes);
|
||||
size_t CopyString(const std::string& src, char* dst, size_t size);
|
||||
bool FileToByteArray(const std::string& path, char** target, int& size, bool nullTerminate = false);
|
||||
|
||||
|
@ -146,7 +146,7 @@ void BrowseLayout::ProcessMessage(musik::core::runtime::IMessage &message) {
|
||||
LayoutBase::ProcessMessage(message);
|
||||
}
|
||||
|
||||
void BrowseLayout::ScrollTo(const std::string& fieldType, DBID fieldId) {
|
||||
void BrowseLayout::ScrollTo(const std::string& fieldType, musik_uint64 fieldId) {
|
||||
this->SetFocus(this->trackList);
|
||||
this->categoryList->RequeryWithField(fieldType, "", fieldId);
|
||||
|
||||
@ -172,7 +172,7 @@ void BrowseLayout::OnIndexerProgress(int count) {
|
||||
|
||||
void BrowseLayout::RequeryTrackList(ListWindow *view) {
|
||||
if (view == this->categoryList.get()) {
|
||||
DBID selectedId = this->categoryList->GetSelectedId();
|
||||
musik_uint64 selectedId = this->categoryList->GetSelectedId();
|
||||
if (selectedId != -1) {
|
||||
this->trackList->Requery(std::shared_ptr<TrackListQueryBase>(
|
||||
new CategoryTrackListQuery(
|
||||
|
@ -66,7 +66,7 @@ namespace musik {
|
||||
virtual cursespp::IWindowPtr GetFocus();
|
||||
virtual bool KeyPress(const std::string& key);
|
||||
virtual void ProcessMessage(musik::core::runtime::IMessage &message);
|
||||
void ScrollTo(const std::string& fieldType, DBID fieldId);
|
||||
void ScrollTo(const std::string& fieldType, musik_uint64 fieldId);
|
||||
|
||||
protected:
|
||||
virtual void OnLayout();
|
||||
|
@ -120,7 +120,7 @@ void ConsoleLayout::SetShortcutsWindow(ShortcutsWindow* shortcuts) {
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleLayout::WriteOutput(const std::string& str, int64 attrs) {
|
||||
void ConsoleLayout::WriteOutput(const std::string& str, musik_int64 attrs) {
|
||||
this->outputAdapter->AddEntry(EntryPtr(new MultiLineEntry(str, attrs)));
|
||||
this->output->OnAdapterChanged();
|
||||
}
|
||||
@ -165,7 +165,7 @@ void ConsoleLayout::SetVolume(float volume) {
|
||||
}
|
||||
|
||||
void ConsoleLayout::Help() {
|
||||
int64 s = -1;
|
||||
musik_int64 s = -1;
|
||||
|
||||
this->WriteOutput("help:\n", s);
|
||||
this->WriteOutput(" <tab> to switch between windows", s);
|
||||
|
@ -84,7 +84,7 @@ namespace musik {
|
||||
void SetVolume(float volume);
|
||||
void Help();
|
||||
|
||||
void WriteOutput(const std::string& str, int64 attrs = -1);
|
||||
void WriteOutput(const std::string& str, musik_int64 attrs = -1);
|
||||
|
||||
std::shared_ptr<LogWindow> logs;
|
||||
std::shared_ptr<cursespp::TextInput> commands;
|
||||
|
@ -219,7 +219,7 @@ void LibraryLayout::OnRemovedFromParent(IWindow* parent) {
|
||||
}
|
||||
|
||||
void LibraryLayout::OnSearchResultSelected(
|
||||
SearchLayout* layout, std::string fieldType, DBID fieldId)
|
||||
SearchLayout* layout, std::string fieldType, musik_uint64 fieldId)
|
||||
{
|
||||
this->ShowBrowse();
|
||||
this->browseLayout->ScrollTo(fieldType, fieldId);
|
||||
|
@ -84,7 +84,7 @@ namespace musik {
|
||||
void OnSearchResultSelected(
|
||||
SearchLayout* layout,
|
||||
std::string fieldType,
|
||||
DBID fieldId);
|
||||
musik_uint64 fieldId);
|
||||
|
||||
void OnMainLayoutFocusTerminated(
|
||||
LayoutBase::FocusDirection direction);
|
||||
|
@ -85,10 +85,10 @@ NowPlayingLayout::~NowPlayingLayout() {
|
||||
|
||||
}
|
||||
|
||||
int64 NowPlayingLayout::RowDecorator(musik::core::TrackPtr track, size_t index) {
|
||||
musik_int64 NowPlayingLayout::RowDecorator(musik::core::TrackPtr track, size_t index) {
|
||||
bool selected = index == trackListView->GetSelectedIndex();
|
||||
|
||||
int64 attrs = selected
|
||||
musik_int64 attrs = selected
|
||||
? COLOR_PAIR(CURSESPP_HIGHLIGHTED_LIST_ITEM)
|
||||
: CURSESPP_DEFAULT_COLOR;
|
||||
|
||||
@ -207,7 +207,7 @@ void NowPlayingLayout::RequeryTrackList() {
|
||||
this->OnTrackListRequeried(nullptr);
|
||||
}
|
||||
|
||||
void NowPlayingLayout::OnPlaylistSelected(DBID playlistId) {
|
||||
void NowPlayingLayout::OnPlaylistSelected(musik_uint64 playlistId) {
|
||||
auto query = std::shared_ptr<GetPlaylistQuery>(
|
||||
new GetPlaylistQuery(library, playlistId));
|
||||
|
||||
|
@ -74,8 +74,8 @@ namespace musik {
|
||||
|
||||
/* callbacks */
|
||||
void OnTrackListRequeried(musik::core::db::local::TrackListQueryBase* query);
|
||||
int64 RowDecorator(musik::core::TrackPtr track, size_t index);
|
||||
void OnPlaylistSelected(DBID playlistId);
|
||||
musik_int64 RowDecorator(musik::core::TrackPtr track, size_t index);
|
||||
void OnPlaylistSelected(musik_uint64 playlistId);
|
||||
|
||||
musik::core::audio::PlaybackService& playback;
|
||||
musik::core::ILibraryPtr library;
|
||||
|
@ -57,7 +57,7 @@ namespace musik {
|
||||
public sigslot::has_slots<>
|
||||
{
|
||||
public:
|
||||
sigslot::signal3<SearchLayout*, std::string, DBID> SearchResultSelected;
|
||||
sigslot::signal3<SearchLayout*, std::string, musik_uint64> SearchResultSelected;
|
||||
|
||||
SearchLayout(
|
||||
musik::core::audio::PlaybackService& playback,
|
||||
|
@ -248,7 +248,7 @@ void SettingsLayout::RefreshAddedPaths() {
|
||||
this->addedPathsList->OnAdapterChanged();
|
||||
}
|
||||
|
||||
int64 SettingsLayout::ListItemDecorator(
|
||||
musik_int64 SettingsLayout::ListItemDecorator(
|
||||
ScrollableWindow* scrollable,
|
||||
size_t index,
|
||||
size_t line,
|
||||
|
@ -102,7 +102,7 @@ namespace musik {
|
||||
void OnThemeDropdownActivate(cursespp::TextLabel* label);
|
||||
void OnLocaleDropdownActivate(cursespp::TextLabel* label);
|
||||
|
||||
int64 ListItemDecorator(
|
||||
musik_int64 ListItemDecorator(
|
||||
cursespp::ScrollableWindow* w,
|
||||
size_t index,
|
||||
size_t line,
|
||||
|
@ -119,7 +119,7 @@ static void showPlaylistListOverlay(
|
||||
static void confirmOverwritePlaylist(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& playlistName,
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
std::shared_ptr<TrackList> tracks)
|
||||
{
|
||||
std::shared_ptr<DialogOverlay> dialog(new DialogOverlay());
|
||||
@ -162,7 +162,7 @@ static void createNewPlaylist(
|
||||
|
||||
static void renamePlaylist(
|
||||
musik::core::ILibraryPtr library,
|
||||
const DBID playlistId,
|
||||
const musik_uint64 playlistId,
|
||||
const std::string& oldName)
|
||||
{
|
||||
std::shared_ptr<InputOverlay> dialog(new InputOverlay());
|
||||
@ -183,7 +183,7 @@ static void renamePlaylist(
|
||||
static void confirmDeletePlaylist(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& playlistName,
|
||||
const DBID playlistId)
|
||||
const musik_uint64 playlistId)
|
||||
{
|
||||
std::shared_ptr<DialogOverlay> dialog(new DialogOverlay());
|
||||
|
||||
@ -220,7 +220,7 @@ static void handleAddCategorySelection(
|
||||
musik::core::audio::PlaybackService& playback,
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& fieldColumn,
|
||||
DBID fieldId,
|
||||
musik_uint64 fieldId,
|
||||
size_t type)
|
||||
{
|
||||
std::shared_ptr<CategoryTrackListQuery> query(
|
||||
@ -251,8 +251,8 @@ static void handleJumpTo(
|
||||
musik::core::runtime::IMessageQueue& messageQueue,
|
||||
musik::core::TrackPtr track)
|
||||
{
|
||||
unsigned long long type;
|
||||
unsigned long long id;
|
||||
musik_uint64 type;
|
||||
musik_uint64 id;
|
||||
|
||||
if (index == 0) {
|
||||
type = message::category::Album;
|
||||
@ -321,7 +321,7 @@ void PlayQueueOverlays::ShowAddCategoryOverlay(
|
||||
musik::core::audio::PlaybackService& playback,
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& fieldColumn,
|
||||
DBID fieldId)
|
||||
musik_uint64 fieldId)
|
||||
{
|
||||
std::shared_ptr<Adapter> adapter(new Adapter());
|
||||
adapter->AddEntry(_TSTR("playqueue_overlay_add_to_end"));
|
||||
@ -412,7 +412,7 @@ void PlayQueueOverlays::ShowLoadPlaylistOverlay(
|
||||
[library, result, callback]
|
||||
(ListOverlay* overlay, IScrollAdapterPtr adapter, size_t index) {
|
||||
if (index != ListWindow::NO_SELECTION && callback) {
|
||||
DBID playlistId = (*result)[index]->id;
|
||||
musik_uint64 playlistId = (*result)[index]->id;
|
||||
callback(playlistId);
|
||||
}
|
||||
});
|
||||
@ -421,7 +421,7 @@ void PlayQueueOverlays::ShowLoadPlaylistOverlay(
|
||||
void PlayQueueOverlays::ShowSavePlaylistOverlay(
|
||||
musik::core::audio::PlaybackService& playback,
|
||||
musik::core::ILibraryPtr library,
|
||||
DBID selectedPlaylistId)
|
||||
musik_uint64 selectedPlaylistId)
|
||||
{
|
||||
std::shared_ptr<CategoryListQuery> query = queryPlaylists(library);
|
||||
auto result = query->GetResult();
|
||||
@ -456,7 +456,7 @@ void PlayQueueOverlays::ShowSavePlaylistOverlay(
|
||||
}
|
||||
else { /* replace existing */
|
||||
--index;
|
||||
DBID playlistId = (*result)[index]->id;
|
||||
musik_uint64 playlistId = (*result)[index]->id;
|
||||
std::string playlistName = (*result)[index]->displayValue;
|
||||
confirmOverwritePlaylist(library, playlistName, playlistId, tracks);
|
||||
}
|
||||
@ -482,7 +482,7 @@ void PlayQueueOverlays::ShowRenamePlaylistOverlay(musik::core::ILibraryPtr libra
|
||||
adapter,
|
||||
[library, result](ListOverlay* overlay, IScrollAdapterPtr adapter, size_t index) {
|
||||
if (index != ListWindow::NO_SELECTION) {
|
||||
DBID playlistId = (*result)[index]->id;
|
||||
musik_uint64 playlistId = (*result)[index]->id;
|
||||
std::string playlistName = (*result)[index]->displayValue;
|
||||
renamePlaylist(library, playlistId, playlistName);
|
||||
}
|
||||
@ -508,7 +508,7 @@ void PlayQueueOverlays::ShowDeletePlaylistOverlay(musik::core::ILibraryPtr libra
|
||||
[library, result]
|
||||
(ListOverlay* overlay, IScrollAdapterPtr adapter, size_t index) {
|
||||
if (index != ListWindow::NO_SELECTION) {
|
||||
DBID playlistId = (*result)[index]->id;
|
||||
musik_uint64 playlistId = (*result)[index]->id;
|
||||
std::string playlistName = (*result)[index]->displayValue;
|
||||
confirmDeletePlaylist(library, playlistName, playlistId);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace musik {
|
||||
namespace box {
|
||||
class PlayQueueOverlays {
|
||||
public:
|
||||
using PlaylistSelectedCallback = std::function<void(DBID)>;
|
||||
using PlaylistSelectedCallback = std::function<void(musik_uint64)>;
|
||||
|
||||
static void ShowAddTrackOverlay(
|
||||
musik::core::runtime::IMessageQueue& messageQueue,
|
||||
@ -54,7 +54,7 @@ namespace musik {
|
||||
musik::core::audio::PlaybackService& playback,
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& fieldColumn,
|
||||
DBID fieldId);
|
||||
musik_uint64 fieldId);
|
||||
|
||||
static void ShowAlbumDividerOverlay(
|
||||
musik::core::runtime::IMessageQueue& messageQueue,
|
||||
@ -70,7 +70,7 @@ namespace musik {
|
||||
static void ShowSavePlaylistOverlay(
|
||||
musik::core::audio::PlaybackService& playback,
|
||||
musik::core::ILibraryPtr library,
|
||||
DBID selectedPlaylistId = -1);
|
||||
musik_uint64 selectedPlaylistId = -1);
|
||||
|
||||
static void ShowRenamePlaylistOverlay(
|
||||
musik::core::ILibraryPtr library);
|
||||
|
@ -82,7 +82,7 @@ CategoryListView::~CategoryListView() {
|
||||
void CategoryListView::RequeryWithField(
|
||||
const std::string& fieldName,
|
||||
const std::string& filter,
|
||||
const DBID selectAfterQuery)
|
||||
const musik_uint64 selectAfterQuery)
|
||||
{
|
||||
if (this->activeQuery) {
|
||||
this->activeQuery->Cancel();
|
||||
@ -94,7 +94,7 @@ void CategoryListView::RequeryWithField(
|
||||
this->library->Enqueue(activeQuery);
|
||||
}
|
||||
|
||||
void CategoryListView::Requery(const std::string& filter, const DBID selectAfterQuery) {
|
||||
void CategoryListView::Requery(const std::string& filter, const musik_uint64 selectAfterQuery) {
|
||||
this->RequeryWithField(this->fieldName, filter, selectAfterQuery);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ void CategoryListView::Reset() {
|
||||
this->OnAdapterChanged();
|
||||
}
|
||||
|
||||
DBID CategoryListView::GetSelectedId() {
|
||||
musik_uint64 CategoryListView::GetSelectedId() {
|
||||
size_t index = this->GetSelectedIndex();
|
||||
if (index != NO_SELECTION && this->metadata && index < this->metadata->size()) {
|
||||
return this->metadata->at(index)->id;
|
||||
@ -152,7 +152,7 @@ void CategoryListView::ScrollToPlaying() {
|
||||
|
||||
bool CategoryListView::KeyPress(const std::string& key) {
|
||||
if (Hotkeys::Is(Hotkeys::ContextMenu, key)) {
|
||||
DBID id = this->GetSelectedId();
|
||||
musik_uint64 id = this->GetSelectedId();
|
||||
if (id != -1) {
|
||||
PlayQueueOverlays::ShowAddCategoryOverlay(
|
||||
this->playback,
|
||||
@ -220,7 +220,7 @@ IScrollAdapter::EntryPtr CategoryListView::Adapter::GetEntry(cursespp::Scrollabl
|
||||
|
||||
bool selected = index == parent.GetSelectedIndex();
|
||||
|
||||
int64 attrs = selected
|
||||
musik_int64 attrs = selected
|
||||
? COLOR_PAIR(CURSESPP_HIGHLIGHTED_LIST_ITEM)
|
||||
: CURSESPP_DEFAULT_COLOR;
|
||||
|
||||
|
@ -68,17 +68,17 @@ namespace musik {
|
||||
void RequeryWithField(
|
||||
const std::string& fieldName,
|
||||
const std::string& filter = "",
|
||||
const DBID selectAfterQuery = 0);
|
||||
const musik_uint64 selectAfterQuery = 0);
|
||||
|
||||
void Requery(
|
||||
const std::string& filter = "",
|
||||
const DBID selectAfterQuery = 0);
|
||||
const musik_uint64 selectAfterQuery = 0);
|
||||
|
||||
virtual bool KeyPress(const std::string& key);
|
||||
|
||||
void Reset();
|
||||
|
||||
DBID GetSelectedId();
|
||||
musik_uint64 GetSelectedId();
|
||||
std::string GetFieldName();
|
||||
void SetFieldName(const std::string& fieldName);
|
||||
|
||||
@ -113,7 +113,7 @@ namespace musik {
|
||||
musik::core::TrackPtr playing;
|
||||
|
||||
std::string fieldName;
|
||||
DBID selectAfterQuery;
|
||||
musik_uint64 selectAfterQuery;
|
||||
musik::core::db::local::CategoryListQuery::ResultList metadata;
|
||||
};
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void LogWindow::Update() {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < pending.size(); i++) {
|
||||
int64 attrs = COLOR_PAIR(CURSESPP_TEXT_DEFAULT);
|
||||
musik_int64 attrs = COLOR_PAIR(CURSESPP_TEXT_DEFAULT);
|
||||
|
||||
LogEntry* entry = pending[i];
|
||||
|
||||
|
@ -173,7 +173,7 @@ size_t TrackListView::Count() {
|
||||
|
||||
void TrackListView::ScrollToPlaying() {
|
||||
if (this->playing && this->tracks) {
|
||||
DBID id = this->playing->GetId();
|
||||
musik_uint64 id = this->playing->GetId();
|
||||
for (size_t i = 0; i < this->tracks->Count(); i++) {
|
||||
if (this->tracks->GetId(i) == id) {
|
||||
size_t rawIndex = headers.TrackListToAdapterIndex(i);
|
||||
@ -392,7 +392,7 @@ IScrollAdapter::EntryPtr TrackListView::Adapter::GetEntry(cursespp::ScrollableWi
|
||||
return entry;
|
||||
}
|
||||
|
||||
int64 attrs = CURSESPP_DEFAULT_COLOR;
|
||||
musik_int64 attrs = CURSESPP_DEFAULT_COLOR;
|
||||
|
||||
if (parent.decorator) {
|
||||
attrs = parent.decorator(track, trackIndex);
|
||||
|
@ -63,7 +63,7 @@ namespace musik {
|
||||
typedef std::function<std::string(
|
||||
musik::core::TrackPtr, size_t)> RowFormatter;
|
||||
|
||||
typedef std::function<int64(
|
||||
typedef std::function<musik_int64(
|
||||
musik::core::TrackPtr, size_t)> RowDecorator;
|
||||
|
||||
typedef std::shared_ptr<std::set<size_t> > Headers;
|
||||
|
@ -77,7 +77,7 @@ using namespace cursespp;
|
||||
#define MIN_HEIGHT 2
|
||||
|
||||
#define DEBOUNCE_REFRESH(mode, delay) \
|
||||
this->DebounceMessage(message::RefreshTransport, (int64) mode, 0, delay);
|
||||
this->DebounceMessage(message::RefreshTransport, (musik_int64) mode, 0, delay);
|
||||
|
||||
#define ON(w, a) if (a != CURSESPP_DEFAULT_COLOR) { wattron(w, a); }
|
||||
#define OFF(w, a) if (a != CURSESPP_DEFAULT_COLOR) { wattroff(w, a); }
|
||||
@ -233,15 +233,15 @@ static size_t writePlayingFormat(
|
||||
TokenList tokens;
|
||||
tokenize(Strings.PLAYING_FORMAT, tokens);
|
||||
|
||||
int64 dim = COLOR_PAIR(CURSESPP_TEXT_DISABLED);
|
||||
int64 gb = COLOR_PAIR(CURSESPP_TEXT_ACTIVE);
|
||||
musik_int64 dim = COLOR_PAIR(CURSESPP_TEXT_DISABLED);
|
||||
musik_int64 gb = COLOR_PAIR(CURSESPP_TEXT_ACTIVE);
|
||||
size_t remaining = width;
|
||||
|
||||
auto it = tokens.begin();
|
||||
while (it != tokens.end() && remaining > 0) {
|
||||
Token *token = it->get();
|
||||
|
||||
int64 attr = dim;
|
||||
musik_int64 attr = dim;
|
||||
std::string value;
|
||||
size_t cols;
|
||||
|
||||
@ -454,10 +454,10 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
bool stopped = (transport.GetPlaybackState() == PlaybackStopped);
|
||||
bool muted = transport.IsMuted();
|
||||
|
||||
int64 gb = COLOR_PAIR(CURSESPP_TEXT_ACTIVE);
|
||||
int64 disabled = COLOR_PAIR(CURSESPP_TEXT_DISABLED);
|
||||
musik_int64 gb = COLOR_PAIR(CURSESPP_TEXT_ACTIVE);
|
||||
musik_int64 disabled = COLOR_PAIR(CURSESPP_TEXT_DISABLED);
|
||||
|
||||
int64 volumeAttrs = CURSESPP_DEFAULT_COLOR;
|
||||
musik_int64 volumeAttrs = CURSESPP_DEFAULT_COLOR;
|
||||
if (this->focus == FocusVolume) {
|
||||
volumeAttrs = COLOR_PAIR(CURSESPP_TEXT_FOCUSED);
|
||||
}
|
||||
@ -465,7 +465,7 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
volumeAttrs = gb;
|
||||
}
|
||||
|
||||
int64 timerAttrs = (this->focus == FocusTime)
|
||||
musik_int64 timerAttrs = (this->focus == FocusTime)
|
||||
? COLOR_PAIR(CURSESPP_TEXT_FOCUSED) : CURSESPP_DEFAULT_COLOR;
|
||||
|
||||
/* prepare the "shuffle" label */
|
||||
@ -487,7 +487,7 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
}
|
||||
|
||||
wmove(c, 0, cx - shuffleLabelLen);
|
||||
int64 shuffleAttrs = this->playback.IsShuffled() ? gb : disabled;
|
||||
musik_int64 shuffleAttrs = this->playback.IsShuffled() ? gb : disabled;
|
||||
ON(c, shuffleAttrs);
|
||||
wprintw(c, shuffleLabel.c_str());
|
||||
OFF(c, shuffleAttrs);
|
||||
@ -519,7 +519,7 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
|
||||
RepeatMode mode = this->playback.GetRepeatMode();
|
||||
std::string repeatModeLabel;
|
||||
int64 repeatAttrs = CURSESPP_DEFAULT_COLOR;
|
||||
musik_int64 repeatAttrs = CURSESPP_DEFAULT_COLOR;
|
||||
switch (mode) {
|
||||
case RepeatList:
|
||||
repeatModeLabel += Strings.REPEAT_LIST;
|
||||
@ -537,10 +537,10 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
|
||||
/* time slider */
|
||||
|
||||
int64 currentTimeAttrs = timerAttrs;
|
||||
musik_int64 currentTimeAttrs = timerAttrs;
|
||||
|
||||
if (paused) { /* blink the track if paused */
|
||||
int64 now = duration_cast<seconds>(
|
||||
musik_int64 now = duration_cast<seconds>(
|
||||
system_clock::now().time_since_epoch()).count();
|
||||
|
||||
if (now % 2 == 0) {
|
||||
|
@ -57,7 +57,7 @@ using namespace std::chrono;
|
||||
|
||||
static OverlayStack overlays;
|
||||
static bool disconnected = false;
|
||||
static int64 resizeAt = 0;
|
||||
static musik_int64 resizeAt = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
static void hangupHandler(int signal) {
|
||||
@ -169,7 +169,7 @@ void App::Run(ILayoutPtr layout) {
|
||||
Colors::SetTheme(this->colorTheme);
|
||||
}
|
||||
|
||||
int64 ch;
|
||||
musik_int64 ch;
|
||||
|
||||
bool quit = false;
|
||||
|
||||
@ -358,7 +358,7 @@ void App::FocusPrevInLayout() {
|
||||
this->UpdateFocusedWindow(this->state.ActiveLayout()->FocusPrev());
|
||||
}
|
||||
|
||||
int64 App::Now() {
|
||||
musik_int64 App::Now() {
|
||||
return duration_cast<milliseconds>(
|
||||
system_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace cursespp {
|
||||
void Run(ILayoutPtr layout);
|
||||
void ChangeLayout(ILayoutPtr layout);
|
||||
|
||||
static int64 Now();
|
||||
static musik_int64 Now();
|
||||
static OverlayStack& Overlays();
|
||||
|
||||
private:
|
||||
|
@ -81,7 +81,7 @@ void Checkbox::OnRedraw() {
|
||||
std::string symbol = (this->checked ? CHECKED : UNCHECKED);
|
||||
std::string ellipsized = text::Ellipsize(symbol + " " + this->buffer, cx);
|
||||
|
||||
int64 attrs = this->IsFocused() ? CURSESPP_TEXT_FOCUSED : CURSESPP_DEFAULT_COLOR;
|
||||
musik_int64 attrs = this->IsFocused() ? CURSESPP_TEXT_FOCUSED : CURSESPP_DEFAULT_COLOR;
|
||||
|
||||
if (attrs != -1) {
|
||||
wattron(c, COLOR_PAIR(attrs));
|
||||
|
@ -65,7 +65,7 @@ namespace cursespp {
|
||||
virtual size_t GetLineCount() = 0;
|
||||
virtual std::string GetLine(size_t line) = 0;
|
||||
virtual void SetWidth(size_t width) = 0;
|
||||
virtual int64 GetAttrs(size_t line) = 0;
|
||||
virtual musik_int64 GetAttrs(size_t line) = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IEntry> EntryPtr;
|
||||
|
@ -54,14 +54,14 @@ namespace cursespp {
|
||||
virtual void SetParent(IWindow* parent) = 0;
|
||||
virtual void Focus() = 0;
|
||||
virtual void Blur() = 0;
|
||||
virtual void SetContentColor(int64 color) = 0;
|
||||
virtual void SetFrameColor(int64 color) = 0;
|
||||
virtual void SetFocusedFrameColor(int64 color) = 0;
|
||||
virtual void SetFocusedContentColor(int64 color) = 0;
|
||||
virtual int64 GetContentColor() = 0;
|
||||
virtual int64 GetFrameColor() = 0;
|
||||
virtual int64 GetFocusedContentColor() = 0;
|
||||
virtual int64 GetFocusedFrameColor() = 0;
|
||||
virtual void SetContentColor(musik_int64 color) = 0;
|
||||
virtual void SetFrameColor(musik_int64 color) = 0;
|
||||
virtual void SetFocusedFrameColor(musik_int64 color) = 0;
|
||||
virtual void SetFocusedContentColor(musik_int64 color) = 0;
|
||||
virtual musik_int64 GetContentColor() = 0;
|
||||
virtual musik_int64 GetFrameColor() = 0;
|
||||
virtual musik_int64 GetFocusedContentColor() = 0;
|
||||
virtual musik_int64 GetFocusedFrameColor() = 0;
|
||||
virtual void SetFrameVisible(bool visible) = 0;
|
||||
virtual bool IsFrameVisible() = 0;
|
||||
virtual void SetSize(int width, int height) = 0;
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
using namespace cursespp;
|
||||
|
||||
MultiLineEntry::MultiLineEntry(const std::string& value, int64 attrs) {
|
||||
MultiLineEntry::MultiLineEntry(const std::string& value, musik_int64 attrs) {
|
||||
this->value = value;
|
||||
this->charCount = value.size();
|
||||
this->width = -1;
|
||||
@ -53,7 +53,7 @@ std::string MultiLineEntry::GetLine(size_t n) {
|
||||
return this->lines.at(n);
|
||||
}
|
||||
|
||||
int64 MultiLineEntry::GetAttrs(size_t line) {
|
||||
musik_int64 MultiLineEntry::GetAttrs(size_t line) {
|
||||
return this->attrs;
|
||||
}
|
||||
|
||||
|
@ -39,19 +39,19 @@
|
||||
namespace cursespp {
|
||||
class MultiLineEntry : public IScrollAdapter::IEntry {
|
||||
public:
|
||||
MultiLineEntry(const std::string& value, int64 attrs = -1);
|
||||
MultiLineEntry(const std::string& value, musik_int64 attrs = -1);
|
||||
virtual ~MultiLineEntry() { }
|
||||
|
||||
virtual size_t GetLineCount();
|
||||
virtual std::string GetLine(size_t line);
|
||||
virtual void SetWidth(size_t width);
|
||||
virtual int64 GetAttrs(size_t line);
|
||||
virtual musik_int64 GetAttrs(size_t line);
|
||||
|
||||
private:
|
||||
std::string value;
|
||||
std::vector<std::string> lines;
|
||||
size_t charCount;
|
||||
int64 attrs;
|
||||
musik_int64 attrs;
|
||||
size_t width;
|
||||
};
|
||||
}
|
@ -131,7 +131,7 @@ void ScrollAdapterBase::DrawPage(ScrollableWindow* scrollable, size_t index, Scr
|
||||
size_t count = entry->GetLineCount();
|
||||
|
||||
for (size_t i = 0; i < count && drawnLines < this->height; i++) {
|
||||
int64 attrs = -1;
|
||||
musik_int64 attrs = -1;
|
||||
|
||||
if (this->decorator) {
|
||||
attrs = this->decorator(scrollable, topIndex + e, i, entry);
|
||||
|
@ -41,7 +41,7 @@
|
||||
namespace cursespp {
|
||||
class ScrollAdapterBase : public IScrollAdapter {
|
||||
public:
|
||||
typedef std::function<int64(
|
||||
typedef std::function<musik_int64(
|
||||
ScrollableWindow*,
|
||||
size_t,
|
||||
size_t,
|
||||
|
@ -59,7 +59,7 @@ void ShortcutsWindow::SetAlignment(text::TextAlign align) {
|
||||
void ShortcutsWindow::AddShortcut(
|
||||
const std::string& key,
|
||||
const std::string& description,
|
||||
int64 attrs)
|
||||
musik_int64 attrs)
|
||||
{
|
||||
this->entries.push_back(
|
||||
std::shared_ptr<Entry>(new Entry(key, description, attrs)));
|
||||
@ -103,8 +103,8 @@ size_t ShortcutsWindow::CalculateLeftPadding() {
|
||||
void ShortcutsWindow::OnRedraw() {
|
||||
this->Clear();
|
||||
|
||||
int64 normalAttrs = COLOR_PAIR(CURSESPP_BUTTON_NORMAL);
|
||||
int64 activeAttrs = COLOR_PAIR(CURSESPP_BUTTON_HIGHLIGHTED);
|
||||
musik_int64 normalAttrs = COLOR_PAIR(CURSESPP_BUTTON_NORMAL);
|
||||
musik_int64 activeAttrs = COLOR_PAIR(CURSESPP_BUTTON_HIGHLIGHTED);
|
||||
|
||||
WINDOW* c = this->GetContent();
|
||||
|
||||
@ -115,7 +115,7 @@ void ShortcutsWindow::OnRedraw() {
|
||||
for (size_t i = 0; i < this->entries.size() && remaining > 0; i++) {
|
||||
auto e = this->entries[i];
|
||||
|
||||
int64 keyAttrs = (e->attrs == -1) ? normalAttrs : COLOR_PAIR(e->attrs);
|
||||
musik_int64 keyAttrs = (e->attrs == -1) ? normalAttrs : COLOR_PAIR(e->attrs);
|
||||
keyAttrs = (e->key == this->activeKey) ? activeAttrs : keyAttrs;
|
||||
|
||||
wprintw(c, " ");
|
||||
|
@ -53,7 +53,7 @@ namespace cursespp {
|
||||
void AddShortcut(
|
||||
const std::string& key,
|
||||
const std::string& description,
|
||||
int64 attrs = -1);
|
||||
musik_int64 attrs = -1);
|
||||
|
||||
void RemoveAll();
|
||||
void SetActive(const std::string& key);
|
||||
@ -65,7 +65,7 @@ namespace cursespp {
|
||||
size_t CalculateLeftPadding();
|
||||
|
||||
struct Entry {
|
||||
Entry(const std::string& key, const std::string& desc, int64 attrs = -1) {
|
||||
Entry(const std::string& key, const std::string& desc, musik_int64 attrs = -1) {
|
||||
this->key = key;
|
||||
this->description = desc;
|
||||
this->attrs = attrs;
|
||||
@ -73,7 +73,7 @@ namespace cursespp {
|
||||
|
||||
std::string key;
|
||||
std::string description;
|
||||
int64 attrs;
|
||||
musik_int64 attrs;
|
||||
};
|
||||
|
||||
typedef std::vector<std::shared_ptr<Entry> > EntryList;
|
||||
|
@ -46,11 +46,11 @@ void SingleLineEntry::SetWidth(size_t width) {
|
||||
this->width = width;
|
||||
}
|
||||
|
||||
int64 SingleLineEntry::GetAttrs(size_t line) {
|
||||
musik_int64 SingleLineEntry::GetAttrs(size_t line) {
|
||||
return this->attrs;
|
||||
}
|
||||
|
||||
void SingleLineEntry::SetAttrs(int64 attrs) {
|
||||
void SingleLineEntry::SetAttrs(musik_int64 attrs) {
|
||||
this->attrs = attrs;
|
||||
}
|
||||
|
||||
|
@ -43,15 +43,15 @@ namespace cursespp {
|
||||
virtual ~SingleLineEntry() { }
|
||||
|
||||
virtual void SetWidth(size_t width);
|
||||
virtual int64 GetAttrs(size_t line);
|
||||
virtual musik_int64 GetAttrs(size_t line);
|
||||
virtual size_t GetLineCount();
|
||||
virtual std::string GetLine(size_t line);
|
||||
|
||||
void SetAttrs(int64 attrs);
|
||||
void SetAttrs(musik_int64 attrs);
|
||||
|
||||
private:
|
||||
size_t width;
|
||||
std::string value;
|
||||
int64 attrs;
|
||||
musik_int64 attrs;
|
||||
};
|
||||
}
|
@ -295,12 +295,12 @@ namespace cursespp {
|
||||
return (it != KEY_MAPPING.end()) ? it->second : kn;
|
||||
}
|
||||
|
||||
std::string Read(int64 ch) {
|
||||
std::string Read(musik_int64 ch) {
|
||||
std::string kn = keyname((int)ch);
|
||||
|
||||
/* convert +ESC to M- sequences */
|
||||
if (kn == "^[") {
|
||||
int64 next = getch();
|
||||
musik_int64 next = getch();
|
||||
if (next != -1) {
|
||||
kn = std::string("M-") + std::string(keyname((int)next));
|
||||
}
|
||||
|
@ -52,6 +52,6 @@ namespace cursespp {
|
||||
|
||||
namespace key {
|
||||
std::string Normalize(const std::string& keyname);
|
||||
std::string Read(int64 ch);
|
||||
std::string Read(musik_int64 ch);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void TextLabel::OnRedraw() {
|
||||
|
||||
WINDOW* c = this->GetContent();
|
||||
|
||||
int64 attrs = this->GetContentColor();
|
||||
musik_int64 attrs = this->GetContentColor();
|
||||
if (attrs != -1) {
|
||||
wbkgd(c, COLOR_PAIR(attrs));
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void Window::SendToBottom() {
|
||||
}
|
||||
}
|
||||
|
||||
void Window::PostMessage(int messageType, int64 user1, int64 user2, int64 delay) {
|
||||
void Window::PostMessage(int messageType, musik_int64 user1, musik_int64 user2, musik_int64 delay) {
|
||||
messageQueue.Post(
|
||||
Message::Create(
|
||||
this,
|
||||
@ -185,7 +185,7 @@ void Window::PostMessage(int messageType, int64 user1, int64 user2, int64 delay)
|
||||
delay);
|
||||
}
|
||||
|
||||
void Window::DebounceMessage(int messageType, int64 user1, int64 user2, int64 delay) {
|
||||
void Window::DebounceMessage(int messageType, musik_int64 user1, musik_int64 user2, musik_int64 delay) {
|
||||
messageQueue.Debounce(
|
||||
Message::Create(
|
||||
this,
|
||||
@ -352,28 +352,28 @@ int Window::GetY() const {
|
||||
return this->y;
|
||||
}
|
||||
|
||||
void Window::SetContentColor(int64 color) {
|
||||
void Window::SetContentColor(musik_int64 color) {
|
||||
this->contentColor = (color == CURSESPP_DEFAULT_COLOR)
|
||||
? CURSESPP_DEFAULT_CONTENT_COLOR : color;
|
||||
|
||||
this->RepaintBackground();
|
||||
}
|
||||
|
||||
void Window::SetFocusedContentColor(int64 color) {
|
||||
void Window::SetFocusedContentColor(musik_int64 color) {
|
||||
this->focusedContentColor = (color == CURSESPP_DEFAULT_COLOR)
|
||||
? CURSESPP_DEFAULT_CONTENT_COLOR : color;
|
||||
|
||||
this->RepaintBackground();
|
||||
}
|
||||
|
||||
void Window::SetFrameColor(int64 color) {
|
||||
void Window::SetFrameColor(musik_int64 color) {
|
||||
this->frameColor = (color == CURSESPP_DEFAULT_COLOR)
|
||||
? CURSESPP_DEFAULT_FRAME_COLOR : color;
|
||||
|
||||
this->RepaintBackground();
|
||||
}
|
||||
|
||||
void Window::SetFocusedFrameColor(int64 color) {
|
||||
void Window::SetFocusedFrameColor(musik_int64 color) {
|
||||
this->focusedFrameColor = (color == CURSESPP_DEFAULT_COLOR)
|
||||
? CURSESPP_FOCUSED_FRAME_COLOR : color;
|
||||
|
||||
@ -568,10 +568,10 @@ void Window::Create() {
|
||||
|
||||
bool focused = this->IsFocused();
|
||||
|
||||
int64 currentFrameColor = focused
|
||||
musik_int64 currentFrameColor = focused
|
||||
? this->focusedFrameColor : this->frameColor;
|
||||
|
||||
int64 currentContentColor = focused
|
||||
musik_int64 currentContentColor = focused
|
||||
? this->focusedContentColor : this->contentColor;
|
||||
|
||||
/* create the corresponding panel. required for z-ordering. */
|
||||
@ -680,8 +680,8 @@ void Window::Clear() {
|
||||
wmove(this->content, 0, 0);
|
||||
|
||||
bool focused = this->IsFocused();
|
||||
int64 contentColor = isFocused ? this->focusedContentColor : this->contentColor;
|
||||
int64 frameColor = isFocused ? this->focusedFrameColor : this->frameColor;
|
||||
musik_int64 contentColor = isFocused ? this->focusedContentColor : this->contentColor;
|
||||
musik_int64 frameColor = isFocused ? this->focusedFrameColor : this->frameColor;
|
||||
|
||||
if (this->content == this->frame) {
|
||||
wbkgd(this->frame, COLOR_PAIR(contentColor));
|
||||
|
@ -68,15 +68,15 @@ namespace cursespp {
|
||||
virtual void Focus();
|
||||
virtual void Blur();
|
||||
|
||||
virtual void SetContentColor(int64 color);
|
||||
virtual void SetFrameColor(int64 color);
|
||||
virtual void SetFocusedContentColor(int64 color);
|
||||
virtual void SetFocusedFrameColor(int64 color);
|
||||
virtual void SetContentColor(musik_int64 color);
|
||||
virtual void SetFrameColor(musik_int64 color);
|
||||
virtual void SetFocusedContentColor(musik_int64 color);
|
||||
virtual void SetFocusedFrameColor(musik_int64 color);
|
||||
|
||||
virtual int64 GetContentColor() { return this->contentColor; }
|
||||
virtual int64 GetFrameColor() { return this->frameColor; }
|
||||
virtual int64 GetFocusedContentColor() { return this->focusedContentColor; }
|
||||
virtual int64 GetFocusedFrameColor() { return this->focusedFrameColor; }
|
||||
virtual musik_int64 GetContentColor() { return this->contentColor; }
|
||||
virtual musik_int64 GetFrameColor() { return this->frameColor; }
|
||||
virtual musik_int64 GetFocusedContentColor() { return this->focusedContentColor; }
|
||||
virtual musik_int64 GetFocusedFrameColor() { return this->focusedFrameColor; }
|
||||
|
||||
virtual void SetSize(int width, int height);
|
||||
virtual void SetPosition(int x, int y);
|
||||
@ -121,8 +121,8 @@ namespace cursespp {
|
||||
protected:
|
||||
IWindow* GetParent() const;
|
||||
|
||||
void PostMessage(int messageType, int64 user1 = 0, int64 user2 = 0, int64 delay = 0);
|
||||
void DebounceMessage(int messageType, int64 user1 = 0, int64 user2 = 0, int64 delay = 0);
|
||||
void PostMessage(int messageType, musik_int64 user1 = 0, musik_int64 user2 = 0, musik_int64 delay = 0);
|
||||
void DebounceMessage(int messageType, musik_int64 user1 = 0, musik_int64 user2 = 0, musik_int64 delay = 0);
|
||||
void RemoveMessage(int messageType);
|
||||
|
||||
void Create();
|
||||
@ -152,8 +152,8 @@ namespace cursespp {
|
||||
bool isVisible, isFocused, isDirty;
|
||||
int focusOrder;
|
||||
int id;
|
||||
int64 contentColor, frameColor;
|
||||
int64 focusedContentColor, focusedFrameColor;
|
||||
musik_int64 contentColor, frameColor;
|
||||
musik_int64 focusedContentColor, focusedFrameColor;
|
||||
int width, height, x, y;
|
||||
int lastAbsoluteX, lastAbsoluteY;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user