Changed format of add torrent reports a bit
This commit is contained in:
parent
be23d00042
commit
2b244f0628
|
@ -46,6 +46,7 @@ import base64
|
||||||
from deluge.ui.sessionproxy import SessionProxy
|
from deluge.ui.sessionproxy import SessionProxy
|
||||||
|
|
||||||
from input_popup import InputPopup
|
from input_popup import InputPopup
|
||||||
|
from popup import Popup
|
||||||
import deluge.ui.console.colors as colors
|
import deluge.ui.console.colors as colors
|
||||||
import format_utils
|
import format_utils
|
||||||
|
|
||||||
|
@ -380,7 +381,7 @@ class AddTorrents(BaseMode, component.Component):
|
||||||
def fail_cb(msg,t_file,ress):
|
def fail_cb(msg,t_file,ress):
|
||||||
log.debug("failed to add torrent: %s: %s"%(t_file,msg))
|
log.debug("failed to add torrent: %s: %s"%(t_file,msg))
|
||||||
ress["fail"]+=1
|
ress["fail"]+=1
|
||||||
ress["fmsg"].append("%s: %s"%(t_file,msg))
|
ress["fmsg"].append("{!input!} * %s: {!error!}%s"%(t_file,msg))
|
||||||
if (ress["succ"]+ress["fail"]) >= ress["total"]:
|
if (ress["succ"]+ress["fail"]) >= ress["total"]:
|
||||||
self.alltorrentmode._report_add_status(ress["succ"],ress["fail"],ress["fmsg"])
|
self.alltorrentmode._report_add_status(ress["succ"],ress["fail"],ress["fmsg"])
|
||||||
|
|
||||||
|
@ -404,8 +405,8 @@ class AddTorrents(BaseMode, component.Component):
|
||||||
t_options["add_paused"] = result["add_paused"]
|
t_options["add_paused"] = result["add_paused"]
|
||||||
|
|
||||||
d = client.core.add_torrent_file(filename, filedump, t_options)
|
d = client.core.add_torrent_file(filename, filedump, t_options)
|
||||||
d.addCallback(success_cb, path, ress)
|
d.addCallback(success_cb, filename, ress)
|
||||||
d.addErrback(fail_cb, path, ress)
|
d.addErrback(fail_cb, filename, ress)
|
||||||
|
|
||||||
self.back_to_overview()
|
self.back_to_overview()
|
||||||
|
|
||||||
|
@ -483,15 +484,13 @@ class AddTorrents(BaseMode, component.Component):
|
||||||
elif c == curses.KEY_END:
|
elif c == curses.KEY_END:
|
||||||
self.scroll_list_down(len(self.formatted_rows))
|
self.scroll_list_down(len(self.formatted_rows))
|
||||||
elif c == curses.KEY_RIGHT:
|
elif c == curses.KEY_RIGHT:
|
||||||
self._perform_action()
|
if self.cursel < len(self.listing_dirs):
|
||||||
|
self._enter_dir()
|
||||||
elif c == curses.KEY_LEFT:
|
elif c == curses.KEY_LEFT:
|
||||||
self._go_up()
|
self._go_up()
|
||||||
# Enter Key
|
# Enter Key
|
||||||
elif c == curses.KEY_ENTER or c == 10:
|
elif c == curses.KEY_ENTER or c == 10:
|
||||||
self._perform_action()
|
self._perform_action()
|
||||||
# space
|
|
||||||
elif c == 32:
|
|
||||||
self._perform_action()
|
|
||||||
else:
|
else:
|
||||||
if c > 31 and c < 256:
|
if c > 31 and c < 256:
|
||||||
if chr(c) == 'h':
|
if chr(c) == 'h':
|
||||||
|
|
|
@ -678,7 +678,7 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
if fail_cnt == 0:
|
if fail_cnt == 0:
|
||||||
self.report_message("Torrents Added","{!success!}Successfully added %d torrent(s)"%succ_cnt)
|
self.report_message("Torrents Added","{!success!}Successfully added %d torrent(s)"%succ_cnt)
|
||||||
else:
|
else:
|
||||||
msg = ("{!error!}Failed to add the following %d torrent(s):\n {!input!}"%fail_cnt)+"\n {!error!}".join(fail_msgs)
|
msg = ("{!error!}Failed to add the following %d torrent(s):\n {!input!}"%fail_cnt)+"\n ".join(fail_msgs)
|
||||||
if succ_cnt != 0:
|
if succ_cnt != 0:
|
||||||
msg += "\n \n{!success!}Successfully added %d torrent(s)"%succ_cnt
|
msg += "\n \n{!success!}Successfully added %d torrent(s)"%succ_cnt
|
||||||
self.report_message("Torrent Add Report",msg)
|
self.report_message("Torrent Add Report",msg)
|
||||||
|
@ -694,7 +694,8 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
def fail_cb(msg,t_file,ress):
|
def fail_cb(msg,t_file,ress):
|
||||||
log.debug("failed to add torrent: %s: %s"%(t_file,msg))
|
log.debug("failed to add torrent: %s: %s"%(t_file,msg))
|
||||||
ress["fail"]+=1
|
ress["fail"]+=1
|
||||||
ress["fmsg"].append("%s: %s"%(t_file,msg))
|
filename = t_file.split("/")[-1]
|
||||||
|
ress["fmsg"].append("{!input!} * %s: {!error!}%s"%(filename,msg))
|
||||||
if (ress["succ"]+ress["fail"]) >= ress["total"]:
|
if (ress["succ"]+ress["fail"]) >= ress["total"]:
|
||||||
self._report_add_status(ress["succ"],ress["fail"],ress["fmsg"])
|
self._report_add_status(ress["succ"],ress["fail"],ress["fmsg"])
|
||||||
def suc_cb(tid,t_file,ress):
|
def suc_cb(tid,t_file,ress):
|
||||||
|
@ -779,7 +780,7 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
# show a message popup if there's anything queued
|
# show a message popup if there's anything queued
|
||||||
if self.popup == None and self.messages:
|
if self.popup == None and self.messages:
|
||||||
title,msg = self.messages.popleft()
|
title,msg = self.messages.popleft()
|
||||||
self.popup = MessagePopup(self,title,msg)
|
self.popup = MessagePopup(self,title,msg, width_req=1.0)
|
||||||
|
|
||||||
if not lines:
|
if not lines:
|
||||||
if component.get("ConsoleUI").screen != self:
|
if component.get("ConsoleUI").screen != self:
|
||||||
|
|
Loading…
Reference in New Issue