WIP. Scale cover art option now mandatory!

This commit is contained in:
emeric
2014-06-15 23:40:04 +02:00
parent 9bada5ee2a
commit b739f4ef56
10 changed files with 67 additions and 36 deletions
-1
View File
@@ -4,7 +4,6 @@
#include <vector>
#include <string>
#include "database/AudioTypes.hpp"
namespace CoverArt
{
+27 -6
View File
@@ -8,6 +8,32 @@
namespace CoverArt {
std::vector<CoverArt>
Grabber::getFromInputFormatContext(const Av::InputFormatContext& input)
{
std::vector<CoverArt> res;
try
{
std::vector< std::vector<unsigned char> > pictures;
input.getPictures(pictures);
BOOST_FOREACH(const std::vector<unsigned char>& picture, pictures)
res.push_back( CoverArt("application/octet-stream", picture) );
}
catch(std::exception& e)
{
std::cerr << "Cannot get pictures: " << e.what() << std::endl;
}
return res;
}
std::vector<CoverArt>
Grabber::getFromTrack(Track::pointer track)
{
@@ -17,12 +43,7 @@ Grabber::getFromTrack(Track::pointer track)
{
Av::InputFormatContext input(track->getPath());
std::vector< std::vector<unsigned char> > pictures;
input.getPictures(pictures);
BOOST_FOREACH(const std::vector<unsigned char>& picture, pictures)
res.push_back( CoverArt("application/octet-stream", picture) );
return getFromInputFormatContext(input);
}
catch(std::exception& e)
{
+6
View File
@@ -1,6 +1,11 @@
#ifndef COVER_ART_GRABBER_HPP
#define COVER_ART_GRABBER_HPP
#include <vector>
#include "av/InputFormatContext.hpp"
#include "database/AudioTypes.hpp"
#include "CoverArt.hpp"
@@ -10,6 +15,7 @@ class Grabber
{
public:
static std::vector<CoverArt> getFromInputFormatContext(const Av::InputFormatContext& input);
static std::vector<CoverArt> getFromTrack(Track::pointer track);
static std::vector<CoverArt> getFromRelease(Release::pointer release);
};