Wrote a patch for kettu, web interface for transmssion

Kettu is the new web interface for transmission bit torrent client. It is written using javascript and jquery. I wrote a small patch for kettu to filter the torrents on the basis of activity. Here activity means if the torrent is either uploading or downloading, i.e, uploadspeed + downloadspeed > 0 KBps.

Here’ s the patch I wrote :

diff –git a/index.html b/index.html
index 2a8ff97..b54b6b4 100644
— a/index.html
+++ b/index.html
@@ -58,6 +58,7 @@
Sort

All
+            Activity
Downloading
Seeding
Paused
@@ -94,4 +95,4 @@

  • No newline at end of file
  • diff –git a/js/helpers/filtertorrentshelpers.js b/js/helpers/filtertorrentshelpers.js
    index 95f841e..3b54b2c 100644
    — a/js/helpers/filtertorrentshelpers.js
    +++ b/js/helpers/filtertorrentshelpers.js
    @@ -5,6 +5,12 @@ var FilterTorrentsHelpers = {

if(filtermode ‘all’) {
filtered
torrents = torrents;
+    } else if(filtermode ‘active’) {
+      $.each(torrents, function() {
+        if(this.activity()) {
+          filtered
torrents.push(this)
+        }
+      })
} else {
$.each(torrents, function() {
if(this.status == stati[filter_mode]) {
@@ -15,4 +21,4 @@ var FilterTorrentsHelpers = {

return filteredtorrents;
}
-}
No newline at end of file
+}
diff –git a/js/models/torrent.js b/js/models/torrent.js
index 8e39f1d..1bf2a2a 100644
— a/js/models/torrent.js
+++ b/js/models/torrent.js
@@ -106,6 +106,7 @@ Torrent = function(attributes) {
localized
stati[torrent.stati[‘downloading’]] = ‘Downloading';
localizedstati[torrent.stati[‘seeding’]] = ‘Seeding';
localized
stati[torrent.stati[‘paused’]] = ‘Paused';
+    localized_stati[torrent.stati[‘active’]] = ‘Activity';

return localizedstati[this[‘status’]] ? localizedstati[this[‘status’]] : ‘error';
};
@@ -138,4 +139,4 @@ Torrent = function(attributes) {
};

return torrent;
-};
No newline at end of file
+};

The patch got accepted by the kettu upstream endor on  2010-03-29 and following is the patch commit link:

http://github.com/endor/kettu/commit/5d3a64c4807eee6bbfbb2d3013e384971930bca8

Feels nice to have written my first patch :)

Check the next post: RPM Packaging xnoise for fedora »

Share on:
comments powered by Disqus