JohnDoee / autotorrent2

Cross-seed matching and torrent lifecycle tool
https://johndoee.github.io/autotorrent2/
MIT License
157 stars 12 forks source link

scan-clients error: "IndexError: list index out of range" #8

Open Jerrk opened 2 years ago

Jerrk commented 2 years ago

Running deluge with 5000~ torrents

Command /mnt/user/appdata/autotorrent2/bin/at2 -c /mnt/user/appdata/autotorrent2/autotorrent/config.toml scan-clients

Scanning clients
Traceback (most recent call last):
  File "/mnt/user/appdata/autotorrent2/bin/at2", line 8, in <module>
    sys.exit(cli())
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/autotorrent/__main__.py", line 637, in scan_clients
    indexer.scan_clients(clients, full_scan=full, fast_scan=fast)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/autotorrent/indexer.py", line 43, in scan_clients
    self._scan_client(name, client, not full_scan and fast_scan)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/autotorrent/indexer.py", line 66, in _scan_client
    files = client.get_files(torrent.infohash)
  File "/mnt/user/appdata/autotorrent2/lib64/python3.9/site-packages/libtc/clients/deluge.py", line 237, in get_files
    name = name.split("/", 1)[1]
IndexError: list index out of range
JohnDoee commented 2 years ago

Have you renamed the file via Deluge? Is it a single or multi-file torrent?

Jerrk commented 2 years ago

Have you renamed the file via Deluge? Is it a single or multi-file torrent?

I'm not sure if the error is pointing to a specific torrent but i have renamed files within deluge and i have both single and multi-file torrents

Jerrk commented 2 years ago

I turned on verbose logging and i found the offending torrent.

you were right that i had renamed the torrent in the client and that it had multiple files

JohnDoee commented 2 years ago

A long story short is that you can do some weird stuff with renaming and Deluge.

I'll try to add some tests and see because I think it's very common to rename.

Jerrk commented 2 years ago

What i noticed is that for the torrents that show this issue i have removed the top level folder, i.e renaming

into just

This is probably not recommended and i'm not sure some clients even allow this sort of renaming, i'll probably just fix the renaming in deluge and this error should be resolved.