Rename _data → _profile.

This commit is contained in:
tastytea 2019-12-28 06:57:23 +01:00
parent 4168e77648
commit 74369d6ab5
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ using std::move;
Document::Document(Config &cfg) Document::Document(Config &cfg)
: _cfg{cfg} : _cfg{cfg}
, _data{cfg.data} , _profile{cfg.data}
{ {
RestClient::init(); RestClient::init();
@ -65,20 +65,20 @@ void Document::download(const string &uri)
case 200: case 200:
{ {
_raw_doc = response.body; _raw_doc = response.body;
BOOST_LOG_TRIVIAL(debug) << "Downloaded feed: " << _data.feedurl; BOOST_LOG_TRIVIAL(debug) << "Downloaded feed: " << _profile.feedurl;
break; break;
} }
case 301: case 301:
case 308: case 308:
{ {
_data.feedurl = extract_location(response.headers); _profile.feedurl = extract_location(response.headers);
if (_data.feedurl.empty()) if (_profile.feedurl.empty())
{ {
throw HTTPException{response.code}; throw HTTPException{response.code};
} }
BOOST_LOG_TRIVIAL(debug) << "Feed has new location (permanent): " BOOST_LOG_TRIVIAL(debug) << "Feed has new location (permanent): "
<< _data.feedurl; << _profile.feedurl;
_cfg.write(); _cfg.write();
download(); download();
break; break;
@ -94,7 +94,7 @@ void Document::download(const string &uri)
} }
BOOST_LOG_TRIVIAL(debug) << "Feed has new location (temporary): " BOOST_LOG_TRIVIAL(debug) << "Feed has new location (temporary): "
<< _data.feedurl; << _profile.feedurl;
download(newuri); download(newuri);
break; break;
} }
@ -111,7 +111,7 @@ void Document::download(const string &uri)
void Document::download() void Document::download()
{ {
download(_data.feedurl); download(_profile.feedurl);
} }
void Document::parse() void Document::parse()
@ -140,14 +140,14 @@ void Document::parse_rss(const pt::ptree &tree)
{ {
guid = rssitem.get<string>("link"); guid = rssitem.get<string>("link");
} }
if (guid == _data.last_guid) if (guid == _profile.last_guid)
{ {
break; break;
} }
bool skipthis{false}; bool skipthis{false};
string title{rssitem.get<string>("title")}; string title{rssitem.get<string>("title")};
for (const auto &skip : _data.skip) for (const auto &skip : _profile.skip)
{ {
if (title.substr(0, skip.length()) == skip) if (title.substr(0, skip.length()) == skip)
{ {
@ -166,7 +166,7 @@ void Document::parse_rss(const pt::ptree &tree)
{ {
string desc string desc
{remove_html(rssitem.get<string>("description"))}; {remove_html(rssitem.get<string>("description"))};
for (const auto &fix : _data.fixes) for (const auto &fix : _profile.fixes)
{ {
desc = regex_replace(desc, regex{fix}, ""); desc = regex_replace(desc, regex{fix}, "");
} }
@ -179,7 +179,7 @@ void Document::parse_rss(const pt::ptree &tree)
BOOST_LOG_TRIVIAL(debug) << "Found GUID: " << item.guid; BOOST_LOG_TRIVIAL(debug) << "Found GUID: " << item.guid;
if (_data.last_guid.empty()) if (_profile.last_guid.empty())
{ {
break; break;
} }

View File

@ -67,7 +67,7 @@ public:
private: private:
Config &_cfg; Config &_cfg;
ProfileData &_data; ProfileData &_profile;
string _raw_doc; string _raw_doc;
void parse_rss(const pt::ptree &tree); void parse_rss(const pt::ptree &tree);