Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't download a pack searched via a SearchEngine #18

Open
itsjustdeepred opened this issue Jan 15, 2021 · 3 comments
Open

Can't download a pack searched via a SearchEngine #18

itsjustdeepred opened this issue Jan 15, 2021 · 3 comments

Comments

@itsjustdeepred
Copy link

Hi
I'm unable to download a pack searched using XDCC_EU Search engine

from xdcc_dl.xdcc import download_packs
from xdcc_dl.pack_search import SearchEngines

results = SearchEngines.XDCC_EU.value.search("test")

download_packs(results)

I get:

Traceback (most recent call last):
File "/home/user/PycharmProjects/pythonProject/main.py", line 7, in
download_packs(results)
File "/home/user/.local/lib/python3.8/site-packages/xdcc_dl/xdcc/init.py", line 51, in download_packs
for pack in packs:
TypeError: 'XDCCPack' object is not iterable

Even when using your example:

from xdcc_dl.xdcc import download_packs
from xdcc_dl.pack_search import SearchEngines
from xdcc_dl.entities import XDCCPack, IrcServer

# Generate packs
manual = XDCCPack(IrcServer("irc.rizon.net"), "bot", 1)
from_message = XDCCPack.from_xdcc_message("/msg bot xdcc send #2-10")
search_results = SearchEngines.HORRIBLESUBS.value.search("Test")
combined = [manual] + from_message + search_results

# Start download
download_packs(combined)

I get:

Traceback (most recent call last):
File "/home/user/PycharmProjects/pythonProject/main.py", line 9, in
combined = [manual] + from_message + search_results
TypeError: can only concatenate list (not "XDCCPack") to list`

I also tried to add a random.choice() in order to select a random choice from the packs list returned by the SearchEngine function without success. Am I doing something wrong or is it a bug?

@namboy94
Copy link
Owner

You don't seem to be doing anything wrong from what I can see, the code you posted seems to work on my end.

Maybe make sure you have the newest versions of both puffotter(0.17.2) and xdcc-dl(5.1.0) installed via pip. I can't really come up with any explanation what could be wrong otherwise right now.

@itsjustdeepred
Copy link
Author

They were updated so I reinstalled them just to double check, now I get:

/usr/bin/python3.8 /home/user/PycharmProjects/pythonProject/main.py
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/irc/client.py", line 186, in connect
    self.socket = self.connect_factory(self.server_address)
  File "/home/user/.local/lib/python3.8/site-packages/irc/connection.py", line 49, in connect
    sock.connect(server_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/xdcc_dl/xdcc/XDCCClient.py", line 179, in download
    self.connect(
  File "/home/user/.local/lib/python3.8/site-packages/irc/client.py", line 1166, in connect
    self.connection.connect(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/jaraco/functools.py", line 456, in wrapper
    return method(self, *args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/irc/client.py", line 188, in connect
    raise ServerConnectionError("Couldn't connect to socket: %s" % ex)
irc.client.ServerConnectionError: Couldn't connect to socket: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/PycharmProjects/pythonProject/main.py", line 9, in <module>
    download_packs(search_results)
  File "/home/user/.local/lib/python3.8/site-packages/xdcc_dl/xdcc/__init__.py", line 61, in download_packs
    client.download()
  File "/home/user/.local/lib/python3.8/site-packages/xdcc_dl/xdcc/XDCCClient.py", line 217, in download
    self.timeout_watcher_thread.join()
  File "/usr/lib/python3.8/threading.py", line 1006, in join
    raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started

Process finished with exit code 1

Also, what would be the best way to select a random item from the results?
I can't iterate it using a for loop or a random.choice()

@namboy94
Copy link
Owner

I'm honestly not sure what the issue could be here. Maybe also update the irc package to the newest version. Does this also occur when using the command line tool xdcc-browse?
If so, it could be that there's some issue on a network level, maybe firewall settings or IP bans?

Regarding picking a random item from the results: That should be possible using random.choice(), since the results should be a list of XDCCPack objects. I don't quite know why it wouldn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants