Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: button to apply trackers to existing
  • Loading branch information
ludufre committed Dec 29, 2024
commit 5995d7506e2d3d45290ae654298c6088dd6b8120
8 changes: 8 additions & 0 deletions defaulttrackers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,11 @@ def get_config(self):
"""Returns the config dictionary"""
return self.config.config

@export
def apply_existing(self):
"""Apply trackerlist to existings torrents"""

for torrent_id in component.get("TorrentManager").torrents:
self.on_torrent_added(torrent_id)
return True

21 changes: 21 additions & 0 deletions defaulttrackers/data/defaulttrackers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ DefaultTrackersPanel = Ext.extend(Ext.form.FormPanel, {
autoWidth: true,
}));

var applyExisting = this.add({
fieldLabel: _(''),
name: 'trackers_apply',
xtype: 'container',
layout: 'hbox',
items: [{
xtype: 'button',
text: 'Apply Existing Torrents',
}]
});

applyExisting.getComponent(0).setHandler(this.onApplyExisting, this);

deluge.preferences.on('show', this.onPreferencesShow, this);
},

Expand Down Expand Up @@ -119,6 +132,14 @@ DefaultTrackersPanel = Ext.extend(Ext.form.FormPanel, {
onSetConfig: function() {
this.opts.commit();
},
onApplyExisting: function() {
deluge.client.defaulttrackers.apply_existing({
success: function() {
Ext.Msg.alert('Success', 'Default trackers applied to existing torrents');
},
scope: this,
});
}
});

DefaultTrackersPlugin = Ext.extend(Deluge.Plugin, {
Expand Down
Binary file added egg/DefaultTrackers-0.6-py3.12.egg
Binary file not shown.