Added an audible bell on torrent completion (optional, off by default)

This commit is contained in:
Asmageddon 2012-05-29 23:51:00 +02:00
parent 935777fb49
commit cf58aa780a
3 changed files with 7 additions and 2 deletions

View File

@ -40,6 +40,7 @@ import deluge.common
import colors import colors
from deluge.ui.client import client from deluge.ui.client import client
import curses
import time import time
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -68,6 +69,7 @@ class EventLog(component.Component):
self.previous_time = time.localtime(0) self.previous_time = time.localtime(0)
def on_torrent_added_event(self, torrent_id, from_state): def on_torrent_added_event(self, torrent_id, from_state):
if from_state: return
def on_torrent_status(status): def on_torrent_status(status):
self.write("{!green!}Torrent Added{!input!}(from_state=%s): {!info!}%s (%s)" % ( self.write("{!green!}Torrent Added{!input!}(from_state=%s): {!info!}%s (%s)" % (
from_state, status["name"], torrent_id) from_state, status["name"], torrent_id)
@ -89,11 +91,12 @@ class EventLog(component.Component):
if state in colors.state_color: if state in colors.state_color:
state = colors.state_color[state] + state state = colors.state_color[state] + state
#self.write("State change: %s {!info!}%s (%s)" %
self.write("%s: {!info!}%s ({!cyan!}%s{!info!})" % self.write("%s: {!info!}%s ({!cyan!}%s{!info!})" %
(state, self.console.get_torrent_name(torrent_id), torrent_id)) (state, self.console.get_torrent_name(torrent_id), torrent_id))
def on_torrent_finished_event(self, torrent_id): def on_torrent_finished_event(self, torrent_id):
if component.get("AllTorrents").config["ring_bell"]:
curses.beep()
self.write("{!info!}Torrent Finished: %s (%s)" % self.write("{!info!}Torrent Finished: %s (%s)" %
(self.console.get_torrent_name(torrent_id), torrent_id)) (self.console.get_torrent_name(torrent_id), torrent_id))

View File

@ -175,7 +175,8 @@ DEFAULT_PREFS = {
"torrents_per_tab_press": 15, "torrents_per_tab_press": 15,
"sort_primary": "queue", "sort_primary": "queue",
"sort_secondary": "name", "sort_secondary": "name",
"separate_complete": True "separate_complete": True,
"ring_bell": False
} }
column_pref_names = ["queue","name","size","state", column_pref_names = ["queue","name","size","state",

View File

@ -317,6 +317,7 @@ class InterfacePane(BasePane):
self.add_checked_input("move_selection","Move selection when moving torrents in the queue",parent.console_config["move_selection"]) self.add_checked_input("move_selection","Move selection when moving torrents in the queue",parent.console_config["move_selection"])
self.add_checked_input("third_tab_lists_all","Third tab lists all remaining torrents in legacy mode",parent.console_config["third_tab_lists_all"]) self.add_checked_input("third_tab_lists_all","Third tab lists all remaining torrents in legacy mode",parent.console_config["third_tab_lists_all"])
self.add_int_spin_input("torrents_per_tab_press","Torrents per tab press",parent.console_config["torrents_per_tab_press"], 5, 100) self.add_int_spin_input("torrents_per_tab_press","Torrents per tab press",parent.console_config["torrents_per_tab_press"], 5, 100)
self.add_checked_input("ring_bell","Ring system bell when a download finishes",parent.console_config["ring_bell"])
self.add_header("Columns To Display", True) self.add_header("Columns To Display", True)