diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-30 11:35:32 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-30 11:35:32 -0400 |
commit | 95cd6e298cf6b80476fdcec08c5249ff4530bb16 (patch) | |
tree | a1e654a7619567e9f7a917bbf95d65a76c23e0eb | |
download | composite-95cd6e298cf6b80476fdcec08c5249ff4530bb16.tar.gz composite-95cd6e298cf6b80476fdcec08c5249ff4530bb16.tar.bz2 composite-95cd6e298cf6b80476fdcec08c5249ff4530bb16.zip |
Initial commit
-rw-r--r-- | .gitmodules | 9 | ||||
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | composite.cpp | 39 | ||||
m--------- | vendor/libtwittercpp | 0 | ||||
m--------- | vendor/verbly | 0 | ||||
m--------- | vendor/yaml-cpp | 0 |
6 files changed, 60 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3ac2123 --- /dev/null +++ b/.gitmodules | |||
@@ -0,0 +1,9 @@ | |||
1 | [submodule "vendor/libtwittercpp"] | ||
2 | path = vendor/libtwittercpp | ||
3 | url = https://github.com/hatkirby/libtwittercpp | ||
4 | [submodule "vendor/verbly"] | ||
5 | path = vendor/verbly | ||
6 | url = https://github.com/hatkirby/verbly | ||
7 | [submodule "vendor/yaml-cpp"] | ||
8 | path = vendor/yaml-cpp | ||
9 | url = https://github.com/jbeder/yaml-cpp | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a90ea6e --- /dev/null +++ b/CMakeLists.txt | |||
@@ -0,0 +1,12 @@ | |||
1 | cmake_minimum_required (VERSION 3.1) | ||
2 | project (composite) | ||
3 | |||
4 | add_subdirectory(vendor/libtwittercpp) | ||
5 | add_subdirectory(vendor/verbly) | ||
6 | add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL) | ||
7 | |||
8 | include_directories(vendor/libtwittercpp/src vendor/verbly/lib vendor/yaml-cpp/include) | ||
9 | add_executable(composite composite.cpp) | ||
10 | set_property(TARGET composite PROPERTY CXX_STANDARD 11) | ||
11 | set_property(TARGET composite PROPERTY CXX_STANDARD_REQUIRED ON) | ||
12 | target_link_libraries(composite verbly twitter++ yaml-cpp) | ||
diff --git a/composite.cpp b/composite.cpp new file mode 100644 index 0000000..891f179 --- /dev/null +++ b/composite.cpp | |||
@@ -0,0 +1,39 @@ | |||
1 | #include <verbly.h> | ||
2 | #include <yaml-cpp/yaml.h> | ||
3 | #include <twitter.h> | ||
4 | #include <chrono> | ||
5 | #include <string> | ||
6 | #include <thread> | ||
7 | #include <iostream> | ||
8 | |||
9 | int main(int argc, char** argv) | ||
10 | { | ||
11 | YAML::Node config = YAML::LoadFile("config.yml"); | ||
12 | |||
13 | twitter::auth auth; | ||
14 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | ||
15 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | ||
16 | auth.setAccessKey(config["access_key"].as<std::string>()); | ||
17 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | ||
18 | |||
19 | twitter::client client(auth); | ||
20 | verbly::data database("data.sqlite3"); | ||
21 | |||
22 | for (;;) | ||
23 | { | ||
24 | std::cout << "Generating..." << std::endl; | ||
25 | auto nq = database.nouns().with_stress({{true, false, false}}).random().limit(1).run().front(); | ||
26 | std::string output = "full metal " + nq.singular_form(); | ||
27 | std::cout << output << std::endl; | ||
28 | |||
29 | twitter::tweet sent; | ||
30 | twitter::response resp = client.updateStatus(output, sent); | ||
31 | if (resp != twitter::response::ok) | ||
32 | { | ||
33 | std::cout << "Twitter error: " << resp << std::endl; | ||
34 | } | ||
35 | |||
36 | std::cout << "Waiting..." << std::endl; | ||
37 | std::this_thread::sleep_for(std::chrono::hours(1)); | ||
38 | } | ||
39 | } \ No newline at end of file | ||
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp new file mode 160000 | |||
Subproject 501880160ac69f90143bc38add541731a9242ab | |||
diff --git a/vendor/verbly b/vendor/verbly new file mode 160000 | |||
Subproject 6c2aca03c89b37e136ab4c7ea58b485dadc85bc | |||
diff --git a/vendor/yaml-cpp b/vendor/yaml-cpp new file mode 160000 | |||
Subproject 728e26e42645d4d70ca65522990f915f47b47a5 | |||