deluge.ui.common

The ui common module contains methods and classes that are deemed useful for all the interfaces.

class deluge.ui.common.FileTree(paths)

Convert a list of paths in a file tree.

Parameter:paths (list) – The paths to be converted.
get_tree()

Return the tree, after first converting all file lists to a tuple.

Returns:the file tree.
Return type:dictionary
walk(callback)

Walk through the file tree calling the callback function on each item contained.

Parameter:callback (function) – The function to be used as a callback, it should have the signature func(item, path) where item is a tuple for a file and dict for a directory.
class deluge.ui.common.FileTree2(paths)

Converts a list of paths in to a file tree.

Parameter:paths (list) – The paths to be converted
get_tree()

Return the tree.

Returns:the file tree.
Return type:dictionary
walk(callback)

Walk through the file tree calling the callback function on each item contained.

Parameter:callback (function) – The function to be used as a callback, it should have the signature func(item, path) where item is a tuple for a file and dict for a directory.
class deluge.ui.common.TorrentInfo(filename)

Collects information about a torrent file.

Parameter:filename (string) – The path to the torrent
as_dict(*keys)

Return the torrent info as a dictionary, only including the passed in keys.

Parameter:keys (string) – a number of key strings
filedata

The torrents file data. This will be the bencoded dictionary read from the torrent file.

Return type:string
files

A list of the files that the torrent contains.

Return type:list
files_tree

A dictionary based tree of the files.

{
    "some_directory": {
        "some_file": (index, size, download)
    }
}
Return type:dictionary
info_hash

The torrents info_hash

Return type:string
metadata

The torrents metadata.

Return type:dictionary
name

The name of the torrent.

Return type:string
deluge.ui.common.decode_string(s, encoding='utf8')

Decodes a string and re-encodes it in utf8. If it cannot decode using :param:encoding then it will try to detect the string encoding and decode it.

Parameters:
  • s (string) – string to decode
  • encoding (string) – the encoding to use in the decoding
deluge.ui.common.get_localhost_auth()

Grabs the localclient auth line from the ‘auth’ file and creates a localhost uri

Returns:with the username and password to login as
Return type:tuple

Previous topic

deluge.ui.client

Next topic

deluge.ui.coreconfig

This Page