~xavi-garcia-mena/thumbnailer/art-downloader-interface

« back to all changes in this revision

Viewing changes to src/lastfmdownloader.cpp

  • Committer: Xavi Garcia
  • Date: 2015-03-31 09:53:24 UTC
  • Revision ID: xavi.garcia.mena@canonical.com-20150331095324-dcjnrdbzrag4c4ig
Raw pointer removed to use unique_ptr instead. Some coding style changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include <memory>
28
28
 
29
 
const char* NOTFOUND_IMAGE = "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_medium.png";
 
29
char const* NOTFOUND_IMAGE = "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_medium.png";
30
30
 
31
31
using namespace std;
32
32
using namespace unity::thumbnailer::internal;
76
76
    return url;
77
77
}
78
78
 
79
 
string LastFMDownloader::download(const std::string& artist, const std::string& album)
 
79
string LastFMDownloader::download(std::string const& artist, std::string const& album)
80
80
{
81
 
    const char* lastfmTemplate = "http://ws.audioscrobbler.com/1.0/album/%s/%s/info.xml";
82
 
    const int bufsize = 1024;
 
81
    char const* lastfmTemplate = "http://ws.audioscrobbler.com/1.0/album/%s/%s/info.xml";
 
82
    int const bufsize = 1024;
83
83
    char buf[bufsize];
84
84
    snprintf(buf, bufsize, lastfmTemplate, artist.c_str(), album.c_str());
85
85
    string xml(dl->download(buf));
90
90
        return string();
91
91
    }
92
92
 
93
 
    return string(dl->download(parsed));
 
93
    return dl->download(parsed);
94
94
}
95
95
 
96
 
string LastFMDownloader::download_artist(const std::string& /*artist*/, const std::string& /*album*/)
 
96
string LastFMDownloader::download_artist(std::string const& /*artist*/, std::string const& /*album*/)
97
97
{
98
98
    // not implemented
99
99
    return string();