root/src/gelbooruclient.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef GELBOORUCLIENT_H
#define GELBOORUCLIENT_H


#include <curl/curl.h>
#include <QString>
#include <QThread>
#include <QDir>
#include <sstream>
#include "nwutils.h"
#include "curlresult.h"
#include "tvshow.h"
#include "filedownloadthread.h"
#include "wallpaperdownloadclient.h"

namespace Gelbooru {
using WallpaperDownload::FetchThread;
using WallpaperDownload::Rating;
using WallpaperDownload::SearchResult;
using WallpaperDownload::Entry;

class Client : public WallpaperDownload::Client
{
public:
    Client(QString baseUrl = "http://gelbooru.com", int limit = 10, Rating ratingFilter = WallpaperDownload::ratingSafe);

    SearchResult fetchPostsBlocking(QString tagName, int page = 1);
protected:
    Entry parseEntry(nw::Describer *de);
    SearchResult parseSearchResult(std::stringstream &ss, int limit);
    CURL* curlClient(QString tag, CurlResult& userdata, const unsigned int page = 1);
};

}

#endif // GELBOORUCLIENT_H