[UI/MOBILE] WIP on internal path support
This commit is contained in:
+2
-1
@@ -13,7 +13,8 @@ lms_css_DATA = \
|
|||||||
docroot/css/lms.css
|
docroot/css/lms.css
|
||||||
|
|
||||||
lms_images_DATA = \
|
lms_images_DATA = \
|
||||||
docroot/images/unknown-cover.jpg
|
docroot/images/unknown-cover.jpg \
|
||||||
|
docroot/images/unknown-artist.jpg
|
||||||
|
|
||||||
lms_approot_DATA = \
|
lms_approot_DATA = \
|
||||||
approot/templates.xml
|
approot/templates.xml
|
||||||
|
|||||||
+40
-87
@@ -365,12 +365,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message id="mobile-search">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">${search}</div>
|
|
||||||
</div>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="mobile-search-title">
|
<message id="mobile-search-title">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
@@ -386,62 +380,45 @@
|
|||||||
</div>
|
</div>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message id="mobile-artist-res">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="mobile-search-entry">${name}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="mobile-release-res">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="mobile-search-entry">
|
|
||||||
<div class="row">
|
|
||||||
<div class ="vertical-align">
|
|
||||||
<div class="col-xs-2" style="margin-top:3px">${cover}</div>
|
|
||||||
<div class="col-xs-10">${name}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="mobile-track-res">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="mobile-search-entry">
|
|
||||||
<div class="row">
|
|
||||||
<div class="vertical-align">
|
|
||||||
<div class="col-xs-2" style="margin-top:3px">${cover}</div>
|
|
||||||
<div class="col-xs-7">${name}</div>
|
|
||||||
<div class="col-xs-3">${btn}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="mobile-audio-footer">
|
<message id="mobile-audio-footer">
|
||||||
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
|
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
|
||||||
${player}
|
${player}
|
||||||
</nav>
|
</nav>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message id="wa-release-wrapper">
|
|
||||||
<div class="section text-center">
|
<!--
|
||||||
<div class="container">
|
wa-artist-search
|
||||||
<div class="row">
|
-> wa-artist-search-res
|
||||||
${contents}
|
-> wa-artist-search-res
|
||||||
</div>
|
-> ...
|
||||||
</div>
|
-->
|
||||||
</div>
|
<message id="wa-artist-search">
|
||||||
|
${title}
|
||||||
|
${contents}
|
||||||
|
${show-more}
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message id="wa-release-res">
|
<message id="wa-artist-search-res">
|
||||||
|
<div class="col-xs-6 col-md-2">
|
||||||
|
<br/>${gif}
|
||||||
|
<h4 class="release_truncated-name" title="${artistname}">${name}<div style="font-size: 75%"></div></h4>
|
||||||
|
</div>
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
wa-release-search
|
||||||
|
-> wa-release-search-res
|
||||||
|
-> wa-release-search-res
|
||||||
|
-> ...
|
||||||
|
-->
|
||||||
|
<message id="wa-release-search">
|
||||||
|
${title}
|
||||||
|
${contents}
|
||||||
|
${show-more}
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message id="wa-release-search-res">
|
||||||
<div class="col-xs-6 col-md-2">
|
<div class="col-xs-6 col-md-2">
|
||||||
<br/>${cover}
|
<br/>${cover}
|
||||||
<h4 class="release_truncated-name" title="${release_name}">${name}<div style="font-size: 75%"><br/>${artist}<br/></div></h4>
|
<h4 class="release_truncated-name" title="${release_name}">${name}<div style="font-size: 75%"><br/>${artist}<br/></div></h4>
|
||||||
@@ -449,43 +426,20 @@
|
|||||||
</message>
|
</message>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
wa-artist-wrapper
|
wa-track_search
|
||||||
-> wa-artist-res
|
-> wa-track-search-res
|
||||||
-> wa-artist-res
|
-> wa-track-search-res
|
||||||
-> ...
|
-> ...
|
||||||
-->
|
!-->
|
||||||
<message id="wa-artist-search">
|
<message id="wa-track-search">
|
||||||
${title}
|
|
||||||
${release-container}
|
|
||||||
${show-more}
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="wa-artist-wrapper">
|
|
||||||
<div class="section text-center">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
${contents}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="wa-artist-res">
|
|
||||||
<div class="col-xs-6 col-md-2">
|
|
||||||
<br/>${gif}
|
|
||||||
<h4 class="release_truncated-name" title="${artistname}">${name}<div style="font-size: 75%"></div></h4>
|
|
||||||
</div>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message id="wa-track-wrapper">
|
|
||||||
${title}
|
${title}
|
||||||
<div class="menu-category list-group ">
|
<div class="menu-category list-group ">
|
||||||
${track-container}
|
${contents}
|
||||||
</div>
|
</div>
|
||||||
${show-more}
|
${show-more}
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message id="wa-track">
|
<message id="wa-track-search-res">
|
||||||
<div class="menu-item list-group-item ">
|
<div class="menu-item list-group-item ">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="vertical-align">
|
<div class="vertical-align">
|
||||||
@@ -498,8 +452,7 @@
|
|||||||
</message>
|
</message>
|
||||||
|
|
||||||
|
|
||||||
<!-- Track container
|
<!-- Release view
|
||||||
|
|
||||||
Track bar title
|
Track bar title
|
||||||
|
|
||||||
Release1
|
Release1
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Regular → Executable
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 25 KiB |
+3
-1
@@ -37,13 +37,15 @@ lms_SOURCES = \
|
|||||||
$(srcdir)/ui/audio/mobile/MobileAudio.cpp \
|
$(srcdir)/ui/audio/mobile/MobileAudio.cpp \
|
||||||
$(srcdir)/ui/audio/mobile/PreviewSearchView.cpp \
|
$(srcdir)/ui/audio/mobile/PreviewSearchView.cpp \
|
||||||
$(srcdir)/ui/audio/mobile/ReleaseSearch.cpp \
|
$(srcdir)/ui/audio/mobile/ReleaseSearch.cpp \
|
||||||
|
$(srcdir)/ui/audio/mobile/ReleaseSearchView.cpp \
|
||||||
$(srcdir)/ui/audio/mobile/ReleaseView.cpp \
|
$(srcdir)/ui/audio/mobile/ReleaseView.cpp \
|
||||||
$(srcdir)/ui/audio/mobile/TrackSearch.cpp \
|
$(srcdir)/ui/audio/mobile/TrackSearch.cpp \
|
||||||
|
$(srcdir)/ui/audio/mobile/TrackSearchView.cpp \
|
||||||
$(srcdir)/ui/common/DirectoryValidator.cpp \
|
$(srcdir)/ui/common/DirectoryValidator.cpp \
|
||||||
$(srcdir)/ui/common/InputRange.cpp \
|
$(srcdir)/ui/common/InputRange.cpp \
|
||||||
$(srcdir)/ui/common/LineEdit.cpp \
|
$(srcdir)/ui/common/LineEdit.cpp \
|
||||||
$(srcdir)/ui/resource/AvConvTranscodeStreamResource.cpp \
|
$(srcdir)/ui/resource/AvConvTranscodeStreamResource.cpp \
|
||||||
$(srcdir)/ui/resource/CoverResource.cpp \
|
$(srcdir)/ui/resource/ImageResource.cpp \
|
||||||
$(srcdir)/ui/resource/TranscodeResource.cpp \
|
$(srcdir)/ui/resource/TranscodeResource.cpp \
|
||||||
$(srcdir)/ui/settings/Settings.cpp \
|
$(srcdir)/ui/settings/Settings.cpp \
|
||||||
$(srcdir)/ui/settings/SettingsAccountFormView.cpp \
|
$(srcdir)/ui/settings/SettingsAccountFormView.cpp \
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ Artist::getByMBID(Wt::Dbo::Session& session, const std::string& mbid)
|
|||||||
return session.find<Artist>().where("mbid = ?").bind(mbid);
|
return session.find<Artist>().where("mbid = ?").bind(mbid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Artist::pointer
|
||||||
|
Artist::getById(Wt::Dbo::Session& session, Artist::id_type id)
|
||||||
|
{
|
||||||
|
return session.find<Artist>().where("id = ?").bind(id);
|
||||||
|
}
|
||||||
|
|
||||||
Artist::pointer
|
Artist::pointer
|
||||||
Artist::create(Wt::Dbo::Session& session, const std::string& name, const std::string& MBID)
|
Artist::create(Wt::Dbo::Session& session, const std::string& name, const std::string& MBID)
|
||||||
{
|
{
|
||||||
@@ -84,6 +90,24 @@ Artist::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset,
|
|||||||
return std::vector<pointer>(res.begin(), res.end());
|
return std::vector<pointer>(res.begin(), res.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Artist::pointer>
|
||||||
|
Artist::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, int size, bool& moreResults)
|
||||||
|
{
|
||||||
|
auto res = getByFilter(session, filter, offset, size + 1);
|
||||||
|
|
||||||
|
if (size != -1 && res.size() == static_cast<std::size_t>(size) + 1)
|
||||||
|
{
|
||||||
|
moreResults = true;
|
||||||
|
res.pop_back();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
moreResults = false;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<Wt::Dbo::ptr<Release> >
|
std::vector<Wt::Dbo::ptr<Release> >
|
||||||
Artist::getReleases() const
|
Artist::getReleases() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class Artist : public Wt::Dbo::Dbo<Artist>
|
|||||||
static pointer getNone(Wt::Dbo::Session& session); // Special entry
|
static pointer getNone(Wt::Dbo::Session& session); // Special entry
|
||||||
static std::vector<pointer> getByName(Wt::Dbo::Session& session, const std::string& name);
|
static std::vector<pointer> getByName(Wt::Dbo::Session& session, const std::string& name);
|
||||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
|
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
|
||||||
|
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, int size, bool& moreExpected);
|
||||||
|
|
||||||
static std::vector<pointer> getAll(Wt::Dbo::Session& session, int offset = -1, int size = -1);
|
static std::vector<pointer> getAll(Wt::Dbo::Session& session, int offset = -1, int size = -1);
|
||||||
static std::vector<pointer> getAllOrphans(Wt::Dbo::Session& session);
|
static std::vector<pointer> getAllOrphans(Wt::Dbo::Session& session);
|
||||||
|
|||||||
@@ -140,6 +140,22 @@ Release::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset,
|
|||||||
return std::vector<pointer>(res.begin(), res.end());
|
return std::vector<pointer>(res.begin(), res.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Release::pointer>
|
||||||
|
Release::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, int size, bool& moreResults)
|
||||||
|
{
|
||||||
|
auto res = getByFilter(session, filter, offset, size + 1);
|
||||||
|
|
||||||
|
if (size != -1 && res.size() == static_cast<std::size_t>(size) + 1)
|
||||||
|
{
|
||||||
|
moreResults = true;
|
||||||
|
res.pop_back();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
moreResults = false;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Release::getReleaseYear(bool original) const
|
Release::getReleaseYear(bool original) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class Release : public Wt::Dbo::Dbo<Release>
|
|||||||
static std::vector<pointer> getAllOrphans(Wt::Dbo::Session& session);
|
static std::vector<pointer> getAllOrphans(Wt::Dbo::Session& session);
|
||||||
static std::vector<pointer> getAll(Wt::Dbo::Session& session, int offset, int size);
|
static std::vector<pointer> getAll(Wt::Dbo::Session& session, int offset, int size);
|
||||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
|
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
|
||||||
|
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, int size, bool& moreExpected);
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
static pointer create(Wt::Dbo::Session& session, const std::string& name, const std::string& MBID = "");
|
static pointer create(Wt::Dbo::Session& session, const std::string& name, const std::string& MBID = "");
|
||||||
|
|||||||
@@ -159,6 +159,22 @@ Track::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, i
|
|||||||
return std::vector<pointer>(res.begin(), res.end());
|
return std::vector<pointer>(res.begin(), res.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Track::pointer>
|
||||||
|
Track::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, int size, bool& moreResults)
|
||||||
|
{
|
||||||
|
auto res = getByFilter(session, filter, offset, size + 1);
|
||||||
|
|
||||||
|
if (size != -1 && res.size() == static_cast<std::size_t>(size) + 1)
|
||||||
|
{
|
||||||
|
moreResults = true;
|
||||||
|
res.pop_back();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
moreResults = false;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Track::updateUIQueryModel(Wt::Dbo::Session& session, Wt::Dbo::QueryModel< UIQueryResult >& model, SearchFilter filter, const std::vector<Wt::WString>& columnNames)
|
Track::updateUIQueryModel(Wt::Dbo::Session& session, Wt::Dbo::QueryModel< UIQueryResult >& model, SearchFilter filter, const std::vector<Wt::WString>& columnNames)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class Track
|
|||||||
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
||||||
static pointer getByMBID(Wt::Dbo::Session& session, const std::string& MBID);
|
static pointer getByMBID(Wt::Dbo::Session& session, const std::string& MBID);
|
||||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
|
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
|
||||||
|
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset, int size, bool &moreResults);
|
||||||
static Wt::Dbo::collection< pointer > getAll(Wt::Dbo::Session& session);
|
static Wt::Dbo::collection< pointer > getAll(Wt::Dbo::Session& session);
|
||||||
static std::vector<boost::filesystem::path> getAllPaths(Wt::Dbo::Session& session);
|
static std::vector<boost::filesystem::path> getAllPaths(Wt::Dbo::Session& session);
|
||||||
static std::vector<pointer> getMBIDDuplicates(Wt::Dbo::Session& session);
|
static std::vector<pointer> getMBIDDuplicates(Wt::Dbo::Session& session);
|
||||||
|
|||||||
+25
-11
@@ -48,6 +48,18 @@ namespace skeletons {
|
|||||||
extern const char *AuthStrings_xml1;
|
extern const char *AuthStrings_xml1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool agentIsMobile()
|
||||||
|
{
|
||||||
|
const Wt::WEnvironment& env = Wt::WApplication::instance()->environment();
|
||||||
|
return (env.agentIsIEMobile()
|
||||||
|
|| env.agentIsMobileWebKit()
|
||||||
|
|| env.userAgent().find("Mobile") != std::string::npos // Workaround for firefox
|
||||||
|
|| env.userAgent().find("Tablet") != std::string::npos // Workaround for firefox
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
|
|
||||||
@@ -76,9 +88,9 @@ LmsApplication::instance()
|
|||||||
LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnectionPool& connectionPool)
|
LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnectionPool& connectionPool)
|
||||||
: Wt::WApplication(env),
|
: Wt::WApplication(env),
|
||||||
_db(connectionPool),
|
_db(connectionPool),
|
||||||
_coverResource(nullptr)
|
_imageResource(nullptr),
|
||||||
|
_transcodeResource(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
Wt::WBootstrapTheme *bootstrapTheme = new Wt::WBootstrapTheme(this);
|
Wt::WBootstrapTheme *bootstrapTheme = new Wt::WBootstrapTheme(this);
|
||||||
bootstrapTheme->setVersion(Wt::WBootstrapTheme::Version3);
|
bootstrapTheme->setVersion(Wt::WBootstrapTheme::Version3);
|
||||||
bootstrapTheme->setResponsive(true);
|
bootstrapTheme->setResponsive(true);
|
||||||
@@ -106,7 +118,6 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnecti
|
|||||||
createFirstConnectionUI();
|
createFirstConnectionUI();
|
||||||
else
|
else
|
||||||
createLmsUI();
|
createLmsUI();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Database::Handler& DbHandler()
|
Database::Handler& DbHandler()
|
||||||
@@ -128,9 +139,9 @@ Database::User::pointer CurrentUser()
|
|||||||
return DbHandler().getCurrentUser();
|
return DbHandler().getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
CoverResource* SessionCoverResource()
|
ImageResource* SessionImageResource()
|
||||||
{
|
{
|
||||||
return LmsApplication::instance()->getCoverResource();
|
return LmsApplication::instance()->getImageResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
TranscodeResource* SessionTranscodeResource()
|
TranscodeResource* SessionTranscodeResource()
|
||||||
@@ -150,7 +161,7 @@ LmsApplication::createFirstConnectionUI()
|
|||||||
void
|
void
|
||||||
LmsApplication::createLmsUI()
|
LmsApplication::createLmsUI()
|
||||||
{
|
{
|
||||||
_coverResource = new CoverResource(_db, root());
|
_imageResource = new ImageResource(_db, root());
|
||||||
_transcodeResource = new TranscodeResource(_db, root());
|
_transcodeResource = new TranscodeResource(_db, root());
|
||||||
|
|
||||||
DbHandler().getLogin().changed().connect(this, &LmsApplication::handleAuthEvent);
|
DbHandler().getLogin().changed().connect(this, &LmsApplication::handleAuthEvent);
|
||||||
@@ -163,8 +174,6 @@ LmsApplication::createLmsUI()
|
|||||||
authWidget->processEnvironment();
|
authWidget->processEnvironment();
|
||||||
|
|
||||||
root()->addWidget(authWidget);
|
root()->addWidget(authWidget);
|
||||||
|
|
||||||
setInternalPath("/");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -186,7 +195,7 @@ LmsApplication::handleAuthEvent(void)
|
|||||||
setConfirmCloseMessage("Closing LMS. Are you sure?");
|
setConfirmCloseMessage("Closing LMS. Are you sure?");
|
||||||
|
|
||||||
// Handle internal paths
|
// Handle internal paths
|
||||||
// this->setInternalPath("audio");
|
// setInternalPath("audio");
|
||||||
|
|
||||||
// Create a Vertical layout: top is the nav bar, bottom is the contents
|
// Create a Vertical layout: top is the nav bar, bottom is the contents
|
||||||
Wt::WVBoxLayout *layout = new Wt::WVBoxLayout(this->root());
|
Wt::WVBoxLayout *layout = new Wt::WVBoxLayout(this->root());
|
||||||
@@ -207,11 +216,16 @@ LmsApplication::handleAuthEvent(void)
|
|||||||
LineEdit *searchEdit = new LineEdit(500);
|
LineEdit *searchEdit = new LineEdit(500);
|
||||||
navigation->bindWidget("search", searchEdit);
|
navigation->bindWidget("search", searchEdit);
|
||||||
searchEdit->setEmptyText("Search...");
|
searchEdit->setEmptyText("Search...");
|
||||||
searchEdit->addStyleClass("navbar-form navbar-nav");
|
AearchEdit->addStyleClass("navbar-form navbar-nav");
|
||||||
searchEdit->setWidth(150);
|
searchEdit->setWidth(150);
|
||||||
// TODO add a span with a search icon
|
// TODO add a span with a search icon
|
||||||
|
|
||||||
Mobile::Audio *audio = new Mobile::Audio();
|
Audio *audio;
|
||||||
|
|
||||||
|
if (agentIsMobile())
|
||||||
|
audio = new Mobile::Audio();
|
||||||
|
else
|
||||||
|
audio = new Desktop::Audio();
|
||||||
|
|
||||||
menu->addItem("Audio", audio);
|
menu->addItem("Audio", audio);
|
||||||
#if defined HAVE_VIDEO
|
#if defined HAVE_VIDEO
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <Wt/Dbo/SqlConnectionPool>
|
#include <Wt/Dbo/SqlConnectionPool>
|
||||||
|
|
||||||
#include "database/DatabaseHandler.hpp"
|
#include "database/DatabaseHandler.hpp"
|
||||||
#include "resource/CoverResource.hpp"
|
#include "resource/ImageResource.hpp"
|
||||||
#include "resource/TranscodeResource.hpp"
|
#include "resource/TranscodeResource.hpp"
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
@@ -40,7 +40,7 @@ class LmsApplication : public Wt::WApplication
|
|||||||
LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnectionPool& connectionPool);
|
LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnectionPool& connectionPool);
|
||||||
|
|
||||||
// Session application data
|
// Session application data
|
||||||
CoverResource* getCoverResource() { return _coverResource; }
|
ImageResource* getImageResource() { return _imageResource; }
|
||||||
TranscodeResource* getTranscodeResource() { return _transcodeResource; }
|
TranscodeResource* getTranscodeResource() { return _transcodeResource; }
|
||||||
Database::Handler& getDbHandler() { return _db;}
|
Database::Handler& getDbHandler() { return _db;}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class LmsApplication : public Wt::WApplication
|
|||||||
void createLmsUI();
|
void createLmsUI();
|
||||||
|
|
||||||
Database::Handler _db;
|
Database::Handler _db;
|
||||||
CoverResource* _coverResource;
|
ImageResource* _imageResource;
|
||||||
TranscodeResource* _transcodeResource;
|
TranscodeResource* _transcodeResource;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ Wt::Dbo::Session& DboSession();
|
|||||||
const Wt::Auth::User& CurrentAuthUser();
|
const Wt::Auth::User& CurrentAuthUser();
|
||||||
Database::User::pointer CurrentUser();
|
Database::User::pointer CurrentUser();
|
||||||
|
|
||||||
CoverResource *SessionCoverResource();
|
ImageResource *SessionImageResource();
|
||||||
TranscodeResource *SessionTranscodeResource();
|
TranscodeResource *SessionTranscodeResource();
|
||||||
|
|
||||||
} // namespace UserInterface
|
} // namespace UserInterface
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ AudioPlayer::loadTrack(Database::Track::id_type trackId)
|
|||||||
|
|
||||||
bindString("track", Wt::WString::fromUTF8(track->getName()));
|
bindString("track", Wt::WString::fromUTF8(track->getName()));
|
||||||
bindString("artist", Wt::WString::fromUTF8(track->getArtist()->getName()));
|
bindString("artist", Wt::WString::fromUTF8(track->getArtist()->getName()));
|
||||||
_cover->setImageLink(SessionCoverResource()->getTrackUrl(trackId, 64));
|
_cover->setImageLink(SessionImageResource()->getTrackUrl(trackId, 64));
|
||||||
|
|
||||||
std::string durationFormat = track->getDuration().total_seconds() < 3600 ? "%M:%S" : "%H:%M:%S";
|
std::string durationFormat = track->getDuration().total_seconds() < 3600 ? "%M:%S" : "%H:%M:%S";
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ AudioPlayer::AudioPlayer(Wt::WContainerWidget *parent)
|
|||||||
|
|
||||||
_cover = new Wt::WImage();
|
_cover = new Wt::WImage();
|
||||||
bindWidget("cover", _cover);
|
bindWidget("cover", _cover);
|
||||||
_cover->setImageLink(SessionCoverResource()->getUnknownTrackUrl(64));
|
_cover->setImageLink(SessionImageResource()->getUnknownTrackUrl(64));
|
||||||
|
|
||||||
InputRange *seekbar = new InputRange();
|
InputRange *seekbar = new InputRange();
|
||||||
seekbar->addStyleClass("mediaplayer-seekbar");
|
seekbar->addStyleClass("mediaplayer-seekbar");
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ PlayQueue::addTracks(const std::vector<Database::Track::id_type>& trackIds)
|
|||||||
_model->setData(dataRow, COLUMN_ID_TRACK_ID, track.id(), Wt::UserRole);
|
_model->setData(dataRow, COLUMN_ID_TRACK_ID, track.id(), Wt::UserRole);
|
||||||
|
|
||||||
std::string coverUrl;
|
std::string coverUrl;
|
||||||
coverUrl = LmsApplication::instance()->getCoverResource()->getTrackUrl(track.id(), 64);
|
coverUrl = SessionImageResource()->getTrackUrl(track.id(), 64);
|
||||||
|
|
||||||
_model->setData(dataRow, COLUMN_ID_COVER, coverUrl, Wt::DecorationRole);
|
_model->setData(dataRow, COLUMN_ID_COVER, coverUrl, Wt::DecorationRole);
|
||||||
_model->setData(dataRow, COLUMN_ID_COVER, std::string("playqueue-cover"), Wt::StyleClassRole);
|
_model->setData(dataRow, COLUMN_ID_COVER, std::string("playqueue-cover"), Wt::StyleClassRole);
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#include "database/Types.hpp"
|
#include "database/Types.hpp"
|
||||||
|
|
||||||
#include "resource/CoverResource.hpp"
|
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
namespace Desktop {
|
namespace Desktop {
|
||||||
|
|
||||||
|
|||||||
@@ -29,23 +29,19 @@
|
|||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
namespace Mobile {
|
namespace Mobile {
|
||||||
|
|
||||||
using namespace Database;
|
|
||||||
|
|
||||||
ArtistSearch::ArtistSearch(Wt::WString title, Wt::WContainerWidget *parent)
|
ArtistSearch::ArtistSearch(Wt::WString title, Wt::WContainerWidget *parent)
|
||||||
: Wt::WContainerWidget(parent),
|
: Wt::WContainerWidget(parent)
|
||||||
_count(0)
|
|
||||||
{
|
{
|
||||||
Wt::WTemplate* artistSearch = new Wt::WTemplate(this);
|
Wt::WTemplate* t = new Wt::WTemplate(this);
|
||||||
artistSearch->setTemplateText(Wt::WString::tr("wa-artist-search"));
|
t->setTemplateText(Wt::WString::tr("wa-artist-search"));
|
||||||
|
|
||||||
Wt::WTemplate *titleTemplate = new Wt::WTemplate(this);
|
Wt::WTemplate *titleTemplate = new Wt::WTemplate(this);
|
||||||
titleTemplate->setTemplateText(Wt::WString::tr("mobile-search-title"));
|
titleTemplate->setTemplateText(Wt::WString::tr("mobile-search-title"));
|
||||||
titleTemplate->bindString("text", title);
|
titleTemplate->bindString("text", title);
|
||||||
|
t->bindWidget("title", titleTemplate);
|
||||||
artistSearch->bindWidget("title", titleTemplate);
|
|
||||||
|
|
||||||
_contents = new Wt::WContainerWidget();
|
_contents = new Wt::WContainerWidget();
|
||||||
artistSearch->bindWidget("release-container", _contents );
|
t->bindWidget("contents", _contents );
|
||||||
|
|
||||||
_showMore = new Wt::WTemplate();
|
_showMore = new Wt::WTemplate();
|
||||||
_showMore->setTemplateText(Wt::WString::tr("mobile-search-more"));
|
_showMore->setTemplateText(Wt::WString::tr("mobile-search-more"));
|
||||||
@@ -54,15 +50,13 @@ _count(0)
|
|||||||
_showMore->clicked().connect(std::bind([=] {
|
_showMore->clicked().connect(std::bind([=] {
|
||||||
_sigShowMore.emit();
|
_sigShowMore.emit();
|
||||||
}));
|
}));
|
||||||
|
t->bindWidget("show-more", _showMore);
|
||||||
artistSearch->bindWidget("show-more", _showMore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArtistSearch::clear()
|
ArtistSearch::clear()
|
||||||
{
|
{
|
||||||
_contents->clear();
|
_contents->clear();
|
||||||
_count = 0;
|
|
||||||
_showMore->hide();
|
_showMore->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,38 +69,24 @@ ArtistSearch::search(Database::SearchFilter filter, size_t nb)
|
|||||||
addResults(nb);
|
addResults(nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
std::vector<Artist::pointer>
|
|
||||||
getArtists(SearchFilter filter, size_t offset, size_t nb, bool &moreResults)
|
|
||||||
{
|
|
||||||
std::vector<Artist::pointer> artists = Artist::getByFilter(DboSession(), filter, offset, nb + 1);
|
|
||||||
|
|
||||||
if (artists.size() == nb + 1)
|
|
||||||
{
|
|
||||||
moreResults = true;
|
|
||||||
artists.pop_back();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
moreResults = false;
|
|
||||||
|
|
||||||
return artists;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArtistSearch::addResults(std::size_t nb)
|
ArtistSearch::addResults(std::size_t nb)
|
||||||
{
|
{
|
||||||
|
using namespace Database;
|
||||||
|
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
bool moreResults;
|
bool moreResults;
|
||||||
std::vector<Artist::pointer> artists = getArtists(_filter, _count, nb, moreResults);
|
std::vector<Artist::pointer> artists = Artist::getByFilter(DboSession(), _filter, _contents->count(), nb, moreResults);
|
||||||
|
|
||||||
for (Artist::pointer artist : artists)
|
for (Artist::pointer artist : artists)
|
||||||
{
|
{
|
||||||
Wt::WTemplate* res = new Wt::WTemplate(_contents);
|
Wt::WTemplate* res = new Wt::WTemplate(_contents);
|
||||||
res->setTemplateText(Wt::WString::tr("wa-artist-res"));
|
res->setTemplateText(Wt::WString::tr("wa-artist-search-res"));
|
||||||
|
|
||||||
Wt::WAnchor *coverAnchor = new Wt::WAnchor(Wt::WLink(Wt:: WLink::InternalPath, "/audio/artist/" + std::to_string(artist.id())));
|
Wt::WAnchor *coverAnchor = new Wt::WAnchor(Wt::WLink(Wt:: WLink::InternalPath, "/audio/artist/" + std::to_string(artist.id())));
|
||||||
Wt::WImage *artistImg = new Wt::WImage(coverAnchor);
|
Wt::WImage *artistImg = new Wt::WImage(coverAnchor);
|
||||||
|
artistImg->setImageLink( SessionImageResource()->getArtistUrl(artist.id(), 512));
|
||||||
artistImg->setStyleClass("center-block"); // TODO move in css?
|
artistImg->setStyleClass("center-block"); // TODO move in css?
|
||||||
artistImg->setStyleClass("release_res_shadow release_img-responsive"); // TODO move in css?
|
artistImg->setStyleClass("release_res_shadow release_img-responsive"); // TODO move in css?
|
||||||
|
|
||||||
@@ -114,8 +94,6 @@ ArtistSearch::addResults(std::size_t nb)
|
|||||||
res->bindString("name", Wt::WString::fromUTF8(artist->getName(), Wt::PlainText));
|
res->bindString("name", Wt::WString::fromUTF8(artist->getName(), Wt::PlainText));
|
||||||
}
|
}
|
||||||
|
|
||||||
_count += artists.size();
|
|
||||||
|
|
||||||
if (moreResults)
|
if (moreResults)
|
||||||
_showMore->show();
|
_showMore->show();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Wt/WApplication>
|
#include "LmsApplication.hpp"
|
||||||
|
|
||||||
#include "utils/Utils.hpp"
|
#include "utils/Utils.hpp"
|
||||||
|
|
||||||
@@ -45,11 +45,22 @@ ArtistView::ArtistView(Wt::WContainerWidget *parent)
|
|||||||
|
|
||||||
Artist::id_type id;
|
Artist::id_type id;
|
||||||
if (readAs(strId, id))
|
if (readAs(strId, id))
|
||||||
releases->search(SearchFilter::ById(SearchFilter::Field::Artist, id), 20);
|
{
|
||||||
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
|
auto artist = Artist::getById(DboSession(), id);
|
||||||
|
releases->search(SearchFilter::ById(SearchFilter::Field::Artist, id), 20, artist ? Wt::WString::fromUTF8(artist->getName()) : "Unknown artist");
|
||||||
|
}
|
||||||
|
|
||||||
}, std::placeholders::_1));
|
}, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wt::WLink
|
||||||
|
ArtistView::getLink(Database::Artist::id_type id)
|
||||||
|
{
|
||||||
|
return Wt::WLink(Wt::WLink::InternalPath, "/audio/artist/" + std::to_string(id));
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace Mobile
|
} //namespace Mobile
|
||||||
} //namespace UserInterface
|
} //namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
|
#include <Wt/WLink>
|
||||||
|
|
||||||
|
#include "database/Types.hpp"
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
namespace Mobile {
|
namespace Mobile {
|
||||||
@@ -27,6 +30,9 @@ namespace Mobile {
|
|||||||
class ArtistView : public Wt::WContainerWidget
|
class ArtistView : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static Wt::WLink getLink(Database::Artist::id_type id);
|
||||||
|
|
||||||
ArtistView(Wt::WContainerWidget *parent = 0);
|
ArtistView(Wt::WContainerWidget *parent = 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,10 +29,11 @@
|
|||||||
#include "audio/AudioPlayer.hpp"
|
#include "audio/AudioPlayer.hpp"
|
||||||
#include "LmsApplication.hpp"
|
#include "LmsApplication.hpp"
|
||||||
|
|
||||||
#include "ArtistSearchView.hpp"
|
|
||||||
#include "PreviewSearchView.hpp"
|
#include "PreviewSearchView.hpp"
|
||||||
#include "ReleaseSearch.hpp"
|
#include "ArtistSearchView.hpp"
|
||||||
#include "TrackSearch.hpp"
|
#include "ReleaseSearchView.hpp"
|
||||||
|
#include "TrackSearchView.hpp"
|
||||||
|
|
||||||
#include "ArtistView.hpp"
|
#include "ArtistView.hpp"
|
||||||
#include "ReleaseView.hpp"
|
#include "ReleaseView.hpp"
|
||||||
|
|
||||||
@@ -84,8 +85,8 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
// Same order as WidgetIdxXXX
|
// Same order as WidgetIdxXXX
|
||||||
stack->addWidget(new PreviewSearchView());
|
stack->addWidget(new PreviewSearchView());
|
||||||
stack->addWidget(new ArtistSearchView());
|
stack->addWidget(new ArtistSearchView());
|
||||||
stack->addWidget(new ReleaseSearch());
|
stack->addWidget(new ReleaseSearchView());
|
||||||
stack->addWidget(new TrackSearch());
|
stack->addWidget(new TrackSearchView());
|
||||||
stack->addWidget(new ArtistView());
|
stack->addWidget(new ArtistView());
|
||||||
stack->addWidget(new ReleaseView());
|
stack->addWidget(new ReleaseView());
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,14 @@ PreviewSearchView::PreviewSearchView(Wt::WContainerWidget* parent)
|
|||||||
wApp->setInternalPath(path, true);
|
wApp->setInternalPath(path, true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
trackSearch->showMore().connect(std::bind([=]
|
||||||
|
{
|
||||||
|
std::string path = wApp->internalPath();
|
||||||
|
path.replace(0, pathPrefix.length(), "/audio/search/track");
|
||||||
|
|
||||||
|
wApp->setInternalPath(path, true);
|
||||||
|
}));
|
||||||
|
|
||||||
wApp->internalPathChanged().connect(std::bind([=] (std::string path)
|
wApp->internalPathChanged().connect(std::bind([=] (std::string path)
|
||||||
{
|
{
|
||||||
if (!wApp->internalPathMatches(pathPrefix))
|
if (!wApp->internalPathMatches(pathPrefix))
|
||||||
@@ -68,7 +76,7 @@ PreviewSearchView::PreviewSearchView(Wt::WContainerWidget* parent)
|
|||||||
std::vector<std::string> keywords = searchPathToSearchKeywords(path.substr(pathPrefix.length()));
|
std::vector<std::string> keywords = searchPathToSearchKeywords(path.substr(pathPrefix.length()));
|
||||||
|
|
||||||
artistSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Artist, keywords), SEARCH_NB_ITEMS);
|
artistSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Artist, keywords), SEARCH_NB_ITEMS);
|
||||||
releaseSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Release, keywords), SEARCH_NB_ITEMS);
|
releaseSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Release, keywords), SEARCH_NB_ITEMS, "Releases");
|
||||||
trackSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Track, keywords), SEARCH_NB_ITEMS);
|
trackSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Track, keywords), SEARCH_NB_ITEMS);
|
||||||
|
|
||||||
}, std::placeholders::_1));
|
}, std::placeholders::_1));
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include "LmsApplication.hpp"
|
#include "LmsApplication.hpp"
|
||||||
|
|
||||||
#include "ReleaseSearch.hpp"
|
#include "ReleaseSearch.hpp"
|
||||||
|
#include "ReleaseView.hpp"
|
||||||
|
#include "ArtistView.hpp"
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
namespace Mobile {
|
namespace Mobile {
|
||||||
@@ -33,112 +35,94 @@ namespace Mobile {
|
|||||||
using namespace Database;
|
using namespace Database;
|
||||||
|
|
||||||
ReleaseSearch::ReleaseSearch(Wt::WContainerWidget *parent)
|
ReleaseSearch::ReleaseSearch(Wt::WContainerWidget *parent)
|
||||||
: Wt::WContainerWidget(parent),
|
: Wt::WContainerWidget(parent)
|
||||||
_resCount(0)
|
|
||||||
{
|
{
|
||||||
Wt::WTemplate* title = new Wt::WTemplate(this);
|
Wt::WTemplate* t = new Wt::WTemplate(this);
|
||||||
title->setTemplateText(Wt::WString::tr("mobile-search-title"));
|
t->setTemplateText(Wt::WString::tr("wa-release-search"));
|
||||||
|
|
||||||
title->bindWidget("text", new Wt::WText("Releases", Wt::PlainText));
|
Wt::WTemplate *titleTemplate = new Wt::WTemplate(this);
|
||||||
|
titleTemplate->setTemplateText(Wt::WString::tr("mobile-search-title"));
|
||||||
|
|
||||||
|
_title = new Wt::WText();
|
||||||
|
titleTemplate->bindWidget("text", _title);
|
||||||
|
|
||||||
|
t->bindWidget("title", titleTemplate);
|
||||||
|
|
||||||
Wt::WTemplate* releaseWrapper = new Wt::WTemplate(this);
|
|
||||||
releaseWrapper->setTemplateText(Wt::WString::tr("wa-release-wrapper"));
|
|
||||||
_contents = new Wt::WContainerWidget();
|
_contents = new Wt::WContainerWidget();
|
||||||
releaseWrapper->bindWidget("contents", _contents );
|
t->bindWidget("contents", _contents );
|
||||||
|
|
||||||
|
_showMore = new Wt::WTemplate();
|
||||||
|
_showMore->setTemplateText(Wt::WString::tr("mobile-search-more"));
|
||||||
|
_showMore->bindString("text", "Tap to show more results...");
|
||||||
|
_showMore->hide();
|
||||||
|
_showMore->clicked().connect(std::bind([=] {
|
||||||
|
_sigShowMore.emit();
|
||||||
|
}));
|
||||||
|
|
||||||
|
t->bindWidget("show-more", _showMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ReleaseSearch::clear()
|
ReleaseSearch::clear()
|
||||||
{
|
{
|
||||||
while (count() > 1)
|
_contents->clear();
|
||||||
removeWidget(this->widget(1));
|
_showMore->hide();
|
||||||
|
|
||||||
_resCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ReleaseSearch::search(Database::SearchFilter filter, size_t max)
|
ReleaseSearch::search(Database::SearchFilter filter, size_t max, Wt::WString title)
|
||||||
{
|
{
|
||||||
|
_filter = filter;
|
||||||
|
_title->setText(title);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
addResults(filter, max);
|
addResults(max);
|
||||||
}
|
|
||||||
|
|
||||||
static Wt::WString
|
|
||||||
getArtistFromRelease(Release::pointer release)
|
|
||||||
{
|
|
||||||
auto artists = Artist::getByFilter(DboSession(),
|
|
||||||
SearchFilter::ById(SearchFilter::Field::Release, release.id()), -1, 2);
|
|
||||||
|
|
||||||
if (artists.size() > 1)
|
|
||||||
return Wt::WString::fromUTF8("Various artists", Wt::PlainText);
|
|
||||||
else
|
|
||||||
return Wt::WString::fromUTF8(artists.front()->getName(), Wt::PlainText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ReleaseSearch::addResults(Database::SearchFilter filter, size_t nb)
|
ReleaseSearch::addResults(size_t nb)
|
||||||
{
|
{
|
||||||
using namespace Database;
|
using namespace Database;
|
||||||
|
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
std::vector<Release::pointer> releases = Release::getByFilter(DboSession(), filter, _resCount, nb + 1);
|
bool moreResults;
|
||||||
|
std::vector<Release::pointer> releases = Release::getByFilter(DboSession(), _filter, _contents->count(), nb, moreResults);
|
||||||
bool expectMoreResults;
|
|
||||||
if (releases.size() == nb + 1)
|
|
||||||
{
|
|
||||||
expectMoreResults = true;
|
|
||||||
releases.pop_back();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
expectMoreResults = false;
|
|
||||||
|
|
||||||
for (Release::pointer release : releases)
|
for (Release::pointer release : releases)
|
||||||
{
|
{
|
||||||
Wt::WTemplate* releaseWidget = new Wt::WTemplate(this);
|
Wt::WTemplate* res = new Wt::WTemplate(_contents);
|
||||||
releaseWidget->setTemplateText(Wt::WString::tr("wa-release-res"));
|
res->setTemplateText(Wt::WString::tr("wa-release-search-res"));
|
||||||
|
|
||||||
Wt::WAnchor *coverAnchor = new Wt::WAnchor(Wt::WLink(Wt:: WLink::InternalPath, "/audio/release/" + std::to_string(release.id())));
|
Wt::WAnchor *coverAnchor = new Wt::WAnchor(ReleaseView::getLink(release.id()));
|
||||||
Wt::WImage *cover = new Wt::WImage(coverAnchor);
|
Wt::WImage *cover = new Wt::WImage(coverAnchor);
|
||||||
cover->setStyleClass("center-block");
|
cover->setStyleClass("center-block");
|
||||||
cover->setImageLink( Wt::WLink( LmsApplication::instance()->getCoverResource()->getReleaseUrl(release.id(), 512)));
|
cover->setImageLink( SessionImageResource()->getReleaseUrl(release.id(), 512));
|
||||||
cover->setStyleClass("release_res_shadow release_img-responsive"); // TODO move?
|
cover->setStyleClass("release_res_shadow release_img-responsive"); // TODO move?
|
||||||
|
|
||||||
releaseWidget->bindWidget("cover", coverAnchor);
|
res->bindWidget("cover", coverAnchor);
|
||||||
releaseWidget->bindWidget("name", new Wt::WText(Wt::WString::fromUTF8(release->getName()), Wt::PlainText));
|
res->bindWidget("name", new Wt::WText(Wt::WString::fromUTF8(release->getName()), Wt::PlainText));
|
||||||
releaseWidget->bindString("release_name", Wt::WString::fromUTF8(release->getName()), Wt::PlainText);
|
res->bindString("release_name", Wt::WString::fromUTF8(release->getName()), Wt::PlainText);
|
||||||
|
|
||||||
|
|
||||||
auto artists = Artist::getByFilter(DboSession(),
|
auto artists = Artist::getByFilter(DboSession(),
|
||||||
SearchFilter::ById(SearchFilter::Field::Release, release.id()), -1, 2);
|
SearchFilter::ById(SearchFilter::Field::Release, release.id()), -1, 2);
|
||||||
if (artists.size() == 1)
|
if (artists.size() == 1)
|
||||||
{
|
{
|
||||||
Wt::WAnchor *artistAnchor = new Wt::WAnchor(Wt::WLink(Wt:: WLink::InternalPath, "/audio/artist/" + std::to_string(artists.front().id())));
|
Wt::WAnchor *artistAnchor = new Wt::WAnchor(ArtistView::getLink(artists.front().id()));
|
||||||
Wt::WText *artist = new Wt::WText(artistAnchor);
|
Wt::WText *artist = new Wt::WText(artistAnchor);
|
||||||
artist->setText(Wt::WString::fromUTF8(artists.front()->getName(), Wt::PlainText));
|
artist->setText(Wt::WString::fromUTF8(artists.front()->getName(), Wt::PlainText));
|
||||||
releaseWidget->bindWidget("artist", artistAnchor);
|
res->bindWidget("artist", artistAnchor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
releaseWidget->bindWidget("artist", new Wt::WText(Wt::WString::fromUTF8("Various Artists", Wt::PlainText)));
|
res->bindWidget("artist", new Wt::WText(Wt::WString::fromUTF8("Various Artists", Wt::PlainText)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_resCount += releases.size();;
|
if (moreResults)
|
||||||
|
_showMore->show();
|
||||||
|
else
|
||||||
|
_showMore->hide();
|
||||||
|
|
||||||
if (expectMoreResults)
|
|
||||||
{
|
|
||||||
Wt::WTemplate* moreRes = new Wt::WTemplate(this);
|
|
||||||
moreRes->setTemplateText(Wt::WString::tr("mobile-search-more"));
|
|
||||||
|
|
||||||
moreRes->bindWidget("text", new Wt::WText("Tap to show more results..."));
|
|
||||||
|
|
||||||
moreRes->clicked().connect(std::bind([=] {
|
|
||||||
_sigMoreReleasesSelected();
|
|
||||||
removeWidget(moreRes);
|
|
||||||
|
|
||||||
addResults(filter, 20);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Mobile
|
} // namespace Mobile
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
#include <Wt/WSignal>
|
#include <Wt/WSignal>
|
||||||
|
#include <Wt/WText>
|
||||||
|
|
||||||
#include "database/SearchFilter.hpp"
|
#include "database/SearchFilter.hpp"
|
||||||
#include "database/Types.hpp"
|
#include "database/Types.hpp"
|
||||||
@@ -34,22 +35,23 @@ class ReleaseSearch : public Wt::WContainerWidget
|
|||||||
|
|
||||||
ReleaseSearch(Wt::WContainerWidget *parent = 0);
|
ReleaseSearch(Wt::WContainerWidget *parent = 0);
|
||||||
|
|
||||||
void search(Database::SearchFilter filter, size_t nb);
|
void search(Database::SearchFilter filter, std::size_t nb, Wt::WString title);
|
||||||
|
void addResults(std::size_t nb);
|
||||||
|
|
||||||
// Slots
|
// Slots
|
||||||
Wt::Signal<Database::Release::id_type>& releaseSelected() { return _sigReleaseSelected;}
|
Wt::Signal<void>& showMore() { return _sigShowMore;}
|
||||||
Wt::Signal<void>& moreReleasesSelected() { return _sigMoreReleasesSelected;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Wt::Signal<Database::Release::id_type> _sigReleaseSelected;
|
Wt::Signal<void> _sigShowMore;
|
||||||
Wt::Signal<void> _sigMoreReleasesSelected;
|
|
||||||
|
|
||||||
void clear(void);
|
void clear(void);
|
||||||
void addResults(Database::SearchFilter filter, size_t nb);
|
|
||||||
|
|
||||||
Wt::WContainerWidget* _contents;
|
Wt::WTemplate* _showMore;
|
||||||
std::size_t _resCount;
|
Database::SearchFilter _filter;
|
||||||
|
Wt::WContainerWidget* _contents;
|
||||||
|
Wt::WText* _title;
|
||||||
|
std::size_t _count;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Mobile
|
} // namespace Mobile
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Emeric Poupon
|
||||||
|
*
|
||||||
|
* This file is part of LMS.
|
||||||
|
*
|
||||||
|
* LMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Wt/WApplication>
|
||||||
|
|
||||||
|
#include "SearchUtils.hpp"
|
||||||
|
|
||||||
|
#include "ReleaseSearch.hpp"
|
||||||
|
|
||||||
|
#include "ReleaseSearchView.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
namespace Mobile {
|
||||||
|
|
||||||
|
#define SEARCH_NB_ITEMS 20
|
||||||
|
|
||||||
|
using namespace Database;
|
||||||
|
|
||||||
|
ReleaseSearchView::ReleaseSearchView(Wt::WContainerWidget* parent)
|
||||||
|
{
|
||||||
|
ReleaseSearch* artistSearch = new ReleaseSearch(this);
|
||||||
|
artistSearch->showMore().connect(std::bind([=] {
|
||||||
|
artistSearch->addResults(SEARCH_NB_ITEMS);
|
||||||
|
}));
|
||||||
|
|
||||||
|
wApp->internalPathChanged().connect(std::bind([=] (std::string path)
|
||||||
|
{
|
||||||
|
const std::string pathPrefix = "/audio/search/release";
|
||||||
|
|
||||||
|
if (!wApp->internalPathMatches(pathPrefix))
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::vector<std::string> keywords = searchPathToSearchKeywords(path.substr(pathPrefix.length()));
|
||||||
|
|
||||||
|
artistSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Release, keywords), SEARCH_NB_ITEMS, "Releases");
|
||||||
|
|
||||||
|
}, std::placeholders::_1));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Mobile
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Emeric Poupon
|
||||||
|
*
|
||||||
|
* This file is part of LMS.
|
||||||
|
*
|
||||||
|
* LMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Wt/WContainerWidget>
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
namespace Mobile {
|
||||||
|
|
||||||
|
class ReleaseSearchView : public Wt::WContainerWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
ReleaseSearchView(Wt::WContainerWidget* parent = 0);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Mobile
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ ReleaseView::addResults(size_t nb)
|
|||||||
|
|
||||||
Wt::WImage *cover = new Wt::WImage();
|
Wt::WImage *cover = new Wt::WImage();
|
||||||
cover->setStyleClass ("center-block img-responsive"); // TODO move to CSS?
|
cover->setStyleClass ("center-block img-responsive"); // TODO move to CSS?
|
||||||
cover->setImageLink(Wt::WLink (LmsApplication::instance()->getCoverResource()->getReleaseUrl(release.id(), 512)));
|
cover->setImageLink(Wt::WLink (LmsApp->getImageResource()->getReleaseUrl(release.id(), 512)));
|
||||||
|
|
||||||
releaseContainer->bindWidget("cover", cover);
|
releaseContainer->bindWidget("cover", cover);
|
||||||
releaseContainer->bindString("artist-name", getArtistNameFromRelease(release), Wt::PlainText);
|
releaseContainer->bindString("artist-name", getArtistNameFromRelease(release), Wt::PlainText);
|
||||||
@@ -210,5 +210,11 @@ ReleaseView::addResults(size_t nb)
|
|||||||
_showMore->hide();
|
_showMore->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wt::WLink
|
||||||
|
ReleaseView::getLink(Database::Release::id_type id)
|
||||||
|
{
|
||||||
|
return Wt::WLink(Wt::WLink::InternalPath, "/audio/release/" + std::to_string(id));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Mobile
|
} // namespace Mobile
|
||||||
} // namespace UserInterface
|
} // namespace UserInterface
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
#include <Wt/WSignal>
|
#include <Wt/WSignal>
|
||||||
|
|
||||||
#include "resource/CoverResource.hpp"
|
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
namespace Mobile {
|
namespace Mobile {
|
||||||
|
|
||||||
@@ -31,6 +29,8 @@ class ReleaseView : public Wt::WContainerWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static Wt::WLink getLink(Database::Release::id_type id);
|
||||||
|
|
||||||
ReleaseView(Wt::WContainerWidget *parent = 0);
|
ReleaseView(Wt::WContainerWidget *parent = 0);
|
||||||
|
|
||||||
void search(Database::SearchFilter filter, size_t nb);
|
void search(Database::SearchFilter filter, size_t nb);
|
||||||
|
|||||||
@@ -36,37 +36,32 @@ using namespace Database;
|
|||||||
TrackSearch::TrackSearch(Wt::WContainerWidget *parent)
|
TrackSearch::TrackSearch(Wt::WContainerWidget *parent)
|
||||||
: Wt::WContainerWidget(parent)
|
: Wt::WContainerWidget(parent)
|
||||||
{
|
{
|
||||||
Wt::WTemplate* wrapper = new Wt::WTemplate(this);
|
Wt::WTemplate* t = new Wt::WTemplate(this);
|
||||||
wrapper->setTemplateText(Wt::WString::tr("wa-track-wrapper"));
|
t->setTemplateText(Wt::WString::tr("wa-track-search"));
|
||||||
|
|
||||||
Wt::WTemplate* title = new Wt::WTemplate(this);
|
Wt::WTemplate* title = new Wt::WTemplate(this);
|
||||||
wrapper->bindWidget("title", title);
|
|
||||||
|
|
||||||
title->setTemplateText(Wt::WString::tr("mobile-search-title"));
|
title->setTemplateText(Wt::WString::tr("mobile-search-title"));
|
||||||
title->bindString("text", "Tracks", Wt::PlainText);
|
title->bindString("text", "Tracks", Wt::PlainText);
|
||||||
|
t->bindWidget("title", title);
|
||||||
|
|
||||||
_container = new Wt::WContainerWidget();
|
_contents = new Wt::WContainerWidget();
|
||||||
wrapper->bindWidget("track-container", _container);
|
t->bindWidget("contents", _contents);
|
||||||
|
|
||||||
_showMore = new Wt::WTemplate();
|
_showMore = new Wt::WTemplate();
|
||||||
wrapper->bindWidget("show-more", _showMore);
|
|
||||||
|
|
||||||
_showMore->setTemplateText(Wt::WString::tr("mobile-search-more"));
|
_showMore->setTemplateText(Wt::WString::tr("mobile-search-more"));
|
||||||
_showMore->bindString("text", "Tap to show more results...");
|
_showMore->bindString("text", "Tap to show more results...");
|
||||||
_showMore->hide();
|
_showMore->hide();
|
||||||
_showMore->clicked().connect(std::bind([=] {
|
_showMore->clicked().connect(std::bind([=] {
|
||||||
_sigMoreSelected();
|
_sigShowMore.emit();
|
||||||
addResults(20);
|
addResults(20);
|
||||||
}));
|
}));
|
||||||
|
t->bindWidget("show-more", _showMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackSearch::clear()
|
TrackSearch::clear()
|
||||||
{
|
{
|
||||||
// Flush the release container
|
_contents->clear();
|
||||||
_container->clear();
|
|
||||||
|
|
||||||
_nbTracks = 0;
|
|
||||||
_showMore->hide();
|
_showMore->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,43 +74,25 @@ TrackSearch::search(SearchFilter filter, size_t nb)
|
|||||||
addResults(nb);
|
addResults(nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
std::vector<Track::pointer >
|
|
||||||
getTracks(SearchFilter filter, size_t offset, size_t nb, bool &moreResults)
|
|
||||||
{
|
|
||||||
std::vector<Track::pointer > tracks = Track::getByFilter(DboSession(), filter, offset, nb + 1);
|
|
||||||
|
|
||||||
if (tracks.size() == nb + 1)
|
|
||||||
{
|
|
||||||
moreResults = true;
|
|
||||||
tracks.pop_back();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
moreResults = false;
|
|
||||||
|
|
||||||
return tracks;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackSearch::addResults(size_t nb)
|
TrackSearch::addResults(size_t nb)
|
||||||
{
|
{
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
bool moreResults;
|
bool moreResults;
|
||||||
std::vector<Track::pointer > tracks = getTracks(_filter, _nbTracks, nb, moreResults);
|
std::vector<Track::pointer > tracks = Track::getByFilter(DboSession(), _filter, _contents->count(), nb, moreResults);
|
||||||
|
|
||||||
for (Track::pointer track : tracks)
|
for (Track::pointer track : tracks)
|
||||||
{
|
{
|
||||||
Wt::WTemplate* trackRes = new Wt::WTemplate(_container);
|
Wt::WTemplate* res = new Wt::WTemplate(_contents);
|
||||||
trackRes->setTemplateText(Wt::WString::tr("wa-track"));
|
res->setTemplateText(Wt::WString::tr("wa-track-search-res"));
|
||||||
|
|
||||||
Wt::WImage *cover = new Wt::WImage();
|
Wt::WImage *cover = new Wt::WImage();
|
||||||
cover->setStyleClass ("center-block img-responsive");
|
cover->setStyleClass ("center-block img-responsive");
|
||||||
cover->setImageLink(Wt::WLink(LmsApplication::instance()->getCoverResource()->getTrackUrl(track.id(), 128)));
|
cover->setImageLink(SessionImageResource()->getTrackUrl(track.id(), 64));
|
||||||
trackRes->bindWidget("cover", cover);
|
res->bindWidget("cover", cover);
|
||||||
|
res->bindString("track-name", Wt::WString::fromUTF8(track->getName()), Wt::PlainText);
|
||||||
trackRes->bindString("track-name", Wt::WString::fromUTF8(track->getName()), Wt::PlainText);
|
res->bindString("artist-name", Wt::WString::fromUTF8(track->getArtist()->getName()), Wt::PlainText);
|
||||||
trackRes->bindString("artist-name", Wt::WString::fromUTF8(track->getArtist()->getName()), Wt::PlainText);
|
|
||||||
|
|
||||||
Wt::WText *playBtn = new Wt::WText("Play", Wt::PlainText);
|
Wt::WText *playBtn = new Wt::WText("Play", Wt::PlainText);
|
||||||
playBtn->setStyleClass("center-block"); // TODO move to CSS?
|
playBtn->setStyleClass("center-block"); // TODO move to CSS?
|
||||||
@@ -123,8 +100,7 @@ TrackSearch::addResults(size_t nb)
|
|||||||
_sigTrackPlay.emit(track.id());
|
_sigTrackPlay.emit(track.id());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
trackRes->bindWidget("btn", playBtn);
|
res->bindWidget("btn", playBtn);
|
||||||
_nbTracks++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moreResults)
|
if (moreResults)
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
#include <Wt/WSignal>
|
#include <Wt/WSignal>
|
||||||
|
|
||||||
#include "database/Types.hpp"
|
|
||||||
#include "database/SearchFilter.hpp"
|
#include "database/SearchFilter.hpp"
|
||||||
|
#include "database/Types.hpp"
|
||||||
|
|
||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
namespace Mobile {
|
namespace Mobile {
|
||||||
@@ -34,25 +34,23 @@ class TrackSearch : public Wt::WContainerWidget
|
|||||||
|
|
||||||
TrackSearch(Wt::WContainerWidget *parent = 0);
|
TrackSearch(Wt::WContainerWidget *parent = 0);
|
||||||
|
|
||||||
|
void addResults(size_t nb);
|
||||||
void search(Database::SearchFilter filter, size_t nb);
|
void search(Database::SearchFilter filter, size_t nb);
|
||||||
|
|
||||||
// Slots
|
// Slots
|
||||||
|
Wt::Signal<void>& showMore() { return _sigShowMore;}
|
||||||
Wt::Signal<Database::Track::id_type>& trackPlay() { return _sigTrackPlay;}
|
Wt::Signal<Database::Track::id_type>& trackPlay() { return _sigTrackPlay;}
|
||||||
Wt::Signal<void>& moreSelected() { return _sigMoreSelected;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Wt::Signal<void> _sigShowMore;
|
||||||
Wt::Signal<Database::Track::id_type> _sigTrackPlay;
|
Wt::Signal<Database::Track::id_type> _sigTrackPlay;
|
||||||
Wt::Signal<void> _sigMoreSelected;
|
|
||||||
|
|
||||||
void clear(void);
|
void clear(void);
|
||||||
void addResults(size_t nb);
|
|
||||||
|
|
||||||
Wt::WTemplate* _showMore;
|
|
||||||
|
|
||||||
|
Wt::WTemplate* _showMore;
|
||||||
Database::SearchFilter _filter;
|
Database::SearchFilter _filter;
|
||||||
std::size_t _nbTracks;
|
Wt::WContainerWidget* _contents;
|
||||||
Wt::WContainerWidget* _container;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Mobile
|
} // namespace Mobile
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Emeric Poupon
|
||||||
|
*
|
||||||
|
* This file is part of LMS.
|
||||||
|
*
|
||||||
|
* LMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Wt/WApplication>
|
||||||
|
#include <Wt/WText>
|
||||||
|
|
||||||
|
#include "logger/Logger.hpp"
|
||||||
|
#include "SearchUtils.hpp"
|
||||||
|
|
||||||
|
#include "TrackSearch.hpp"
|
||||||
|
|
||||||
|
#include "TrackSearchView.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
namespace Mobile {
|
||||||
|
|
||||||
|
#define SEARCH_NB_ITEMS 20
|
||||||
|
|
||||||
|
using namespace Database;
|
||||||
|
|
||||||
|
TrackSearchView::TrackSearchView(Wt::WContainerWidget* parent)
|
||||||
|
{
|
||||||
|
TrackSearch* trackSearch = new TrackSearch(this);
|
||||||
|
trackSearch->showMore().connect(std::bind([=] {
|
||||||
|
trackSearch->addResults(SEARCH_NB_ITEMS);
|
||||||
|
}));
|
||||||
|
|
||||||
|
wApp->internalPathChanged().connect(std::bind([=] (std::string path)
|
||||||
|
{
|
||||||
|
const std::string pathPrefix = "/audio/search/track";
|
||||||
|
|
||||||
|
if (!wApp->internalPathMatches(pathPrefix))
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::vector<std::string> keywords = searchPathToSearchKeywords(path.substr(pathPrefix.length()));
|
||||||
|
|
||||||
|
trackSearch->search(SearchFilter::ByNameAnd(SearchFilter::Field::Track, keywords), SEARCH_NB_ITEMS);
|
||||||
|
|
||||||
|
}, std::placeholders::_1));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Mobile
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Emeric Poupon
|
||||||
|
*
|
||||||
|
* This file is part of LMS.
|
||||||
|
*
|
||||||
|
* LMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Wt/WContainerWidget>
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
namespace Mobile {
|
||||||
|
|
||||||
|
class TrackSearchView : public Wt::WContainerWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
TrackSearchView(Wt::WContainerWidget* parent = 0);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Mobile
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 Emeric Poupon
|
|
||||||
*
|
|
||||||
* This file is part of LMS.
|
|
||||||
*
|
|
||||||
* LMS is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* LMS is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Wt/WApplication>
|
|
||||||
#include <Wt/Http/Response>
|
|
||||||
|
|
||||||
#include "logger/Logger.hpp"
|
|
||||||
#include "LmsApplication.hpp"
|
|
||||||
|
|
||||||
#include "cover/CoverArtGrabber.hpp"
|
|
||||||
|
|
||||||
#include "CoverResource.hpp"
|
|
||||||
|
|
||||||
namespace UserInterface {
|
|
||||||
|
|
||||||
const std::string CoverResource::unknownCoverPath = "/images/unknown-cover.jpg";
|
|
||||||
|
|
||||||
CoverResource::CoverResource(Database::Handler& db, Wt::WObject *parent)
|
|
||||||
: Wt::WResource(parent),
|
|
||||||
_db(db)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CoverResource::~CoverResource()
|
|
||||||
{
|
|
||||||
beingDeleted();
|
|
||||||
}
|
|
||||||
|
|
||||||
Image::Image
|
|
||||||
CoverResource::getDefaultCover(std::size_t size)
|
|
||||||
{
|
|
||||||
std::unique_lock<std::mutex> lock(_mutex);
|
|
||||||
|
|
||||||
auto itCover = _defaultCovers.find(size);
|
|
||||||
if (itCover == _defaultCovers.end())
|
|
||||||
{
|
|
||||||
// Load default cover art for this size
|
|
||||||
Image::Image image;
|
|
||||||
|
|
||||||
if (!image.load( Wt::WApplication::instance()->docRoot() + unknownCoverPath ))
|
|
||||||
throw std::runtime_error("Cannot read default cover file");
|
|
||||||
|
|
||||||
image.scale(size);
|
|
||||||
|
|
||||||
auto res = _defaultCovers.insert(std::make_pair(size, image));
|
|
||||||
itCover = res.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
return itCover->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
CoverResource::getReleaseUrl(Database::Release::id_type releaseId, std::size_t size) const
|
|
||||||
{
|
|
||||||
return url() + "&releaseid=" + std::to_string(releaseId) + "&size=" + std::to_string(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
CoverResource::getTrackUrl(Database::Track::id_type trackId, std::size_t size) const
|
|
||||||
{
|
|
||||||
return url() + "&trackid=" + std::to_string(trackId) + "&size=" + std::to_string(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
CoverResource::getUnknownTrackUrl(size_t size) const
|
|
||||||
{
|
|
||||||
return url() + "&size=" + std::to_string(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CoverResource::putCover(Wt::Http::Response& response, Image::Image cover)
|
|
||||||
{
|
|
||||||
std::vector<unsigned char> data;
|
|
||||||
|
|
||||||
cover.save(data, Image::Format::JPEG);
|
|
||||||
|
|
||||||
response.setMimeType( Image::format_to_mimeType(Image::Format::JPEG) );
|
|
||||||
response.out().write(reinterpret_cast<const char *>(&data[0]), data.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CoverResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response)
|
|
||||||
{
|
|
||||||
// Retrieve parameters
|
|
||||||
const std::string *trackIdStr = request.getParameter("trackid");
|
|
||||||
const std::string *releaseIdStr = request.getParameter("releaseid");
|
|
||||||
const std::string *sizeStr = request.getParameter("size");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::vector<Image::Image> covers;
|
|
||||||
|
|
||||||
// Mandatory parameter size
|
|
||||||
if (!sizeStr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::size_t size = std::stol(*sizeStr);
|
|
||||||
if (size > maxSize)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (trackIdStr)
|
|
||||||
{
|
|
||||||
Database::Track::id_type trackId = std::stol(*trackIdStr);
|
|
||||||
boost::filesystem::path path;
|
|
||||||
Database::Track::CoverType coverType = Database::Track::CoverType::None;
|
|
||||||
|
|
||||||
{
|
|
||||||
// transactions are not thread safe
|
|
||||||
Wt::WApplication::UpdateLock lock(LmsApplication::instance());
|
|
||||||
|
|
||||||
Wt::Dbo::Transaction transaction(_db.getSession());
|
|
||||||
|
|
||||||
Database::Track::pointer track = Database::Track::getById(_db.getSession(), trackId);
|
|
||||||
if (track)
|
|
||||||
{
|
|
||||||
coverType = track->getCoverType();
|
|
||||||
path = track->getPath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (coverType)
|
|
||||||
{
|
|
||||||
case Database::Track::CoverType::Embedded:
|
|
||||||
covers = CoverArt::Grabber::instance().getFromTrack(path);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Database::Track::CoverType::None:
|
|
||||||
covers = CoverArt::Grabber::instance().getFromDirectory(path.parent_path());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (releaseIdStr)
|
|
||||||
{
|
|
||||||
Database::Release::id_type releaseId = std::stol(*releaseIdStr);
|
|
||||||
|
|
||||||
// transactions are not thread safe
|
|
||||||
Wt::WApplication::UpdateLock lock(LmsApplication::instance());
|
|
||||||
Wt::Dbo::Transaction transaction(_db.getSession());
|
|
||||||
|
|
||||||
covers = CoverArt::Grabber::instance().getFromRelease(_db.getSession(), releaseId);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Image::Image& cover : covers)
|
|
||||||
{
|
|
||||||
if (cover.scale(size))
|
|
||||||
{
|
|
||||||
putCover(response, cover);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no cover found, just send default one
|
|
||||||
putCover(response, getDefaultCover(size));
|
|
||||||
}
|
|
||||||
catch (std::invalid_argument& e)
|
|
||||||
{
|
|
||||||
LMS_LOG(UI, ERROR) << "Invalid argument: " << e.what();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace UserInterface
|
|
||||||
@@ -0,0 +1,226 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Emeric Poupon
|
||||||
|
*
|
||||||
|
* This file is part of LMS.
|
||||||
|
*
|
||||||
|
* LMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Wt/WApplication>
|
||||||
|
#include <Wt/Http/Response>
|
||||||
|
|
||||||
|
#include "logger/Logger.hpp"
|
||||||
|
#include "utils/Utils.hpp"
|
||||||
|
#include "LmsApplication.hpp"
|
||||||
|
|
||||||
|
#include "cover/CoverArtGrabber.hpp"
|
||||||
|
|
||||||
|
#include "ImageResource.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
|
static const std::string unknownCoverPath = "/images/unknown-cover.jpg";
|
||||||
|
static const std::string unknownArtistImagePath = "/images/unknown-artist.jpg";
|
||||||
|
|
||||||
|
ImageResource::ImageResource(Database::Handler& db, Wt::WObject *parent)
|
||||||
|
: Wt::WResource(parent),
|
||||||
|
_db(db)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageResource::~ImageResource()
|
||||||
|
{
|
||||||
|
beingDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
Image::Image
|
||||||
|
ImageResource::getDefaultCover(std::size_t size)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(_mutex);
|
||||||
|
|
||||||
|
auto itCover = _defaultCovers.find(size);
|
||||||
|
if (itCover == _defaultCovers.end())
|
||||||
|
{
|
||||||
|
// Load default cover art for this size
|
||||||
|
Image::Image image;
|
||||||
|
|
||||||
|
if (!image.load( Wt::WApplication::instance()->docRoot() + unknownCoverPath ))
|
||||||
|
throw std::runtime_error("Cannot read default cover file");
|
||||||
|
|
||||||
|
image.scale(size);
|
||||||
|
|
||||||
|
auto res = _defaultCovers.insert(std::make_pair(size, image));
|
||||||
|
itCover = res.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itCover->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
Image::Image
|
||||||
|
ImageResource::getDefaultArtistImage(std::size_t size)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(_mutex);
|
||||||
|
|
||||||
|
auto itCover = _defaultArtistImages.find(size);
|
||||||
|
if (itCover == _defaultArtistImages.end())
|
||||||
|
{
|
||||||
|
Image::Image image;
|
||||||
|
|
||||||
|
if (!image.load( Wt::WApplication::instance()->docRoot() + unknownArtistImagePath))
|
||||||
|
throw std::runtime_error("Cannot read default artist image file");
|
||||||
|
|
||||||
|
image.scale(size);
|
||||||
|
|
||||||
|
auto res = _defaultArtistImages.insert(std::make_pair(size, image));
|
||||||
|
itCover = res.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itCover->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
ImageResource::getReleaseUrl(Database::Release::id_type releaseId, std::size_t size) const
|
||||||
|
{
|
||||||
|
return url() + "&releaseid=" + std::to_string(releaseId) + "&size=" + std::to_string(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
ImageResource::getTrackUrl(Database::Track::id_type trackId, std::size_t size) const
|
||||||
|
{
|
||||||
|
return url() + "&trackid=" + std::to_string(trackId) + "&size=" + std::to_string(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
ImageResource::getArtistUrl(Database::Artist::id_type artistId, std::size_t size) const
|
||||||
|
{
|
||||||
|
return url() + "&artistid=" + std::to_string(artistId) + "&size=" + std::to_string(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
ImageResource::getUnknownTrackUrl(size_t size) const
|
||||||
|
{
|
||||||
|
return url() + "&size=" + std::to_string(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ImageResource::putImage(Wt::Http::Response& response, Image::Image cover)
|
||||||
|
{
|
||||||
|
std::vector<unsigned char> data;
|
||||||
|
|
||||||
|
cover.save(data, Image::Format::JPEG);
|
||||||
|
|
||||||
|
response.setMimeType( Image::format_to_mimeType(Image::Format::JPEG) );
|
||||||
|
response.out().write(reinterpret_cast<const char *>(&data[0]), data.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ImageResource::putCover(Wt::Http::Response& response, std::vector<Image::Image> covers, size_t size)
|
||||||
|
{
|
||||||
|
for (Image::Image cover : covers)
|
||||||
|
{
|
||||||
|
if (cover.scale(size))
|
||||||
|
{
|
||||||
|
putImage(response, cover);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no cover found, just send default one
|
||||||
|
putImage(response, getDefaultCover(size));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ImageResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response)
|
||||||
|
{
|
||||||
|
// Retrieve parameters
|
||||||
|
const std::string *trackIdStr = request.getParameter("trackid");
|
||||||
|
const std::string *releaseIdStr = request.getParameter("releaseid");
|
||||||
|
const std::string *artistIdStr = request.getParameter("artistid");
|
||||||
|
const std::string *sizeStr = request.getParameter("size");
|
||||||
|
|
||||||
|
// Mandatory parameter size
|
||||||
|
if (!sizeStr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::size_t size;
|
||||||
|
if (!readAs(*sizeStr, size) || size > maxSize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (trackIdStr)
|
||||||
|
{
|
||||||
|
Database::Track::id_type trackId;
|
||||||
|
if (!readAs(*trackIdStr, trackId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
boost::filesystem::path path;
|
||||||
|
Database::Track::CoverType coverType = Database::Track::CoverType::None;
|
||||||
|
{
|
||||||
|
// transactions are not thread safe
|
||||||
|
Wt::WApplication::UpdateLock lock(LmsApplication::instance());
|
||||||
|
|
||||||
|
Wt::Dbo::Transaction transaction(_db.getSession());
|
||||||
|
|
||||||
|
Database::Track::pointer track = Database::Track::getById(_db.getSession(), trackId);
|
||||||
|
if (track)
|
||||||
|
{
|
||||||
|
coverType = track->getCoverType();
|
||||||
|
path = track->getPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Image::Image> covers;
|
||||||
|
switch (coverType)
|
||||||
|
{
|
||||||
|
case Database::Track::CoverType::Embedded:
|
||||||
|
covers = CoverArt::Grabber::instance().getFromTrack(path);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Database::Track::CoverType::None:
|
||||||
|
covers = CoverArt::Grabber::instance().getFromDirectory(path.parent_path());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
putCover(response, covers, size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (releaseIdStr)
|
||||||
|
{
|
||||||
|
Database::Release::id_type releaseId;
|
||||||
|
if (!readAs(*releaseIdStr, releaseId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::vector<Image::Image> covers;
|
||||||
|
|
||||||
|
// transactions are not thread safe
|
||||||
|
{
|
||||||
|
Wt::WApplication::UpdateLock lock(LmsApplication::instance());
|
||||||
|
covers = CoverArt::Grabber::instance().getFromRelease(_db.getSession(), releaseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
putCover(response, covers, size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (artistIdStr)
|
||||||
|
{
|
||||||
|
putImage(response, getDefaultArtistImage(size));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
putImage(response, getDefaultCover(size));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
@@ -30,14 +30,13 @@
|
|||||||
namespace UserInterface {
|
namespace UserInterface {
|
||||||
|
|
||||||
|
|
||||||
class CoverResource : public Wt::WResource
|
class ImageResource : public Wt::WResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::string unknownCoverPath;
|
|
||||||
static const std::size_t maxSize = 512;
|
static const std::size_t maxSize = 512;
|
||||||
|
|
||||||
CoverResource(Database::Handler& db, Wt::WObject *parent = 0);
|
ImageResource(Database::Handler& db, Wt::WObject *parent = 0);
|
||||||
~CoverResource();
|
~ImageResource();
|
||||||
|
|
||||||
std::string getReleaseUrl(Database::Release::id_type releaseId, size_t size) const;
|
std::string getReleaseUrl(Database::Release::id_type releaseId, size_t size) const;
|
||||||
std::string getTrackUrl(Database::Track::id_type trackId, size_t size) const;
|
std::string getTrackUrl(Database::Track::id_type trackId, size_t size) const;
|
||||||
@@ -49,7 +48,9 @@ class CoverResource : public Wt::WResource
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
Image::Image getDefaultCover(std::size_t size);
|
Image::Image getDefaultCover(std::size_t size);
|
||||||
void putCover(Wt::Http::Response& response, Image::Image image);
|
Image::Image getDefaultArtistImage(std::size_t size);
|
||||||
|
void putImage(Wt::Http::Response& response, Image::Image image);
|
||||||
|
void putCover(Wt::Http::Response& response, std::vector<Image::Image> covers, std::size_t size);
|
||||||
|
|
||||||
// Used to protect transactions since they are not thread safe
|
// Used to protect transactions since they are not thread safe
|
||||||
std::mutex _mutex;
|
std::mutex _mutex;
|
||||||
@@ -58,6 +59,9 @@ class CoverResource : public Wt::WResource
|
|||||||
// Default cover for different sizes
|
// Default cover for different sizes
|
||||||
std::map<std::size_t, Image::Image> _defaultCovers;
|
std::map<std::size_t, Image::Image> _defaultCovers;
|
||||||
|
|
||||||
|
// Default artist images for different sizes
|
||||||
|
std::map<std::size_t, Image::Image> _defaultArtistImages;
|
||||||
|
|
||||||
// TODO construct a cache for covers?
|
// TODO construct a cache for covers?
|
||||||
};
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user