mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-23 10:38:49 +00:00
add move storage option to torrent actions
This commit is contained in:
parent
2b04955128
commit
5619991f2a
1 changed files with 18 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from popup import SelectablePopup
|
from popup import SelectablePopup
|
||||||
|
from input_popup import InputPopup
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -45,6 +46,7 @@ class ACTION:
|
||||||
EDIT_TRACKERS=3
|
EDIT_TRACKERS=3
|
||||||
RECHECK=4
|
RECHECK=4
|
||||||
REMOVE=5
|
REMOVE=5
|
||||||
|
MOVE_STORAGE=9
|
||||||
|
|
||||||
REMOVE_DATA=6
|
REMOVE_DATA=6
|
||||||
REMOVE_NODATA=7
|
REMOVE_NODATA=7
|
||||||
|
@ -81,6 +83,21 @@ def torrent_action(idx, data, mode, ids):
|
||||||
popup.add_line("_Cancel",data=0)
|
popup.add_line("_Cancel",data=0)
|
||||||
mode.set_popup(popup)
|
mode.set_popup(popup)
|
||||||
return False
|
return False
|
||||||
|
elif data==ACTION.MOVE_STORAGE:
|
||||||
|
def do_move(res):
|
||||||
|
import os.path
|
||||||
|
if os.path.exists(res["path"]) and not os.path.isdir(res["path"]):
|
||||||
|
mode.report_message("Cannot Move Storage","{!error!}%s exists and is not a directory"%res["path"])
|
||||||
|
else:
|
||||||
|
log.debug("Moving %s to: %s",ids,res["path"])
|
||||||
|
client.core.move_storage(ids,res["path"]).addErrback(action_error,mode)
|
||||||
|
if len(ids) == 1:
|
||||||
|
mode.clear_marks()
|
||||||
|
return True
|
||||||
|
popup = InputPopup(mode,"Move Storage (Esc to cancel)",close_cb=do_move)
|
||||||
|
popup.add_text_input("Enter path to move to:","path")
|
||||||
|
mode.set_popup(popup)
|
||||||
|
return False
|
||||||
elif data==ACTION.RECHECK:
|
elif data==ACTION.RECHECK:
|
||||||
log.debug("Rechecking torrents: %s", ids)
|
log.debug("Rechecking torrents: %s", ids)
|
||||||
client.core.force_recheck(ids).addErrback(action_error,mode)
|
client.core.force_recheck(ids).addErrback(action_error,mode)
|
||||||
|
@ -108,6 +125,7 @@ def torrent_actions_popup(mode,tids,details=False):
|
||||||
popup.add_divider()
|
popup.add_divider()
|
||||||
popup.add_line("Remo_ve Torrent",data=ACTION.REMOVE)
|
popup.add_line("Remo_ve Torrent",data=ACTION.REMOVE)
|
||||||
popup.add_line("_Force Recheck",data=ACTION.RECHECK)
|
popup.add_line("_Force Recheck",data=ACTION.RECHECK)
|
||||||
|
popup.add_line("_Move Storage",data=ACTION.MOVE_STORAGE)
|
||||||
if details:
|
if details:
|
||||||
popup.add_divider()
|
popup.add_divider()
|
||||||
popup.add_line("Torrent _Details",data=ACTION.DETAILS)
|
popup.add_line("Torrent _Details",data=ACTION.DETAILS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue