Fix add torrent dialog for torrents with only 1 file
This commit is contained in:
parent
ee071dcece
commit
c906b50d11
|
@ -201,15 +201,22 @@ class AddTorrentDialog(component.Component):
|
||||||
|
|
||||||
# Get list of files from torrent info
|
# Get list of files from torrent info
|
||||||
files = []
|
files = []
|
||||||
prefix = ""
|
if metadata["info"].has_key("files"):
|
||||||
if len(metadata["info"]["files"]) > 1:
|
prefix = ""
|
||||||
prefix = metadata["info"]["name"]
|
if len(metadata["info"]["files"]) > 1:
|
||||||
|
prefix = metadata["info"]["name"]
|
||||||
|
|
||||||
for f in metadata["info"]["files"]:
|
for f in metadata["info"]["files"]:
|
||||||
|
files.append({
|
||||||
|
'path': os.path.join(prefix, *f["path"]),
|
||||||
|
'size': f["length"],
|
||||||
|
'download': True
|
||||||
|
})
|
||||||
|
else:
|
||||||
files.append({
|
files.append({
|
||||||
'path': os.path.join(prefix, *f["path"]),
|
"path": metadata["info"]["name"],
|
||||||
'size': f["length"],
|
"size": metadata["info"]["length"],
|
||||||
'download': True
|
"download": True
|
||||||
})
|
})
|
||||||
|
|
||||||
name = "%s (%s)" % (metadata["info"]["name"], os.path.split(filename)[-1])
|
name = "%s (%s)" % (metadata["info"]["name"], os.path.split(filename)[-1])
|
||||||
|
|
Loading…
Reference in New Issue