Remote/local path match (like in Transmission)

Suggestions and discussion of future versions
Post Reply
Winand
New User
New User
Posts: 9
Joined: Fri May 11, 2012 9:05 am

Remote/local path match (like in Transmission)

Post by Winand »

I made a dirty patch for my Deluge installation, so i can open torrent folder when connected to remote daemon if there's a match in /path_matches/. I think it's quite an simple feature to integrate into deluge. Thanks in advance.)

Code: Select all

        non_remote_items = [
            #"menuitem_open_folder",
            "separator4"
        ]
<...>
    def on_menuitem_open_folder_activate(self, data=None):
        log.debug("on_menuitem_open_folder")
        def _on_torrent_status(status):
#            deluge.common.open_file(status["save_path"])
            import os, sys, subprocess
            path_matches = {"/shares/Public": "Z:"}
            path = os.path.join(status["save_path"], status["name"])
            for i in path_matches:
                if path.startswith(i):
                    path = os.path.normpath(os.path.join(path_matches[i], path[len(i):]))
                    break
            subprocess.Popen("explorer /select,"+path.encode(sys.getfilesystemencoding()))
        for torrent_id in component.get("TorrentView").get_selected_torrents():
            component.get("SessionProxy").get_torrent_status(torrent_id, ["save_path", "name"]).addCallback(_on_torrent_status)
UPD: source code above only shows what i mean, this is some kind of feature request)
Post Reply