WIP. Scale cover art option now mandatory!
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "database/AudioTypes.hpp"
|
||||
|
||||
namespace CoverArt
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user