Add author etc to github scraper.

This commit is contained in:
Martin Rotter 2021-03-04 09:48:15 +01:00
parent be1c3952bb
commit 56c4619cfd
3 changed files with 18 additions and 7 deletions

View File

@ -26,13 +26,15 @@ for rel in json_data:
if rel['prerelease'] and leave_out_prereleases:
continue
article_url = json.dumps(rel['url'])
article_title = json.dumps(rel['tag_name'])
article_author = json.dumps(rel["author"]["login"])
article_url = json.dumps(rel["html_url"])
article_title = json.dumps(rel["tag_name"])
article_time = json.dumps(datetime.strptime(rel["published_at"], "%Y-%m-%dT%H:%M:%SZ").isoformat())
items.append("{{\"title\": {title}, \"content_html\": {html}, \"url\": {url}, \"date_published\": {date}}}".format(title=article_title,
items.append("{{\"title\": {title}, \"authors\": [{{\"name\": {author}}}], \"content_html\": {html}, \"url\": {url}, \"date_published\": {date}}}".format(title=article_title,
html=article_title,
url=article_url,
date=article_time))
date=article_time,
author=article_author))
json_feed = json_feed.format(title = "Releases", items = ", ".join(items))
print(json_feed)

View File

@ -26,6 +26,10 @@ FormStandardFeedDetails::FormStandardFeedDetails(ServiceRoot* service_root, Root
connect(m_standardFeedDetails->m_ui.m_btnFetchMetadata, &QPushButton::clicked, this, &FormStandardFeedDetails::guessFeed);
connect(m_standardFeedDetails->m_actionFetchIcon, &QAction::triggered, this, &FormStandardFeedDetails::guessIconOnly);
connect(m_standardFeedDetails->m_ui.m_txtTitle->lineEdit(), &QLineEdit::textChanged,
this, &FormStandardFeedDetails::onTitleChanged);
onTitleChanged(m_standardFeedDetails->m_ui.m_txtTitle->lineEdit()->text());
}
void FormStandardFeedDetails::guessFeed() {
@ -44,6 +48,10 @@ void FormStandardFeedDetails::guessIconOnly() {
m_authDetails->m_txtPassword->lineEdit()->text());
}
void FormStandardFeedDetails::onTitleChanged(const QString& title) {
m_ui->m_buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(!title.simplified().isEmpty());
}
void FormStandardFeedDetails::apply() {
FormFeedDetails::apply();

View File

@ -19,6 +19,7 @@ class FormStandardFeedDetails : public FormFeedDetails {
private slots:
void guessFeed();
void guessIconOnly();
void onTitleChanged(const QString& title);
virtual void apply();