toot newest entry on first run

This commit is contained in:
tastytea 2018-01-26 20:59:01 +01:00
parent 992ebe0ec4
commit 63b11121bb
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
3 changed files with 13 additions and 4 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.7)
include(GNUInstallDirs) include(GNUInstallDirs)
project (rss2mastodon project (rss2mastodon
VERSION 0.1.2 VERSION 0.1.3
LANGUAGES CXX LANGUAGES CXX
) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall")

View File

@ -32,8 +32,9 @@ Install with `make install`.
# Usage # Usage
Put watchwords.json into `~/.config/rss2mastodon/`. Launch with profile name. Put watchwords.json into `~/.config/rss2mastodon/`. Launch with profile name.
In the first run nothing is tooted, only the newest entry is saved. In the first run only the newest entry is tooted.
In the next run only newer entries are tooted.
The profile can't be named "global".
## Error codes ## Error codes

View File

@ -181,7 +181,15 @@ int main(int argc, char *argv[])
http_get(hostname, path, answer); http_get(hostname, path, answer);
entries = parse_website(profile, answer); entries = parse_website(profile, answer);
if (last_entry.empty())
{
last_entry = entries.at(1);
config.put(profile + ".last_entry", last_entry);
}
else
{
config.put(profile + ".last_entry", entries.front()); config.put(profile + ".last_entry", entries.front());
}
pt::write_json(filepath + "config.json", config); pt::write_json(filepath + "config.json", config);
bool new_content = false; bool new_content = false;