net-libs/syndication-domination: update SRC_URI

Signed-off-by: brettalcox <brettalcox@gmail.com>
This commit is contained in:
brettalcox
2023-10-05 14:43:58 -05:00
parent d674404fcb
commit 9b009438dd
4 changed files with 110 additions and 11 deletions

View File

@@ -1,2 +1 @@
DIST 75920321.patch 4208 BLAKE2B c24362cdc5f01858608476bddab3004f3acd9cc9a555ca52abedbeb009952f7a84db4e18db36c731fc2d6212f3cfa21cc9881b4b7472bb7465787b49f9bef7e3 SHA512 cbe5f1def629fe21f232566d8e812c4b8c48be4c5fb68b5c60b6c91ae49dde8cf561e14abb3b52b1ca9ad2560b921f3e834498d9d0c0eee198d7da60a689da4f
DIST syndication-domination-1.0.tar.bz2 46908 BLAKE2B cd7d70c61277e315fa03e16af5190c8b87140c8d5d80c3b58a0d7d2026403558b74be0a1cfb8e9c450204bb4842970844c308d33676a65e0f7cbbda77cf821f0 SHA512 6fa093144c6a86c6e81ad7530527d171dac8bc011f9aa2895b254eef8e288e251dfc9dab8d2fa598182df825b53cd8ef583736c8b6971375904543ab93d76b7e

View File

@@ -0,0 +1,106 @@
From 75920321062d682437f3fb0319dad227d8b18f6c Mon Sep 17 00:00:00 2001
From: Gabriele Musco <gabmus@disroot.org>
Date: Sat, 25 Mar 2023 14:13:44 +0100
Subject: [PATCH] add author extraction for feed item
---
src/feed_item.cpp | 12 +++++++++---
src/feed_item.hpp | 14 ++++++++++++++
src/pybind.cpp | 4 ++++
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/feed_item.cpp b/src/feed_item.cpp
index a08cd71..e0dbb8c 100644
--- a/src/feed_item.cpp
+++ b/src/feed_item.cpp
@@ -1,5 +1,5 @@
-#include "feed_item.hpp"
-#include "utils.hpp"
+#include "./feed_item.hpp"
+#include "./utils.hpp"
std::string FeedItem::extract_url() {
std::string res = item_node.child("link").text().as_string();
@@ -75,6 +75,10 @@ void FeedItem::parse() {
// pub_date
pub_date = SynDomUtils::extract_from_node(item_node, __PUB_DATE_PARAMS);
+ // author
+ author_name = SynDomUtils::extract_from_node(item_node, __AUTHOR_NAME_PARAMS);
+ author_url = SynDomUtils::extract_from_node(item_node, __AUTHOR_URL_PARAMS);
+
// img_url
img_url = extract_img_url();
fix_url(img_url);
@@ -87,6 +91,8 @@ std::string FeedItem::to_json() {
" \"url\": \"" + url + "\",\n"
" \"media_url\": \"" + media_url + "\",\n"
" \"pub_date\": \"" + pub_date + "\",\n"
- " \"img_url\": \"" + img_url + "\"\n"
+ " \"img_url\": \"" + img_url + "\",\n"
+ " \"author_name\": \"" + author_name + "\",\n"
+ " \"author_url\": \"" + author_url + "\"\n"
" }";
}
diff --git a/src/feed_item.hpp b/src/feed_item.hpp
index 5d7105e..fd1259f 100644
--- a/src/feed_item.hpp
+++ b/src/feed_item.hpp
@@ -28,6 +28,8 @@ private:
std::string media_url;
std::string pub_date;
std::string img_url;
+ std::string author_name;
+ std::string author_url;
/**
* Tries to extract the item url and returns it.
@@ -73,6 +75,16 @@ private:
{ExtractionParam::ParamType::CHILD, {"date"}},
{ExtractionParam::ParamType::CHILD, {"dc:date"}}
};
+ static inline const std::vector<ExtractionParam> __AUTHOR_NAME_PARAMS{
+ {ExtractionParam::ParamType::CHILD, {"author", "name"}},
+ {ExtractionParam::ParamType::CHILD, {"author"}},
+ {ExtractionParam::ParamType::CHILD, {"dc:creator"}},
+ {ExtractionParam::ParamType::CHILD, {"creator"}},
+ {ExtractionParam::ParamType::CHILD, {"itunes:author"}},
+ };
+ static inline const std::vector<ExtractionParam> __AUTHOR_URL_PARAMS{
+ {ExtractionParam::ParamType::CHILD, {"author", "uri"}}
+ };
/**
* Entry point of the class, parses all the relevant content. Called by
* the constructor.
@@ -101,6 +113,8 @@ public:
std::string get_media_url() { return media_url; }
std::string get_pub_date() { return pub_date; }
std::string get_img_url() { return img_url; }
+ std::string get_author_name() { return author_name; }
+ std::string get_author_url() { return author_url; }
/**
* Represents the FeedItem object (itself) as a json, returned as a string.
diff --git a/src/pybind.cpp b/src/pybind.cpp
index bef72f9..1d5a58d 100644
--- a/src/pybind.cpp
+++ b/src/pybind.cpp
@@ -19,11 +19,15 @@ PYBIND11_MODULE(syndom, m) {
.def_property_readonly("media_url", &FeedItem::get_media_url)
.def_property_readonly("pub_date", &FeedItem::get_pub_date)
.def_property_readonly("img_url", &FeedItem::get_img_url)
+ .def_property_readonly("author_name", &FeedItem::get_author_name)
+ .def_property_readonly("author_url", &FeedItem::get_author_url)
.def("get_title", &FeedItem::get_title)
.def("get_content", &FeedItem::get_content)
.def("get_url", &FeedItem::get_url)
.def("get_media_url", &FeedItem::get_media_url)
.def("get_pub_date", &FeedItem::get_pub_date)
+ .def("get_author_name", &FeedItem::get_author_name)
+ .def("get_author_url", &FeedItem::get_author_url)
.def("get_img_url", &FeedItem::get_img_url);
py::class_<Feed>(m, "Feed")
.def(py::init<std::string>())
--
GitLab

View File

@@ -15,12 +15,9 @@ if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://gitlab.com/gabmus/syndication-domination.git"
else
KEYWORDS="~amd64"
SRC_URI="
https://gitlab.com/gabmus/syndication-domination/-/archive/${PV}/${P}.tar.bz2
https://gitlab.com/gabmus/syndication-domination/-/commit/75920321.patch
"
SRC_URI="https://gitlab.com/gabmus/syndication-domination/-/archive/${PV}/${P}.tar.bz2"
#required for gfeeds
PATCHES="${DISTDIR}/75920321.patch"
PATCHES="${FILESDIR}/gfeeds-2.2.0-blueprint-compiler-fix.patch"
fi
LICENSE="AGPL-3"

View File

@@ -15,12 +15,9 @@ if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://gitlab.com/gabmus/syndication-domination.git"
else
KEYWORDS="~amd64"
SRC_URI="
https://gitlab.com/gabmus/syndication-domination/-/archive/${PV}/${P}.tar.bz2
https://gitlab.com/gabmus/syndication-domination/-/commit/75920321.patch
"
SRC_URI="https://gitlab.com/gabmus/syndication-domination/-/archive/${PV}/${P}.tar.bz2"
#required for gfeeds
PATCHES="${DISTDIR}/75920321.patch"
PATCHES="${FILESDIR}/gfeeds-2.2.0-blueprint-compiler-fix.patch"
fi
LICENSE="AGPL-3"