mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 13:21:13 +00:00
- A bit of Transport.h header cleanup
- Ensure fields are using the correct keys for queries and data access (we were using ALBUM_ID, ARTIST_ID, GENRE_ID incorrectly).
This commit is contained in:
parent
15a181a281
commit
52d01ffb7b
@ -98,14 +98,13 @@ namespace musik { namespace core { namespace audio {
|
||||
void OnPlaybackError(Player* player);
|
||||
|
||||
private:
|
||||
double volume;
|
||||
PlaybackState state;
|
||||
bool nextCanStart;
|
||||
boost::recursive_mutex stateMutex;
|
||||
Player* nextPlayer;
|
||||
musik::core::audio::OutputPtr output;
|
||||
std::list<Player*> active;
|
||||
|
||||
Player* nextPlayer;
|
||||
double volume;
|
||||
bool nextCanStart;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace musik::core::library::constants;
|
||||
|
||||
#define CATEGORY_WIDTH 25
|
||||
#define DEFAULT_CATEGORY constants::Track::ARTIST_ID
|
||||
#define DEFAULT_CATEGORY constants::Track::ARTIST
|
||||
|
||||
using namespace musik::core;
|
||||
using namespace musik::core::audio;
|
||||
@ -120,15 +120,15 @@ bool BrowseLayout::KeyPress(const std::string& key) {
|
||||
return true;
|
||||
}
|
||||
else if (key == "ALT_1" || key == "M-1") {
|
||||
this->categoryList->SetFieldName(constants::Track::ARTIST_ID);
|
||||
this->categoryList->SetFieldName(constants::Track::ARTIST);
|
||||
return true;
|
||||
}
|
||||
else if (key == "ALT_2" || key == "M-2") {
|
||||
this->categoryList->SetFieldName(constants::Track::ALBUM_ID);
|
||||
this->categoryList->SetFieldName(constants::Track::ALBUM);
|
||||
return true;
|
||||
}
|
||||
else if (key == "ALT_3" || key == "M-3") {
|
||||
this->categoryList->SetFieldName(constants::Track::GENRE_ID);
|
||||
this->categoryList->SetFieldName(constants::Track::GENRE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,16 +11,12 @@
|
||||
|
||||
using namespace musik::core::library::constants;
|
||||
|
||||
#define CATEGORY_WIDTH 25
|
||||
|
||||
#ifdef WIN32
|
||||
#define TRANSPORT_HEIGHT 3
|
||||
#else
|
||||
#define TRANSPORT_HEIGHT 2
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CATEGORY constants::Track::ARTIST_ID
|
||||
|
||||
using namespace musik::core;
|
||||
using namespace musik::core::audio;
|
||||
using namespace musik::core::library;
|
||||
|
@ -39,9 +39,9 @@ static boost::mutex QUERY_MAP_MUTEX;
|
||||
static std::map<std::string, std::string> FIELD_TO_QUERY_MAP;
|
||||
|
||||
static void initFieldToQueryMap() {
|
||||
FIELD_TO_QUERY_MAP[Track::ALBUM_ID] = ALBUM_QUERY;
|
||||
FIELD_TO_QUERY_MAP[Track::ARTIST_ID] = ARTIST_QUERY;
|
||||
FIELD_TO_QUERY_MAP[Track::GENRE_ID] = GENRE_QUERY;
|
||||
FIELD_TO_QUERY_MAP[Track::ALBUM] = ALBUM_QUERY;
|
||||
FIELD_TO_QUERY_MAP[Track::ARTIST] = ARTIST_QUERY;
|
||||
FIELD_TO_QUERY_MAP[Track::GENRE] = GENRE_QUERY;
|
||||
}
|
||||
|
||||
CategoryListViewQuery::CategoryListViewQuery(const std::string& trackField) {
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <core/library/LocalLibraryConstants.h>
|
||||
#include <core/db/Statement.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
using musik::core::db::Statement;
|
||||
using musik::core::db::Row;
|
||||
using musik::core::TrackPtr;
|
||||
@ -15,15 +17,26 @@ using namespace musik::core::db;
|
||||
using namespace musik::core::library::constants;
|
||||
using namespace musik::box;
|
||||
|
||||
static std::map<std::string, std::string> FIELD_TO_FOREIGN_KEY =
|
||||
{
|
||||
std::make_pair(Track::ALBUM, Track::ALBUM_ID),
|
||||
std::make_pair(Track::ARTIST, Track::ARTIST_ID),
|
||||
std::make_pair(Track::GENRE, Track::GENRE_ID),
|
||||
std::make_pair(Track::ALBUM_ARTIST, Track::ALBUM_ARTIST_ID)
|
||||
};
|
||||
|
||||
CategoryTrackListQuery::CategoryTrackListQuery(LibraryPtr library, const std::string& column, DBID id) {
|
||||
this->library = library;
|
||||
this->column = column;
|
||||
this->id = id;
|
||||
this->result.reset(new std::vector<TrackPtr>());
|
||||
this->headers.reset(new std::set<size_t>());
|
||||
this->hash = 0;
|
||||
|
||||
this->GetQueryHash();
|
||||
if (FIELD_TO_FOREIGN_KEY.find(column) == FIELD_TO_FOREIGN_KEY.end()) {
|
||||
throw std::runtime_error("invalid input column specified");
|
||||
}
|
||||
|
||||
this->column = FIELD_TO_FOREIGN_KEY[column];
|
||||
}
|
||||
|
||||
CategoryTrackListQuery::~CategoryTrackListQuery() {
|
||||
@ -85,9 +98,9 @@ bool CategoryTrackListQuery::OnRun(Connection& db) {
|
||||
track->SetValue(Track::TITLE, trackQuery.ColumnText(6));
|
||||
track->SetValue(Track::FILENAME, trackQuery.ColumnText(7));
|
||||
track->SetValue(Track::THUMBNAIL_ID, trackQuery.ColumnText(8));
|
||||
track->SetValue(Track::ALBUM_ID, album.c_str());
|
||||
track->SetValue(Track::GENRE_ID, trackQuery.ColumnText(10));
|
||||
track->SetValue(Track::ARTIST_ID, trackQuery.ColumnText(11));
|
||||
track->SetValue(Track::ALBUM, album.c_str());
|
||||
track->SetValue(Track::GENRE, trackQuery.ColumnText(10));
|
||||
track->SetValue(Track::ARTIST, trackQuery.ColumnText(11));
|
||||
track->SetValue(Track::FILETIME, trackQuery.ColumnText(12));
|
||||
|
||||
result->push_back(track);
|
||||
|
@ -1,33 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "SingleTrackQuery.h"
|
||||
|
||||
#include <core/library/track/LibraryTrack.h>
|
||||
#include <core/library/LocalLibraryConstants.h>
|
||||
#include <core/db/Statement.h>
|
||||
|
||||
using musik::core::db::Statement;
|
||||
using musik::core::db::Row;
|
||||
using musik::core::TrackPtr;
|
||||
using musik::core::LibraryTrack;
|
||||
|
||||
using namespace musik::core::library::constants;
|
||||
using namespace musik::core::db;
|
||||
using namespace musik::box;
|
||||
|
||||
SingleTrackQuery::SingleTrackQuery(const std::string& filename) {
|
||||
this->filename = filename;
|
||||
}
|
||||
|
||||
SingleTrackQuery::~SingleTrackQuery() {
|
||||
|
||||
}
|
||||
|
||||
TrackPtr SingleTrackQuery::GetResult() {
|
||||
return this->result;
|
||||
}
|
||||
|
||||
bool SingleTrackQuery::OnRun(Connection& db) {
|
||||
result.reset(new LibraryTrack());
|
||||
result->SetValue("filename", filename.c_str());
|
||||
return LibraryTrack::Load(result.get(), db);
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/library/query/QueryBase.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/library/track/Track.h>
|
||||
#include "CategoryListViewQuery.h"
|
||||
|
||||
namespace musik {
|
||||
namespace box {
|
||||
class SingleTrackQuery : public musik::core::query::QueryBase {
|
||||
public:
|
||||
SingleTrackQuery(const std::string& path);
|
||||
virtual ~SingleTrackQuery();
|
||||
|
||||
virtual std::string Name() { return "SingleTrackQuery"; }
|
||||
virtual musik::core::TrackPtr GetResult();
|
||||
|
||||
protected:
|
||||
virtual bool OnRun(musik::core::db::Connection &db);
|
||||
|
||||
private:
|
||||
musik::core::TrackPtr result;
|
||||
std::string filename;
|
||||
};
|
||||
}
|
||||
}
|
@ -136,8 +136,8 @@ IScrollAdapter::EntryPtr TrackListView::Adapter::GetEntry(size_t index) {
|
||||
}
|
||||
|
||||
std::string trackNum = track->GetValue(constants::Track::TRACK_NUM);
|
||||
std::string artist = track->GetValue(constants::Track::ARTIST_ID);
|
||||
std::string album = track->GetValue(constants::Track::ALBUM_ID);
|
||||
std::string artist = track->GetValue(constants::Track::ARTIST);
|
||||
std::string album = track->GetValue(constants::Track::ALBUM);
|
||||
std::string title = track->GetValue(constants::Track::TITLE);
|
||||
std::string duration = track->GetValue(constants::Track::DURATION);
|
||||
|
||||
@ -170,7 +170,7 @@ IScrollAdapter::EntryPtr TrackListView::Adapter::GetEntry(size_t index) {
|
||||
% group(setw(column4Width), setiosflags(std::ios::left), setfill(' '), album));
|
||||
|
||||
if (this->parent.headers->find(index) != this->parent.headers->end()) {
|
||||
std::string album = track->GetValue(constants::Track::ALBUM_ID);
|
||||
std::string album = track->GetValue(constants::Track::ALBUM);
|
||||
std::shared_ptr<EntryWithHeader> entry(new EntryWithHeader(album, text));
|
||||
entry->SetAttrs(COLOR_PAIR(BOX_COLOR_GREEN_ON_BLACK), attrs);
|
||||
return entry;
|
||||
|
@ -111,7 +111,7 @@ void TransportWindow::Update() {
|
||||
|
||||
if (this->currentTrack) {
|
||||
title = this->currentTrack->GetValue(constants::Track::TITLE);
|
||||
album = this->currentTrack->GetValue(constants::Track::ALBUM_ID);
|
||||
album = this->currentTrack->GetValue(constants::Track::ALBUM);
|
||||
duration = this->currentTrack->GetValue(constants::Track::DURATION);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,6 @@
|
||||
<ClCompile Include="app\layout\NowPlayingLayout.cpp" />
|
||||
<ClCompile Include="app\query\CategoryListViewQuery.cpp" />
|
||||
<ClCompile Include="app\query\NowPlayingTrackListQuery.cpp" />
|
||||
<ClCompile Include="app\query\SingleTrackQuery.cpp" />
|
||||
<ClCompile Include="app\query\CategoryTrackListQuery.cpp" />
|
||||
<ClCompile Include="app\service\PlaybackService.cpp" />
|
||||
<ClCompile Include="app\util\GlobalHotkeys.cpp" />
|
||||
@ -163,7 +162,6 @@
|
||||
<ClInclude Include="app\query\CategoryListViewQuery.h" />
|
||||
<ClInclude Include="app\query\NowPlayingTrackListQuery.h" />
|
||||
<ClInclude Include="app\query\TrackListQueryBase.h" />
|
||||
<ClInclude Include="app\query\SingleTrackQuery.h" />
|
||||
<ClInclude Include="app\query\CategoryTrackListQuery.h" />
|
||||
<ClInclude Include="app\service\PlaybackService.h" />
|
||||
<ClInclude Include="app\util\GlobalHotkeys.h" />
|
||||
|
@ -60,9 +60,6 @@
|
||||
<ClCompile Include="app\window\LogWindow.cpp">
|
||||
<Filter>app\window</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\query\SingleTrackQuery.cpp">
|
||||
<Filter>app\query</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\util\GlobalHotkeys.cpp">
|
||||
<Filter>app\util</Filter>
|
||||
</ClCompile>
|
||||
@ -195,9 +192,6 @@
|
||||
<ClInclude Include="app\window\CommandWindow.h">
|
||||
<Filter>app\window</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\query\SingleTrackQuery.h">
|
||||
<Filter>app\query</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\util\GlobalHotkeys.h">
|
||||
<Filter>app\util</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
x
Reference in New Issue
Block a user