diff options
-rw-r--r-- | difference.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/difference.cpp b/difference.cpp index c2e3b37..b9290cb 100644 --- a/difference.cpp +++ b/difference.cpp | |||
@@ -88,10 +88,18 @@ bool downloadImage(std::string url, curl::curl_header headers, Magick::Blob& img | |||
88 | int main(int argc, char** argv) | 88 | int main(int argc, char** argv) |
89 | { | 89 | { |
90 | Magick::InitializeMagick(nullptr); | 90 | Magick::InitializeMagick(nullptr); |
91 | 91 | ||
92 | if (argc != 2) | ||
93 | { | ||
94 | std::cout << "usage: difference [configfile]" << std::endl; | ||
95 | return -1; | ||
96 | } | ||
97 | |||
98 | std::string configfile(argv[1]); | ||
99 | YAML::Node config = YAML::LoadFile(configfile); | ||
100 | |||
92 | int delay = 60 * 60; | 101 | int delay = 60 * 60; |
93 | 102 | ||
94 | YAML::Node config = YAML::LoadFile("config.yml"); | ||
95 | twitter::auth auth; | 103 | twitter::auth auth; |
96 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 104 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
97 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | 105 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); |
@@ -103,7 +111,9 @@ int main(int argc, char** argv) | |||
103 | std::random_device random_device; | 111 | std::random_device random_device; |
104 | std::mt19937 random_engine{random_device()}; | 112 | std::mt19937 random_engine{random_device()}; |
105 | 113 | ||
106 | verbly::data database("data.sqlite3"); | 114 | std::string fontfile = "@" + config["font"].as<std::string>(); |
115 | |||
116 | verbly::data database(config["verbly_datafile"].as<std::string>()); | ||
107 | 117 | ||
108 | auto whitelist = database.nouns(); | 118 | auto whitelist = database.nouns(); |
109 | whitelist.with_wnid(111530512); // Crops (plants) | 119 | whitelist.with_wnid(111530512); // Crops (plants) |
@@ -264,7 +274,7 @@ int main(int argc, char** argv) | |||
264 | Magick::Image composite(Magick::Geometry(width*2, height, 0, 0), "white"); | 274 | Magick::Image composite(Magick::Geometry(width*2, height, 0, 0), "white"); |
265 | composite.draw(Magick::DrawableCompositeImage(0, 0, pic1)); | 275 | composite.draw(Magick::DrawableCompositeImage(0, 0, pic1)); |
266 | composite.draw(Magick::DrawableCompositeImage(width, 0, pic2)); | 276 | composite.draw(Magick::DrawableCompositeImage(width, 0, pic2)); |
267 | composite.font("@coolvetica.ttf"); | 277 | composite.font(fontfile); |
268 | 278 | ||
269 | double fontsize = 72; | 279 | double fontsize = 72; |
270 | for (;;) | 280 | for (;;) |