After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 785454 - Add support for RSS enclosures
Add support for RSS enclosures
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: Miners
0.12.x
Other All
: Normal normal
: ---
Assigned To: tracker-general
tracker-general
Depends on:
Blocks:
 
 
Reported: 2017-07-26 18:11 UTC by Lucas Satabin
Modified: 2017-07-28 11:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add support for feed enclosures (4.95 KB, patch)
2017-07-26 18:16 UTC, Lucas Satabin
none Details | Review
Add support for feed enclosures (4.86 KB, patch)
2017-07-26 18:23 UTC, Lucas Satabin
none Details | Review
Add support for feed enclosures (4.87 KB, patch)
2017-07-26 19:04 UTC, Lucas Satabin
none Details | Review
Add support for feed enclosures (6.22 KB, patch)
2017-07-26 19:51 UTC, Lucas Satabin
committed Details | Review

Description Lucas Satabin 2017-07-26 18:11:56 UTC
Some RSS feed have enclosures (e.g. podcasts) and such enclosures are supported by the ontology. The RSS miner should extract these elements and link them to the messages.
Comment 1 Lucas Satabin 2017-07-26 18:16:17 UTC
Created attachment 356436 [details] [review]
Add support for feed enclosures

This is a first implementation of the enclosure support for RSS miner.

It uses the `mfo:Enclosure` and `nfo:RemoteDataObject` classes to store the information and the `mfo:enclosureList` predicate to link messages to its enclosures.
Comment 2 Lucas Satabin 2017-07-26 18:23:14 UTC
Created attachment 356437 [details] [review]
Add support for feed enclosures

New patch without tab expansion.
Comment 3 Carlos Garnacho 2017-07-26 18:54:07 UTC
Review of attachment 356437 [details] [review]:

Looks mostly good! thanks for the patch :). Some comments follow:

::: src/miners/rss/tracker-miner-rss.c
@@ +715,3 @@
+static void
+sparql_add_enclosure (TrackerSparqlBuilder *sparql,
+                      gchar                *subject,

The subject argument is not modified here, better make it const gchar*

@@ +886,3 @@
+
+    // subject is not freed right now as it will be freed at the end of the
+    // method in a foreach loop over the contrib_aliases list

Tracker uses /* */ comments in C code, and it's not properly indented :).

Also, ugh... were we doubly freeing the strings? Probably worth a separate bug (or at least patch) on its own.

@@ +891,3 @@
+
+	i = 0;
+	for(l = enclosures; l; l = l->next) {

Missing space between for and (

@@ +902,3 @@
+
+		// subject is not freed right now as it will be freed at the end of the
+		// method in a foreach loop over the enclosure_aliases list

Again, /* */ comments, please :)

@@ +1002,2 @@
 	g_list_free (contrib_aliases);
+	g_list_free (enclosure_aliases);

Now that you're at it, please use g_list_free_full(), also for contrib_aliases.
Comment 4 Lucas Satabin 2017-07-26 19:04:26 UTC
Created attachment 356443 [details] [review]
Add support for feed enclosures

Hi Carlos,

Thanks for the really quick review. Sorry for my code style issues.
Here is a new version of the patch with your remarks taken into account.
Comment 5 Carlos Garnacho 2017-07-26 19:49:33 UTC
Comment on attachment 356443 [details] [review]
Add support for feed enclosures

Thanks! The patch looks good for master. If you don't have a GNOME git account I'll eventually push it.
Comment 6 Lucas Satabin 2017-07-26 19:51:21 UTC
Created attachment 356444 [details] [review]
Add support for feed enclosures

New patch with two enhancements:

 - enclosures are deleted together with their referencing message
 - avoid adding twice enclosures with same URL in a message
Comment 7 Lucas Satabin 2017-07-26 19:53:03 UTC
(In reply to Carlos Garnacho from comment #5)
> Comment on attachment 356443 [details] [review] [review]
> Add support for feed enclosures
> 
> Thanks! The patch looks good for master. If you don't have a GNOME git
> account I'll eventually push it.

I have no GNOME git account. Thanks for your feedback.
Comment 8 Carlos Garnacho 2017-07-28 11:46:09 UTC
Pushed to the master branch. Thanks for your contribution!