This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[patch] syndication plugin - find more torrent links

Tags: None
(comma "," separated)
Raven24
Registered Member
Posts
2
Karma
0
The congress I've been to recently put recordings of all the talks on the internet, and there is also an RSS feed with the torrent links available:
http://skowron.biz/29c3.rss
(here is one of the xml elements, in case that link becomes unavailable)
Code: Select all
<item>
  <enclosure url="http://mirror.netcologne.de/CCC/29C3/mp4-h264-HQ/29c3-5024-en-hackers_as_a_highrisk_population_h264.mp4.torrent" />
  <title>29c3-5024-en-hackers_as_a_highrisk_population_h264.mp4.torrent</title>
  <pubDate>Sat, 29 Dec 2012 17:01:00 +0000</pubDate>
  <guid>29Dec2012170100-29c3-5024-en-hackers_as_a_highrisk_population_h264.mp4.torrent</guid>
</item>

I was unable to get it to work with the way the syndication plugin currently looks for torrent links inside feeds, so I created a patch that would enable it to find the links in this situation.
Code: Select all
From 211dc407ef8d36217e6f6cb8e72d0d54c0e5eaa3 Mon Sep 17 00:00:00 2001
From: Florian Staudacher <florian_staudacher@yahoo.de>
Date: Thu, 3 Jan 2013 14:18:57 +0100
Subject: [PATCH] find torrent links that don't specify a content type

---
 plugins/syndication/feedwidgetmodel.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/syndication/feedwidgetmodel.cpp b/plugins/syndication/feedwidgetmodel.cpp
index 30c1076..a790138 100644
--- a/plugins/syndication/feedwidgetmodel.cpp
+++ b/plugins/syndication/feedwidgetmodel.cpp
@@ -148,7 +148,8 @@ namespace kt
         QList<Syndication::EnclosurePtr> encs = item->enclosures();
         foreach (Syndication::EnclosurePtr e, encs)
         {
-            if (e->type() == "application/x-bittorrent")
+            if (e->type() == "application/x-bittorrent" ||
+                e->url().endsWith(".torrent"))
                 return e->url();
         }
 
--
1.8.1


I hope that you can use it, and it would be great if this was included in KTorrent.
Thank you!
George
Moderator
Posts
5421
Karma
1
Looks good, I have committed the patch.
Raven24
Registered Member
Posts
2
Karma
0
great, thanks!


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell