Skip to content

Commit 499902d

Browse files
Merge branch 'feat-apply-existing' of https://github.com/ludufre/deluge-default-trackers into ludufre-feat-apply-existing
2 parents 05b56cc + 5995d75 commit 499902d

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

defaulttrackers/core.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,11 @@ def get_config(self):
152152
"""Returns the config dictionary"""
153153
return self.config.config
154154

155+
@export
156+
def apply_existing(self):
157+
"""Apply trackerlist to existings torrents"""
158+
159+
for torrent_id in component.get("TorrentManager").torrents:
160+
self.on_torrent_added(torrent_id)
161+
return True
162+

defaulttrackers/data/defaulttrackers.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ DefaultTrackersPanel = Ext.extend(Ext.form.FormPanel, {
8585
autoWidth: true,
8686
}));
8787

88+
var applyExisting = this.add({
89+
fieldLabel: _(''),
90+
name: 'trackers_apply',
91+
xtype: 'container',
92+
layout: 'hbox',
93+
items: [{
94+
xtype: 'button',
95+
text: 'Apply Existing Torrents',
96+
}]
97+
});
98+
99+
applyExisting.getComponent(0).setHandler(this.onApplyExisting, this);
100+
88101
deluge.preferences.on('show', this.onPreferencesShow, this);
89102
},
90103

@@ -119,6 +132,14 @@ DefaultTrackersPanel = Ext.extend(Ext.form.FormPanel, {
119132
onSetConfig: function() {
120133
this.opts.commit();
121134
},
135+
onApplyExisting: function() {
136+
deluge.client.defaulttrackers.apply_existing({
137+
success: function() {
138+
Ext.Msg.alert('Success', 'Default trackers applied to existing torrents');
139+
},
140+
scope: this,
141+
});
142+
}
122143
});
123144

124145
DefaultTrackersPlugin = Ext.extend(Deluge.Plugin, {

egg/DefaultTrackers-0.6-py3.12.egg

39.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)