Beastwick18 / nyaa

A tui tool for browsing and downloading torrents
https://crates.io/crates/nyaa
GNU General Public License v3.0
380 stars 8 forks source link

QOL Changes #5

Closed SlyPredator closed 6 months ago

SlyPredator commented 6 months ago

Mode of installation: Both cargo and direct executable download, on Windows 10

Description: I must be missing something becase I do not see any default config file to modify. I have gone through the README (no mention of the location of the config file) and checked my directories for a config file to no avail. I have also tried creating a config file without any extension and added in the parameters from the README, but don't think that worked out. (I need to modify the config to add proxies.)

Also not sure if I need to open another issue, but on the themes selector, only j and k keys work, not the arrow keys. Same thing for category selector, none of the navigation keys work (or is it activated only when the search is actually successful?)

SlyPredator commented 6 months ago

Closing the issue!

I realised I did not check the %appdata% folder, and surely enough, it was there! The config worked and I am able to browse now. Sorry about this, but it would be helpful indeed to mention the location in the README too.

Thanks!

SlyPredator commented 6 months ago

Just loads the torrents' names, but can't actually sort, categorise, or download with it after clicking Enter, it just shows me an Error. Categories popup is static, no interactivity. I can navigate the pages, but not much else.

Beastwick18 commented 6 months ago

For the categories popup, you should have to press tab to switch between each group. I'll also add on the readme the locations of the config file. Also, what error is it giving you specifically when you press enter?

Beastwick18 commented 6 months ago

Try using:

torrent_client_cmd = 'cmd.exe /c "curl {torrent} > %USERPROFILE%\Downloads\{file}"'

in your config. I'll make sure to add a better default command for windows.

Beastwick18 commented 6 months ago

I've just made a v0.6.1 release which should address all issues in this thread. Let me know if everything is now working :)

SlyPredator commented 6 months ago

Also, what error is it giving you specifically when you press enter?

It is giving out descriptive errors now with the new release, before it was just blank. The error says that it failed to connect to nyaa.si port 443 for the torrent download, which makes sense since it looks like you forgot to reroute to the proxies for the download. (the curl command tells me the origin for the files is nyaa.si itself.)

As of now, I'm just getting 0kb files downloaded in my Downloads folder, so it is actually creating files but not able to access content since it just goes to the main site.

I've just made a v0.6.1 release which should address all issues in this thread.

Yes everything else is working, very snappy in fact. Thanks!

Also, I just noticed, the themes aren't persisting after restart, even after changing the config.toml file for the default_theme category.

Beastwick18 commented 6 months ago

Just want to double check, are you using Nyaa HTML source, or the Nyaa RSS source. You can check by pressing Ctrl-S. If it's rss, I've just fixed that and will publish another release soon.

SlyPredator commented 6 months ago

I was using NyaaHTML.

Tried switching to RSS now, looks like again it goes to .si instead of the designated proxy, so it gives me an error.

error sending request for url (https://nyaa.si/?page=rss&f=0&c=0_0&q=&m): error trying to connect: tcp connect error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (os error 10060)

Beastwick18 commented 6 months ago

In your config, have you changed base_url to something like nyaa.land?

SlyPredator commented 6 months ago

Yes I have.

My config file below: torrnet_client_cmd = 'cmd.exe /c "curl {torrent} > %USERPOFILE%/Downloads/{title}.torrent"' default_theme = 'Catppuccin Macchiato' default_category = 'AllCategories' default_filter = 'NoFilter' default_sort = 'Date' default_search = '' default_source = 'NyaaHtml' base_url = 'https://nyaa.land' timeout = 30 Oh whoops seems like there's a typo in first line, just copied straight from the README, should I be changing that on my side?

Beastwick18 commented 6 months ago

Whoops, didn't notice that. Yes, that should be fixed, I'll change that

Beastwick18 commented 6 months ago

Looks like results were using the proxy, but download links were hard-coded to use nyaa.si. I'll get that fixed and publish a new release.

SlyPredator commented 6 months ago

Oh also, just pointing out if you missed it, but in the first line of the default config, it should be %USERPROFILE% not %USERPOFILE%. Although I'm not sure how the download even went to the right directory anyways in the first place as a blank file, but yeah there's that too.

Beastwick18 commented 6 months ago

Whoops again, I fixed that typo in the source code, but not the readme. 0.6.2 is out. Should fix themes and proxy links.

SlyPredator commented 6 months ago

Yes downloading finally works!

SlyPredator commented 6 months ago

Just a couple suggestions:

  1. I think trying to generalise the quotes would be better since I see issues arising from the formatting of the name while saving it.
  2. It would be convenient to add a command to open the default torrent client if any, right after downloading the torrent file.
  3. I think for the theme atleast, setting it in the TUI should update in the config file automatically, so that it saves the step of having to set it manually.

I have tried implementing 1 and 2 and here goes: torrent_client_cmd = 'cmd.exe /c curl {torrent} > %USERPROFILE%/Downloads/"{title}".torrent && start "" %USERPROFILE%/Downloads/"{title}".torrent' This works for me and opens the default client as well.

But there are still a few issues with some files, having "" in the name. For reproducing, try searching up goumon and download a file with the "" in the name. Some files work, some files don't. It gives out the error that the directory is wrong. I'm not sure how to fix that so just putting it out here.

But for most files, the above changes have worked for me.

Beastwick18 commented 6 months ago

The issue with quotes has been bothering me too. I have some ideas on how to fix it. It's something I hope to have resolved before the next release.

As for opening a client after, it's definitely something I'll look into adding a built in way of doing. I'm hoping to add support for connecting to clients like qBittorent directly without the need for a command. The reason for using commands right now is simply because their flexible enough that users can adapt to whichever client they may be using, albeit not very elegantly.

And saving the theme to file on change is a good idea. That will be in the next release.

Thanks for your suggestions! :)

