Covers. Minor bugfixes

This commit is contained in:
emeric
2014-06-25 12:43:11 +02:00
parent 17662d4eb8
commit 47a12b220f
6 changed files with 28 additions and 10 deletions
+3 -3
View File
@@ -14,9 +14,9 @@
- Create a new type: "share", that handles every other types in a directory based share? - Create a new type: "share", that handles every other types in a directory based share?
- Group video in "video groups". Each video may has sub groups (current "Path" class) - Group video in "video groups". Each video may has sub groups (current "Path" class)
- Simplify database and remove the Path class - Simplify database and remove the Path class
- Use limits for strings? - Use size limits for strings?
- Convert to UTF-8 in name strings
- Manage a global database revision number - Manage a global database revision number
- Process only files whose extensions are well known in audio/video world (avoid useless parsing/errors)
[Audio] [Audio]
- ReleaseView/ArtistView/GenreView: <All> -> Track count for this special category. Easier: add a special entry '<All>' that contains everything? - ReleaseView/ArtistView/GenreView: <All> -> Track count for this special category. Easier: add a special entry '<All>' that contains everything?
@@ -35,7 +35,7 @@
- Use Groups/SubGroups to organize videos (WTreeView?) - Use Groups/SubGroups to organize videos (WTreeView?)
[Remote API] [Remote API]
- Think about a remote API to get/retrieve media (i.e. for mobile apps) - Use SSL based sockets
[Layout] [Layout]
- Make it mobile browser compatible - Make it mobile browser compatible
+4 -4
View File
@@ -52,10 +52,10 @@ AC_CHECK_LIB( [boost_locale],
, ,
[AC_MSG_ERROR([libboost_locale not found!])]) [AC_MSG_ERROR([libboost_locale not found!])])
#AC_CHECK_LIB( [boost_thread], AC_CHECK_LIB( [boost_thread],
# [main], [main],
# , ,
# [AC_MSG_ERROR([libboost_thread not found!])]) [AC_MSG_ERROR([libboost_thread not found!])])
#AC_CHECK_LIB( [boost_date_time], #AC_CHECK_LIB( [boost_date_time],
# [main], # [main],
+4
View File
@@ -13,6 +13,10 @@ bool
CoverArt::scale(std::size_t size) CoverArt::scale(std::size_t size)
{ {
bool res = false; bool res = false;
if (!size)
return false;
try { try {
boost::gil::rgb8_image_t source; boost::gil::rgb8_image_t source;
+6
View File
@@ -39,6 +39,9 @@ Grabber::getFromTrack(Track::pointer track)
{ {
std::vector<CoverArt> res; std::vector<CoverArt> res;
if (!track)
return std::vector<CoverArt>();
try try
{ {
Av::InputFormatContext input(track->getPath()); Av::InputFormatContext input(track->getPath());
@@ -56,6 +59,9 @@ Grabber::getFromTrack(Track::pointer track)
std::vector<CoverArt> std::vector<CoverArt>
Grabber::getFromRelease(Release::pointer release) Grabber::getFromRelease(Release::pointer release)
{ {
if (!release)
return std::vector<CoverArt>();
// TODO // TODO
// Check if there is an image file in the directory of the release // Check if there is an image file in the directory of the release
// For now, just get the cover art from the first track of the release // For now, just get the cover art from the first track of the release
+2 -1
View File
@@ -1,3 +1,4 @@
#include <boost/thread.hpp>
#include "DatabaseRefreshService.hpp" #include "DatabaseRefreshService.hpp"
@@ -12,7 +13,7 @@ DatabaseRefreshService::DatabaseRefreshService(boost::asio::io_service& ioServic
_database.watchDirectory( WatchedDirectory("/storage/common/Media/Video", WatchedDirectory::Video) ); _database.watchDirectory( WatchedDirectory("/storage/common/Media/Video", WatchedDirectory::Video) );
// TODO launch thread // TODO launch thread
// boost::thread refreshThread(boost::bind(&Database::refresh, &database)); boost::thread refreshThread(boost::bind(&Database::refresh, &_database));
} }
void void
@@ -2,7 +2,6 @@
#include <boost/locale.hpp> #include <boost/locale.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "AudioCollectionRequestHandler.hpp" #include "AudioCollectionRequestHandler.hpp"
@@ -275,7 +274,15 @@ AudioCollectionRequestHandler::processGetCoverArt(const AudioCollectionRequest::
AudioCollectionResponse_CoverArt* cover_art = response.add_cover_art(); AudioCollectionResponse_CoverArt* cover_art = response.add_cover_art();
if (request.has_size()) if (request.has_size())
coverArt.scale(request.size()); {
std::size_t size = request.size();
if (size > _maxCoverArtSize || size == 0)
size = _maxCoverArtSize;
if (size < _minCoverArtSize)
size = _minCoverArtSize;
coverArt.scale(size);
}
cover_art->set_mime_type(coverArt.getMimeType()); cover_art->set_mime_type(coverArt.getMimeType());
cover_art->set_data( std::string( coverArt.getData().begin(), coverArt.getData().end()) ); cover_art->set_data( std::string( coverArt.getData().begin(), coverArt.getData().end()) );