diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-04-10 11:35:55 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-04-10 11:35:55 -0400 |
commit | bd8ff4083d41417f014241ddb94e43b39bee6080 (patch) | |
tree | 09ec764e995b53de78462b2fb996db5973d25aef /difference.h | |
parent | 95e89d24d998c75dae191ceefbe17c0d44c2d78a (diff) | |
download | difference-bd8ff4083d41417f014241ddb94e43b39bee6080.tar.gz difference-bd8ff4083d41417f014241ddb94e43b39bee6080.tar.bz2 difference-bd8ff4083d41417f014241ddb94e43b39bee6080.zip |
Updated verbly (new API)
Also updated libtwitter++, and blacklisted some problematic images.
Diffstat (limited to 'difference.h')
-rw-r--r-- | difference.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/difference.h b/difference.h new file mode 100644 index 0000000..bccf9ab --- /dev/null +++ b/difference.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef DIFFERENCE_H_081276A3 | ||
2 | #define DIFFERENCE_H_081276A3 | ||
3 | |||
4 | #include <random> | ||
5 | #include <string> | ||
6 | #include <Magick++.h> | ||
7 | #include <utility> | ||
8 | #include <verbly.h> | ||
9 | #include <stdexcept> | ||
10 | #include <twitter.h> | ||
11 | #include <memory> | ||
12 | |||
13 | class difference { | ||
14 | public: | ||
15 | |||
16 | difference( | ||
17 | std::string configFile, | ||
18 | std::mt19937& rng); | ||
19 | |||
20 | void run() const; | ||
21 | |||
22 | private: | ||
23 | |||
24 | verbly::word getPicturedNoun() const; | ||
25 | |||
26 | std::pair<Magick::Image, Magick::Image> | ||
27 | getImagesForNoun(verbly::word pictured) const; | ||
28 | |||
29 | Magick::Image getImageAtUrl(std::string url) const; | ||
30 | |||
31 | std::pair<verbly::word, verbly::word> getOppositeIdentifiers() const; | ||
32 | |||
33 | Magick::Image composeImage( | ||
34 | Magick::Image image1, | ||
35 | verbly::word word1, | ||
36 | Magick::Image image2, | ||
37 | verbly::word word2) const; | ||
38 | |||
39 | std::string generateTweetText(verbly::word word1, verbly::word word2) const; | ||
40 | |||
41 | void sendTweet(std::string text, Magick::Image image) const; | ||
42 | |||
43 | class could_not_get_images : public std::runtime_error { | ||
44 | public: | ||
45 | |||
46 | could_not_get_images() : std::runtime_error("Could not get images for noun") | ||
47 | { | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | std::mt19937& rng_; | ||
52 | std::unique_ptr<verbly::database> database_; | ||
53 | std::unique_ptr<twitter::client> client_; | ||
54 | std::string fontfile_; | ||
55 | |||
56 | }; | ||
57 | |||
58 | #endif /* end of include guard: DIFFERENCE_H_081276A3 */ | ||