Merge branch 'database' into develop
This commit is contained in:
@@ -230,7 +230,7 @@ Updater::process(boost::system::error_code err)
|
||||
rootDirectories.push_back( std::make_pair( directory->getPath(), directory->getType() ));
|
||||
}
|
||||
|
||||
BOOST_FOREACH( RootDirectory rootDirectory, rootDirectories)
|
||||
for (RootDirectory rootDirectory : rootDirectories)
|
||||
processDirectory(rootDirectory.first, rootDirectory.first, rootDirectory.second, stats);
|
||||
|
||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Changes = " << stats.nbChanges();
|
||||
@@ -430,11 +430,16 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
||||
// ***** Genres
|
||||
std::vector< Genre::pointer > genres;
|
||||
{
|
||||
genres = getGenres( boost::any_cast< std::list<std::string> > (items[MetaData::Type::Genres]) );
|
||||
std::list<std::string> genreList;
|
||||
|
||||
if (items.find(MetaData::Type::Genres) != items.end())
|
||||
genreList = boost::any_cast< std::list<std::string> > (items[MetaData::Type::Genres]);
|
||||
|
||||
genres = getGenres( genreList );
|
||||
}
|
||||
assert( !genres.empty() );
|
||||
|
||||
// Get the associated Artist
|
||||
// ***** Artist
|
||||
Artist::pointer artist;
|
||||
{
|
||||
std::string artistName;
|
||||
@@ -450,7 +455,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
||||
}
|
||||
assert(artist);
|
||||
|
||||
// Get the associated Release
|
||||
// ***** Release
|
||||
Release::pointer release;
|
||||
{
|
||||
std::string releaseName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Emeric Poupon
|
||||
* Copyright (C) 2015 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Artist.hpp"
|
||||
#include "Types.hpp"
|
||||
#include "SqlQuery.hpp"
|
||||
|
||||
#include "logger/Logger.hpp"
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
/*
|
||||
* 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 "Release.hpp"
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "SearchFilter.hpp"
|
||||
#include "SqlQuery.hpp"
|
||||
|
||||
|
||||
@@ -97,32 +97,16 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
||||
std::vector<std::string> keywords;
|
||||
boost::algorithm::split(keywords, text, boost::is_any_of(" "), boost::token_compress_on);
|
||||
|
||||
{
|
||||
SearchFilter filter;
|
||||
for (std::string keyword : keywords)
|
||||
{
|
||||
filter.nameLikeMatch[SearchFilter::Field::Artist].push_back(keyword);
|
||||
filter.nameLikeMatch[SearchFilter::Field::Release].push_back(keyword);
|
||||
}
|
||||
releaseSearch->search(SearchFilter::NameLikeMatch( {
|
||||
{ SearchFilter::Field::Artist, keywords },
|
||||
{ SearchFilter::Field::Release, keywords }}),
|
||||
3);
|
||||
|
||||
releaseSearch->search(filter, 3);
|
||||
}
|
||||
artistSearch->search(SearchFilter::NameLikeMatch({{SearchFilter::Field::Artist, keywords}}),
|
||||
3);
|
||||
|
||||
{
|
||||
SearchFilter filter;
|
||||
for (std::string keyword : keywords)
|
||||
filter.nameLikeMatch[SearchFilter::Field::Artist].push_back(keyword);
|
||||
|
||||
artistSearch->search(filter, 3);
|
||||
}
|
||||
|
||||
{
|
||||
SearchFilter filter;
|
||||
BOOST_FOREACH(std::string keyword, keywords)
|
||||
filter.nameLikeMatch[SearchFilter::Field::Track].push_back(keyword);
|
||||
|
||||
trackSearch->search(filter, 3);
|
||||
}
|
||||
trackSearch->search(SearchFilter::NameLikeMatch({{SearchFilter::Field::Track, keywords}}),
|
||||
3);
|
||||
|
||||
artistSearch->show();
|
||||
releaseSearch->show();
|
||||
@@ -143,10 +127,8 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
||||
trackSearch->hide();
|
||||
releaseSearch->show();
|
||||
|
||||
SearchFilter filter;
|
||||
filter.idMatch[SearchFilter::Field::Artist].push_back(artistId);
|
||||
|
||||
releaseSearch->search(filter, 20);
|
||||
releaseSearch->search(SearchFilter::IdMatch({{SearchFilter::Field::Artist, {artistId}}}),
|
||||
20);
|
||||
}, std::placeholders::_1));
|
||||
|
||||
releaseSearch->moreReleasesSelected().connect(std::bind([=]
|
||||
@@ -162,11 +144,8 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
||||
releaseSearch->hide();
|
||||
trackSearch->show();
|
||||
|
||||
// TODO load track search with selected release
|
||||
SearchFilter filter;
|
||||
filter.idMatch[SearchFilter::Field::Release].push_back(releaseId);
|
||||
|
||||
trackSearch->search(filter, 20);
|
||||
trackSearch->search(SearchFilter::IdMatch({{SearchFilter::Field::Release, {releaseId}}}),
|
||||
20);
|
||||
}, std::placeholders::_1));
|
||||
|
||||
trackSearch->moreTracksSelected().connect(std::bind([=]
|
||||
@@ -207,10 +186,9 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
||||
|
||||
// Initially, populate the widgets using an empty search
|
||||
{
|
||||
SearchFilter filter; // empty filter
|
||||
artistSearch->search(filter, 3);
|
||||
releaseSearch->search(filter, 3);
|
||||
trackSearch->search(filter, 3);
|
||||
artistSearch->search(SearchFilter(), 3);
|
||||
releaseSearch->search(SearchFilter(), 3);
|
||||
trackSearch->search(SearchFilter(), 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user