Beastwick18 commented 6 months ago

Also, to get around problems with certain characters in the title, you can use something like:

torrent_client_cmd = 'cmd.exe /c curl {torrent} > %USERPROFILE%/Downloads/{file}'

{file} is replaced with the name of the torrent file hosted on nyaa, which looks like: 1782878.torrent and doesn't have any special characters.

SlyPredator commented 6 months ago

Oh that's good to hear. Your point about the clients and directly hooking to them sounds great! Fair point about the flexibility too.

I'll be closing this issue since these aren't exactly issues, just things to be worked on I guess, plus the core issues have been solved.

Thanks for helping out and for the project too!

SlyPredator commented 6 months ago

Also, to get around problems with certain characters in the title, you can use something like:

torrent_client_cmd = 'cmd.exe /c curl {torrent} > %USERPROFILE%/Downloads/{file}'

{file} is replaced with the name of the torrent file hosted on nyaa, which looks like: 1782878.torrent and doesn't have any special characters.

Oh cool! Will change that👍

Beastwick18 commented 6 months ago

Oh that's good to hear. Your point about the clients and directly hooking to them sounds great! Fair point about the flexibility too.

I'll be closing this issue since these aren't exactly issues, just things to be worked on I guess, plus the core issues have been solved.

Thanks for helping out and for the project too!

No problem, thanks for helping me correct these issues!

SlyPredator commented 6 months ago

About magnet links, is that planned after the direct hook to torrent clients? Or is there any provision for that coming soon?

Beastwick18 commented 6 months ago

Magnet links are already a feature, they can be put into the torrent client cmd with {magnet}. On windows, you could use them with something like:

torrent_client_cmd = 'cmd.exe /c start "" "{magnet}"'
SlyPredator commented 6 months ago

That's amazing! So much more convenient.

But a weird bug though, once I confirm it, it does go through to the client and everything is fine, but in the TUI I get this: image

Do tell me if you need one of these in a log file.

Other than that weird output, everything works smoothly, the files download as well.

Beastwick18 commented 6 months ago

Yep I get the same error. Probably just an issue relating to how cmd parses arguments, since it seems to not handle & symbols well. The reason it still works is because everything before the &dn is enough to grab the torrent.

Beastwick18 commented 6 months ago

I'll see if I can find a workaround for this for the next release

Disonantemus commented 6 months ago

From ~/.config/nyaa/config.toml: I did change first line to just copy magnet to X11 clipboard:

torrent_client_cmd = 'echo "{magnet}" | xsel -ib'

Didn't work, because output has many extra \ (backslashes) that aren't in the original link, this is not expected.

As it is now, I changed that, to remove backslashes with tr:

torrent_client_cmd = 'echo "{magnet}" | tr -d "\\" 2> /dev/null | xsel -ib'

And seems to work.


nyaa v0.6.3
distro: Arch Linux x86_64
kernel: 6.1.52-1-lts
shell: bash 5.2.26
term: tmux