Skip to content

Commit 5995d75

Browse files
committed
feat: button to apply trackers to existing
1 parent 74447da commit 5995d75

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
@@ -143,3 +143,11 @@ def get_config(self):
143143
"""Returns the config dictionary"""
144144
return self.config.config
145145

146+
@export
147+
def apply_existing(self):
148+
"""Apply trackerlist to existings torrents"""
149+
150+
for torrent_id in component.get("TorrentManager").torrents:
151+
self.on_torrent_added(torrent_id)
152+
return True
153+

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)